Skip to content

Commit

Permalink
Revert "Revert "Build starboard shared library for linux-x64x11 (yout…
Browse files Browse the repository at this point in the history
…ube#4215)"" (youtube#4247)

Reverts youtube#4245

b/365546355
  • Loading branch information
andrewsavage1 authored Oct 14, 2024
1 parent 102a04d commit 79e6b53
Show file tree
Hide file tree
Showing 33 changed files with 302 additions and 108 deletions.
3 changes: 2 additions & 1 deletion .github/config/linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"gpu_unittests",
"gin_unittests",
"blink_unittests",
"content_shell"
"content_shell",
"starboard/libstarboard.so.17"
],
"includes": [
{
Expand Down
9 changes: 9 additions & 0 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,12 @@ exec_script_whitelist =
"//tools/grit/grit_rule.gni",
"//tools/gritsettings/BUILD.gn",
]

import("//chrobalt/build/configs/chrobalt.gni")
if (chrobalt) {
exec_script_whitelist += [
"//starboard/tools/BUILD.gn",
"//starboard/build/config/sabi/BUILD.gn",
"//starboard/build/platform_path.gni",
]
}
3 changes: 3 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,9 @@ group("gn_all") {
deps += [ "//components/cronet:cronet_tests" ]
}
}
if (chrobalt) {
deps += [ "//chrobalt:gn_all" ]
}
}

# All Rust targets. This is provided for convenience while developing Rust to
Expand Down
11 changes: 11 additions & 0 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,13 @@ is_posix = !is_win && !is_fuchsia
# requirement and just need to add a config everywhere, reference it as a
# sub-config of an existing one, most commonly the main "compiler" one.

import("//chrobalt/build/configs/chrobalt.gni")
# TODO(b/371589344): Fix android build configs.
if (chrobalt && target_os != "android") {
import("//chrobalt/build/configs/initialize_variables.gni")
import("//chrobalt/build/configs/variables.gni")
}

