diff --git a/base/BUILD.gn b/base/BUILD.gn index 0afa1d812bc1..1a3732e8f123 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -109,7 +109,7 @@ if (is_apple) { # ../../third_party/libevent/signal.c:43:10: fatal error: 'sys/queue.h' file not found # #include # Determines whether libevent should be dep. -if (is_cobalt && is_starboard && use_custom_libc) { +if (is_cobalt && is_cobalt_hermetic_build) { dep_libevent = false } else { dep_libevent = !is_fuchsia && !is_win && !is_mac && !is_nacl @@ -209,7 +209,6 @@ buildflag_header("ios_cronet_buildflags") { } enable_message_pump_epoll = is_linux || is_chromeos || is_android - buildflag_header("message_pump_buildflags") { header = "message_pump_buildflags.h" header_dir = "base/message_loop" @@ -1025,7 +1024,7 @@ component("base") { ] } - if (is_cobalt && is_starboard && use_custom_libc) { + if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "debug/proc_maps_linux.cc", "debug/proc_maps_linux.h", @@ -1118,8 +1117,7 @@ component("base") { "//third_party/abseil-cpp:absl", ] - if (is_cobalt && is_starboard && use_custom_libc && - current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { deps -= [ "//base/allocator/partition_allocator:raw_ptr" ] deps += [ "//starboard:starboard_group" ] } @@ -1157,7 +1155,7 @@ component("base") { "allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.h", ] } - if (is_cobalt && is_starboard && use_custom_libc) { + if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc", "allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.h", @@ -1192,7 +1190,7 @@ component("base") { # ^ # ../../third_party/musl/include/malloc.h:19:8: note: previous declaration is here # size_t malloc_usable_size(void *); - if (is_cobalt && is_starboard && use_custom_libc) { + if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "allocator/partition_allocator/shim/allocator_shim_override_cpp_symbols.h", "allocator/partition_allocator/shim/allocator_shim_override_glibc_weak_symbols.h", @@ -1703,8 +1701,7 @@ component("base") { } # TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. - if (is_cobalt && is_starboard && use_custom_libc && - current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "base_paths_posix.h", "memory/madv_free_discardable_memory_allocator_posix.cc", @@ -1735,7 +1732,7 @@ component("base") { ] } - if (is_cobalt && is_starboard && use_custom_libc) { + if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "process/process_metrics_posix.cc", "sync_socket_posix.cc", @@ -1761,7 +1758,7 @@ component("base") { ] } - if (is_cobalt && is_starboard && use_custom_libc) { + if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "native_library_posix.cc", "posix/can_lower_nice_to.cc", diff --git a/base/allocator/partition_allocator/BUILD.gn b/base/allocator/partition_allocator/BUILD.gn index 2d455bf40248..37d188ab7163 100644 --- a/base/allocator/partition_allocator/BUILD.gn +++ b/base/allocator/partition_allocator/BUILD.gn @@ -233,7 +233,7 @@ component("partition_alloc") { ] # TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. - if (is_cobalt && is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { sources -= [ "partition_alloc_base/rand_util_posix.cc" ] } @@ -330,7 +330,7 @@ component("partition_alloc") { deps += [ "//third_party/android_ndk:cpu_features" ] } - if (is_cobalt && is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { deps += [ "//starboard:starboard_group" ] } if (is_fuchsia) { diff --git a/build/config/c++/BUILD.gn b/build/config/c++/BUILD.gn index 2f923082cae2..c92530c046d9 100644 --- a/build/config/c++/BUILD.gn +++ b/build/config/c++/BUILD.gn @@ -72,8 +72,7 @@ config("runtime_library") { "-isystem" + rebase_path("$libcxx_prefix/include", root_build_dir), "-isystem" + rebase_path("$libcxxabi_prefix/include", root_build_dir), ] - if (is_cobalt && is_starboard && use_custom_libc && - current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { cflags_cc += [ "-isystem" + rebase_path("//third_party/musl/include", root_build_dir), "-isystem" + @@ -109,8 +108,7 @@ config("runtime_library") { "m", "rt", ] - if (is_cobalt && is_starboard && use_custom_libc && - current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { libs -= [ "c", "rt", diff --git a/buildtools/third_party/libc++/BUILD.gn b/buildtools/third_party/libc++/BUILD.gn index 21334c2d9770..ad91e311c07a 100644 --- a/buildtools/third_party/libc++/BUILD.gn +++ b/buildtools/third_party/libc++/BUILD.gn @@ -58,8 +58,7 @@ target(_libcxx_target_type, "libc++") { "//build/config:common_deps", "//third_party/catapult/devil:devil", ] - if (is_cobalt && is_starboard && use_custom_libc && - current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { visibility += [ "//starboard:starboard_group" ] } @@ -124,8 +123,7 @@ target(_libcxx_target_type, "libc++") { "trunk/src/verbose_abort.cpp", ] - if (is_cobalt && is_starboard && use_custom_libc && - current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { # TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically. sources -= [ "trunk/src/atomic.cpp" ] } @@ -226,8 +224,7 @@ target(_libcxx_target_type, "libc++") { } } - if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain && - use_custom_libc) { + if (is_cobalt && is_cobalt_hermetic_build) { deps += [ "//third_party/llvm-project/compiler-rt:compiler_rt", "//third_party/musl:c", diff --git a/buildtools/third_party/libc++abi/BUILD.gn b/buildtools/third_party/libc++abi/BUILD.gn index 34f36d0f94c7..cd49e5f5de8c 100644 --- a/buildtools/third_party/libc++abi/BUILD.gn +++ b/buildtools/third_party/libc++abi/BUILD.gn @@ -16,8 +16,7 @@ source_set("libc++abi") { } else { visibility = [ "//buildtools/third_party/libc++" ] } - if (is_cobalt && is_starboard && use_custom_libc && - current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { visibility += [ "//starboard:starboard_group" ] } @@ -28,7 +27,7 @@ source_set("libc++abi") { deps = [ "//buildtools/third_party/libunwind" ] } - if (is_cobalt && is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain) { + if (is_cobalt && is_cobalt_hermetic_build) { deps = [ "//third_party/musl:c" ] } diff --git a/cobalt/build/configs/BUILD.gn b/cobalt/build/configs/BUILD.gn index 71f4b359579f..bc6de5326d47 100644 --- a/cobalt/build/configs/BUILD.gn +++ b/cobalt/build/configs/BUILD.gn @@ -22,8 +22,7 @@ config("cobalt_config") { ] if (current_toolchain == starboard_toolchain) { configs += [ "//${starboard_path}/platform_configuration" ] - } else if (is_starboard && use_custom_libc && - current_toolchain == cobalt_toolchain) { + } else if (is_cobalt_hermetic_build) { configs += [ "//starboard/build/config/modular/x64", "//starboard/build/config:starboard", diff --git a/cobalt/build/configs/modular_variables.gni b/cobalt/build/configs/modular_variables.gni index 86cf8bbe13c8..0775b2c29395 100644 --- a/cobalt/build/configs/modular_variables.gni +++ b/cobalt/build/configs/modular_variables.gni @@ -16,3 +16,6 @@ declare_args() { # TODO: b/371241293 - Remove this variable when the hermetic toolchain is setup use_custom_libc = false } + +is_cobalt_hermetic_build = + is_starboard && use_custom_libc && current_toolchain == cobalt_toolchain diff --git a/starboard/BUILD.gn b/starboard/BUILD.gn index 3b5b4312973f..6226444300c7 100644 --- a/starboard/BUILD.gn +++ b/starboard/BUILD.gn @@ -111,7 +111,7 @@ if (!is_cobalt) { "//starboard/client_porting/eztime", ] - if (sb_is_modular && current_toolchain == cobalt_toolchain) { + if (is_cobalt_hermetic_build) { public_deps += [ "//third_party/llvm-project/compiler-rt:compiler_rt", "//third_party/llvm-project/libcxx:cxx", @@ -177,8 +177,7 @@ if (!is_cobalt) { "//starboard/client_porting/eztime", ] - if (sb_is_modular && use_custom_libc && - current_toolchain == cobalt_toolchain) { + if (is_cobalt_hermetic_build) { public_deps += [ "//buildtools/third_party/libc++", "//buildtools/third_party/libc++abi", diff --git a/starboard/shared/modular/BUILD.gn b/starboard/shared/modular/BUILD.gn index f5648939f1b1..1da182f53264 100644 --- a/starboard/shared/modular/BUILD.gn +++ b/starboard/shared/modular/BUILD.gn @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//cobalt/build/configs/modular_variables.gni") + # TODO: b/315170518 - Revert to static library after fixing # symbol visibility issues for windows based modular platform builds. if ((sb_is_modular || sb_is_evergreen_compatible) && @@ -44,8 +46,7 @@ if ((sb_is_modular || sb_is_evergreen_compatible) && } } -if (sb_is_modular && !sb_is_evergreen && - current_toolchain == cobalt_toolchain) { +if (is_cobalt_hermetic_build && !sb_is_evergreen) { source_set("cobalt_layer_posix_abi_wrappers") { sources = [ "cobalt_layer_posix_directory_abi_wrappers.cc", diff --git a/third_party/abseil-cpp/absl/base/BUILD.gn b/third_party/abseil-cpp/absl/base/BUILD.gn index 3045cc970f0b..fb098cd94ae7 100644 --- a/third_party/abseil-cpp/absl/base/BUILD.gn +++ b/third_party/abseil-cpp/absl/base/BUILD.gn @@ -42,7 +42,7 @@ absl_source_set("raw_logging_internal") { ":log_severity", ] visibility = [ "//third_party/abseil-cpp/absl/*" ] - if (is_cobalt && is_starboard && use_custom_libc) { + if (is_cobalt && is_cobalt_hermetic_build) { public_deps += [ "//starboard:starboard_headers_only" ] } } diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn index de60e3957353..e45861dc736d 100644 --- a/third_party/boringssl/BUILD.gn +++ b/third_party/boringssl/BUILD.gn @@ -168,7 +168,7 @@ component("boringssl") { # config is forwarded to callers. In particular, boringssl_crypto_tests # requires it. public_deps = [ ":boringssl_asm" ] - if (is_cobalt && is_starboard && use_custom_libc) { + if (is_cobalt && is_cobalt_hermetic_build) { public_deps += [ "//starboard/common", "//starboard:starboard_headers_only" ] }