OLD | NEW |
1 # Copyright 2015 The Native Client Authors. All rights reserved. | 1 # Copyright 2015 The Native Client Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/features.gni") | 5 import("//build/config/features.gni") |
6 import("//build/config/nacl/config.gni") | 6 import("//build/config/nacl/config.gni") |
7 | 7 |
8 # Generate a nmf file | 8 # Generate a nmf file |
9 # | 9 # |
10 # Native Client Manifest (nmf) is a JSON file that tells the browser where to | 10 # Native Client Manifest (nmf) is a JSON file that tells the browser where to |
11 # download and load Native Client application files and libraries. | 11 # download and load Native Client application files and libraries. |
12 # | 12 # |
13 # Variables: | 13 # Variables: |
14 # executables: .nexe/.pexe/.bc executables to generate nmf for | 14 # executables: .nexe/.pexe/.bc executables to generate nmf for |
15 # lib_prefix: path to prepend to shared libraries in the nmf | 15 # lib_prefix: path to prepend to shared libraries in the nmf |
16 # nmf: the name and the path of the output file | 16 # nmf: the name and the path of the output file |
17 # nmfflags: additional flags for the nmf generator | 17 # nmfflags: additional flags for the nmf generator |
18 # stage_dependencies: directory for staging libraries | 18 # stage_dependencies: directory for staging libraries |
19 template("generate_nmf") { | 19 template("generate_nmf") { |
20 assert(defined(invoker.executables), "Must define executables") | 20 assert(defined(invoker.executables), "Must define executables") |
21 assert(defined(invoker.nmf), "Must define nmf") | 21 assert(defined(invoker.nmf), "Must define nmf") |
22 | 22 |
23 action(target_name) { | 23 action(target_name) { |
24 nmfflags = [] | |
25 | |
26 forward_variables_from(invoker, | 24 forward_variables_from(invoker, |
27 [ | 25 [ |
28 "deps", | 26 "deps", |
29 "data_deps", | 27 "data_deps", |
30 "executables", | 28 "executables", |
31 "lib_prefix", | 29 "lib_prefix", |
32 "nmf", | 30 "nmf", |
33 "nmfflags", | 31 "nmfflags", |
34 "public_deps", | 32 "public_deps", |
35 "stage_dependencies", | 33 "stage_dependencies", |
36 "testonly", | 34 "testonly", |
37 "visibility", | 35 "visibility", |
38 ]) | 36 ]) |
| 37 if (!defined(nmfflags)) { |
| 38 nmfflags = [] |
| 39 } |
39 | 40 |
40 # TODO(phosek): Remove this conditional once | 41 # TODO(phosek): Remove this conditional once |
41 # https://bugs.chromium.org/p/nativeclient/issues/detail?id=4339 is | 42 # https://bugs.chromium.org/p/nativeclient/issues/detail?id=4339 is |
42 # resolved. | 43 # resolved. |
43 if (current_cpu == "pnacl") { | 44 if (current_cpu == "pnacl") { |
44 objdump = rebase_path("${nacl_toolchain_bindir}/x86_64-nacl-objdump") | 45 objdump = rebase_path("${nacl_toolchain_bindir}/x86_64-nacl-objdump") |
45 } else { | 46 } else { |
46 objdump = rebase_path("${nacl_toolprefix}objdump") | 47 objdump = rebase_path("${nacl_toolprefix}objdump") |
47 } | 48 } |
48 if (host_os == "win") { | 49 if (host_os == "win") { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 # | 113 # |
113 # Variables: | 114 # Variables: |
114 # executable: Non-SFI .nexe executable to generate nmf for | 115 # executable: Non-SFI .nexe executable to generate nmf for |
115 # nmf: the name and the path of the output file | 116 # nmf: the name and the path of the output file |
116 # nmfflags: additional flags for the nmf generator | 117 # nmfflags: additional flags for the nmf generator |
117 template("generate_nonsfi_test_nmf") { | 118 template("generate_nonsfi_test_nmf") { |
118 assert(defined(invoker.executable), "Must define executable") | 119 assert(defined(invoker.executable), "Must define executable") |
119 assert(defined(invoker.nmf), "Must define nmf") | 120 assert(defined(invoker.nmf), "Must define nmf") |
120 | 121 |
121 action(target_name) { | 122 action(target_name) { |
122 nmfflags = [] | |
123 | |
124 forward_variables_from(invoker, | 123 forward_variables_from(invoker, |
125 [ | 124 [ |
126 "deps", | 125 "deps", |
127 "data_deps", | 126 "data_deps", |
128 "executable", | 127 "executable", |
129 "nmf", | 128 "nmf", |
130 "nmfflags", | |
131 "testonly", | 129 "testonly", |
132 "public_deps", | 130 "public_deps", |
133 "visibility", | 131 "visibility", |
134 ]) | 132 ]) |
135 | 133 |
136 script = "//ppapi/tests/create_nonsfi_test_nmf.py" | 134 script = "//ppapi/tests/create_nonsfi_test_nmf.py" |
137 sources = [ | 135 sources = [ |
138 executable, | 136 executable, |
139 ] | 137 ] |
140 outputs = [ | 138 outputs = [ |
141 nmf, | 139 nmf, |
142 ] | 140 ] |
143 | 141 |
144 # NOTE: We use target_cpu rather than current_cpu on purpose because | 142 # NOTE: We use target_cpu rather than current_cpu on purpose because |
145 # current_cpu is always going to be pnacl for Non-SFI, but the Non-SFI | 143 # current_cpu is always going to be pnacl for Non-SFI, but the Non-SFI |
146 # .nexe executable is always translated to run on the target machine. | 144 # .nexe executable is always translated to run on the target machine. |
147 if (target_cpu == "x86") { | 145 if (target_cpu == "x86") { |
148 arch = "x86-32" | 146 arch = "x86-32" |
149 } else if (target_cpu == "x64") { | 147 } else if (target_cpu == "x64") { |
150 arch = "x86-64" | 148 arch = "x86-64" |
151 } else { | 149 } else { |
152 arch = target_cpu | 150 arch = target_cpu |
153 } | 151 } |
154 args = [ | 152 args = [ |
155 "--program=" + rebase_path(executable, root_build_dir), | 153 "--program=" + rebase_path(executable, root_build_dir), |
156 "--arch=${arch}", | 154 "--arch=${arch}", |
157 "--output=" + rebase_path(nmf, root_build_dir), | 155 "--output=" + rebase_path(nmf, root_build_dir), |
158 ] + nmfflags | 156 ] |
| 157 if (defined(invoker.nmfflags)) { |
| 158 args += invoker.nmfflags |
| 159 } |
159 } | 160 } |
160 } | 161 } |
OLD | NEW |