diff options
-rw-r--r-- | build/config/BUILD.gn | 12 | ||||
-rw-r--r-- | build/config/build_metadata.gni | 18 | ||||
-rw-r--r-- | build/config/compiler/BUILD.gn | 9 | ||||
-rw-r--r-- | build/config/linux/pkg_config.gni | 2 | ||||
-rw-r--r-- | build/config/posix/BUILD.gn | 10 | ||||
-rw-r--r-- | build/config/sysroot.gni | 24 | ||||
-rw-r--r-- | printing/BUILD.gn | 4 |
7 files changed, 53 insertions, 26 deletions
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index 9a3a6b7..b9208ac 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/allocator.gni") +import("//build/config/build_metadata.gni") import("//build/config/chrome_build.gni") import("//build/config/chromecast_build.gni") import("//build/config/crypto.gni") @@ -23,17 +24,6 @@ declare_args() { # significantly slow execution. enable_iterator_debugging = true - # Set to true to not store any build metadata, e.g. ifdef out all __DATE__ - # and __TIME__. Set to 0 to reenable the use of these macros in the code - # base. See http://crbug.com/314403. - # - # Continue to embed build meta data in Official builds, basically the - # time it was built. - # TODO(maruel): This decision should be revisited because having an - # official deterministic build has high value too but MSVC toolset can't - # generate anything deterministic with WPO enabled AFAIK. - dont_embed_build_metadata = !is_official_build - # Set to true to enable dcheck in Release builds. dcheck_always_on = false } diff --git a/build/config/build_metadata.gni b/build/config/build_metadata.gni new file mode 100644 index 0000000..befacbc --- /dev/null +++ b/build/config/build_metadata.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2016 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. + +import("//build/config/chrome_build.gni") + +declare_args() { + # Set to true to not store any build metadata, e.g. ifdef out all __DATE__ + # and __TIME__. Set to 0 to reenable the use of these macros in the code + # base. See http://crbug.com/314403. + # + # Continue to embed build meta data in Official builds, basically the + # time it was built. + # TODO(maruel): This decision should be revisited because having an + # official deterministic build has high value too but MSVC toolset can't + # generate anything deterministic with WPO enabled AFAIK. + dont_embed_build_metadata = !is_official_build +} diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 8ddbf7e..b1e6622 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -309,6 +309,15 @@ config("compiler") { cflags += [ "-fcolor-diagnostics" ] } + # Makes builds independent of absolute file path. + # clang-cl (used if is_win) doesn't expose this flag. + # Currently disabled for nacl since its toolchain lacks this flag (too old). + # TODO(zforman): Once nacl's toolchain is updated, remove check. + if (is_clang && !is_win && !is_nacl) { + absolute_path = rebase_path("//.") + cflags += [ "-fdebug-prefix-map=$absolute_path=." ] + } + # C++11 compiler flags setup. # --------------------------- if (is_linux || is_android || (is_nacl && is_clang)) { diff --git a/build/config/linux/pkg_config.gni b/build/config/linux/pkg_config.gni index 204cbab..f2c7958 100644 --- a/build/config/linux/pkg_config.gni +++ b/build/config/linux/pkg_config.gni @@ -52,7 +52,7 @@ if (sysroot != "") { # Pass the sysroot if we're using one (it requires the CPU arch also). pkg_config_args = [ "-s", - sysroot, + rebase_path(sysroot), "-a", current_cpu, ] diff --git a/build/config/posix/BUILD.gn b/build/config/posix/BUILD.gn index 6f65443..b2ccace 100644 --- a/build/config/posix/BUILD.gn +++ b/build/config/posix/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/build_metadata.gni") import("//build/config/sysroot.gni") assert(is_posix) @@ -13,7 +14,14 @@ assert(is_posix) config("runtime_library") { if (!is_mac && sysroot != "") { # Pass the sysroot to all C compiler variants, the assembler, and linker. - cflags = [ "--sysroot=" + sysroot ] + # If we don't care about build metadata, then just set the sysroot to an + # absolute path. Some buildbots (read: codesearch) care about this. + # See crbug.com/580103 for some discussion of why this was necessary. + if (dont_embed_build_metadata) { + cflags = [ "--sysroot=" + rebase_path(sysroot, root_build_dir) ] + } else { + cflags = [ "--sysroot=" + rebase_path(sysroot) ] + } asmflags = cflags ldflags = cflags diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni index 29a2b61..dcd215a 100644 --- a/build/config/sysroot.gni +++ b/build/config/sysroot.gni @@ -19,17 +19,17 @@ if (current_toolchain == default_toolchain && target_sysroot != "") { } else if (is_android) { import("//build/config/android/config.gni") if (current_cpu == "x86") { - sysroot = rebase_path("$android_ndk_root/$x86_android_sysroot_subdir") + sysroot = "$android_ndk_root/$x86_android_sysroot_subdir" } else if (current_cpu == "arm") { - sysroot = rebase_path("$android_ndk_root/$arm_android_sysroot_subdir") + sysroot = "$android_ndk_root/$arm_android_sysroot_subdir" } else if (current_cpu == "mipsel") { - sysroot = rebase_path("$android_ndk_root/$mips_android_sysroot_subdir") + sysroot = "$android_ndk_root/$mips_android_sysroot_subdir" } else if (current_cpu == "x64") { - sysroot = rebase_path("$android_ndk_root/$x86_64_android_sysroot_subdir") + sysroot = "$android_ndk_root/$x86_64_android_sysroot_subdir" } else if (current_cpu == "arm64") { - sysroot = rebase_path("$android_ndk_root/$arm64_android_sysroot_subdir") + sysroot = "$android_ndk_root/$arm64_android_sysroot_subdir" } else if (current_cpu == "mips64") { - sysroot = rebase_path("$android_ndk_root/$mips64_android_sysroot_subdir") + sysroot = "$android_ndk_root/$mips64_android_sysroot_subdir" } else { sysroot = "" } @@ -37,13 +37,13 @@ if (current_toolchain == default_toolchain && target_sysroot != "") { # By default build against a sysroot image downloaded from Cloud Storage # during gclient runhooks. if (current_cpu == "x64") { - sysroot = rebase_path("//build/linux/debian_wheezy_amd64-sysroot") + sysroot = "//build/linux/debian_wheezy_amd64-sysroot" } else if (current_cpu == "x86") { - sysroot = rebase_path("//build/linux/debian_wheezy_i386-sysroot") + sysroot = "//build/linux/debian_wheezy_i386-sysroot" } else if (current_cpu == "mipsel") { - sysroot = rebase_path("//build/linux/debian_wheezy_mips-sysroot") + sysroot = "//build/linux/debian_wheezy_mips-sysroot" } else if (current_cpu == "arm") { - sysroot = rebase_path("//build/linux/debian_wheezy_arm-sysroot") + sysroot = "//build/linux/debian_wheezy_arm-sysroot" } else { # Any other builds don't use a sysroot. sysroot = "" @@ -63,7 +63,9 @@ if (current_toolchain == default_toolchain && target_sysroot != "") { _script_arch = "amd64" } assert( - exec_script("//build/dir_exists.py", [ sysroot ], "string") == "True", + exec_script("//build/dir_exists.py", + [ rebase_path(sysroot) ], + "string") == "True", "Missing sysroot ($sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=$_script_arch") } } else if (is_mac) { diff --git a/printing/BUILD.gn b/printing/BUILD.gn index 985a626..466388f 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn @@ -131,7 +131,7 @@ component("printing") { cups_version = exec_script("cups_config_helper.py", [ "--api-version", - sysroot, + rebase_path(sysroot), ], "trim string") @@ -244,7 +244,7 @@ if (use_cups) { libs = exec_script("cups_config_helper.py", [ "--libs-for-gn", - sysroot, + rebase_path(sysroot), ], "value") } |