From ccc0c36006da95b6c8a681abd48609180eafdfcf Mon Sep 17 00:00:00 2001 From: Dirk Pranke Date: Thu, 28 Sep 2017 22:15:11 +0000 Subject: [PATCH] Move "enable_nacl" out of //build/config/features.gni. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ideally //build/config/features.gni would be empty (or, at least, would only reference features defined inside of //build). This CL moves the `enable_nacl` flag out of that file, and into its own dedicated file, so that it has a much smaller scope and we can help ensure that it is not referenced or needed by other projects that are using //build but aren't building Chromium. This work will be useful as part of the work we're doing to make NaCl something that can be disabled directly in DEPS (without needing to depend on GYP_DEFINES to do so). TBR=bradnelson@chromium.org R: brettw@chromium.org, bradleynelson@chromium.org, dschuff@chromium.org, phajdan.jr@chromium.org Bug: 756688 Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation Change-Id: I3af65646803912db67d421d35b4dfe9c2e0b703e Reviewed-on: https://chromium-review.googlesource.com/688314 Commit-Queue: Dirk Pranke Reviewed-by: Paweł Hajdan Jr. Reviewed-by: Brett Wilson Cr-Commit-Position: refs/heads/master@{#505188} --- BUILD.gn | 1 + build/config/features.gni | 10 - build/config/nacl/config.gni | 67 +++--- build/config/nacl/rules.gni | 1 - chrome/BUILD.gn | 1 + chrome/app/BUILD.gn | 1 + chrome/app/mash/BUILD.gn | 1 + chrome/browser/BUILD.gn | 1 + chrome/browser/extensions/BUILD.gn | 1 + chrome/browser/nacl_host/test/BUILD.gn | 2 +- .../resources/chromeos/chromevox/BUILD.gn | 1 + chrome/browser/ui/BUILD.gn | 1 + chrome/common/BUILD.gn | 1 + chrome/installer/linux/BUILD.gn | 1 + chrome/installer/mini_installer/BUILD.gn | 1 + chrome/renderer/BUILD.gn | 1 + chrome/test/BUILD.gn | 1 + chrome/test/data/nacl/BUILD.gn | 1 + components/BUILD.gn | 1 + components/nacl/broker/BUILD.gn | 2 +- components/nacl/browser/BUILD.gn | 2 +- components/nacl/common/BUILD.gn | 2 +- components/nacl/features.gni | 17 ++ components/nacl/loader/BUILD.gn | 2 +- components/nacl/loader/sandbox_linux/BUILD.gn | 2 +- components/nacl/renderer/BUILD.gn | 2 +- extensions/common/BUILD.gn | 1 + extensions/shell/BUILD.gn | 1 + extensions/shell/installer/linux/BUILD.gn | 1 + mash/BUILD.gn | 1 + native_client_sdk/src/BUILD.gn | 2 +- ppapi/BUILD.gn | 1 + ppapi/native_client/nacl_test_data.gni | 2 + .../pnacl_support_extension/BUILD.gn | 226 +++++++++--------- ppapi/tests/extensions/BUILD.gn | 3 +- remoting/BUILD.gn | 1 + remoting/client/plugin/BUILD.gn | 3 + remoting/tools/BUILD.gn | 1 + remoting/tools/javascript_key_tester/BUILD.gn | 78 +++--- remoting/webapp/build_template.gni | 1 + tools/ipc_fuzzer/message_lib/BUILD.gn | 2 +- 41 files changed, 242 insertions(+), 206 deletions(-) create mode 100644 components/nacl/features.gni diff --git a/BUILD.gn b/BUILD.gn index 4023a0c73b6221..eae58211e66783 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -12,6 +12,7 @@ import("//build/config/compiler/compiler.gni") import("//build/config/features.gni") import("//build/config/sanitizers/sanitizers.gni") import("//build/config/ui.gni") +import("//components/nacl/features.gni") import("//device/vr/features/features.gni") import("//extensions/features/features.gni") import("//media/media_options.gni") diff --git a/build/config/features.gni b/build/config/features.gni index 21b3bbcc21c047..d014d0e12f1aab 100644 --- a/build/config/features.gni +++ b/build/config/features.gni @@ -21,16 +21,6 @@ if (is_android) { } declare_args() { - # Enables Native Client support. - # Temporarily disable nacl on arm64 linux to get rid of compilation errors. - # TODO(mcgrathr): When mipsel-nacl-clang is available, drop the exclusion. - enable_nacl = !is_ios && !is_android && !is_fuchsia && !is_chromecast && - current_cpu != "mipsel" && current_cpu != "mips64el" && - !(is_linux && target_cpu == "arm64") - - # Non-SFI is not yet supported on mipsel - enable_nacl_nonsfi = current_cpu != "mipsel" && current_cpu != "mips64el" - # Enables proprietary codecs and demuxers; e.g. H264, AAC, MP3, and MP4. # We always build Google Chrome and Chromecast with proprietary codecs. # diff --git a/build/config/nacl/config.gni b/build/config/nacl/config.gni index ad8936ed9859e0..77e15fc51cb339 100644 --- a/build/config/nacl/config.gni +++ b/build/config/nacl/config.gni @@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/features.gni") - declare_args() { # Native Client supports both Newlib and Glibc C libraries where Newlib # is assumed to be the default one; use this to determine whether Glibc @@ -14,39 +12,44 @@ declare_args() { is_nacl_irt = false is_nacl_nonsfi = false -if (enable_nacl) { - nacl_toolchain_dir = "//native_client/toolchain/${host_os}_x86" - - if (is_nacl_glibc) { - if (current_cpu == "x86" || current_cpu == "x64") { - nacl_toolchain_package = "nacl_x86_glibc" - } else if (current_cpu == "arm") { - nacl_toolchain_package = "nacl_arm_glibc" - } - } else { - nacl_toolchain_package = "pnacl_newlib" - } +nacl_toolchain_dir = "//native_client/toolchain/${host_os}_x86" - if (current_cpu == "pnacl") { - _nacl_tuple = "pnacl" - } else if (current_cpu == "x86" || current_cpu == "x64") { - _nacl_tuple = "x86_64-nacl" +if (is_nacl_glibc) { + if (current_cpu == "x86" || current_cpu == "x64") { + nacl_toolchain_package = "nacl_x86_glibc" } else if (current_cpu == "arm") { - _nacl_tuple = "arm-nacl" - } else if (current_cpu == "mipsel") { - _nacl_tuple = "mipsel-nacl" + nacl_toolchain_package = "nacl_arm_glibc" } +} else { + nacl_toolchain_package = "pnacl_newlib" +} - nacl_toolchain_bindir = "${nacl_toolchain_dir}/${nacl_toolchain_package}/bin" - nacl_toolchain_tooldir = - "${nacl_toolchain_dir}/${nacl_toolchain_package}/${_nacl_tuple}" - nacl_toolprefix = "${nacl_toolchain_bindir}/${_nacl_tuple}-" +if (current_cpu == "pnacl") { + _nacl_tuple = "pnacl" +} else if (current_cpu == "x86" || current_cpu == "x64") { + _nacl_tuple = "x86_64-nacl" +} else if (current_cpu == "arm") { + _nacl_tuple = "arm-nacl" +} else if (current_cpu == "mipsel") { + _nacl_tuple = "mipsel-nacl" +} else { + # In order to allow this file to be included unconditionally + # from build files that can't depend on //components/nacl/features.gni + # we provide a dummy value that should be harmless if nacl isn't needed. + # If nacl *is* needed this will result in a real error, indicating that + # people need to set the toolchain path correctly. + _nacl_tuple = "unknown" +} - nacl_irt_toolchain = "//build/toolchain/nacl:irt_" + target_cpu - is_nacl_irt = current_toolchain == nacl_irt_toolchain +nacl_toolchain_bindir = "${nacl_toolchain_dir}/${nacl_toolchain_package}/bin" +nacl_toolchain_tooldir = + "${nacl_toolchain_dir}/${nacl_toolchain_package}/${_nacl_tuple}" +nacl_toolprefix = "${nacl_toolchain_bindir}/${_nacl_tuple}-" - # Non-SFI mode is a lightweight sandbox used by Chrome OS for running ARC - # applications. - nacl_nonsfi_toolchain = "//build/toolchain/nacl:newlib_pnacl_nonsfi" - is_nacl_nonsfi = current_toolchain == nacl_nonsfi_toolchain -} +nacl_irt_toolchain = "//build/toolchain/nacl:irt_" + target_cpu +is_nacl_irt = current_toolchain == nacl_irt_toolchain + +# Non-SFI mode is a lightweight sandbox used by Chrome OS for running ARC +# applications. +nacl_nonsfi_toolchain = "//build/toolchain/nacl:newlib_pnacl_nonsfi" +is_nacl_nonsfi = current_toolchain == nacl_nonsfi_toolchain diff --git a/build/config/nacl/rules.gni b/build/config/nacl/rules.gni index 1c1a9121eb935e..9bb4ede89c7090 100644 --- a/build/config/nacl/rules.gni +++ b/build/config/nacl/rules.gni @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/features.gni") import("//build/config/nacl/config.gni") # Generate a nmf file diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index e8387e1d182ac0..23ce0d2af89cff 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn @@ -15,6 +15,7 @@ import("//build/toolchain/toolchain.gni") import("//chrome/chrome_paks.gni") import("//chrome/common/features.gni") import("//chrome/process_version_rc_template.gni") +import("//components/nacl/features.gni") import("//extensions/features/features.gni") import("//media/media_options.gni") import("//ppapi/features/features.gni") diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn index abb33a3daa748e..d76bb9b25490d7 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn @@ -4,6 +4,7 @@ import("//build/config/ui.gni") import("//chrome/common/features.gni") +import("//components/nacl/features.gni") import("//ppapi/features/features.gni") import("//printing/features/features.gni") import("//services/catalog/public/tools/catalog.gni") diff --git a/chrome/app/mash/BUILD.gn b/chrome/app/mash/BUILD.gn index 0e8a9e9bbdcf6d..7edf8dfb73c96a 100644 --- a/chrome/app/mash/BUILD.gn +++ b/chrome/app/mash/BUILD.gn @@ -4,6 +4,7 @@ import("//build/config/nacl/config.gni") import("//chrome/common/features.gni") +import("//components/nacl/features.gni") import("//services/catalog/public/tools/catalog.gni") import("//services/service_manager/public/service_manifest.gni") diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 0619a2be83c0db..b112aca5347663 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -9,6 +9,7 @@ import("//build/config/ui.gni") import("//build/split_static_library.gni") import("//chrome/common/features.gni") import("//components/feature_engagement/features.gni") +import("//components/nacl/features.gni") import("//components/offline_pages/features/features.gni") import("//components/os_crypt/features.gni") import("//components/signin/features.gni") diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 3db2fd35846fff..62d4aad9f32bda 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn @@ -5,6 +5,7 @@ import("//build/config/features.gni") import("//build/config/ui.gni") import("//chrome/common/features.gni") +import("//components/nacl/features.gni") import("//extensions/features/features.gni") import("//media/media_options.gni") import("//mojo/public/tools/bindings/mojom.gni") diff --git a/chrome/browser/nacl_host/test/BUILD.gn b/chrome/browser/nacl_host/test/BUILD.gn index 0715b3312eb9b9..0de6e09f3a30eb 100644 --- a/chrome/browser/nacl_host/test/BUILD.gn +++ b/chrome/browser/nacl_host/test/BUILD.gn @@ -2,7 +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/features.gni") +import("//components/nacl/features.gni") if (enable_nacl && (is_linux || is_win)) { executable("mock_nacl_gdb") { diff --git a/chrome/browser/resources/chromeos/chromevox/BUILD.gn b/chrome/browser/resources/chromeos/chromevox/BUILD.gn index 5f75f2aaf29cc9..6e5018a8af0b6a 100644 --- a/chrome/browser/resources/chromeos/chromevox/BUILD.gn +++ b/chrome/browser/resources/chromeos/chromevox/BUILD.gn @@ -4,6 +4,7 @@ import("//build/config/features.gni") import("//chrome/common/features.gni") +import("//components/nacl/features.gni") import("//testing/test.gni") import("//chrome/test/base/js2gtest.gni") import("run_jsbundler.gni") diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 71237423efd697..1b544a19963a37 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -8,6 +8,7 @@ import("//build/config/features.gni") import("//build/config/ui.gni") import("//build/split_static_library.gni") import("//chrome/common/features.gni") +import("//components/nacl/features.gni") import("//components/signin/features.gni") import("//extensions/features/features.gni") import("//media/media_options.gni") diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index 06d2042198f7ba..81e5011dfa497c 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn @@ -6,6 +6,7 @@ import("//build/buildflag_header.gni") import("//build/util/process_version.gni") import("//chrome/common/features.gni") import("//chrome/process_version_rc_template.gni") # For branding_file_path. +import("//components/nacl/features.gni") import("//extensions/features/features.gni") import("//media/media_options.gni") import("//mojo/public/tools/bindings/mojom.gni") diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn index af7487edcb2817..ca0178e32432e5 100644 --- a/chrome/installer/linux/BUILD.gn +++ b/chrome/installer/linux/BUILD.gn @@ -10,6 +10,7 @@ import("//build/config/sysroot.gni") import("//build/util/process_version.gni") import("//build/util/version.gni") import("//chrome/process_version_rc_template.gni") # For branding_file_path. +import("//components/nacl/features.gni") if (current_cpu == "x86" || current_cpu == "x64") { import("//media/cdm/ppapi/cdm_paths.gni") diff --git a/chrome/installer/mini_installer/BUILD.gn b/chrome/installer/mini_installer/BUILD.gn index d8249e611034aa..cc3782f4a91da5 100644 --- a/chrome/installer/mini_installer/BUILD.gn +++ b/chrome/installer/mini_installer/BUILD.gn @@ -7,6 +7,7 @@ import("//build/config/features.gni") import("//build/config/ui.gni") import("//chrome/process_version_rc_template.gni") import("//chrome/test/mini_installer/mini_installer_test.gni") +import("//components/nacl/features.gni") import("//third_party/icu/config.gni") import("//ui/base/ui_features.gni") import("//v8/gni/v8.gni") diff --git a/chrome/renderer/BUILD.gn b/chrome/renderer/BUILD.gn index d3a748f660f023..f211e8165a7fdf 100644 --- a/chrome/renderer/BUILD.gn +++ b/chrome/renderer/BUILD.gn @@ -4,6 +4,7 @@ import("//build/config/features.gni") import("//chrome/common/features.gni") +import("//components/nacl/features.gni") import("//components/spellcheck/spellcheck_build_features.gni") import("//extensions/features/features.gni") import("//media/media_options.gni") diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 4f6bafd528c5e3..40c15e3ae8d69a 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn @@ -10,6 +10,7 @@ import("//build/config/ui.gni") import("//chrome/common/features.gni") import("//chrome/chrome_repack_locales.gni") import("//components/feature_engagement/features.gni") +import("//components/nacl/features.gni") import("//components/offline_pages/features/features.gni") import("//components/os_crypt/features.gni") import("//components/signin/features.gni") diff --git a/chrome/test/data/nacl/BUILD.gn b/chrome/test/data/nacl/BUILD.gn index 4a46affe24d809..ed8057c9781337 100644 --- a/chrome/test/data/nacl/BUILD.gn +++ b/chrome/test/data/nacl/BUILD.gn @@ -5,6 +5,7 @@ import("//build/config/compiler/compiler.gni") import("//build/config/features.gni") import("//build/config/nacl/config.gni") +import("//components/nacl/features.gni") import("//ppapi/native_client/nacl_test_data.gni") group("nacl") { diff --git a/components/BUILD.gn b/components/BUILD.gn index fedaff577164de..19929894ea0fc0 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -5,6 +5,7 @@ import("//build/config/chrome_build.gni") import("//build/config/features.gni") import("//build/config/ui.gni") +import("//components/nacl/features.gni") import("//printing/features/features.gni") import("//rlz/features/features.gni") import("//testing/test.gni") diff --git a/components/nacl/broker/BUILD.gn b/components/nacl/broker/BUILD.gn index 925060a0261a2d..e86f9729344035 100644 --- a/components/nacl/broker/BUILD.gn +++ b/components/nacl/broker/BUILD.gn @@ -2,8 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/features.gni") import("//build/config/compiler/compiler.gni") +import("//components/nacl/features.gni") import("//services/service_manager/public/service_manifest.gni") # This file builds nacl64.exe, which is a 64-bit x86 Windows executable diff --git a/components/nacl/browser/BUILD.gn b/components/nacl/browser/BUILD.gn index 08e4a05f13cc31..a10c599561488e 100644 --- a/components/nacl/browser/BUILD.gn +++ b/components/nacl/browser/BUILD.gn @@ -2,7 +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/features.gni") +import("//components/nacl/features.gni") assert(enable_nacl) diff --git a/components/nacl/common/BUILD.gn b/components/nacl/common/BUILD.gn index 8840bf9cf40233..bc1656352a9e65 100644 --- a/components/nacl/common/BUILD.gn +++ b/components/nacl/common/BUILD.gn @@ -3,7 +3,7 @@ # found in the LICENSE file. import("//build/buildflag_header.gni") -import("//build/config/features.gni") +import("//components/nacl/features.gni") import("//mojo/public/tools/bindings/mojom.gni") if (enable_nacl) { diff --git a/components/nacl/features.gni b/components/nacl/features.gni new file mode 100644 index 00000000000000..de172b4d73c510 --- /dev/null +++ b/components/nacl/features.gni @@ -0,0 +1,17 @@ +# Copyright 2017 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/chromecast_build.gni") + +declare_args() { + # Enables Native Client support. + # Temporarily disable nacl on arm64 linux to get rid of compilation errors. + # TODO: When mipsel-nacl-clang is available, drop the exclusion. + enable_nacl = !is_ios && !is_android && !is_fuchsia && !is_chromecast && + current_cpu != "mipsel" && current_cpu != "mips64el" && + !(is_linux && target_cpu == "arm64") + + # Non-SFI is not yet supported on mipsel + enable_nacl_nonsfi = current_cpu != "mipsel" && current_cpu != "mips64el" +} diff --git a/components/nacl/loader/BUILD.gn b/components/nacl/loader/BUILD.gn index 974939bee617cd..db67c535c1cff1 100644 --- a/components/nacl/loader/BUILD.gn +++ b/components/nacl/loader/BUILD.gn @@ -2,8 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/features.gni") import("//build/config/nacl/config.gni") +import("//components/nacl/features.gni") import("//services/service_manager/public/service_manifest.gni") import("//testing/test.gni") diff --git a/components/nacl/loader/sandbox_linux/BUILD.gn b/components/nacl/loader/sandbox_linux/BUILD.gn index 96dc1dbdcec8ee..f3a0f4d4366a99 100644 --- a/components/nacl/loader/sandbox_linux/BUILD.gn +++ b/components/nacl/loader/sandbox_linux/BUILD.gn @@ -2,8 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/features.gni") import("//build/config/ui.gni") +import("//components/nacl/features.gni") assert(is_linux) assert(enable_nacl) diff --git a/components/nacl/renderer/BUILD.gn b/components/nacl/renderer/BUILD.gn index 065ca4fac5d50c..1b41d6b9f05a78 100644 --- a/components/nacl/renderer/BUILD.gn +++ b/components/nacl/renderer/BUILD.gn @@ -2,7 +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/features.gni") +import("//components/nacl/features.gni") assert(enable_nacl) diff --git a/extensions/common/BUILD.gn b/extensions/common/BUILD.gn index 52ecdc9d442950..a46a85f47969f0 100644 --- a/extensions/common/BUILD.gn +++ b/extensions/common/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/features.gni") +import("//components/nacl/features.gni") import("//extensions/features/features.gni") import("//mojo/public/tools/bindings/mojom.gni") diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn index 08feb0836cb2d9..b7bc6f50a86192 100644 --- a/extensions/shell/BUILD.gn +++ b/extensions/shell/BUILD.gn @@ -5,6 +5,7 @@ import("//build/config/features.gni") import("//build/config/ui.gni") import("//build/util/process_version.gni") +import("//components/nacl/features.gni") import("//extensions/features/features.gni") import("//testing/test.gni") import("//tools/grit/grit_rule.gni") diff --git a/extensions/shell/installer/linux/BUILD.gn b/extensions/shell/installer/linux/BUILD.gn index f73353fd45fe48..748dafcc2cfcab 100644 --- a/extensions/shell/installer/linux/BUILD.gn +++ b/extensions/shell/installer/linux/BUILD.gn @@ -11,6 +11,7 @@ import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sysroot.gni") import("//build/util/version.gni") import("//chrome/process_version_rc_template.gni") # For branding_file_path. +import("//components/nacl/features.gni") import("//extensions/features/features.gni") assert(is_desktop_linux) diff --git a/mash/BUILD.gn b/mash/BUILD.gn index cbbfaa2c81f988..f2c43c5b4bc4d3 100644 --- a/mash/BUILD.gn +++ b/mash/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/nacl/config.gni") +import("//components/nacl/features.gni") import("//services/catalog/public/tools/catalog.gni") import("//services/service_manager/public/service_manifest.gni") import("//testing/test.gni") diff --git a/native_client_sdk/src/BUILD.gn b/native_client_sdk/src/BUILD.gn index 5c9fa121509aad..ff31576b83f55f 100644 --- a/native_client_sdk/src/BUILD.gn +++ b/native_client_sdk/src/BUILD.gn @@ -2,7 +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/features.gni") +import("//components/nacl/features.gni") declare_args() { # Set to true if cross compiling trusted (e.g. building sel_ldr_arm on x86) diff --git a/ppapi/BUILD.gn b/ppapi/BUILD.gn index 0f11d0acd0b8c3..cf28f25b06b9d1 100644 --- a/ppapi/BUILD.gn +++ b/ppapi/BUILD.gn @@ -5,6 +5,7 @@ import("//build/config/features.gni") import("//build/config/nacl/config.gni") import("//build/config/nacl/rules.gni") +import("//components/nacl/features.gni") import("//ppapi/features/features.gni") import("//testing/test.gni") if (is_mac) { diff --git a/ppapi/native_client/nacl_test_data.gni b/ppapi/native_client/nacl_test_data.gni index 823b732e0a8b65..4bf1b90b471975 100644 --- a/ppapi/native_client/nacl_test_data.gni +++ b/ppapi/native_client/nacl_test_data.gni @@ -2,7 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/nacl/config.gni") import("//build/config/nacl/rules.gni") +import("//components/nacl/features.gni") assert(enable_nacl) diff --git a/ppapi/native_client/src/untrusted/pnacl_support_extension/BUILD.gn b/ppapi/native_client/src/untrusted/pnacl_support_extension/BUILD.gn index f81896e891adcc..a4ee2076e56fcd 100644 --- a/ppapi/native_client/src/untrusted/pnacl_support_extension/BUILD.gn +++ b/ppapi/native_client/src/untrusted/pnacl_support_extension/BUILD.gn @@ -2,141 +2,141 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/features.gni") - -if (enable_nacl) { - # This target copies files from the prebuilt/DEPS'ed in pnacl_translator - # toolchain and copies the latest PNaCl IRT shim library. - # We could use 'copies', but we want to rename the files in a white-listed - # way first. Thus use an action. - action("pnacl_support_extension") { - script = "pnacl_component_crx_gen.py" - inputs = [ - "//native_client/build/package_version/package_version.py", - "//native_client/pnacl/driver/pnacl_info_template.json", - "//native_client/toolchain_revisions/pnacl_translator.json", - ] - shim_target_label = - "//ppapi/native_client/src/untrusted/pnacl_irt_shim:browser" - src_shim_name = "libpnacl_irt_shim_browser.a" - desired_shim_name = "libpnacl_irt_shim.a" - - # Use the IRT toolchain to build the shim. We want similar properties - # (x86-64 sandbox base address hiding). One thing we don't want is the - # IRT's secondary TLS, but that is handled by tls_edit and not compiler - # flags (so IRT compiler flags should be fine). - shim_toolchain_base = "//build/toolchain/nacl:irt_" - - shim_target_tc_label = "$shim_target_label($shim_toolchain_base$target_cpu)" - deps = [ - shim_target_tc_label, - ] - shim_cpu = target_cpu +import("//components/nacl/features.gni") + +assert(enable_nacl) + +# This target copies files from the prebuilt/DEPS'ed in pnacl_translator +# toolchain and copies the latest PNaCl IRT shim library. +# We could use 'copies', but we want to rename the files in a white-listed +# way first. Thus use an action. +action("pnacl_support_extension") { + script = "pnacl_component_crx_gen.py" + inputs = [ + "//native_client/build/package_version/package_version.py", + "//native_client/pnacl/driver/pnacl_info_template.json", + "//native_client/toolchain_revisions/pnacl_translator.json", + ] + shim_target_label = + "//ppapi/native_client/src/untrusted/pnacl_irt_shim:browser" + src_shim_name = "libpnacl_irt_shim_browser.a" + desired_shim_name = "libpnacl_irt_shim.a" + + # Use the IRT toolchain to build the shim. We want similar properties + # (x86-64 sandbox base address hiding). One thing we don't want is the + # IRT's secondary TLS, but that is handled by tls_edit and not compiler + # flags (so IRT compiler flags should be fine). + shim_toolchain_base = "//build/toolchain/nacl:irt_" + + shim_target_tc_label = "$shim_target_label($shim_toolchain_base$target_cpu)" + deps = [ + shim_target_tc_label, + ] + shim_cpu = target_cpu + + output_prefix = "$root_out_dir/pnacl/pnacl_public_" + outputs = [ + "${output_prefix}pnacl_json", + ] + + # Files that will be copied from the toolchain to output. + outputs_from_toolchain = [ + "crtbegin_o", + "crtend_o", + "ld_nexe", + "libcrt_platform_a", + "libgcc_a", + "libpnacl_irt_shim_a", + "pnacl_llc_nexe", + "pnacl_sz_nexe", + ] + + if (target_cpu == "arm") { + output_cpu = "arm" + } else if (target_cpu == "mipsel") { + output_cpu = "mips32" + } else if (target_cpu == "x64") { + output_cpu = "x86_64" + } else if (target_cpu == "x86") { + output_cpu = "x86_32" + } else { + assert(false, "unhandled target_cpu") + } - output_prefix = "$root_out_dir/pnacl/pnacl_public_" - outputs = [ - "${output_prefix}pnacl_json", - ] + foreach(output_elem, outputs_from_toolchain) { + outputs += [ output_prefix + output_cpu + "_" + output_elem ] + } - # Files that will be copied from the toolchain to output. - outputs_from_toolchain = [ - "crtbegin_o", - "crtend_o", - "ld_nexe", - "libcrt_platform_a", - "libgcc_a", - "libpnacl_irt_shim_a", - "pnacl_llc_nexe", - "pnacl_sz_nexe", - ] + shim_lib_path = + rebase_path(get_label_info(shim_target_tc_label, "target_out_dir") + + "/$src_shim_name", + root_build_dir) - if (target_cpu == "arm") { - output_cpu = "arm" - } else if (target_cpu == "mipsel") { - output_cpu = "mips32" - } else if (target_cpu == "x64") { - output_cpu = "x86_64" - } else if (target_cpu == "x86") { - output_cpu = "x86_32" - } else { - assert(false, "unhandled target_cpu") - } + # This describes the irt shim library for the main architecture. + # On Windows x86, another switch will be added to this below. + lib_overrides = [ + "--lib_override", + "$shim_cpu,$shim_lib_path,$desired_shim_name", + ] - foreach(output_elem, outputs_from_toolchain) { - outputs += [ output_prefix + output_cpu + "_" + output_elem ] - } + if (is_win && target_cpu == "x86") { + # On Windows, for offline testing (i.e., without component updater + # selecting the platform-specific files with multi-CRXes), we need + # to stage both x86-32 and x86-64 (because 32-bit chrome on 64-bit + # windows will need 64-bit nexes). + + shim_target_tc_label = "$shim_target_label(${shim_toolchain_base}x64)" + shim_cpu = "x64" shim_lib_path = rebase_path(get_label_info(shim_target_tc_label, "target_out_dir") + "/$src_shim_name", root_build_dir) - # This describes the irt shim library for the main architecture. - # On Windows x86, another switch will be added to this below. - lib_overrides = [ + # Pass a second --lib_override for the second architecture. + lib_overrides += [ "--lib_override", "$shim_cpu,$shim_lib_path,$desired_shim_name", ] - if (is_win && target_cpu == "x86") { - # On Windows, for offline testing (i.e., without component updater - # selecting the platform-specific files with multi-CRXes), we need - # to stage both x86-32 and x86-64 (because 32-bit chrome on 64-bit - # windows will need 64-bit nexes). + deps += [ shim_target_tc_label ] - shim_target_tc_label = "$shim_target_label(${shim_toolchain_base}x64)" - shim_cpu = "x64" - - shim_lib_path = - rebase_path(get_label_info(shim_target_tc_label, "target_out_dir") + - "/$src_shim_name", - root_build_dir) - - # Pass a second --lib_override for the second architecture. - lib_overrides += [ - "--lib_override", - "$shim_cpu,$shim_lib_path,$desired_shim_name", - ] - - deps += [ shim_target_tc_label ] - - foreach(output_elem, outputs_from_toolchain) { - outputs += [ output_prefix + "x86_64_" + output_elem ] - } + foreach(output_elem, outputs_from_toolchain) { + outputs += [ output_prefix + "x86_64_" + output_elem ] } + } - if (current_os == "chromeos") { - toolchain_os = "linux" - } else { - toolchain_os = current_os - } + if (current_os == "chromeos") { + toolchain_os = "linux" + } else { + toolchain_os = current_os + } - args = lib_overrides - args += [ - "--dest", - rebase_path("$root_out_dir/pnacl", root_build_dir), + args = lib_overrides + args += [ + "--dest", + rebase_path("$root_out_dir/pnacl", root_build_dir), - "--target_arch", - target_cpu, + "--target_arch", + target_cpu, - "--info_template_path", - rebase_path("//native_client/pnacl/driver/pnacl_info_template.json", - root_build_dir), + "--info_template_path", + rebase_path("//native_client/pnacl/driver/pnacl_info_template.json", + root_build_dir), - "--pnacl_translator_path", - rebase_path( - "//native_client/toolchain/${toolchain_os}_x86/pnacl_translator", - root_build_dir), + "--pnacl_translator_path", + rebase_path( + "//native_client/toolchain/${toolchain_os}_x86/pnacl_translator", + root_build_dir), - "--package_version_path", - rebase_path("//native_client/build/package_version/package_version.py", - root_build_dir), + "--package_version_path", + rebase_path("//native_client/build/package_version/package_version.py", + root_build_dir), - "--pnacl_package_name", - "pnacl_translator", + "--pnacl_package_name", + "pnacl_translator", - # ABI Version Number - "1", - ] - } + # ABI Version Number + "1", + ] } diff --git a/ppapi/tests/extensions/BUILD.gn b/ppapi/tests/extensions/BUILD.gn index b8363ab28bbc0b..83017579d9240e 100644 --- a/ppapi/tests/extensions/BUILD.gn +++ b/ppapi/tests/extensions/BUILD.gn @@ -2,8 +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/features.gni") -import("//build/config/nacl/config.gni") +import("//components/nacl/features.gni") import("//ppapi/native_client/nacl_test_data.gni") group("extensions") { diff --git a/remoting/BUILD.gn b/remoting/BUILD.gn index 8c908582a3b4d7..a0bd29588203c6 100644 --- a/remoting/BUILD.gn +++ b/remoting/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("//components/nacl/features.gni") import("//media/media_options.gni") import("//remoting/build/config/remoting_build.gni") diff --git a/remoting/client/plugin/BUILD.gn b/remoting/client/plugin/BUILD.gn index 763a7450d4e834..a2aa05c658269a 100644 --- a/remoting/client/plugin/BUILD.gn +++ b/remoting/client/plugin/BUILD.gn @@ -2,6 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//components/nacl/features.gni") +assert(enable_nacl) + assert(is_nacl, "These targets must only be built using the untrusted NaCl toolchains.") diff --git a/remoting/tools/BUILD.gn b/remoting/tools/BUILD.gn index 67f76533a96b26..14c3ff46ef9f77 100644 --- a/remoting/tools/BUILD.gn +++ b/remoting/tools/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("//components/nacl/features.gni") import("//remoting/build/config/remoting_build.gni") group("all_tests") { diff --git a/remoting/tools/javascript_key_tester/BUILD.gn b/remoting/tools/javascript_key_tester/BUILD.gn index 3fea7683921137..02bd63d7bc5231 100644 --- a/remoting/tools/javascript_key_tester/BUILD.gn +++ b/remoting/tools/javascript_key_tester/BUILD.gn @@ -2,47 +2,47 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/features.gni") +import("//components/nacl/features.gni") -if (enable_nacl) { - group("javascript_key_tester") { - deps = [ - ":javascript_key_tester_copies", - ] - } +assert(enable_nacl) - copy("javascript_key_tester_copies") { - pexe_dir = get_label_info( - "pnacl:remoting_key_tester_newlib(//build/toolchain/nacl:newlib_pnacl)", - "root_out_dir") - - sources = [ - "$pexe_dir/remoting_key_tester_newlib.pexe", - "background.js", - "chord_tracker.js", - "event_listeners.js", - "icon_128.png", - "main.css", - "main.html", - "main.js", - "manifest.json", - "pnacl/remoting_key_tester.nmf", - ] - - outputs = [ - "$target_out_dir/remoting/key_tester/{{source_file_part}}", - ] - - deps = [ - ":javascript_key_tester_jscompile", - "pnacl:remoting_key_tester_newlib(//build/toolchain/nacl:newlib_pnacl)", - ] - } +group("javascript_key_tester") { + deps = [ + ":javascript_key_tester_copies", + ] +} + +copy("javascript_key_tester_copies") { + pexe_dir = get_label_info( + "pnacl:remoting_key_tester_newlib(//build/toolchain/nacl:newlib_pnacl)", + "root_out_dir") + + sources = [ + "$pexe_dir/remoting_key_tester_newlib.pexe", + "background.js", + "chord_tracker.js", + "event_listeners.js", + "icon_128.png", + "main.css", + "main.html", + "main.js", + "manifest.json", + "pnacl/remoting_key_tester.nmf", + ] + + outputs = [ + "$target_out_dir/remoting/key_tester/{{source_file_part}}", + ] + + deps = [ + ":javascript_key_tester_jscompile", + "pnacl:remoting_key_tester_newlib(//build/toolchain/nacl:newlib_pnacl)", + ] +} - group("javascript_key_tester_jscompile") { - # TODO(GYP): crbug.com/471926 add support for run_jscompile=true. - run_jscompile = false - if (run_jscompile) { - } +group("javascript_key_tester_jscompile") { + # TODO(GYP): crbug.com/471926 add support for run_jscompile=true. + run_jscompile = false + if (run_jscompile) { } } diff --git a/remoting/webapp/build_template.gni b/remoting/webapp/build_template.gni index 28b4c91b18f51a..3e430b03af4419 100644 --- a/remoting/webapp/build_template.gni +++ b/remoting/webapp/build_template.gni @@ -7,6 +7,7 @@ import("//build/config/chrome_build.gni") import("//build/config/features.gni") import("//build/util/version.gni") +import("//components/nacl/features.gni") import("//remoting/remoting_enable.gni") import("//remoting/remoting_locales.gni") import("//remoting/remoting_options.gni") diff --git a/tools/ipc_fuzzer/message_lib/BUILD.gn b/tools/ipc_fuzzer/message_lib/BUILD.gn index a947294e01cfd6..ce870ac4ef9026 100644 --- a/tools/ipc_fuzzer/message_lib/BUILD.gn +++ b/tools/ipc_fuzzer/message_lib/BUILD.gn @@ -2,7 +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/features.gni") +import("//components/nacl/features.gni") import("//remoting/remoting_enable.gni") static_library("ipc_message_lib") {