Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Unified Diff: build/config/nacl/rules.gni

Issue 1432313002: Factor out nmf generation into a GN template (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address remaining feedback Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/nacl/rules.gni
diff --git a/build/config/nacl/rules.gni b/build/config/nacl/rules.gni
new file mode 100644
index 0000000000000000000000000000000000000000..8e93b6a1863798961449090b73ab2279696ca5a3
--- /dev/null
+++ b/build/config/nacl/rules.gni
@@ -0,0 +1,139 @@
+# Copyright 2015 The Native Client 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/features.gni")
+import("//build/config/nacl/config.gni")
+
+# Generate a nmf file
+#
+# Native Client Manifest (nmf) is a JSON file that tells the browser where to
+# download and load Native Client application files and libraries.
+#
+# Variables:
+# executables: .nexe/.pexe/.bc executables to generate nmf for
+# lib_prefix: path to prepend to shared libraries in the nmf
+# nmf: the name and the path of the output file
+# nmfflags: additional flags for the nmf generator
+# stage_dependencies: directory for staging libraries
+template("generate_nmf") {
+ assert(defined(invoker.executables), "Must define executables")
+ assert(defined(invoker.nmf), "Must define nmf")
+
+ action(target_name) {
+ nmfflags = []
+
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "data_deps",
+ "executables",
+ "lib_prefix",
+ "nmf",
+ "nmfflags",
+ "public_deps",
+ "stage_dependencies",
+ "testonly",
+ ])
+
+ script = "//native_client_sdk/src/tools/create_nmf.py"
+ sources = executables
+ outputs = [
+ nmf,
+ ]
+ if (is_nacl_glibc) {
+ if (defined(stage_dependencies)) {
+ nmfflags += [ "--stage-dependencies=" +
+ rebase_path(stage_dependencies, root_build_dir) ]
+ lib_path = stage_dependencies
+ } else {
+ lib_path = root_build_dir
+ }
+ if (defined(lib_prefix)) {
+ nmfflags += [ "--lib-prefix=" + lib_prefix ]
+ lib_path += "/${lib_prefix}"
+ }
+
+ # NOTE: There is no explicit dependency for the lib32
+ # and lib64 directories created in the product directory.
+ # They are created as a side-effect of nmf creation.
+ nmfflags += [ "--library-path=" + rebase_path(root_out_dir) ]
+ if (current_cpu == "x86") {
+ nmfflags += [ "--library-path=" +
+ rebase_path("${nacl_toolchain_tooldir}/lib32") ]
+ data = [
+ "${lib_path}/lib32/",
+ ]
+ } else if (current_cpu == "x64") {
+ nmfflags +=
+ [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ]
+ data = [
+ "${lib_path}/lib64/",
+ ]
+ } else {
+ nmfflags +=
+ [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ]
+ data = [
+ "${lib_path}/lib/",
+ ]
+ }
+ }
+ args = [
+ "--no-default-libpath",
+ "--objdump=" + rebase_path("${nacl_toolprefix}objdump"),
+ "--output=" + rebase_path(nmf, root_build_dir),
+ ] + nmfflags + rebase_path(sources, root_build_dir)
+ if (is_nacl_glibc && current_cpu == "arm") {
+ deps += [ "//native_client/src/untrusted/elf_loader:elf_loader" ]
+ }
+ }
+}
+
+# Generate a nmf file for Non-SFI tests
+#
+# Non-SFI tests use a different manifest format from regular Native Client and
+# as such requires a different generator.
+#
+# Variables:
+# executable: Non-SFI .nexe executable to generate nmf for
+# nmf: the name and the path of the output file
+template("generate_nonsfi_test_nmf") {
+ assert(defined(invoker.executable), "Must define executable")
+ assert(defined(invoker.nmf), "Must define nmf")
+
+ action(target_name) {
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "data_deps",
+ "executable",
+ "nmf",
+ "testonly",
+ "public_deps",
+ ])
+
+ script = "//ppapi/tests/create_nonsfi_test_nmf.py"
+ sources = [
+ executable,
+ ]
+ outputs = [
+ nmf,
+ ]
+
+ # NOTE: We use target_cpu rather than current_cpu on purpose because
+ # current_cpu is always going to be pnacl for Non-SFI, but the Non-SFI
+ # .nexe executable is always translated to run on the target machine.
+ if (target_cpu == "x86") {
+ arch = "x86-32"
+ } else if (target_cpu == "x64") {
+ arch = "x86-64"
+ } else {
+ arch = target_cpu
+ }
+ args = [
+ "--program=" + rebase_path(executable, root_build_dir),
+ "--arch=${arch}",
+ "--output=" + rebase_path(nmf, root_build_dir),
+ ]
+ }
+}
« no previous file with comments | « no previous file | ppapi/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698