2013-12-16 21:58:16 +04:00
|
|
|
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
# This header file defines the "sysroot" variable which is the absolute path
|
|
|
|
# of the sysroot. If no sysroot applies, the variable will be an empty string.
|
|
|
|
|
2015-05-02 01:36:23 +03:00
|
|
|
import("//build/config/chrome_build.gni")
|
|
|
|
|
2014-10-29 20:36:54 +03:00
|
|
|
declare_args() {
|
|
|
|
# The absolute path of the sysroot that is applied when compiling using
|
|
|
|
# the target toolchain.
|
|
|
|
target_sysroot = ""
|
2016-06-29 10:07:34 +03:00
|
|
|
|
2017-04-10 22:44:17 +03:00
|
|
|
# The absolute path to directory containing linux sysroot images
|
|
|
|
target_sysroot_dir = "//build/linux"
|
2016-06-29 10:07:34 +03:00
|
|
|
|
2018-01-25 00:40:19 +03:00
|
|
|
use_sysroot = current_cpu == "x86" || current_cpu == "x64" ||
|
|
|
|
current_cpu == "arm" || current_cpu == "arm64" ||
|
|
|
|
current_cpu == "mipsel" || current_cpu == "mips64el"
|
2014-10-29 20:36:54 +03:00
|
|
|
}
|
|
|
|
|
2017-04-10 22:44:17 +03:00
|
|
|
if (current_os == target_os && current_cpu == target_cpu &&
|
2017-05-10 07:55:56 +03:00
|
|
|
target_sysroot != "") {
|
2014-10-29 20:36:54 +03:00
|
|
|
sysroot = target_sysroot
|
|
|
|
} else if (is_android) {
|
2014-01-09 02:47:42 +04:00
|
|
|
import("//build/config/android/config.gni")
|
2018-01-04 00:30:05 +03:00
|
|
|
|
|
|
|
# Android uses unified headers, and thus a single compile time sysroot
|
2019-08-16 20:24:05 +03:00
|
|
|
sysroot = "$android_toolchain_root/sysroot"
|
2017-11-14 02:21:55 +03:00
|
|
|
} else if (is_linux && use_sysroot) {
|
|
|
|
# By default build against a sysroot image downloaded from Cloud Storage
|
|
|
|
# during gclient runhooks.
|
2017-11-09 03:04:57 +03:00
|
|
|
if (current_cpu == "x64") {
|
2018-02-24 07:45:47 +03:00
|
|
|
sysroot = "$target_sysroot_dir/debian_sid_amd64-sysroot"
|
2017-11-09 03:04:57 +03:00
|
|
|
} else if (current_cpu == "x86") {
|
2018-02-24 07:45:47 +03:00
|
|
|
sysroot = "$target_sysroot_dir/debian_sid_i386-sysroot"
|
2017-11-09 03:04:57 +03:00
|
|
|
} else if (current_cpu == "mipsel") {
|
2018-02-24 07:45:47 +03:00
|
|
|
sysroot = "$target_sysroot_dir/debian_sid_mips-sysroot"
|
2018-01-25 00:40:19 +03:00
|
|
|
} else if (current_cpu == "mips64el") {
|
2018-02-24 07:45:47 +03:00
|
|
|
sysroot = "$target_sysroot_dir/debian_sid_mips64el-sysroot"
|
2017-11-09 03:04:57 +03:00
|
|
|
} else if (current_cpu == "arm") {
|
2018-02-24 07:45:47 +03:00
|
|
|
sysroot = "$target_sysroot_dir/debian_sid_arm-sysroot"
|
2017-11-09 03:04:57 +03:00
|
|
|
} else if (current_cpu == "arm64") {
|
2018-02-24 07:45:47 +03:00
|
|
|
sysroot = "$target_sysroot_dir/debian_sid_arm64-sysroot"
|
2014-01-22 15:41:53 +04:00
|
|
|
} else {
|
2017-04-10 22:44:17 +03:00
|
|
|
assert(false, "No linux sysroot for cpu: $target_cpu")
|
2014-01-22 15:41:53 +04:00
|
|
|
}
|
2015-12-03 23:56:48 +03:00
|
|
|
|
|
|
|
if (sysroot != "") {
|
|
|
|
_script_arch = current_cpu
|
|
|
|
if (_script_arch == "x86") {
|
|
|
|
_script_arch = "i386"
|
|
|
|
} else if (_script_arch == "x64") {
|
|
|
|
_script_arch = "amd64"
|
|
|
|
}
|
|
|
|
assert(
|
2016-02-04 05:23:00 +03:00
|
|
|
exec_script("//build/dir_exists.py",
|
|
|
|
[ rebase_path(sysroot) ],
|
|
|
|
"string") == "True",
|
2015-12-03 23:56:48 +03:00
|
|
|
"Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=$_script_arch")
|
|
|
|
}
|
2013-12-16 21:58:16 +04:00
|
|
|
} else if (is_mac) {
|
2014-01-09 01:38:35 +04:00
|
|
|
import("//build/config/mac/mac_sdk.gni")
|
|
|
|
sysroot = mac_sdk_path
|
2014-01-27 11:41:23 +04:00
|
|
|
} else if (is_ios) {
|
|
|
|
import("//build/config/ios/ios_sdk.gni")
|
|
|
|
sysroot = ios_sdk_path
|
2017-05-12 20:50:37 +03:00
|
|
|
} else if (is_fuchsia) {
|
|
|
|
import("//build/config/fuchsia/config.gni")
|
2018-07-21 11:59:51 +03:00
|
|
|
if (current_cpu == "arm64" || current_cpu == "x64") {
|
|
|
|
sysroot = fuchsia_sdk + "/arch/$current_cpu/sysroot"
|
2017-05-12 20:50:37 +03:00
|
|
|
} else {
|
|
|
|
sysroot = ""
|
|
|
|
}
|
2013-12-16 21:58:16 +04:00
|
|
|
} else {
|
|
|
|
sysroot = ""
|
|
|
|
}
|