Skip to content

Commit

Permalink
Move "enable_nacl" out of //build/config/features.gni.
Browse files Browse the repository at this point in the history
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 <dpranke@chromium.org>
Reviewed-by: Paweł Hajdan Jr. <phajdan.jr@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505188}
  • Loading branch information
dpranke authored and Commit Bot committed Sep 28, 2017
1 parent 6edcc5f commit ccc0c36
Show file tree
Hide file tree
Showing 41 changed files with 242 additions and 206 deletions.
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 0 additions & 10 deletions build/config/features.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
67 changes: 35 additions & 32 deletions build/config/nacl/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 0 additions & 1 deletion build/config/nacl/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/app/mash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
1 change: 1 addition & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/nacl_host/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/resources/chromeos/chromevox/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/installer/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/installer/mini_installer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions chrome/test/data/nacl/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
1 change: 1 addition & 0 deletions components/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion components/nacl/broker/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/nacl/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion components/nacl/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
17 changes: 17 additions & 0 deletions components/nacl/features.gni
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion components/nacl/loader/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion components/nacl/loader/sandbox_linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion components/nacl/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions extensions/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
1 change: 1 addition & 0 deletions extensions/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions extensions/shell/installer/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions mash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion native_client_sdk/src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions ppapi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions ppapi/native_client/nacl_test_data.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading

0 comments on commit ccc0c36

Please sign in to comment.