tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sysroot.gni (2948B)


      1 # Copyright 2013 The Chromium Authors
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 # This header file defines the "sysroot" variable which is the absolute path
      6 # of the sysroot. If no sysroot applies, the variable will be an empty string.
      7 
      8 declare_args() {
      9   # The path of the sysroot that is applied when compiling using the target
     10   # toolchain.
     11   target_sysroot = ""
     12 
     13   # The path to directory containing linux sysroot images.
     14   target_sysroot_dir = "//chromium/build/linux"
     15 
     16   # The path of the sysroot for the current toolchain. If empty, default
     17   # sysroot is used.
     18   sysroot = ""
     19 
     20   # Controls default is_linux sysroot. If set to true, and sysroot
     21   # is empty, default sysroot is calculated.
     22   use_sysroot =
     23       target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
     24       target_cpu == "arm64" || target_cpu == "mipsel" ||
     25       target_cpu == "mips64el" || (target_cpu == "riscv64" && is_android)
     26 }
     27 
     28 if (sysroot == "") {
     29   if (current_os == target_os && target_cpu == target_cpu &&
     30       target_sysroot != "") {
     31     sysroot = target_sysroot
     32   } else if (is_android) {
     33     import("//chromium/build/config/android/config.gni")
     34 
     35     # Android uses unified headers, and thus a single compile time sysroot
     36     sysroot = "$android_toolchain_root/sysroot"
     37   } else if ((is_linux || is_chromeos) && use_sysroot) {
     38     # By default build against a sysroot image downloaded from Cloud Storage
     39     # during gclient runhooks.
     40     if (target_cpu == "x64") {
     41       sysroot = "$target_sysroot_dir/debian_bullseye_amd64-sysroot"
     42     } else if (target_cpu == "x86") {
     43       sysroot = "$target_sysroot_dir/debian_bullseye_i386-sysroot"
     44     } else if (target_cpu == "mipsel") {
     45       sysroot = "$target_sysroot_dir/debian_bullseye_mipsel-sysroot"
     46     } else if (target_cpu == "mips64el") {
     47       sysroot = "$target_sysroot_dir/debian_bullseye_mips64el-sysroot"
     48     } else if (target_cpu == "arm") {
     49       sysroot = "$target_sysroot_dir/debian_bullseye_armhf-sysroot"
     50     } else if (target_cpu == "arm64") {
     51       sysroot = "$target_sysroot_dir/debian_bullseye_arm64-sysroot"
     52     } else {
     53       assert(false, "No linux sysroot for cpu: $target_cpu")
     54     }
     55 
     56     if (sysroot != "") {
     57       _script_arch = target_cpu
     58       if (_script_arch == "x86") {
     59         _script_arch = "i386"
     60       } else if (_script_arch == "x64") {
     61         _script_arch = "amd64"
     62       }
     63       #assert(
     64       #    path_exists(sysroot),
     65       #    "Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=$_script_arch")
     66     }
     67   } else if (is_mac) {
     68     import("//chromium/build/config/mac/mac_sdk.gni")
     69     sysroot = mac_sdk_path
     70   } else if (is_ios) {
     71     import("//chromium/build/config/ios/ios_sdk.gni")
     72     sysroot = ios_sdk_path
     73   } else if (is_fuchsia) {
     74     import("//chromium/build/config/fuchsia/gn_configs.gni")
     75     sysroot = "${fuchsia_arch_root}/sysroot"
     76   }
     77 }