# Holds all configs used for running the compiler.
default_compiler_configs = [
"//build/config:feature_flags",
Expand Down Expand Up @@ -354,6 +361,10 @@ default_compiler_configs = [
"//build/config/sanitizers:default_sanitizer_flags",
]

if (chrobalt) {
default_compiler_configs += [ "//chrobalt/build/configs:chrobalt_config" ]
}

if (is_win) {
default_compiler_configs += [
"//build/config/win:default_cfg_compiler",
Expand Down
17 changes: 6 additions & 11 deletions starboard/build/config/clang.gni → chrobalt/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 The Cobalt Authors. All Rights Reserved.
# Copyright 2024 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,14 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//starboard/build/toolchain/starboard_toolchains.gni")

declare_args() {
clang_revision = "17-init-8029-g27f27d15-3"
}

default_clang_base_path = "$starboard_toolchains_path/x86_64-linux-gnu-clang-chromium-${clang_revision}"

declare_args() {
clang_base_path = default_clang_base_path
group("gn_all") {
# TODO(b/371589344): Fix android build configs.
if (target_os != "android") {
deps = [ "//starboard($starboard_toolchain)" ]
}
}
20 changes: 20 additions & 0 deletions chrobalt/build/configs/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

config("chrobalt_config") {
# TODO(b/371589344): Fix android build configs.
if (target_os != "android") {
configs = [ "//${starboard_path}/platform_configuration" ]
}
}
18 changes: 18 additions & 0 deletions chrobalt/build/configs/chrobalt.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Get the path to the starboard implementation and include its GN
# configuration.

chrobalt = true
75 changes: 75 additions & 0 deletions chrobalt/build/configs/initialize_variables.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2024 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Get the path to the starboard implementation and include its GN
# configuration.

declare_args() {
# Temporary gn arg for work on base/net update.
cobalt_pending_clean_up = true

build_type = "devel"

is_starboard = true

# Used to guard any customizations to Chromium or third-party code for builds
# where the Starboard porting layer is not used.
is_native_target_build = false

is_internal_build = getenv("COBALT_USE_INTERNAL_BUILD") == "1"

using_old_compiler = false

build_with_separate_cobalt_toolchain = true
}

assert(!(is_starboard && is_native_target_build),
"Targets should be built for Starboard or natively, but not both")

# Used to guard customizations to Chromium or third-party code. We historically
# used is_starboard for this, but we developed the need to distinguish between
# a) customizations that should only be used for Starboard builds and b)
# those that should only be used for native target builds (see
# is_native_target_build). use_cobalt_customizations is a convenience in the
# sense that it is functionally equivalent to
# (is_starboard || is_native_target_build), but it should be used in lieu of
# that since the intent is more clear.
use_cobalt_customizations = true

# TODO(b/371589344): Investigate if we need cobalt_is_debug which
# avoids overriding chrome's is_debug.
is_devel = build_type == "devel"
is_qa = build_type == "qa"
is_gold = build_type == "gold"

# TODO(b/372141961): Investigate setting chromium flag
# is_debug = true for debug builds
# assert(is_debug || is_devel || is_qa || is_gold)

if (is_mac) {
declare_args() {
use_system_xcode = true
}
}

# Get the path to the starboard implementation and include its GN
# configuration.
import("//starboard/build/platform_path.gni")
if (build_with_separate_cobalt_toolchain) {
cobalt_toolchain = "//$starboard_path/toolchain:cobalt"
starboard_toolchain = "//$starboard_path/toolchain:starboard"
} else {
cobalt_toolchain = default_toolchain
starboard_toolchain = cobalt_toolchain
}
10 changes: 10 additions & 0 deletions chrobalt/build/configs/linux-x64x11/args.gn
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
target_os = "linux"
target_cpu = "x64"
target_platform = "linux-x64x11"

# Chromium flag overrides needed for building libstarboard

# V8 override
# # Enable WASM and install WebAssembly global.
v8_enable_webassembly = true

# TODO(b/218889313): All flags below this line need to be revisited
# carefully and eliminated if unnecessary.

enable_nacl=false
use_dawn=false
Expand Down
38 changes: 38 additions & 0 deletions chrobalt/build/configs/variables.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2024 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Get the path to the starboard implementation and include its GN
# configuration.


import("//$starboard_path/platform_configuration/configuration.gni")

sb_is_modular = sb_is_evergreen || build_with_separate_cobalt_toolchain

declare_args() {
use_tsan = false
}
declare_args() {
# TODO(b/371589344) : Enable ASAN
use_asan = false
}

# TODO(b/371263047): Resolve issues and build evergreen.
enable_evergreen_code = false

# TODO(b/371606611): Build test targets with cobalt toolchain
enable_test_targets = false

# TODO(b/371642925): Fix install targets for chrobalt
enable_install_targets = false
46 changes: 25 additions & 21 deletions starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@ group("gn_all") {

deps = [
":default",
"//starboard/client_porting/eztime:eztime_test",
"//starboard/client_porting/icu_init",
"//starboard/examples/glclear:starboard_glclear_example",
"//starboard/examples/hello_world:starboard_hello_world_example",
"//starboard/examples/window:starboard_window_example",
"//starboard/extension:extension_test",
"//starboard/nplb",
]
if (sb_is_evergreen_compatible && current_toolchain == starboard_toolchain) {
deps += [ "//starboard/nplb/nplb_evergreen_compat_tests" ]
if (enable_test_targets) {
if (sb_is_evergreen_compatible &&
current_toolchain == starboard_toolchain) {
deps += [ "//starboard/nplb/nplb_evergreen_compat_tests" ]
}
deps += [
"//starboard/client_porting/eztime:eztime_test",
"//starboard/examples/glclear:starboard_glclear_example",
"//starboard/examples/hello_world:starboard_hello_world_example",
"//starboard/examples/window:starboard_window_example",
"//starboard/extension:extension_test",
"//starboard/nplb",
]
}

if (has_platform_targets) {
Expand Down Expand Up @@ -63,18 +68,16 @@ group("gn_all") {
}

if (!sb_is_evergreen) {
if (sb_is_evergreen_compatible) {
if (sb_is_evergreen_compatible && enable_evergreen_code) {
deps += [
"//starboard/elf_loader:elf_loader_test_install($starboard_toolchain)",
"//starboard/loader_app:installation_manager_test_install($starboard_toolchain)",
"//starboard/loader_app:reset_evergreen_update_test_install($starboard_toolchain)",
]

if (current_toolchain == starboard_toolchain) {
deps += [
"//third_party/crashpad/crashpad/client",
"//third_party/lz4_lib:lz4",
]
deps += [ "//third_party/lz4_lib:lz4" ]
deps += [ "//third_party/crashpad/crashpad/client" ]

data_deps = [
"//starboard/loader_app($starboard_toolchain)",
"//third_party/crashpad/crashpad/handler:crashpad_handler(//$starboard_path/toolchain:native_target)",
Expand Down Expand Up @@ -144,13 +147,14 @@ group("starboard_group") {
"//starboard/common",
]

if (!sb_is_modular || sb_is_evergreen) {
if (sb_is_evergreen_compatible &&
current_toolchain == starboard_toolchain) {
public_deps += [ "//starboard/crashpad_wrapper" ]
} else {
public_deps +=
[ "//starboard/crashpad_wrapper:wrapper_stub" ]
if (enable_evergreen_code) {
if (!sb_is_modular || sb_is_evergreen) {
if (sb_is_evergreen_compatible &&
current_toolchain == starboard_toolchain) {
public_deps += [ "//starboard/crashpad_wrapper" ]
} else {
public_deps += [ "//starboard/crashpad_wrapper:wrapper_stub" ]
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion starboard/android/shared/platform_configuration/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ config("platform_configuration") {
"mediandk",
]

if (!cobalt_fastbuild && (is_debug || is_devel)) {
if (is_debug || is_devel) {
cflags += [ "-g" ]
}

Expand Down
1 change: 1 addition & 0 deletions starboard/build/config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import("//build/config/compiler/compiler.gni")
import("//starboard/build/config/os_definitions.gni")
import("//starboard/build/config/toolchain_variables.gni")

# TODO: b/319085130 - This macro is only used temporarily to enable compilation
# of upstream libraries being updated in Cobalt. Use it as
Expand Down
26 changes: 1 addition & 25 deletions starboard/build/config/base_configuration.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//starboard/build/config/clang.gni")
import("//build/config/clang/clang.gni")
import("//starboard/content/fonts/font_configuration.gni")

# NOTE:
Expand Down Expand Up @@ -150,32 +150,8 @@ declare_args() {
# Enables an NPLB audit of C++20 support.
sb_enable_cpp20_audit = true

# Enable WASM and install WebAssembly global.
v8_enable_webassembly = false

# Set this to true if the modular toolchain linker doesn't strip
# all unused symbols and nplb fails to link.
# TODO: b/297808555 Remove this flag after nplb is fixed
sb_has_unused_symbol_issue = false
}

if (current_toolchain == starboard_toolchain &&
build_with_separate_cobalt_toolchain) {
declare_args() {
# Target-specific configurations for executable targets.
executable_configs =
[ "//build/config/gcc:rpath_for_built_shared_libraries" ]

# Target-specific configurations for shared_library targets.
shared_library_configs =
[ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
} else {
declare_args() {
# Target-specific configurations for executable targets.
executable_configs = []

# Target-specific configurations for shared_library targets.
shared_library_configs = []
}
}
Loading

0 comments on commit 79e6b53

Please sign in to comment.