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

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: 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') | ppapi/BUILD.gn » ('J')
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..e0127531016df1933cce6d1ed50498d61143518d
--- /dev/null
+++ b/build/config/nacl/rules.gni
@@ -0,0 +1,101 @@
+# 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")
+
+template("generate_nmf") {
brettw 2015/11/11 21:20:12 All templates should have comments at the top list
Petr Hosek 2015/11/11 23:35:03 Done.
+ assert(defined(invoker.executable), "Must define executable")
+ assert(defined(invoker.nmf), "Must define nmf")
+ objdump = rebase_path("${nacl_toolprefix}objdump")
brettw 2015/11/11 21:20:12 You only use this once, so I'd just inline the reb
Petr Hosek 2015/11/11 23:35:03 Done.
+
+ action(target_name) {
+ forward_variables_from(invoker,
+ [
+ "deps",
+ "data_deps",
+ "executable",
+ "nmf",
+ "nmfflags",
+ "public_deps",
+ "testonly",
+ ])
+
+ script = "//native_client_sdk/src/tools/create_nmf.py"
+ sources = [
+ executable,
+ ]
+ outputs = [
+ nmf,
+ ]
+ args = [
+ "--no-default-libpath",
+ "--objdump=" + objdump,
+ "--output=" + rebase_path(nmf, root_build_dir),
+ ]
+ if (is_nacl_glibc) {
+ args += [ "--library-path=" + rebase_path(root_out_dir) ]
Roland McGrath 2015/11/11 21:44:31 Maybe the library path dir should be listed in inp
brettw 2015/11/11 22:32:56 You can't list directories as inputs, only files.
Petr Hosek 2015/11/11 23:35:03 I could remove this and it'll be up to the invoker
+ if (current_cpu == "x86") {
+ args += [ "--library-path=" +
+ rebase_path("${nacl_toolchain_tooldir}/lib32") ]
+ data = [
+ "$root_build_dir/lib32/",
brettw 2015/11/11 21:20:12 It seems surprising to me that depending on a sing
Petr Hosek 2015/11/11 23:35:03 That's intentional because those are two different
brettw 2015/11/12 17:40:58 Okay, I guess the analogy would be that normal pro
+ ]
+ } else if (target_cpu == "x64" || (target_cpu == "x86" && is_win)) {
brettw 2015/11/11 21:20:12 I'm confused by these conditions. The first if tes
Roland McGrath 2015/11/11 21:44:32 Why is Windows special? If this is the proper con
Petr Hosek 2015/11/11 23:35:03 This is taken from GYP and I haven't found any com
+ args +=
+ [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ]
+ data = [
+ "$root_build_dir/lib64/",
+ ]
+ } else if (current_cpu == "arm") {
Roland McGrath 2015/11/11 21:44:31 Just make this the default 'else' unless you are g
Petr Hosek 2015/11/11 23:35:03 Done.
+ args +=
+ [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ]
+ data = [
+ "$root_build_dir/lib/",
+ ]
+ }
+ }
+ args += nmfflags + rebase_path(sources, root_build_dir)
+ if (is_nacl_glibc && current_cpu == "arm") {
+ deps += [ "//native_client/src/untrusted/elf_loader:elf_loader" ]
+ }
+ }
+}
+
+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,
+ ]
+ if (target_cpu == "x86") {
+ arch = "x86-32"
+ } else if (target_cpu == "x64") {
+ arch = "x86-64"
+ } else if (target_cpu == "arm") {
Roland McGrath 2015/11/11 21:44:32 This can just default to arch = current_cpu. All o
Petr Hosek 2015/11/11 23:35:03 Done.
Petr Hosek 2015/11/13 00:37:38 Actually, in this case we really want target_cpu a
+ arch = "arm"
+ }
+ 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') | ppapi/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698