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