OLD | NEW |
| (Empty) |
1 # Copyright 2014 The Chromium 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 # This GYP file defines untrusted (NaCl) targets. All targets in this | |
6 # file should be conditionally depended upon via 'disable_nacl!=1' to avoid | |
7 # requiring NaCl sources for building. | |
8 | |
9 { | |
10 'includes': [ | |
11 '../build/common_untrusted.gypi', | |
12 'ppapi_sources.gypi', | |
13 ], | |
14 'targets': [ | |
15 { | |
16 'target_name': 'nacl_elf_loader', | |
17 'type': 'none', | |
18 'conditions': [ | |
19 ['target_arch=="arm" and disable_glibc==0', { | |
20 'dependencies': [ | |
21 '<(DEPTH)/native_client/src/untrusted/elf_loader/elf_loader.gyp:elf_
loader_nexe', | |
22 ], | |
23 'actions': [ | |
24 { | |
25 'action_name': 'copy_arm_elf_loader', | |
26 'message': 'Copying elf_loader_arm.nexe', | |
27 'inputs': [ | |
28 '<(PRODUCT_DIR)/elf_loader_newlib_arm.nexe', | |
29 ], | |
30 'outputs': [ | |
31 '>(tc_lib_dir_glibc_arm)/elf_loader_arm.nexe', | |
32 ], | |
33 'action': [ | |
34 'python', '<(DEPTH)/build/cp.py', '>@(_inputs)', '>@(_outputs)' | |
35 ], | |
36 }], | |
37 }], | |
38 ], | |
39 }, | |
40 { | |
41 'target_name': 'ppapi_cpp_lib', | |
42 'type': 'none', | |
43 'variables': { | |
44 'nlib_target': 'libppapi_cpp.a', | |
45 'nso_target': 'libppapi_cpp.so', | |
46 'nacl_untrusted_build': 1, | |
47 'build_glibc': 1, | |
48 'build_newlib': 1, | |
49 'build_pnacl_newlib': 1, | |
50 'sources': [ | |
51 '<@(cpp_source_files)', | |
52 'cpp/module_embedder.h', | |
53 'cpp/ppp_entrypoints.cc', | |
54 ], | |
55 }, | |
56 }, | |
57 { | |
58 'target_name': 'ppapi_gles2_lib', | |
59 'type': 'none', | |
60 'variables': { | |
61 'nlib_target': 'libppapi_gles2.a', | |
62 'nacl_untrusted_build': 1, | |
63 'nso_target': 'libppapi_gles2.so', | |
64 'build_glibc': 1, | |
65 'build_newlib': 1, | |
66 'build_pnacl_newlib': 1, | |
67 'include_dirs': [ | |
68 'lib/gl/include', | |
69 ], | |
70 'sources': [ | |
71 'lib/gl/gles2/gl2ext_ppapi.c', | |
72 'lib/gl/gles2/gl2ext_ppapi.h', | |
73 'lib/gl/gles2/gles2.c', | |
74 ], | |
75 }, | |
76 }, | |
77 { | |
78 'target_name': 'ppapi_nacl_tests', | |
79 'type': 'none', | |
80 'dependencies': [ | |
81 '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib', | |
82 '<(DEPTH)/native_client/src/untrusted/pthread/pthread.gyp:pthread_lib', | |
83 'ppapi_cpp_lib', | |
84 'nacl_elf_loader', | |
85 'native_client/native_client.gyp:ppapi_lib', | |
86 ], | |
87 'variables': { | |
88 # This is user code (vs IRT code), so tls accesses do not | |
89 # need to be indirect through a function call. | |
90 'newlib_tls_flags=': [], | |
91 # TODO(bradnelson): Remove this compile flag once new nacl_rev is | |
92 # above 9362. | |
93 'compile_flags': [ | |
94 '-DGL_GLEXT_PROTOTYPES', | |
95 ], | |
96 # Speed up pnacl linking by not generating debug info for tests. | |
97 # We compile with --strip-all under extra_args so debug info is | |
98 # discarded anyway. Remove this and the --strip-all flag if | |
99 # debug info is really needed. | |
100 'compile_flags!': [ | |
101 '-g', | |
102 ], | |
103 'defines': [ | |
104 'GL_GLEXT_PROTOTYPES', | |
105 ], | |
106 'nexe_target': 'ppapi_nacl_tests', | |
107 'nacl_untrusted_build': 1, | |
108 'build_newlib': 1, | |
109 'include_dirs': [ | |
110 'lib/gl/include', | |
111 '..', | |
112 ], | |
113 'link_flags': [ | |
114 '-lppapi_cpp', | |
115 '-lppapi', | |
116 '-pthread', | |
117 ], | |
118 'link_flags!': [ | |
119 '-O3', | |
120 ], | |
121 'translate_flags': [ | |
122 '-O0', | |
123 ], | |
124 'conditions': [ | |
125 ['target_arch=="ia32"', { | |
126 'extra_deps_newlib32': [ | |
127 '>(tc_lib_dir_newlib32)/libppapi_cpp.a', | |
128 '>(tc_lib_dir_newlib32)/libppapi.a', | |
129 ], | |
130 'extra_deps_glibc32': [ | |
131 '>(tc_lib_dir_glibc32)/libppapi_cpp.so', | |
132 '>(tc_lib_dir_glibc32)/libppapi.so', | |
133 ], | |
134 }], | |
135 ['target_arch=="x64" or (target_arch=="ia32" and OS=="win")', { | |
136 'extra_deps_newlib64': [ | |
137 '>(tc_lib_dir_newlib64)/libppapi_cpp.a', | |
138 '>(tc_lib_dir_newlib64)/libppapi.a', | |
139 ], | |
140 'extra_deps_glibc64': [ | |
141 '>(tc_lib_dir_glibc64)/libppapi_cpp.so', | |
142 '>(tc_lib_dir_glibc64)/libppapi.so', | |
143 ], | |
144 }], | |
145 ['target_arch=="arm"', { | |
146 'extra_deps_arm': [ | |
147 '>(tc_lib_dir_newlib_arm)/libppapi_cpp.a', | |
148 '>(tc_lib_dir_newlib_arm)/libppapi.a', | |
149 ], | |
150 }], | |
151 ], | |
152 'extra_deps_pnacl_newlib': [ | |
153 '>(tc_lib_dir_pnacl_newlib)/libppapi_cpp.a', | |
154 '>(tc_lib_dir_pnacl_newlib)/libppapi.a', | |
155 ], | |
156 'sources': [ | |
157 '<@(test_common_source_files)', | |
158 '<@(test_nacl_source_files)', | |
159 ], | |
160 'extra_args': [ | |
161 '--strip-all', | |
162 ], | |
163 'variables': { | |
164 'conditions': [ | |
165 ['target_arch=="arm"', { | |
166 'objdump': '>(nacl_glibc_tc_root)/bin/arm-nacl-objdump' | |
167 }, { | |
168 'objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump' | |
169 }], | |
170 ] | |
171 }, | |
172 'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py', | |
173 'create_nmf_flags': [ | |
174 '--no-default-libpath', | |
175 '--objdump=<(objdump)', | |
176 ], | |
177 'create_nonsfi_test_nmf': 'tests/create_nonsfi_test_nmf.py', | |
178 }, | |
179 'conditions': [ | |
180 ['target_arch!="mipsel" and disable_glibc==0', { | |
181 'variables': { | |
182 'build_glibc': 1, | |
183 # NOTE: Use /lib, not /lib64 here; it is a symbolic link which | |
184 # doesn't work on Windows. | |
185 'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib', | |
186 'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32', | |
187 'nmf_glibc%': '<(PRODUCT_DIR)/>(nexe_target)_glibc.nmf', | |
188 }, | |
189 'actions': [ | |
190 { | |
191 'action_name': 'Generate GLIBC NMF and copy libs', | |
192 # NOTE: create_nmf must be first, it is the script python executes | |
193 # below. | |
194 'inputs': ['>(create_nmf)'], | |
195 # NOTE: There is no explicit dependency for the lib32 | |
196 # and lib64 directories created in the PRODUCT_DIR. | |
197 # They are created as a side-effect of NMF creation. | |
198 'outputs': ['>(nmf_glibc)'], | |
199 'action': [ | |
200 'python', | |
201 '>@(_inputs)', | |
202 '>@(create_nmf_flags)', | |
203 '--output=>(nmf_glibc)', | |
204 '--stage-dependencies=<(PRODUCT_DIR)', | |
205 ], | |
206 'conditions': [ | |
207 ['target_arch=="ia32"', { | |
208 'action': [ | |
209 '--library-path=>(libdir_glibc32)', | |
210 '--library-path=>(tc_lib_dir_glibc32)', | |
211 ], | |
212 'inputs': ['>(out_glibc32)'], | |
213 }], | |
214 ['target_arch=="arm"', { | |
215 'action': [ | |
216 '--library-path=>(nacl_glibc_tc_root)/arm-nacl/lib', | |
217 '--library-path=>(tc_lib_dir_glibc_arm)', | |
218 ], | |
219 'inputs': ['>(out_glibc_arm)'], | |
220 }], | |
221 ['target_arch=="x64" or (target_arch=="ia32" and OS=="win")', { | |
222 'action': [ | |
223 '--library-path=>(libdir_glibc64)', | |
224 '--library-path=>(tc_lib_dir_glibc64)', | |
225 ], | |
226 'inputs': ['>(out_glibc64)'], | |
227 }], | |
228 ], | |
229 }, | |
230 ], | |
231 }], | |
232 # Test PNaCl pre-translated code (pre-translated to save bot time). | |
233 # We only care about testing that code generation is correct, | |
234 # and in-browser translation is tested elsewhere. | |
235 # NOTE: native_client/build/untrusted.gypi dictates that | |
236 # PNaCl only generate x86-32 and x86-64 on x86 platforms, | |
237 # ARM on ARM platforms, or MIPS on MIPS platforms, not all | |
238 # versions always. | |
239 # The same goes for the PNaCl shims. So, we have two variations here. | |
240 ['disable_pnacl==0 and (target_arch=="ia32" or target_arch=="x64")', { | |
241 'variables': { | |
242 'build_pnacl_newlib': 1, | |
243 'translate_pexe_with_build': 1, | |
244 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf', | |
245 }, | |
246 # Shim is a dependency for the nexe because we pre-translate. | |
247 'dependencies': [ | |
248 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt
_shim.gyp:aot', | |
249 ], | |
250 'actions': [ | |
251 { | |
252 'action_name': 'Generate PNACL NEWLIB NMF', | |
253 # NOTE: create_nmf must be first, it is the script python executes | |
254 # below. | |
255 'inputs': [ | |
256 '>(create_nmf)', | |
257 ], | |
258 'outputs': ['>(nmf_pnacl)'], | |
259 'action': [ | |
260 'python', | |
261 '>@(_inputs)', | |
262 '>@(create_nmf_flags)', | |
263 '--output=>(nmf_pnacl)', | |
264 ], | |
265 'conditions': [ | |
266 ['target_arch=="ia32"', { | |
267 'inputs': [ | |
268 '>(out_pnacl_newlib_x86_32_nexe)', | |
269 ], | |
270 }], | |
271 ['target_arch=="x64" or (target_arch=="ia32" and OS=="win")', { | |
272 'inputs': [ | |
273 '>(out_pnacl_newlib_x86_64_nexe)', | |
274 ], | |
275 }], | |
276 ], | |
277 }, | |
278 ], | |
279 }], | |
280 ['disable_pnacl==0 and (target_arch=="ia32" or target_arch=="x64" or tar
get_arch=="arm") and OS=="linux"', { | |
281 # In addition to above configuration, build x86-32 and arm nonsfi | |
282 # .nexe files by translating from .pexe binary, for non-SFI mode PPAPI | |
283 # testing. | |
284 'variables': { | |
285 'translate_pexe_with_build': 1, | |
286 'nmf_nonsfi%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl_nonsfi.nmf', | |
287 }, | |
288 'conditions': [ | |
289 ['target_arch=="ia32" or target_arch=="x64"', { | |
290 'variables': { | |
291 'enable_x86_32_nonsfi': 1, | |
292 }, | |
293 }], | |
294 ['target_arch=="arm"', { | |
295 'variables': { | |
296 'enable_arm_nonsfi': 1, | |
297 }, | |
298 }], | |
299 ], | |
300 # Shim is a dependency for the nexe because we pre-translate. | |
301 'dependencies': [ | |
302 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt
_shim.gyp:aot', | |
303 ], | |
304 'actions': [ | |
305 { | |
306 'action_name': 'Generate PNACL NEWLIB NONSFI NMF', | |
307 'inputs': ['>(create_nonsfi_test_nmf)'], | |
308 'outputs': ['>(nmf_nonsfi)'], | |
309 'action': [ | |
310 'python', | |
311 '>(create_nonsfi_test_nmf)', | |
312 '--output=>(nmf_nonsfi)', | |
313 ], | |
314 'target_conditions': [ | |
315 ['enable_x86_32_nonsfi==1 and "<(target_arch)"=="ia32"', { | |
316 'inputs': ['>(out_pnacl_newlib_x86_32_nonsfi_nexe)'], | |
317 'action': [ | |
318 '--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)', | |
319 '--arch=x86-32', | |
320 ] | |
321 }], | |
322 ['enable_x86_32_nonsfi==1 and "<(target_arch)"=="x64"', { | |
323 'inputs': ['>(out_pnacl_newlib_x86_32_nonsfi_nexe)'], | |
324 'action': [ | |
325 '--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)', | |
326 # This should be used only for nacl_helper_nonsfi test. | |
327 # In theory this should be x86-32. However, currently | |
328 # fallback logic to x86-32-nonsfi is not implemented, | |
329 # and, moreover, it would break the tests for current | |
330 # nacl_helper in Non-SFI mode on x64 Chrome. | |
331 # So, here we introduce the hack to use "x86-64" in order | |
332 # to take the benefit to run nacl_helper_nonsfi tests on | |
333 # x64 Chrome. | |
334 # TODO(hidehiko): Remove this hack. | |
335 '--arch=x86-64', | |
336 ] | |
337 }], | |
338 ['enable_arm_nonsfi==1', { | |
339 'inputs': ['>(out_pnacl_newlib_arm_nonsfi_nexe)'], | |
340 'action': [ | |
341 '--program=>(out_pnacl_newlib_arm_nonsfi_nexe)', | |
342 '--arch=arm', | |
343 ] | |
344 }], | |
345 ], | |
346 }, | |
347 ], | |
348 }], | |
349 ['disable_pnacl==0 and target_arch=="arm"', { | |
350 'variables': { | |
351 'build_pnacl_newlib': 1, | |
352 'translate_pexe_with_build': 1, | |
353 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf', | |
354 }, | |
355 # Shim is a dependency for the nexe because we pre-translate. | |
356 'dependencies': [ | |
357 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt
_shim.gyp:aot', | |
358 ], | |
359 'actions': [ | |
360 { | |
361 'action_name': 'Generate PNACL NEWLIB NMF', | |
362 # NOTE: create_nmf must be first, it is the script python executes | |
363 # below. | |
364 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib_arm_nexe)'], | |
365 'outputs': ['>(nmf_pnacl)'], | |
366 'action': [ | |
367 'python', | |
368 '>@(_inputs)', | |
369 '>@(create_nmf_flags)', | |
370 '--output=>(nmf_pnacl)', | |
371 ], | |
372 }, | |
373 ], | |
374 }], | |
375 ['disable_pnacl==0 and target_arch=="mipsel"', { | |
376 'variables': { | |
377 'build_pnacl_newlib': 1, | |
378 'translate_pexe_with_build': 1, | |
379 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf', | |
380 }, | |
381 # Shim is a dependency for the nexe because we pre-translate. | |
382 'dependencies': [ | |
383 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt
_shim.gyp:aot', | |
384 ], | |
385 'actions': [ | |
386 { | |
387 'action_name': 'Generate PNACL NEWLIB NMF', | |
388 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib_mips_nexe)'], | |
389 'outputs': ['>(nmf_pnacl)'], | |
390 'action': [ | |
391 'python', | |
392 '>@(_inputs)', | |
393 '>@(create_nmf_flags)', | |
394 '--output=>(nmf_pnacl)', | |
395 ], | |
396 }, | |
397 ], | |
398 }], | |
399 ], | |
400 }, | |
401 ], | |
402 } | |
OLD | NEW |