From 4cda1fae2ba490daf2da924182be997dd9b4b36e Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:12:50 -0700 Subject: [PATCH] Cherry pick PR #1206: Set sb_is_modular appropriately, build linux using sb_is_modular (#1208) Refer to the original PR: https://github.com/youtube/cobalt/pull/1206 b/294267479 b/294230277 Set sb_is_modular = sb_is_evergreen || build_with_separate-cobalt_toolchain Set sb_is_evergreen = !build_with_separate-cobalt_toolchain This PR forces linux-modular builds to be built with sb_is_modular = true and sb_is_evergreen = false Change-Id: Ie9464ce4350023063f2ca0dfbecb2e917cd4ba3b Co-authored-by: Niranjan Yardi --- starboard/BUILD.gn | 4 ++-- starboard/build/config/BUILD.gn | 3 ++- starboard/build/config/BUILDCONFIG.gn | 3 +++ .../evergreen/shared/platform_configuration/configuration.gni | 4 +--- starboard/extension/BUILD.gn | 2 +- starboard/linux/shared/platform_configuration/BUILD.gn | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/starboard/BUILD.gn b/starboard/BUILD.gn index f7e053e6e79b..bb1c3e9bfe22 100644 --- a/starboard/BUILD.gn +++ b/starboard/BUILD.gn @@ -89,7 +89,7 @@ group("starboard") { "//starboard/client_porting/eztime", ] - if (sb_is_modular) { + if (sb_is_modular && current_toolchain == cobalt_toolchain) { public_deps += [ "//third_party/llvm-project/compiler-rt:compiler_rt", "//third_party/llvm-project/libcxx:cxx", @@ -192,7 +192,7 @@ if (current_toolchain == starboard_toolchain) { } else { public_deps += [ "//third_party/crashpad/wrapper:wrapper_stub" ] } - if (!sb_is_modular) { + if (!sb_is_evergreen) { public_deps += [ "//$starboard_path:starboard_platform" ] } } diff --git a/starboard/build/config/BUILD.gn b/starboard/build/config/BUILD.gn index 0c816e81c34d..84e33936b251 100644 --- a/starboard/build/config/BUILD.gn +++ b/starboard/build/config/BUILD.gn @@ -229,7 +229,8 @@ config("warnings_as_errors") { # override flags specified in a platform's "platform_configuration" config, # which is where these particular flags would otherwise naturally fit. config("default_compiler_flags") { - if (is_starboardized_toolchain && sb_is_modular && target_cpu == "arm") { + if (is_starboardized_toolchain && sb_is_modular && + current_toolchain == cobalt_toolchain && target_cpu == "arm") { cflags = [ "-mfpu=vfpv3" ] asmflags = cflags } diff --git a/starboard/build/config/BUILDCONFIG.gn b/starboard/build/config/BUILDCONFIG.gn index 6c7d409f09c0..1b8ad1983998 100644 --- a/starboard/build/config/BUILDCONFIG.gn +++ b/starboard/build/config/BUILDCONFIG.gn @@ -117,6 +117,9 @@ import("//starboard/build/config/toolchain_variables.gni") import("//$starboard_path/platform_configuration/configuration.gni") import("//starboard/build/config/build_assertions.gni") +# TODO(b/295399926) Clean up flag by moving to modular/helper_var.gni +sb_is_modular = sb_is_evergreen || build_with_separate_cobalt_toolchain + declare_args() { use_tsan = getenv("USE_TSAN") == 1 } diff --git a/starboard/evergreen/shared/platform_configuration/configuration.gni b/starboard/evergreen/shared/platform_configuration/configuration.gni index c76baea77b99..4327e1df5cb2 100644 --- a/starboard/evergreen/shared/platform_configuration/configuration.gni +++ b/starboard/evergreen/shared/platform_configuration/configuration.gni @@ -14,9 +14,7 @@ import("//starboard/build/config/base_configuration.gni") -sb_is_modular = true - -sb_is_evergreen = true +sb_is_evergreen = !build_with_separate_cobalt_toolchain cobalt_font_package = "empty" diff --git a/starboard/extension/BUILD.gn b/starboard/extension/BUILD.gn index 5212664b2e01..57b95b18ddf3 100644 --- a/starboard/extension/BUILD.gn +++ b/starboard/extension/BUILD.gn @@ -26,7 +26,7 @@ target(gtest_target_type, "extension_test") { "//testing/gmock", "//testing/gtest", ] - if (sb_is_modular) { + if (sb_is_modular && current_toolchain == cobalt_toolchain) { deps += cobalt_platform_dependencies } } diff --git a/starboard/linux/shared/platform_configuration/BUILD.gn b/starboard/linux/shared/platform_configuration/BUILD.gn index 87ea32955ed1..c1b9622abcf4 100644 --- a/starboard/linux/shared/platform_configuration/BUILD.gn +++ b/starboard/linux/shared/platform_configuration/BUILD.gn @@ -143,7 +143,7 @@ config("platform_configuration") { "rt", ] - if (!sb_is_modular) { + if (!sb_is_modular || current_toolchain != cobalt_toolchain) { ldflags += [ "-static-libstdc++" ] }