Complete SyncMessageFilter initialization after SyncChannel initialization
[chromium-blink-merge.git] / components / nacl.gyp
blobb02102bc4a92ace213d96d80aa786346c744aaef
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             '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel',
123             '../content/content.gyp:content_browser',
124           ],
125           # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
126           'msvs_disabled_warnings': [4267, ],
127           'conditions': [
128             ['OS=="linux"', {
129               'sources': [
130                 '../components/nacl/zygote/nacl_fork_delegate_linux.cc',
131                 '../components/nacl/zygote/nacl_fork_delegate_linux.h',
132               ],
133               'dependencies': [
134                 # Required by nacl_fork_delegate_linux.cc.
135                 '../sandbox/sandbox.gyp:suid_sandbox_client',
136                 '../sandbox/sandbox.gyp:sandbox_services',
137               ]
138             }],
139           ],
140         },
141         {
142           'target_name': 'nacl_renderer',
143           'type': 'static_library',
144           'sources': [
145             'nacl/renderer/file_downloader.cc',
146             'nacl/renderer/file_downloader.h',
147             'nacl/renderer/histogram.cc',
148             'nacl/renderer/histogram.h',
149             'nacl/renderer/json_manifest.cc',
150             'nacl/renderer/json_manifest.h',
151             'nacl/renderer/manifest_downloader.cc',
152             'nacl/renderer/manifest_downloader.h',
153             'nacl/renderer/manifest_service_channel.cc',
154             'nacl/renderer/manifest_service_channel.h',
155             'nacl/renderer/nacl_helper.cc',
156             'nacl/renderer/nacl_helper.h',
157             'nacl/renderer/nexe_load_manager.cc',
158             'nacl/renderer/nexe_load_manager.h',
159             'nacl/renderer/platform_info.cc',
160             'nacl/renderer/platform_info.h',
161             'nacl/renderer/pnacl_translation_resource_host.cc',
162             'nacl/renderer/pnacl_translation_resource_host.h',
163             'nacl/renderer/ppb_nacl_private_impl.cc',
164             'nacl/renderer/ppb_nacl_private_impl.h',
165             'nacl/renderer/progress_event.cc',
166             'nacl/renderer/progress_event.h',
167             'nacl/renderer/trusted_plugin_channel.cc',
168             'nacl/renderer/trusted_plugin_channel.h',
169           ],
170           'include_dirs': [
171             '..',
172           ],
173           'dependencies': [
174             'nacl_common',
175             '../content/content.gyp:content_renderer',
176             '../components/nacl/renderer/plugin/plugin.gyp:nacl_trusted_plugin',
177             '../third_party/WebKit/public/blink.gyp:blink',
178           ],
179         },
180         {
181           'target_name': 'nacl_loader_unittests',
182           'type': '<(gtest_target_type)',
183           'sources': [
184             'nacl/loader/nacl_ipc_adapter_unittest.cc',
185             'nacl/loader/nacl_validation_query_unittest.cc',
186             'nacl/loader/run_all_unittests.cc',
187           ],
188           'dependencies': [
189             'nacl',
190             '../base/base.gyp:test_support_base',
191             '../ipc/ipc.gyp:test_support_ipc',
192             '../testing/gtest.gyp:gtest',
193           ],
194           'conditions': [
195             ['OS=="linux"', {
196               'sources': [
197                 # TODO(mazda): Move this to browser_tests once we have
198                 # established a way to run browser_tests on ARM Chrome OS
199                 # devices (http://crbug.com/364729).
200                 'nacl/loader/nonsfi/irt_icache_unittest.cc',
201                 # TODO(hamaji): Currently, we build them twice. Stop building
202                 # them for components_unittests. See crbug.com/364751
203                 'nacl/loader/nonsfi/nonsfi_sandbox_sigsys_unittest.cc',
204                 'nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc',
205               ],
206               'dependencies': [
207                 'nacl_linux',
208                 '../sandbox/sandbox.gyp:sandbox_linux_test_utils',
209               ],
210             }],
211           ],
212         },
213       ],
214       'conditions': [
215         ['OS=="linux"', {
216           'targets': [
217             {
218               'target_name': 'nacl_helper',
219               'type': 'executable',
220               'include_dirs': [
221                 '..',
222               ],
223               'sources': [
224                 'nacl/loader/nacl_helper_linux.cc',
225                 'nacl/loader/nacl_helper_linux.h',
226               ],
227               'dependencies': [
228                 'nacl_linux',
229               ],
230               'cflags': ['-fPIE'],
231               'ldflags!': [
232                 # Do not pick the default ASan options from
233                 # build/sanitizers/sanitizer_options.cc to avoid a conflict with
234                 # those in nacl/nacl_helper_linux.cc.
235                 '-Wl,-u_sanitizer_options_link_helper',
236               ],
237               'link_settings': {
238                 'ldflags': ['-pie'],
239               },
240             }, {
241               'target_name': 'nacl_linux',
242               'type': 'static_library',
243               'include_dirs': [
244                 '..',
245               ],
246               'defines': [
247                 # Allow .cc files to know if they're being compiled as part
248                 # of nacl_helper.
249                 'IN_NACL_HELPER=1',
250               ],
251               'sources': [
252                 '../ppapi/nacl_irt/irt_manifest.h',
253                 '../ppapi/nacl_irt/manifest_service.cc',
254                 '../ppapi/nacl_irt/manifest_service.h',
255                 '../ppapi/nacl_irt/plugin_main.cc',
256                 '../ppapi/nacl_irt/plugin_main.h',
257                 '../ppapi/nacl_irt/plugin_startup.cc',
258                 '../ppapi/nacl_irt/plugin_startup.h',
259                 '../ppapi/nacl_irt/ppapi_dispatcher.cc',
260                 '../ppapi/nacl_irt/ppapi_dispatcher.h',
261                 'nacl/loader/nonsfi/abi_conversion.cc',
262                 'nacl/loader/nonsfi/abi_conversion.h',
263                 'nacl/loader/nonsfi/elf_loader.cc',
264                 'nacl/loader/nonsfi/elf_loader.h',
265                 'nacl/loader/nonsfi/irt_basic.cc',
266                 'nacl/loader/nonsfi/irt_clock.cc',
267                 'nacl/loader/nonsfi/irt_exception_handling.cc',
268                 'nacl/loader/nonsfi/irt_fdio.cc',
269                 'nacl/loader/nonsfi/irt_futex.cc',
270                 'nacl/loader/nonsfi/irt_icache.cc',
271                 'nacl/loader/nonsfi/irt_interfaces.cc',
272                 'nacl/loader/nonsfi/irt_interfaces.h',
273                 'nacl/loader/nonsfi/irt_memory.cc',
274                 'nacl/loader/nonsfi/irt_ppapi.cc',
275                 'nacl/loader/nonsfi/irt_random.cc',
276                 'nacl/loader/nonsfi/irt_resource_open.cc',
277                 'nacl/loader/nonsfi/irt_thread.cc',
278                 'nacl/loader/nonsfi/irt_util.h',
279                 'nacl/loader/nonsfi/nonsfi_listener.cc',
280                 'nacl/loader/nonsfi/nonsfi_listener.h',
281                 'nacl/loader/nonsfi/nonsfi_main.cc',
282                 'nacl/loader/nonsfi/nonsfi_main.h',
283                 'nacl/loader/nonsfi/nonsfi_sandbox.cc',
284                 'nacl/loader/nonsfi/nonsfi_sandbox.h',
285                 'nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc',
286                 'nacl/loader/sandbox_linux/nacl_sandbox_linux.cc',
287               ],
288               'dependencies': [
289                 'nacl',
290                 'nacl_common',
291                 'nacl_switches',
292                 '../components/tracing.gyp:tracing',
293                 '../crypto/crypto.gyp:crypto',
294                 '../sandbox/sandbox.gyp:libc_urandom_override',
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               ],
322               'cflags': ['-fPIE'],
323             },
324           ],
325         }],
326         ['OS=="win" and target_arch=="ia32"', {
327           'targets': [
328             {
329               'target_name': 'nacl_win64',
330               'type': 'static_library',
331               'variables': {
332                 'nacl_target': 1,
333               },
334               'dependencies': [
335                 'nacl_common_win64',
336                 '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel_main_chrome64',
337                 '../ppapi/ppapi_internal.gyp:ppapi_shared_win64',
338                 '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64',
339               ],
340               'export_dependent_settings': [
341                 '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64',
342               ],
343               'sources': [
344                 '../components/nacl/broker/nacl_broker_listener.cc',
345                 '../components/nacl/broker/nacl_broker_listener.h',
346                 '../components/nacl/common/nacl_debug_exception_handler_win.cc',
347                 '../components/nacl/loader/nacl_helper_win_64.cc',
348                 '../components/nacl/loader/nacl_helper_win_64.h',
349               ],
350               'include_dirs': [
351                 '..',
352               ],
353               'defines': [
354                 '<@(nacl_win64_defines)',
355                 'COMPILE_CONTENT_STATICALLY',
356               ],
357               'configurations': {
358                 'Common_Base': {
359                   'msvs_target_platform': 'x64',
360                 },
361               },
362             },
363             {
364               'target_name': 'nacl_switches_win64',
365               'type': 'static_library',
366               'sources': [
367                 'nacl/common/nacl_switches.cc',
368                 'nacl/common/nacl_switches.h',
369               ],
370               'include_dirs': [
371                 '..',
372               ],
373               'configurations': {
374                 'Common_Base': {
375                   'msvs_target_platform': 'x64',
376                 },
377               },
378             },
379             {
380               'target_name': 'nacl_common_win64',
381               'type': 'static_library',
382               'defines': [
383                 'COMPILE_CONTENT_STATICALLY',
384               ],
385               'sources': [
386                 'nacl/common/nacl_cmd_line.cc',
387                 'nacl/common/nacl_cmd_line.h',
388                 'nacl/common/nacl_constants.cc',
389                 'nacl/common/nacl_constants.h',
390                 'nacl/common/nacl_messages.cc',
391                 'nacl/common/nacl_messages.h',
392                 'nacl/common/nacl_renderer_messages.cc',
393                 'nacl/common/nacl_renderer_messages.h',
394                 'nacl/common/nacl_types.cc',
395                 'nacl/common/nacl_types.h',
396                 'nacl/common/nacl_types_param_traits.cc',
397                 'nacl/common/nacl_types_param_traits.h',
398               ],
399               'include_dirs': [
400                 '..',
401               ],
402               'configurations': {
403                 'Common_Base': {
404                   'msvs_target_platform': 'x64',
405                 },
406               },
407             },
408           ],
409         }],
410       ],
411     }, {  # else (disable_nacl==1)
412       'targets': [
413         {
414           'target_name': 'nacl',
415           'type': 'none',
416           'sources': [],
417         },
418       ],
419       'conditions': [
420         ['OS=="win"', {
421           'targets': [
422             {
423               'target_name': 'nacl_win64',
424               'type': 'none',
425               'sources': [],
426             },
427             {
428               'target_name': 'nacl_switches_win64',
429               'type': 'none',
430               'sources': [],
431             },
432           ],
433         }],
434       ],
435     }],
436     ['disable_nacl!=1 and test_isolation_mode!="noop"', {
437       'targets': [
438         {
439           'target_name': 'nacl_loader_unittests_run',
440           'type': 'none',
441           'dependencies': [
442             'nacl_loader_unittests',
443           ],
444           'includes': [
445             '../build/isolate.gypi',
446           ],
447           'sources': [
448             'nacl_loader_unittests.isolate',
449           ],
450         },
451       ],
452     }],
453     ['disable_nacl==0 and disable_nacl_untrusted==0 and enable_nacl_nonsfi_test==1', {
454       'targets': [
455         {
456           'target_name': 'nacl_helper_nonsfi_unittests',
457           'type': '<(gtest_target_type)',
458           'sources': [
459             'nacl/loader/nonsfi/nacl_helper_nonsfi_unittests.cc',
460           ],
461           'dependencies': [
462             '../base/base.gyp:base',
463             '../base/base.gyp:test_launcher_nacl_nonsfi',
464             'nacl_nonsfi.gyp:nacl_helper_nonsfi_unittests_main',
465           ],
466         },
467       ],
468     }],
469   ],
470   'targets': [
471     {
472       'target_name': 'nacl_switches',
473       'type': 'static_library',
474       'sources': [
475         'nacl/common/nacl_switches.cc',
476         'nacl/common/nacl_switches.h',
477     ],
478       'include_dirs': [
479         '..',
480       ],
481     },
482     {
483       'target_name': 'nacl_common',
484       'type': 'static_library',
485       'sources': [
486         'nacl/common/nacl_cmd_line.cc',
487         'nacl/common/nacl_cmd_line.h',
488         'nacl/common/nacl_constants.cc',
489         'nacl/common/nacl_constants.h',
490         'nacl/common/nacl_host_messages.cc',
491         'nacl/common/nacl_host_messages.h',
492         'nacl/common/nacl_messages.cc',
493         'nacl/common/nacl_messages.h',
494         'nacl/common/nacl_nonsfi_util.cc',
495         'nacl/common/nacl_nonsfi_util.h',
496         'nacl/common/nacl_process_type.h',
497         'nacl/common/nacl_renderer_messages.cc',
498         'nacl/common/nacl_renderer_messages.h',
499         'nacl/common/nacl_sandbox_type.h',
500         'nacl/common/nacl_types.cc',
501         'nacl/common/nacl_types.h',
502         'nacl/common/nacl_types_param_traits.cc',
503         'nacl/common/nacl_types_param_traits.h',
504         'nacl/common/pnacl_types.cc',
505         'nacl/common/pnacl_types.h',
506       ],
507       'include_dirs': [
508         '..',
509       ],
510       'dependencies': [
511         '../content/content.gyp:content_common',
512       ],
513     },
514   ]