OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 import("//build/config/features.gni") | |
6 import("//build/config/nacl/config.gni") | |
7 | |
8 # Generate a nmf file | |
9 # | |
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. | |
12 # | |
13 # Variables: | |
14 # executables: .nexe/.pexe/.bc executables to generate nmf for | |
15 # lib_prefix: path to prepend to shared libraries in the nmf | |
16 # nmf: the name and the path of the output file | |
17 # nmfflags: additional flags for the nmf generator | |
18 # stage_dependencies: directory for staging libraries | |
19 template("generate_nmf") { | |
20 assert(defined(invoker.executables), "Must define executables") | |
21 assert(defined(invoker.nmf), "Must define nmf") | |
22 | |
23 action(target_name) { | |
24 nmfflags = [] | |
25 | |
26 forward_variables_from(invoker, | |
27 [ | |
28 "deps", | |
29 "data_deps", | |
30 "executables", | |
31 "lib_prefix", | |
32 "nmf", | |
33 "nmfflags", | |
34 "public_deps", | |
35 "stage_dependencies", | |
36 "testonly", | |
37 ]) | |
38 | |
39 script = "//native_client_sdk/src/tools/create_nmf.py" | |
40 sources = executables | |
41 outputs = [ | |
42 nmf, | |
43 ] | |
44 if (is_nacl_glibc) { | |
45 if (defined(stage_dependencies)) { | |
46 nmfflags += [ "--stage-dependencies=" + | |
47 rebase_path(stage_dependencies, root_build_dir) ] | |
48 lib_path = stage_dependencies | |
49 } else { | |
50 lib_path = root_build_dir | |
51 } | |
52 if (defined(lib_prefix)) { | |
53 nmfflags += [ "--lib-prefix=" + lib_prefix ] | |
54 lib_path += "/${lib_prefix}" | |
55 } | |
56 | |
57 # NOTE: There is no explicit dependency for the lib32 | |
58 # and lib64 directories created in the product directory. | |
59 # They are created as a side-effect of nmf creation. | |
60 if (current_cpu == "x86") { | |
61 nmfflags += [ "--library-path=" + | |
62 rebase_path("${nacl_toolchain_tooldir}/lib32") ] | |
63 data = [ | |
64 "${lib_path}/lib32/", | |
65 ] | |
66 } else if (current_cpu == "x64") { | |
67 nmfflags += | |
68 [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ] | |
69 data = [ | |
70 "${lib_path}/lib64/", | |
71 ] | |
72 } else { | |
73 nmfflags += | |
74 [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ] | |
75 data = [ | |
76 "${lib_path}/lib/", | |
77 ] | |
78 } | |
79 } | |
80 args = [ | |
81 "--no-default-libpath", | |
82 "--objdump=" + rebase_path("${nacl_toolprefix}objdump"), | |
83 "--output=" + rebase_path(nmf, root_build_dir), | |
84 ] + nmfflags + rebase_path(sources, root_build_dir) | |
85 if (is_nacl_glibc && current_cpu == "arm") { | |
86 deps += [ "//native_client/src/untrusted/elf_loader:elf_loader" ] | |
87 } | |
88 } | |
89 } | |
90 | |
91 # Generate a nmf file for Non-SFI tests | |
92 # | |
93 # Non-SFI tests use a different manifest format from regular Native Client and | |
94 # as such requires a different generator. | |
95 # | |
96 # Variables: | |
97 # executable: Non-SFI .nexe executable to generate nmf for | |
98 # nmf: the name and the path of the output file | |
99 template("generate_nonsfi_test_nmf") { | |
100 assert(defined(invoker.executable), "Must define executable") | |
101 assert(defined(invoker.nmf), "Must define nmf") | |
102 | |
103 action(target_name) { | |
104 forward_variables_from(invoker, | |
105 [ | |
106 "deps", | |
107 "data_deps", | |
108 "executable", | |
109 "nmf", | |
110 "testonly", | |
111 "public_deps", | |
112 ]) | |
113 | |
114 script = "//ppapi/tests/create_nonsfi_test_nmf.py" | |
115 sources = [ | |
116 executable, | |
117 ] | |
118 outputs = [ | |
119 nmf, | |
120 ] | |
121 if (target_cpu == "x86") { | |
Roland McGrath
2015/11/13 19:08:20
Add a comment saying why this is target_cpu rather
Petr Hosek
2015/11/13 20:38:09
Done.
| |
122 arch = "x86-32" | |
123 } else if (target_cpu == "x64") { | |
124 arch = "x86-64" | |
125 } else { | |
126 arch = target_cpu | |
127 } | |
128 args = [ | |
129 "--program=" + rebase_path(executable, root_build_dir), | |
130 "--arch=${arch}", | |
131 "--output=" + rebase_path(nmf, root_build_dir), | |
132 ] | |
133 } | |
134 } | |
OLD | NEW |