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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | ppapi/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 nmfflags += [ "--library-path=" + rebase_path(root_out_dir) ]
61 if (current_cpu == "x86") {
62 nmfflags += [ "--library-path=" +
63 rebase_path("${nacl_toolchain_tooldir}/lib32") ]
64 data = [
65 "${lib_path}/lib32/",
66 ]
67 } else if (current_cpu == "x64") {
68 nmfflags +=
69 [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ]
70 data = [
71 "${lib_path}/lib64/",
72 ]
73 } else {
74 nmfflags +=
75 [ "--library-path=" + rebase_path("${nacl_toolchain_tooldir}/lib") ]
76 data = [
77 "${lib_path}/lib/",
78 ]
79 }
80 }
81 args = [
82 "--no-default-libpath",
83 "--objdump=" + rebase_path("${nacl_toolprefix}objdump"),
84 "--output=" + rebase_path(nmf, root_build_dir),
85 ] + nmfflags + rebase_path(sources, root_build_dir)
86 if (is_nacl_glibc && current_cpu == "arm") {
87 deps += [ "//native_client/src/untrusted/elf_loader:elf_loader" ]
88 }
89 }
90 }
91
92 # Generate a nmf file for Non-SFI tests
93 #
94 # Non-SFI tests use a different manifest format from regular Native Client and
95 # as such requires a different generator.
96 #
97 # Variables:
98 # executable: Non-SFI .nexe executable to generate nmf for
99 # nmf: the name and the path of the output file
100 template("generate_nonsfi_test_nmf") {
101 assert(defined(invoker.executable), "Must define executable")
102 assert(defined(invoker.nmf), "Must define nmf")
103
104 action(target_name) {
105 forward_variables_from(invoker,
106 [
107 "deps",
108 "data_deps",
109 "executable",
110 "nmf",
111 "testonly",
112 "public_deps",
113 ])
114
115 script = "//ppapi/tests/create_nonsfi_test_nmf.py"
116 sources = [
117 executable,
118 ]
119 outputs = [
120 nmf,
121 ]
122
123 # NOTE: We use target_cpu rather than current_cpu on purpose because
124 # current_cpu is always going to be pnacl for Non-SFI, but the Non-SFI
125 # .nexe executable is always translated to run on the target machine.
126 if (target_cpu == "x86") {
127 arch = "x86-32"
128 } else if (target_cpu == "x64") {
129 arch = "x86-64"
130 } else {
131 arch = target_cpu
132 }
133 args = [
134 "--program=" + rebase_path(executable, root_build_dir),
135 "--arch=${arch}",
136 "--output=" + rebase_path(nmf, root_build_dir),
137 ]
138 }
139 }
OLDNEW
« 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