blob: dd1ccba0c8c977ce53843ba049c30070ec0e752a [file] [log] [blame]
[email protected]0c678ce2014-02-27 00:46:111# Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]1f081e7a2011-12-01 19:33:212# 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': [
bradnelson5c5b64142014-09-16 02:30:1611 '../build/common_untrusted.gypi',
[email protected]1f081e7a2011-12-01 19:33:2112 'ppapi_sources.gypi',
13 ],
14 'targets': [
15 {
sbc4df2d472015-11-21 18:43:2116 '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 {
[email protected]1f081e7a2011-12-01 19:33:2141 'target_name': 'ppapi_cpp_lib',
42 'type': 'none',
43 'variables': {
44 'nlib_target': 'libppapi_cpp.a',
[email protected]ee82fab2012-09-24 22:14:3445 'nso_target': 'libppapi_cpp.so',
thakiscdde1a72015-09-15 01:57:2646 'nacl_untrusted_build': 1,
[email protected]4223f8d2012-06-07 01:10:0647 'build_glibc': 1,
[email protected]1f081e7a2011-12-01 19:33:2148 'build_newlib': 1,
[email protected]f7c28712013-01-24 23:11:3349 'build_pnacl_newlib': 1,
[email protected]1f081e7a2011-12-01 19:33:2150 'sources': [
[email protected]70919502011-12-16 02:30:0351 '<@(cpp_source_files)',
[email protected]1f081e7a2011-12-01 19:33:2152 'cpp/module_embedder.h',
53 'cpp/ppp_entrypoints.cc',
54 ],
55 },
[email protected]1f081e7a2011-12-01 19:33:2156 },
57 {
[email protected]ff92200c2012-09-10 21:58:1658 'target_name': 'ppapi_gles2_lib',
59 'type': 'none',
60 'variables': {
61 'nlib_target': 'libppapi_gles2.a',
thakiscdde1a72015-09-15 01:57:2662 'nacl_untrusted_build': 1,
[email protected]ee82fab2012-09-24 22:14:3463 'nso_target': 'libppapi_gles2.so',
[email protected]ff92200c2012-09-10 21:58:1664 'build_glibc': 1,
65 'build_newlib': 1,
[email protected]f7c28712013-01-24 23:11:3366 'build_pnacl_newlib': 1,
[email protected]ff92200c2012-09-10 21:58:1667 '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 },
[email protected]ff92200c2012-09-10 21:58:1676 },
77 {
[email protected]1f081e7a2011-12-01 19:33:2178 'target_name': 'ppapi_nacl_tests',
79 'type': 'none',
80 'dependencies': [
[email protected]ee82fab2012-09-24 22:14:3481 '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
ncbray731b3522014-09-05 08:06:2082 '<(DEPTH)/native_client/src/untrusted/pthread/pthread.gyp:pthread_lib',
[email protected]1f081e7a2011-12-01 19:33:2183 'ppapi_cpp_lib',
sbc4df2d472015-11-21 18:43:2184 'nacl_elf_loader',
[email protected]1f081e7a2011-12-01 19:33:2185 'native_client/native_client.gyp:ppapi_lib',
[email protected]3b74078c2012-08-03 01:01:5286 ],
[email protected]1f081e7a2011-12-01 19:33:2187 'variables': {
[email protected]03b32122013-04-05 07:19:4788 # 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=': [],
[email protected]3b74078c2012-08-03 01:01:5291 # TODO(bradnelson): Remove this compile flag once new nacl_rev is
92 # above 9362.
93 'compile_flags': [
94 '-DGL_GLEXT_PROTOTYPES',
95 ],
[email protected]a070d1682013-03-27 07:40:5696 # 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.
[email protected]3c74cf482014-05-28 03:00:42100 'compile_flags!': [
[email protected]a070d1682013-03-27 07:40:56101 '-g',
102 ],
[email protected]3b74078c2012-08-03 01:01:52103 'defines': [
104 'GL_GLEXT_PROTOTYPES',
105 ],
[email protected]1f081e7a2011-12-01 19:33:21106 'nexe_target': 'ppapi_nacl_tests',
thakiscdde1a72015-09-15 01:57:26107 'nacl_untrusted_build': 1,
[email protected]1f081e7a2011-12-01 19:33:21108 'build_newlib': 1,
109 'include_dirs': [
110 'lib/gl/include',
111 '..',
112 ],
113 'link_flags': [
114 '-lppapi_cpp',
115 '-lppapi',
[email protected]ad854a8ca2012-11-19 22:20:29116 '-pthread',
[email protected]1f081e7a2011-12-01 19:33:21117 ],
[email protected]a070d1682013-03-27 07:40:56118 'link_flags!': [
119 '-O3',
120 ],
121 'translate_flags': [
122 '-O0',
123 ],
[email protected]c5707ee2013-08-04 06:32:21124 'conditions': [
bradnelson5c5b64142014-09-16 02:30:16125 ['target_arch=="ia32"', {
[email protected]c5707ee2013-08-04 06:32:21126 'extra_deps_newlib32': [
127 '>(tc_lib_dir_newlib32)/libppapi_cpp.a',
128 '>(tc_lib_dir_newlib32)/libppapi.a',
129 ],
[email protected]c5707ee2013-08-04 06:32:21130 'extra_deps_glibc32': [
131 '>(tc_lib_dir_glibc32)/libppapi_cpp.so',
132 '>(tc_lib_dir_glibc32)/libppapi.so',
133 ],
134 }],
bradnelson5c5b64142014-09-16 02:30:16135 ['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 }],
[email protected]c5707ee2013-08-04 06:32:21145 ['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 }],
[email protected]ebd08aa2012-05-22 19:54:38151 ],
[email protected]c5707ee2013-08-04 06:32:21152 'extra_deps_pnacl_newlib': [
153 '>(tc_lib_dir_pnacl_newlib)/libppapi_cpp.a',
154 '>(tc_lib_dir_pnacl_newlib)/libppapi.a',
[email protected]1e40ba002013-03-07 22:07:33155 ],
[email protected]1f081e7a2011-12-01 19:33:21156 'sources': [
[email protected]70919502011-12-16 02:30:03157 '<@(test_common_source_files)',
158 '<@(test_nacl_source_files)',
[email protected]1f081e7a2011-12-01 19:33:21159 ],
[email protected]8eca7f02013-01-26 06:06:31160 'extra_args': [
161 '--strip-all',
162 ],
sbc4df2d472015-11-21 18:43:21163 '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 },
[email protected]ea43be42013-12-17 01:33:39172 'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
sbcd362de52015-04-16 20:56:27173 'create_nmf_flags': [
174 '--no-default-libpath',
sbc4df2d472015-11-21 18:43:21175 '--objdump=<(objdump)',
sbcd362de52015-04-16 20:56:27176 ],
[email protected]3c74cf482014-05-28 03:00:42177 'create_nonsfi_test_nmf': 'tests/create_nonsfi_test_nmf.py',
[email protected]1f081e7a2011-12-01 19:33:21178 },
[email protected]4223f8d2012-06-07 01:10:06179 'conditions': [
sbc4df2d472015-11-21 18:43:21180 ['target_arch!="mipsel" and disable_glibc==0', {
[email protected]4223f8d2012-06-07 01:10:06181 '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',
[email protected]4223f8d2012-06-07 01:10:06187 'nmf_glibc%': '<(PRODUCT_DIR)/>(nexe_target)_glibc.nmf',
188 },
189 'actions': [
190 {
191 'action_name': 'Generate GLIBC NMF and copy libs',
[email protected]ea43be42013-12-17 01:33:39192 # NOTE: create_nmf must be first, it is the script python executes
193 # below.
bradnelson5c5b64142014-09-16 02:30:16194 'inputs': ['>(create_nmf)'],
[email protected]4223f8d2012-06-07 01:10:06195 # 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',
[email protected]4223f8d2012-06-07 01:10:06201 '>@(_inputs)',
sbcd362de52015-04-16 20:56:27202 '>@(create_nmf_flags)',
[email protected]4223f8d2012-06-07 01:10:06203 '--output=>(nmf_glibc)',
204 '--stage-dependencies=<(PRODUCT_DIR)',
205 ],
bradnelson5c5b64142014-09-16 02:30:16206 '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 }],
sbc4df2d472015-11-21 18:43:21214 ['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 }],
bradnelson5c5b64142014-09-16 02:30:16221 ['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 ],
[email protected]4223f8d2012-06-07 01:10:06229 },
230 ],
231 }],
[email protected]1e40ba002013-03-07 22:07:33232 # 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,
[email protected]17d0f50c2014-04-07 17:51:04237 # ARM on ARM platforms, or MIPS on MIPS platforms, not all
238 # versions always.
[email protected]1e40ba002013-03-07 22:07:33239 # The same goes for the PNaCl shims. So, we have two variations here.
[email protected]a9912632014-02-20 23:34:10240 ['disable_pnacl==0 and (target_arch=="ia32" or target_arch=="x64")', {
[email protected]1e40ba002013-03-07 22:07:33241 'variables': {
242 'build_pnacl_newlib': 1,
[email protected]4c94cae2014-07-29 03:03:12243 'translate_pexe_with_build': 1,
[email protected]1e40ba002013-03-07 22:07:33244 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf',
245 },
246 # Shim is a dependency for the nexe because we pre-translate.
247 'dependencies': [
[email protected]e2cda32512014-07-16 15:51:46248 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:aot',
[email protected]1e40ba002013-03-07 22:07:33249 ],
[email protected]2c8a5092014-04-03 12:01:49250 'actions': [
[email protected]1e40ba002013-03-07 22:07:33251 {
252 'action_name': 'Generate PNACL NEWLIB NMF',
[email protected]ea43be42013-12-17 01:33:39253 # NOTE: create_nmf must be first, it is the script python executes
254 # below.
255 'inputs': [
256 '>(create_nmf)',
[email protected]ea43be42013-12-17 01:33:39257 ],
[email protected]1e40ba002013-03-07 22:07:33258 'outputs': ['>(nmf_pnacl)'],
259 'action': [
260 'python',
[email protected]1e40ba002013-03-07 22:07:33261 '>@(_inputs)',
sbcd362de52015-04-16 20:56:27262 '>@(create_nmf_flags)',
[email protected]1e40ba002013-03-07 22:07:33263 '--output=>(nmf_pnacl)',
264 ],
bradnelson5c5b64142014-09-16 02:30:16265 '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 ],
[email protected]1e40ba002013-03-07 22:07:33277 },
278 ],
279 }],
hidehikod3427852015-02-02 15:26:05280 ['disable_pnacl==0 and (target_arch=="ia32" or target_arch=="x64" or target_arch=="arm") and OS=="linux"', {
mazdae1b899f2014-11-13 07:19:31281 # 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.
[email protected]2c8a5092014-04-03 12:01:49284 'variables': {
[email protected]4c94cae2014-07-29 03:03:12285 'translate_pexe_with_build': 1,
[email protected]3c74cf482014-05-28 03:00:42286 'nmf_nonsfi%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl_nonsfi.nmf',
[email protected]2c8a5092014-04-03 12:01:49287 },
mazdae1b899f2014-11-13 07:19:31288 'conditions': [
hidehikod3427852015-02-02 15:26:05289 ['target_arch=="ia32" or target_arch=="x64"', {
mazdae1b899f2014-11-13 07:19:31290 'variables': {
291 'enable_x86_32_nonsfi': 1,
292 },
293 }],
294 ['target_arch=="arm"', {
295 'variables': {
296 'enable_arm_nonsfi': 1,
297 },
298 }],
299 ],
[email protected]4c94cae2014-07-29 03:03:12300 # 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 ],
[email protected]3c74cf482014-05-28 03:00:42304 '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)',
mazdae1b899f2014-11-13 07:19:31313 ],
314 'target_conditions': [
hidehikod3427852015-02-02 15:26:05315 ['enable_x86_32_nonsfi==1 and "<(target_arch)"=="ia32"', {
316 'inputs': ['>(out_pnacl_newlib_x86_32_nonsfi_nexe)'],
mazdae1b899f2014-11-13 07:19:31317 'action': [
318 '--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)',
319 '--arch=x86-32',
hidehikod3427852015-02-02 15:26:05320 ]
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 ]
mazdae1b899f2014-11-13 07:19:31337 }],
338 ['enable_arm_nonsfi==1', {
hidehikod3427852015-02-02 15:26:05339 'inputs': ['>(out_pnacl_newlib_arm_nonsfi_nexe)'],
mazdae1b899f2014-11-13 07:19:31340 'action': [
341 '--program=>(out_pnacl_newlib_arm_nonsfi_nexe)',
342 '--arch=arm',
hidehikod3427852015-02-02 15:26:05343 ]
mazdae1b899f2014-11-13 07:19:31344 }],
[email protected]3c74cf482014-05-28 03:00:42345 ],
346 },
347 ],
[email protected]2c8a5092014-04-03 12:01:49348 }],
[email protected]1e40ba002013-03-07 22:07:33349 ['disable_pnacl==0 and target_arch=="arm"', {
350 'variables': {
351 'build_pnacl_newlib': 1,
[email protected]4c94cae2014-07-29 03:03:12352 'translate_pexe_with_build': 1,
[email protected]1e40ba002013-03-07 22:07:33353 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf',
354 },
355 # Shim is a dependency for the nexe because we pre-translate.
356 'dependencies': [
[email protected]e2cda32512014-07-16 15:51:46357 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:aot',
[email protected]1e40ba002013-03-07 22:07:33358 ],
359 'actions': [
360 {
361 'action_name': 'Generate PNACL NEWLIB NMF',
[email protected]ea43be42013-12-17 01:33:39362 # NOTE: create_nmf must be first, it is the script python executes
363 # below.
364 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib_arm_nexe)'],
[email protected]1e40ba002013-03-07 22:07:33365 'outputs': ['>(nmf_pnacl)'],
366 'action': [
367 'python',
[email protected]1e40ba002013-03-07 22:07:33368 '>@(_inputs)',
sbcd362de52015-04-16 20:56:27369 '>@(create_nmf_flags)',
[email protected]1e40ba002013-03-07 22:07:33370 '--output=>(nmf_pnacl)',
371 ],
372 },
373 ],
374 }],
[email protected]17d0f50c2014-04-07 17:51:04375 ['disable_pnacl==0 and target_arch=="mipsel"', {
376 'variables': {
377 'build_pnacl_newlib': 1,
[email protected]4c94cae2014-07-29 03:03:12378 'translate_pexe_with_build': 1,
[email protected]17d0f50c2014-04-07 17:51:04379 'nmf_pnacl%': '<(PRODUCT_DIR)/>(nexe_target)_pnacl.nmf',
380 },
381 # Shim is a dependency for the nexe because we pre-translate.
382 'dependencies': [
[email protected]e2cda32512014-07-16 15:51:46383 '<(DEPTH)/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_irt_shim.gyp:aot',
[email protected]17d0f50c2014-04-07 17:51:04384 ],
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)',
sbcd362de52015-04-16 20:56:27393 '>@(create_nmf_flags)',
[email protected]17d0f50c2014-04-07 17:51:04394 '--output=>(nmf_pnacl)',
395 ],
396 },
397 ],
398 }],
[email protected]4223f8d2012-06-07 01:10:06399 ],
[email protected]1f081e7a2011-12-01 19:33:21400 },
401 ],
402}