Commit d9e3f638 authored by Hidehiko Abe's avatar Hidehiko Abe Committed by Commit Bot

Make sysroot injectable.

With this CL, we can inject sysroot precisely.

BUG=1043804
TEST=Built locally.

Change-Id: I459a45eca86f96c4b143b055b588cd50e24f283a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057503
Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741566}
parent afc98943
......@@ -8,27 +8,34 @@
import("//build/config/chrome_build.gni")
declare_args() {
# The absolute path of the sysroot that is applied when compiling using
# the target toolchain.
# The path of the sysroot that is applied when compiling using the target
# toolchain.
target_sysroot = ""
# The absolute path to directory containing linux sysroot images
# The path to directory containing linux sysroot images.
target_sysroot_dir = "//build/linux"
# The path of the sysroot for the current toolchain. If empty, default
# sysroot is used.
sysroot = ""
# Controls default is_linux sysroot. If set to true, and sysroot
# is empty, default sysroot is calculated.
use_sysroot = current_cpu == "x86" || current_cpu == "x64" ||
current_cpu == "arm" || current_cpu == "arm64" ||
current_cpu == "mipsel" || current_cpu == "mips64el"
}
if (current_os == target_os && current_cpu == target_cpu &&
if (sysroot == "") {
if (current_os == target_os && current_cpu == target_cpu &&
target_sysroot != "") {
sysroot = target_sysroot
} else if (is_android) {
} else if (is_android) {
import("//build/config/android/config.gni")
# Android uses unified headers, and thus a single compile time sysroot
sysroot = "$android_toolchain_root/sysroot"
} else if (is_linux && use_sysroot) {
} else if (is_linux && use_sysroot) {
# By default build against a sysroot image downloaded from Cloud Storage
# during gclient runhooks.
if (current_cpu == "x64") {
......@@ -60,19 +67,16 @@ if (current_os == target_os && current_cpu == target_cpu &&
"string") == "True",
"Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=$_script_arch")
}
} else if (is_mac) {
} else if (is_mac) {
import("//build/config/mac/mac_sdk.gni")
sysroot = mac_sdk_path
} else if (is_ios) {
} else if (is_ios) {
import("//build/config/ios/ios_sdk.gni")
sysroot = ios_sdk_path
} else if (is_fuchsia) {
} else if (is_fuchsia) {
import("//build/config/fuchsia/config.gni")
if (current_cpu == "arm64" || current_cpu == "x64") {
sysroot = fuchsia_sdk + "/arch/$current_cpu/sysroot"
} else {
sysroot = ""
}
} else {
sysroot = ""
}
}
......@@ -69,6 +69,7 @@ cros_toolchain("target") {
use_debug_fission = use_debug_fission
use_gold = use_gold
use_sysroot = use_sysroot
sysroot = target_sysroot
}
}
......@@ -132,6 +133,7 @@ cros_toolchain("host") {
current_cpu = host_cpu
current_os = "linux"
use_sysroot = use_sysroot
sysroot = cros_host_sysroot
}
}
......@@ -166,5 +168,6 @@ cros_toolchain("v8_snapshot") {
v8_current_cpu = v8_target_cpu
current_os = "linux"
use_sysroot = use_sysroot
sysroot = cros_v8_snapshot_sysroot
}
}
......@@ -61,6 +61,7 @@ declare_args() {
cros_host_extra_cppflags = ""
cros_host_extra_cxxflags = ""
cros_host_extra_ldflags = ""
cros_host_sysroot = ""
cros_v8_snapshot_ar = "${clang_base_path}/bin/llvm-ar"
cros_v8_snapshot_cc = "${clang_base_path}/bin/clang"
......@@ -72,6 +73,7 @@ declare_args() {
cros_v8_snapshot_extra_cppflags = ""
cros_v8_snapshot_extra_cxxflags = ""
cros_v8_snapshot_extra_ldflags = ""
cros_v8_snapshot_sysroot = ""
cros_nacl_bootstrap_extra_cflags = ""
cros_nacl_bootstrap_extra_cppflags = ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment