Allow chrome.systemPrivate to be used by apps.
[chromium-blink-merge.git] / components / nacl.gyp
bloba9933cad5a19654dd229878f17971b3772c0bd89
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/platform_info.cc',
171             'nacl/renderer/platform_info.h',
172             'nacl/renderer/pnacl_translation_resource_host.cc',
173             'nacl/renderer/pnacl_translation_resource_host.h',
174             'nacl/renderer/ppb_nacl_private_impl.cc',
175             'nacl/renderer/ppb_nacl_private_impl.h',
176             'nacl/renderer/progress_event.cc',
177             'nacl/renderer/progress_event.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           ],
189           'defines': [
190             '<@(nacl_defines)',
191           ],
192           'direct_dependent_settings': {
193             'defines': [
194               '<@(nacl_defines)',
195             ],
196           },
197         },
198         {
199           'target_name': 'nacl_loader_unittests',
200           'type': '<(gtest_target_type)',
201           'sources': [
202             'nacl/loader/run_all_unittests.cc',
203           ],
204           'dependencies': [
205             'nacl',
206             '../base/base.gyp:test_support_base',
207             '../testing/gtest.gyp:gtest',
208           ],
209           'conditions': [
210             ['OS=="linux"', {
211               'sources': [
212                 # TODO(mazda): Move this to browser_tests once we have
213                 # established a way to run browser_tests on ARM Chrome OS
214                 # devices (http://crbug.com/364729).
215                 'nacl/loader/nonsfi/irt_icache_unittest.cc',
216                 # TODO(hamaji): Currently, we build them twice. Stop building
217                 # them for components_unittests. See crbug.com/364751
218                 'nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc',
219                 'nacl/loader/nonsfi/nonsfi_sandbox_sigsys_unittest.cc',
220               ],
221               'dependencies': [
222                 'nacl_linux',
223                 '../sandbox/sandbox.gyp:sandbox_linux_test_utils',
224               ],
225             }],
226           ],
227         },
228       ],
229       'conditions': [
230         ['OS=="linux"', {
231           'targets': [
232             {
233               'target_name': 'nacl_helper',
234               'type': 'executable',
235               'include_dirs': [
236                 '..',
237               ],
238               'sources': [
239                 'nacl/loader/nacl_helper_linux.cc',
240                 'nacl/loader/nacl_helper_linux.h',
241               ],
242               'dependencies': [
243                 'nacl_linux',
244               ],
245               'cflags': ['-fPIE'],
246               'ldflags!': [
247                 # Do not pick the default ASan options from
248                 # base/debug/sanitizer_options.cc to avoid a conflict with those
249                 # in nacl/nacl_helper_linux.cc.
250                 '-Wl,-u_sanitizer_options_link_helper',
251               ],
252               'link_settings': {
253                 'ldflags': ['-pie'],
254               },
255             }, {
256               'target_name': 'nacl_linux',
257               'type': 'static_library',
258               'include_dirs': [
259                 '..',
260               ],
261               'defines': [
262                 '<@(nacl_defines)',
263                 # Allow .cc files to know if they're being compiled as part
264                 # of nacl_helper.
265                 'IN_NACL_HELPER=1',
266               ],
267               'sources': [
268                 'nacl/loader/nonsfi/abi_conversion.cc',
269                 'nacl/loader/nonsfi/abi_conversion.h',
270                 'nacl/loader/nonsfi/elf_loader.cc',
271                 'nacl/loader/nonsfi/elf_loader.h',
272                 'nacl/loader/nonsfi/irt_basic.cc',
273                 'nacl/loader/nonsfi/irt_clock.cc',
274                 'nacl/loader/nonsfi/irt_exception_handling.cc',
275                 'nacl/loader/nonsfi/irt_fdio.cc',
276                 'nacl/loader/nonsfi/irt_futex.cc',
277                 'nacl/loader/nonsfi/irt_icache.cc',
278                 'nacl/loader/nonsfi/irt_interfaces.cc',
279                 'nacl/loader/nonsfi/irt_interfaces.h',
280                 'nacl/loader/nonsfi/irt_memory.cc',
281                 'nacl/loader/nonsfi/irt_ppapi.cc',
282                 'nacl/loader/nonsfi/irt_random.cc',
283                 'nacl/loader/nonsfi/irt_resource_open.cc',
284                 'nacl/loader/nonsfi/irt_thread.cc',
285                 'nacl/loader/nonsfi/irt_util.h',
286                 'nacl/loader/nonsfi/nonsfi_main.cc',
287                 'nacl/loader/nonsfi/nonsfi_main.h',
288                 'nacl/loader/nonsfi/nonsfi_sandbox.cc',
289                 'nacl/loader/nonsfi/nonsfi_sandbox.h',
290                 'nacl/loader/sandbox_linux/nacl_bpf_sandbox_linux.cc',
291                 'nacl/loader/sandbox_linux/nacl_sandbox_linux.cc',
292                 '../ppapi/nacl_irt/irt_manifest.h',
293                 '../ppapi/nacl_irt/manifest_service.cc',
294                 '../ppapi/nacl_irt/manifest_service.h',
295                 '../ppapi/nacl_irt/plugin_main.cc',
296                 '../ppapi/nacl_irt/plugin_main.h',
297                 '../ppapi/nacl_irt/plugin_startup.cc',
298                 '../ppapi/nacl_irt/plugin_startup.h',
299                 '../ppapi/nacl_irt/ppapi_dispatcher.cc',
300                 '../ppapi/nacl_irt/ppapi_dispatcher.h',
301               ],
302               'dependencies': [
303                 'nacl',
304                 'nacl_common',
305                 'nacl_switches',
306                 '../components/tracing.gyp:tracing',
307                 '../crypto/crypto.gyp:crypto',
308                 '../sandbox/sandbox.gyp:libc_urandom_override',
309                 '../sandbox/sandbox.gyp:sandbox',
310                 '../ppapi/ppapi_internal.gyp:ppapi_proxy',
311               ],
312               'conditions': [
313                 ['use_glib == 1', {
314                   'dependencies': [
315                     '../build/linux/system.gyp:glib',
316                   ],
317                 }],
318                 ['os_posix == 1 and OS != "mac"', {
319                   'conditions': [
320                     ['use_allocator!="none"', {
321                       'dependencies': [
322                         '../base/allocator/allocator.gyp:allocator',
323                       ],
324                     }],
325                   ],
326                 }],
327                 ['use_seccomp_bpf == 0', {
328                   'sources!': [
329                     '../content/common/sandbox_linux/sandbox_bpf_base_policy_linux.cc',
330                     '../content/common/sandbox_linux/sandbox_init_linux.cc',
331                   ],
332                 }, {
333                   'defines': ['USE_SECCOMP_BPF'],
334                 }],
335               ],
336               'cflags': ['-fPIE'],
337             },
338           ],
339         }],
340         ['OS=="win" and target_arch=="ia32"', {
341           'targets': [
342             {
343               'target_name': 'nacl_win64',
344               'type': 'static_library',
345               'variables': {
346                 'nacl_target': 1,
347               },
348               'dependencies': [
349                 'nacl_common_win64',
350                 '../native_client/src/trusted/service_runtime/service_runtime.gyp:sel_main_chrome64',
351                 '../ppapi/ppapi_internal.gyp:ppapi_shared_win64',
352                 '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64',
353               ],
354               'export_dependent_settings': [
355                 '../ppapi/ppapi_internal.gyp:ppapi_ipc_win64',
356               ],
357               'sources': [
358                 '../components/nacl/broker/nacl_broker_listener.cc',
359                 '../components/nacl/broker/nacl_broker_listener.h',
360                 '../components/nacl/common/nacl_debug_exception_handler_win.cc',
361                 '../components/nacl/loader/nacl_helper_win_64.cc',
362                 '../components/nacl/loader/nacl_helper_win_64.h',
363               ],
364               'include_dirs': [
365                 '..',
366               ],
367               'defines': [
368                 '<@(nacl_win64_defines)',
369                 'COMPILE_CONTENT_STATICALLY',
370               ],
371               'configurations': {
372                 'Common_Base': {
373                   'msvs_target_platform': 'x64',
374                 },
375               },
376               'direct_dependent_settings': {
377                 'defines': [
378                   '<@(nacl_defines)',
379                 ],
380               },
381             },
382             {
383               'target_name': 'nacl_switches_win64',
384               'type': 'static_library',
385               'sources': [
386                 'nacl/common/nacl_switches.cc',
387                 'nacl/common/nacl_switches.h',
388               ],
389               'include_dirs': [
390                 '..',
391               ],
392               'configurations': {
393                 'Common_Base': {
394                   'msvs_target_platform': 'x64',
395                 },
396               },
397             },
398             {
399               'target_name': 'nacl_common_win64',
400               'type': 'static_library',
401               'defines': [
402                 'COMPILE_CONTENT_STATICALLY',
403               ],
404               'sources': [
405                 'nacl/common/nacl_cmd_line.cc',
406                 'nacl/common/nacl_cmd_line.h',
407                 'nacl/common/nacl_messages.cc',
408                 'nacl/common/nacl_messages.h',
409                 'nacl/common/nacl_types.cc',
410                 'nacl/common/nacl_types.h',
411               ],
412               'include_dirs': [
413                 '..',
414               ],
415               'configurations': {
416                 'Common_Base': {
417                   'msvs_target_platform': 'x64',
418                 },
419               },
420             },
421           ],
422         }],
423       ],
424     }, {  # else (disable_nacl==1)
425       'targets': [
426         {
427           'target_name': 'nacl',
428           'type': 'none',
429           'sources': [],
430         },
431       ],
432       'conditions': [
433         ['OS=="win"', {
434           'targets': [
435             {
436               'target_name': 'nacl_win64',
437               'type': 'none',
438               'sources': [],
439             },
440             {
441               'target_name': 'nacl_switches_win64',
442               'type': 'none',
443               'sources': [],
444             },
445           ],
446         }],
447       ],
448     }],
449     ['disable_nacl!=1 and test_isolation_mode!="noop"', {
450       'targets': [
451         {
452           'target_name': 'nacl_loader_unittests_run',
453           'type': 'none',
454           'dependencies': [
455             'nacl_loader_unittests',
456           ],
457           'includes': [
458             '../build/isolate.gypi',
459             'nacl_loader_unittests.isolate',
460           ],
461           'sources': [
462             'nacl_loader_unittests.isolate',
463           ],
464         },
465       ],
466     }],
467   ],
468   'targets': [
469     {
470       'target_name': 'nacl_switches',
471       'type': 'static_library',
472       'sources': [
473         'nacl/common/nacl_switches.cc',
474         'nacl/common/nacl_switches.h',
475     ],
476       'include_dirs': [
477         '..',
478       ],
479     },
480     {
481       'target_name': 'nacl_common',
482       'type': 'static_library',
483       'sources': [
484         'nacl/common/nacl_cmd_line.cc',
485         'nacl/common/nacl_cmd_line.h',
486         'nacl/common/nacl_host_messages.h',
487         'nacl/common/nacl_host_messages.cc',
488         'nacl/common/nacl_messages.cc',
489         'nacl/common/nacl_messages.h',
490         'nacl/common/nacl_nonsfi_util.cc',
491         'nacl/common/nacl_nonsfi_util.h',
492         'nacl/common/nacl_process_type.h',
493         'nacl/common/nacl_sandbox_type_mac.h',
494         'nacl/common/nacl_types.cc',
495         'nacl/common/nacl_types.h',
496         'nacl/common/pnacl_types.cc',
497         'nacl/common/pnacl_types.h',
498       ],
499       'include_dirs': [
500         '..',
501       ],
502       'dependencies': [
503         '../content/content.gyp:content_common',
504       ],
505     },
506   ]