Skip to content

Commit

Permalink
Add is_cobalt_hermetic_build
Browse files Browse the repository at this point in the history
  • Loading branch information
niranjanyardi committed Jan 14, 2025
1 parent 46d469b commit 0930a4b
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 35 deletions.
19 changes: 8 additions & 11 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ if (is_apple) {
# ../../third_party/libevent/signal.c:43:10: fatal error: 'sys/queue.h' file not found
# #include <sys/queue.h>
# 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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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" ]
}
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions base/allocator/partition_allocator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}

Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 2 additions & 4 deletions build/config/c++/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 3 additions & 6 deletions buildtools/third_party/libc++/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}

Expand Down Expand Up @@ -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" ]
}
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 2 additions & 3 deletions buildtools/third_party/libc++abi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}

Expand All @@ -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" ]
}

Expand Down
3 changes: 1 addition & 2 deletions cobalt/build/configs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions cobalt/build/configs/modular_variables.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 2 additions & 3 deletions starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions starboard/shared/modular/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion third_party/abseil-cpp/absl/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}
}
Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
}

Expand Down

0 comments on commit 0930a4b

Please sign in to comment.