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