Blink roll 178200:178213
[chromium-blink-merge.git] / components / nacl.gyp
blob5bbfe26984a3c1c014f0fc5f6854ee93014b586c
1 # Copyright 2013 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.
6   'variables': {
7     'chromium_code': 1,
8   },
9   'includes': [
10     'nacl/nacl_defines.gypi',
11   ],
12   'target_defaults': {
13     'variables': {
14       'nacl_target': 0,
15     },
16     'target_conditions': [
17       # This part is shared between the targets defined below. Only files and
18       # settings relevant for building the Win64 target should be added here.
19       ['nacl_target==1', {
20         'include_dirs': [
21           '<(INTERMEDIATE_DIR)',
22         ],
23         'defines': [
24           '<@(nacl_defines)',
25         ],
26         'sources': [
27           # .cc, .h, and .mm files under nacl that are used on all
28           # platforms, including both 32-bit and 64-bit Windows.
29           # Test files are also not included.
30           'nacl/loader/nacl_ipc_adapter.cc',
31           'nacl/loader/nacl_ipc_adapter.h',
32           'nacl/loader/nacl_main.cc',
33           'nacl/loader/nacl_main_platform_delegate.h',
34           'nacl/loader/nacl_main_platform_delegate_linux.cc',
35           'nacl/loader/nacl_main_platform_delegate_mac.mm',
36           'nacl/loader/nacl_main_platform_delegate_win.cc',
37           'nacl/loader/nacl_listener.cc',
38           'nacl/loader/nacl_listener.h',
39           'nacl/loader/nacl_trusted_listener.cc',
40           'nacl/loader/nacl_trusted_listener.h',
41           'nacl/loader/nacl_validation_db.h',
42           'nacl/loader/nacl_validation_query.cc',
43           'nacl/loader/nacl_validation_query.h',
44         ],
45         # TODO(gregoryd): consider switching NaCl to use Chrome OS defines
46         'conditions': [
47           ['OS=="win"', {
48             'defines': [
49               '__STDC_LIMIT_MACROS=1',
50             ],
51             'include_dirs': [
52               '<(DEPTH)/third_party/wtl/include',
53             ],
54           },],
55           ['OS=="linux"', {
56             'defines': [
57               '__STDC_LIMIT_MACROS=1',
58             ],
59             'sources': [
60               '../components/nacl/common/nacl_paths.cc',
61               '../components/nacl/common/nacl_paths.h',
62             ],
63           },],
64         ],
65       }],
66     ],
67   },
68   'conditions': [
69     ['disable_nacl!=1', {
70       'targets': [
71         {
72           'target_name': 'nacl',
73           'type': 'static_library',
74           'variables': {
75             'nacl_target': 1,
76           },
77           'dependencies': [
78             '../base/base.gyp:base',
79             '../base/base.gyp:base_static',
80             '../ipc/ipc.gyp:ipc',
81             '../ppapi/native_client/src/trusted/plugin/plugin.gyp:ppGoogleNaClPluginChrome',
82             '../ppapi/ppapi_internal.gyp:ppapi_shared',
83             '../ppapi/ppapi_internal.gyp:ppapi_ipc',
84             '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel_main_chrome',
85           ],
86           'conditions': [
87             ['disable_nacl_untrusted==0', {
88               'dependencies': [
89                 '../ppapi/native_client/native_client.gyp:nacl_irt',
90                 '../ppapi/native_client/src/untrusted/pnacl_support_extension/pnacl_support_extension.gyp:pnacl_support_extension',
91               ],
92             }],
93           ],
94           'direct_dependent_settings': {
95             'defines': [
96               '<@(nacl_defines)',
97             ],
98           },
99         },
100         {
101           'target_name': 'nacl_browser',
102           'type': 'static_library',
103           'sources': [
104             'nacl/browser/nacl_broker_host_win.cc',
105             'nacl/browser/nacl_broker_host_win.h',
106             'nacl/browser/nacl_broker_service_win.cc',
107             'nacl/browser/nacl_broker_service_win.h',
108             'nacl/browser/nacl_browser.cc',
109             'nacl/browser/nacl_browser.h',
110             'nacl/browser/nacl_file_host.cc',
111             'nacl/browser/nacl_file_host.h',
112             'nacl/browser/nacl_host_message_filter.cc',
113             'nacl/browser/nacl_host_message_filter.h',
114             'nacl/browser/nacl_process_host.cc',
115             'nacl/browser/nacl_process_host.h',
116             'nacl/browser/nacl_validation_cache.cc',
117             'nacl/browser/nacl_validation_cache.h',
118             'nacl/browser/pnacl_host.cc',
119             'nacl/browser/pnacl_host.h',
120             'nacl/browser/pnacl_translation_cache.cc',
121             'nacl/browser/pnacl_translation_cache.h',
122             'nacl/common/nacl_debug_exception_handler_win.cc',
123             'nacl/common/nacl_debug_exception_handler_win.h',
124           ],
125           'include_dirs': [
126             '..',
127           ],
128           'dependencies': [
129             'nacl_common',
130             'nacl_switches',
131             '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel',
132             '../content/content.gyp:content_browser',
133           ],
134           'defines': [
135             '<@(nacl_defines)',
136           ],
137           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
138           'msvs_disabled_warnings': [4267, ],
139           'conditions': [
140             ['OS=="linux"', {
141               'sources': [
142                 '../components/nacl/zygote/nacl_fork_delegate_linux.cc',
143                 '../components/nacl/zygote/nacl_fork_delegate_linux.h',
144               ],
145               'dependencies': [
146                 # Required by nacl_fork_delegate_linux.cc.
147                 '../sandbox/sandbox.gyp:suid_sandbox_client',
148               ]
149             }],
150           ],
151         },
152         {
153           'target_name': 'nacl_renderer',
154           'type': 'static_library',
155           'sources': [
156             'nacl/renderer/file_downloader.cc',
157             'nacl/renderer/file_downloader.h',
158             'nacl/renderer/histogram.cc',
159             'nacl/renderer/histogram.h',
160             'nacl/renderer/manifest_downloader.cc',
161             'nacl/renderer/manifest_downloader.h',
162             'nacl/renderer/manifest_service_channel.cc',
163             'nacl/renderer/manifest_service_channel.h',
164             'nacl/renderer/nacl_helper.cc',
165             'nacl/renderer/nacl_helper.h',
166             'nacl/renderer/json_manifest.cc',
167             'nacl/renderer/json_manifest.h',
168             'nacl/renderer/nexe_load_manager.cc',
169             'nacl/renderer/nexe_load_manager.h',
170             'nacl/renderer/pnacl_translation_resource_host.cc',
171             'nacl/renderer/pnacl_translation_resource_host.h',
172             'nacl/renderer/ppb_nacl_private_impl.cc',
173             'nacl/renderer/ppb_nacl_private_impl.h',
174             'nacl/renderer/progress_event.cc',
175             'nacl/renderer/progress_event.h',
176             'nacl/renderer/sandbox_arch.cc',
177             'nacl/renderer/sandbox_arch.h',
178             'nacl/renderer/trusted_plugin_channel.cc',
179             'nacl/renderer/trusted_plugin_channel.h',
180           ],
181           'include_dirs': [
182             '..',
183           ],
184           'dependencies': [
185             '../content/content.gyp:content_renderer',
186             '../third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
187             '../third_party/WebKit/public/blink.gyp:blink',
188             '../webkit/common/webkit_common.gyp:webkit_common',
189           ],
190           'defines': [
191             '<@(nacl_defines)',
192           ],
193           'direct_dependent_settings': {
194             'defines': [
195               '<@(nacl_defines)',
196             ],
197           },
198         },
199         {
200           'target_name': 'nacl_loader_unittests',
201           'type': '<(gtest_target_type)',
202           'sources': [
203             'nacl/loader/run_all_unittests.cc',
204           ],
205           'dependencies': [
206             'nacl',
207             '../base/base.gyp:test_support_base',
208             '../testing/gtest.gyp:gtest',
209           ],
210           'conditions': [
211             ['OS=="linux"', {
212               'sources': [
213                 # TODO(mazda): Move this to browser_tests once we have
214                 # established a way to run browser_tests on ARM Chrome OS
215                 # devices (http://crbug.com/364729).
216                 'nacl/loader/nonsfi/irt_icache_unittest.cc',
217                 # TODO(hamaji): Currently, we build them twice. Stop building
218                 # them for components_unittests. See crbug.com/364751
219                 'nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc',
220                 'nacl/loader/nonsfi/nonsfi_sandbox_sigsys_unittest.cc',
221               ],
222               'dependencies': [
223                 'nacl_linux',
224                 '../sandbox/sandbox.gyp:sandbox_linux_test_utils',
225               ],
226             }],
227           ],
228         },
229       ],
230       'conditions': [
231         ['OS=="linux"', {
232           'targets': [
233             {
234               'target_name': 'nacl_helper',
235               'type': 'executable',
236               'include_dirs': [
237                 '..',
238               ],
239               'sources': [
240                 'nacl/loader/nacl_helper_linux.cc',
241                 'nacl/loader/nacl_helper_linux.h',
242               ],
243               'dependencies': [
244                 'nacl_linux',
245               ],
246               'cflags': ['-fPIE'],
247               'ldflags!': [
248                 # Do not pick the default ASan options from
249                 # base/debug/sanitizer_options.cc to avoid a conflict with those
250                 # in nacl/nacl_helper_linux.cc.
251                 '-Wl,-u_sanitizer_options_link_helper',
252               ],
253               'link_settings': {
254                 'ldflags': ['-pie'],
255               },
256             }, {
257               'target_name': 'nacl_linux',
258               'type': 'static_library',
259               'include_dirs': [
260                 '..',
261               ],
262               'defines': [
263                 '<@(nacl_defines)',
264                 # Allow .cc files to know if they're being compiled as part
265                 # of nacl_helper.
266                 'IN_NACL_HELPER=1',
267               ],
268               'sources': [
269                 'nacl/loader/nonsfi/abi_conversion.cc',
270                 'nacl/loader/nonsfi/abi_conversion.h',
271                 'nacl/loader/nonsfi/elf_loader.cc',
272                 'nacl/loader/nonsfi/elf_loader.h',
273                 'nacl/loader/nonsfi/irt_basic.cc',
274                 'nacl/loader/nonsfi/irt_clock.cc',
275                 'nacl/loader/nonsfi/irt_exception_handling.cc',
276                 'nacl/loader/nonsfi/irt_fdio.cc',
277                 'nacl/loader/nonsfi/irt_futex.cc',
278                 'nacl/loader/nonsfi/irt_icache.cc',
279                 'nacl/loader/nonsfi/irt_interfaces.cc',
280                 'nacl/loader/nonsfi/irt_interfaces.h',
281                 'nacl/loader/nonsfi/irt_memory.cc',
282                 'nacl/loader/nonsfi/irt_ppapi.cc',
283                 'nacl/loader/nonsfi/irt_random.cc',
284                 'nacl/loader/nonsfi/irt_resource_open.cc',
285                 'nacl/loader/nonsfi/irt_thread.cc',
286                 'nacl/loader/nonsfi/irt_util.h',
287                 'nacl/loader/nonsfi/nonsfi_main.cc',
288                 'nacl/loader/nonsfi/nonsfi_main.h',
289                 'nacl/loader/nonsfi/nonsfi_sandbox.cc',
290                 'nacl/loader/nonsfi/nonsfi_sandbox.h',
291                 'nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc',
292                 'nacl/loader/sandbox_linux/nacl_sandbox_linux.cc',
293                 '../ppapi/nacl_irt/irt_manifest.h',
294                 '../ppapi/nacl_irt/manifest_service.cc',
295                 '../ppapi/nacl_irt/manifest_service.h',
296                 '../ppapi/nacl_irt/plugin_main.cc',
297                 '../ppapi/nacl_irt/plugin_main.h',
298                 '../ppapi/nacl_irt/plugin_startup.cc',
299                 '../ppapi/nacl_irt/plugin_startup.h',
300                 '../ppapi/nacl_irt/ppapi_dispatcher.cc',
301                 '../ppapi/nacl_irt/ppapi_dispatcher.h',
302               ],
303               'dependencies': [
304                 'nacl',
305                 'nacl_common',
306                 'nacl_switches',
307                 '../components/tracing.gyp:tracing',
308                 '../crypto/crypto.gyp:crypto',
309                 '../sandbox/sandbox.gyp:libc_urandom_override',
310                 '../sandbox/sandbox.gyp:sandbox',
311                 '../ppapi/ppapi_internal.gyp:ppapi_proxy',
312               ],
313               'conditions': [
314                 ['use_glib == 1', {
315                   'dependencies': [
316                     '../build/linux/system.gyp:glib',
317                   ],
318                 }],
319                 ['os_posix == 1 and OS != "mac"', {
320                   'conditions': [
321                     ['use_allocator!="none"', {
322                       'dependencies': [
323                         '../base/allocator/allocator.gyp:allocator',
324                       ],
325                     }],
326                   ],
327                 }],
328                 ['use_seccomp_bpf == 0', {
329                   'sources!': [
330                     '../content/common/sandbox_linux/sandbox_bpf_base_policy_linux.cc',
331                     '../content/common/sandbox_linux/sandbox_init_linux.cc',
332                   ],
333                 }, {
334                   'defines': ['USE_SECCOMP_BPF'],
335                 }],
336               ],
337               'cflags': ['-fPIE'],
338             },
339           ],
340         }],
341         ['OS=="win" and target_arch=="ia32"', {
342           'targets': [
343             {
344               'target_name': 'nacl_win64',
345               'type': 'static_library',
346               'variables': {
347                 'nacl_target': 1,
348               },
349               'dependencies': [
350                 'nacl_common_win64',
351                 '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel_main_chrome64',
352                 '../ppapi/ppapi_internal.gyp:ppapi_shared_win64',
353                 '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64',
354               ],
355               'export_dependent_settings': [
356                 '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64',
357               ],
358               'sources': [
359                 '../components/nacl/broker/nacl_broker_listener.cc',
360                 '../components/nacl/broker/nacl_broker_listener.h',
361                 '../components/nacl/common/nacl_debug_exception_handler_win.cc',
362                 '../components/nacl/loader/nacl_helper_win_64.cc',
363                 '../components/nacl/loader/nacl_helper_win_64.h',
364               ],
365               'include_dirs': [
366                 '..',
367               ],
368               'defines': [
369                 '<@(nacl_win64_defines)',
370                 'COMPILE_CONTENT_STATICALLY',
371               ],
372               'configurations': {
373                 'Common_Base': {
374                   'msvs_target_platform': 'x64',
375                 },
376               },
377               'direct_dependent_settings': {
378                 'defines': [
379                   '<@(nacl_defines)',
380                 ],
381               },
382             },
383             {
384               'target_name': 'nacl_switches_win64',
385               'type': 'static_library',
386               'sources': [
387                 'nacl/common/nacl_switches.cc',
388                 'nacl/common/nacl_switches.h',
389               ],
390               'include_dirs': [
391                 '..',
392               ],
393               'configurations': {
394                 'Common_Base': {
395                   'msvs_target_platform': 'x64',
396                 },
397               },
398             },
399             {
400               'target_name': 'nacl_common_win64',
401               'type': 'static_library',
402               'defines': [
403                 'COMPILE_CONTENT_STATICALLY',
404               ],
405               'sources': [
406                 'nacl/common/nacl_cmd_line.cc',
407                 'nacl/common/nacl_cmd_line.h',
408                 'nacl/common/nacl_messages.cc',
409                 'nacl/common/nacl_messages.h',
410                 'nacl/common/nacl_types.cc',
411                 'nacl/common/nacl_types.h',
412               ],
413               'include_dirs': [
414                 '..',
415               ],
416               'configurations': {
417                 'Common_Base': {
418                   'msvs_target_platform': 'x64',
419                 },
420               },
421             },
422           ],
423         }],
424       ],
425     }, {  # else (disable_nacl==1)
426       'targets': [
427         {
428           'target_name': 'nacl',
429           'type': 'none',
430           'sources': [],
431         },
432       ],
433       'conditions': [
434         ['OS=="win"', {
435           'targets': [
436             {
437               'target_name': 'nacl_win64',
438               'type': 'none',
439               'sources': [],
440             },
441             {
442               'target_name': 'nacl_switches_win64',
443               'type': 'none',
444               'sources': [],
445             },
446           ],
447         }],
448       ],
449     }],
450     ['disable_nacl!=1 and test_isolation_mode!="noop"', {
451       'targets': [
452         {
453           'target_name': 'nacl_loader_unittests_run',
454           'type': 'none',
455           'dependencies': [
456             'nacl_loader_unittests',
457           ],
458           'includes': [
459             '../build/isolate.gypi',
460             'nacl_loader_unittests.isolate',
461           ],
462           'sources': [
463             'nacl_loader_unittests.isolate',
464           ],
465         },
466       ],
467     }],
468   ],
469   'targets': [
470     {
471       'target_name': 'nacl_switches',
472       'type': 'static_library',
473       'sources': [
474         'nacl/common/nacl_switches.cc',
475         'nacl/common/nacl_switches.h',
476     ],
477       'include_dirs': [
478         '..',
479       ],
480     },
481     {
482       'target_name': 'nacl_common',
483       'type': 'static_library',
484       'sources': [
485         'nacl/common/nacl_cmd_line.cc',
486         'nacl/common/nacl_cmd_line.h',
487         'nacl/common/nacl_host_messages.h',
488         'nacl/common/nacl_host_messages.cc',
489         'nacl/common/nacl_messages.cc',
490         'nacl/common/nacl_messages.h',
491         'nacl/common/nacl_nonsfi_util.cc',
492         'nacl/common/nacl_nonsfi_util.h',
493         'nacl/common/nacl_process_type.h',
494         'nacl/common/nacl_sandbox_type_mac.h',
495         'nacl/common/nacl_types.cc',
496         'nacl/common/nacl_types.h',
497         'nacl/common/pnacl_types.cc',
498         'nacl/common/pnacl_types.h',
499       ],
500       'include_dirs': [
501         '..',
502       ],
503       'dependencies': [
504         '../content/content.gyp:content_common',
505       ],
506     },
507   ]