Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / native_client / src / trusted / service_runtime / service_runtime.gyp
1 # -*- gyp -*-
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 {
7   'variables': {
8     'conditions': [
9       ['OS=="linux"', {
10         'syscall_handler': [
11           'posix/nacl_syscall_impl.c'
12         ],
13       }],
14       ['OS=="mac"', {
15         'syscall_handler': [
16           'posix/nacl_syscall_impl.c'
17         ],
18       }],
19       ['OS=="win"', {
20         'syscall_handler': [
21           'win/nacl_syscall_impl.c'
22         ],
23         'msvs_cygwin_shell': 0,
24       }],
25     ],
26   },
27   'includes': [
28     '../../../build/common.gypi',
29   ],
30   'target_defaults': {
31     'variables':{
32       'target_base': 'none',
33     },
34     'target_conditions': [
35       ['target_base=="sel"', {
36         'sources': [
37           'dyn_array.c',
38           'elf_util.c',
39           'load_file.c',
40           'nacl_all_modules.c',
41           'nacl_app_thread.c',
42           'nacl_bootstrap_channel_error_reporter.c',
43           'nacl_copy.c',
44           'nacl_desc_effector_ldr.c',
45           'nacl_desc_postmessage.c',
46           'nacl_error_gio.c',
47           'nacl_error_log_hook.c',
48           'nacl_globals.c',
49           'nacl_kernel_service.c',
50           'nacl_resource.c',
51           'nacl_reverse_host_interface.c',
52           'nacl_reverse_quota_interface.c',
53           'nacl_runtime_host_interface.c',
54           'nacl_secure_service.c',
55           'nacl_signal_common.c',
56           'nacl_stack_safety.c',
57           'nacl_syscall_common.c',
58           'nacl_syscall_hook.c',
59           'nacl_text.c',
60           'nacl_valgrind_hooks.c',
61           'name_service/default_name_service.c',
62           'name_service/name_service.c',
63           'sel_addrspace.c',
64           'sel_ldr.c',
65           'sel_ldr_standard.c',
66           'sel_ldr_thread_interface.c',
67           # TODO(mseaborn): Move sel_main_chrome.c to the
68           # "sel_main_chrome" library once Chromium is changed to
69           # depend on that rather than on "sel".
70           'sel_main_chrome.c',
71           'sel_mem.c',
72           'sel_qualify.c',
73           'sel_validate_image.c',
74           'sys_exception.c',
75           'sys_fdio.c',
76           'sys_filename.c',
77           'sys_futex.c',
78           'sys_imc.c',
79           'sys_list_mappings.c',
80           'sys_memory.c',
81           'sys_parallel_io.c',
82           'thread_suspension_common.c',
83           'thread_suspension_unwind.c',
84         ],
85         'include_dirs': [
86           # For generated header files from the x86-64 validator,
87           # e.g. nacl_disallows.h.
88           '<(SHARED_INTERMEDIATE_DIR)',
89         ],
90         'sources!': [
91            '<(syscall_handler)',
92         ],
93         'actions': [
94           {
95             'action_name': 'nacl_syscall_handler',
96             'inputs': [
97               'nacl_syscall_handlers_gen.py',
98               '<(syscall_handler)',
99             ],
100             'action':
101               # TODO(gregoryd): find out how to generate a file
102               # in such a location that can be found in both
103               # NaCl and Chrome builds.
104               ['python', 'nacl_syscall_handlers_gen.py',
105                '-i', '<@(syscall_handler)',
106                '-o', '<@(_outputs)'],
107
108             'msvs_cygwin_shell': 0,
109             'msvs_quote_cmd': 0,
110             'outputs': [
111               '<(INTERMEDIATE_DIR)/nacl_syscall_handlers.c',
112             ],
113             'process_outputs_as_sources': 1,
114             'message': 'Creating nacl_syscall_handlers.c',
115           },
116         ],
117         'conditions': [
118             ['OS=="mac"', {
119               'sources': [
120                 'osx/crash_filter.c',
121                 'osx/mach_exception_handler.c',
122                 'osx/mach_thread_map.c',
123                 'osx/nacl_ldt.c',
124                 'osx/nacl_thread_nice.c',
125                 'osx/outer_sandbox.c',
126                 'osx/thread_suspension.c',
127                 'posix/addrspace_teardown.c',
128                 'posix/sel_memory.c',
129                 'posix/x86/sel_segments.c',
130               ],
131               'actions': [
132                 {
133                   'action_name': 'mig_exc_generation',
134                   'variables': {
135                     'gen_dir': '<(INTERMEDIATE_DIR)/native_client/src/trusted/service_runtime',
136                   },
137                   'inputs': [
138                     'osx/run_mig.py',
139                     '$(SDKROOT)/usr/include/mach/exc.defs',
140                   ],
141                   'outputs': [
142                     '<(gen_dir)/nacl_exc.h',
143                     '<(gen_dir)/nacl_exc_server.c',
144                   ],
145                   'process_outputs_as_sources': 1,
146                   'action': [
147                     'python', '<@(_inputs)', '<@(_outputs)',
148                   ],
149                   'message': 'Generating mig plumbing for exc.defs',
150                 },
151               ],
152               'include_dirs': [
153                 '<(INTERMEDIATE_DIR)',
154               ],
155             }],
156             ['OS=="win"', {
157               'sources': [
158                 'win/addrspace_teardown.c',
159                 'win/debug_exception_handler.c',
160                 'win/debug_exception_handler_standalone.c',
161                 'win/nacl_ldt.c',
162                 'win/nacl_thread_nice.c',
163                 'win/sel_memory.c',
164                 'win/sel_segments.c',
165                 'win/thread_handle_map.c',
166               ],
167             }],
168             # TODO(gregoryd): move arm-specific stuff into a separate gyp file.
169             ['target_arch=="arm"', {
170               'sources': [
171                 'arch/arm/nacl_app.c',
172                 'arch/arm/nacl_switch_to_app_arm.c',
173                 'arch/arm/sel_rt.c',
174                 'arch/arm/nacl_tls.c',
175                 'arch/arm/sel_ldr_arm.c',
176                 'arch/arm/sel_addrspace_arm.c',
177                 'arch/arm/nacl_switch.S',
178                 'arch/arm/nacl_syscall.S',
179                 'arch/arm/tramp_arm.S',
180                 'linux/nacl_signal_arm.c',
181               ],
182             }],
183             ['target_arch=="mipsel"', {
184               'sources': [
185                 'arch/mips/nacl_app.c',
186                 'arch/mips/nacl_switch.S',
187                 'arch/mips/nacl_switch_to_app_mips.c',
188                 'arch/mips/nacl_syscall.S',
189                 'arch/mips/nacl_tls.c',
190                 'arch/mips/sel_addrspace_mips.c',
191                 'arch/mips/sel_ldr_mips.c',
192                 'arch/mips/sel_rt.c',
193                 'arch/mips/tramp_mips.S',
194                 'linux/nacl_signal_mips.c',
195               ],
196             }],
197             ['OS=="linux"', {
198               'sources': [
199                 'linux/nacl_bootstrap_args.c',
200                 'linux/nacl_thread_nice.c',
201                 'linux/r_debug.c',
202                 'linux/reserved_at_zero.c',
203                 'linux/thread_suspension.c',
204                 'posix/addrspace_teardown.c',
205                 'posix/sel_memory.c',
206               ],
207               'conditions': [
208                 ['target_arch=="ia32" or target_arch=="x64"', {
209                   'sources': [
210                     'linux/x86/nacl_ldt.c',
211                     'posix/x86/sel_segments.c',
212                   ],
213                 }],
214                 ['target_arch=="arm"', {
215                   'sources': [
216                     'linux/arm/sel_segments.c',
217                   ],
218                 }],
219                 ['target_arch=="mipsel"', {
220                   'sources': [
221                     'linux/mips/sel_segments.c',
222                   ],
223                 }],
224               ],
225             }],
226             ['OS=="linux" or OS=="mac" or OS=="FreeBSD"', {
227               'sources': [
228                 'posix/nacl_signal_stack.c',
229                 'posix/sel_addrspace_posix.c',
230                ],
231             }],
232             ['OS=="win"', {
233               'sources': [
234                 'win/nacl_signal_stack.c',
235                 'win/sel_addrspace_win.c',
236                 'win/thread_suspension.c',
237                 'win/vm_hole.c',
238               ],
239             }],
240             ['OS!="win"', {
241               'sources': [
242                 'generic/vm_hole.c',
243               ],
244             }],
245           ],
246         }],
247       ],
248    },
249   'targets': [
250     {
251       'target_name': 'sel',
252       'type': 'static_library',
253       'variables': {
254         'target_base': 'sel',
255       },
256       'dependencies': [
257         'env_cleanser',
258         'nacl_error_code',
259         '<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio',
260         '<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform',
261         '<(DEPTH)/native_client/src/shared/srpc/srpc.gyp:nonnacl_srpc',
262         '<(DEPTH)/native_client/src/trusted/debug_stub/debug_stub.gyp:debug_stub',
263         '<(DEPTH)/native_client/src/trusted/desc/desc.gyp:nrd_xfer',
264         '<(DEPTH)/native_client/src/trusted/desc_cacheability/desc_cacheability.gyp:desc_cacheability',
265         '<(DEPTH)/native_client/src/trusted/fault_injection/fault_injection.gyp:nacl_fault_inject',
266         '<(DEPTH)/native_client/src/trusted/gio/gio_wrapped_desc.gyp:gio_wrapped_desc',
267         '<(DEPTH)/native_client/src/trusted/interval_multiset/interval_multiset.gyp:nacl_interval',
268         '<(DEPTH)/native_client/src/trusted/perf_counter/perf_counter.gyp:nacl_perf_counter',
269         '<(DEPTH)/native_client/src/trusted/platform_qualify/platform_qualify.gyp:platform_qual_lib',
270         '<(DEPTH)/native_client/src/trusted/manifest_name_service_proxy/manifest_name_service_proxy.gyp:manifest_proxy',
271         '<(DEPTH)/native_client/src/trusted/simple_service/simple_service.gyp:simple_service',
272         '<(DEPTH)/native_client/src/trusted/threading/threading.gyp:thread_interface',
273         '<(DEPTH)/native_client/src/trusted/validator/validator.gyp:validation_cache',
274         '<(DEPTH)/native_client/src/trusted/validator/validator.gyp:validators',
275       ],
276       'conditions': [
277         ['target_arch=="arm"', {
278           'dependencies': [
279             '<(DEPTH)/native_client/src/trusted/validator_arm/validator_arm.gyp:ncvalidate_arm_v2',
280           ],
281         }],
282         ['target_arch=="mipsel"', {
283           'dependencies': [
284             '<(DEPTH)/native_client/src/trusted/validator_mips/validator_mips.gyp:ncvalidate_mips',
285           ],
286         }],
287         ['target_arch=="ia32" or target_arch=="x64"', {
288           'dependencies': [
289             'arch/x86/service_runtime_x86.gyp:service_runtime_x86_common',
290           ],
291         }],
292         ['target_arch == "ia32"', {
293           'dependencies': [
294             'arch/x86_32/service_runtime_x86_32.gyp:service_runtime_x86_32',
295             '<(DEPTH)/native_client/src/trusted/validator_x86/validator_x86.gyp:nccopy_x86_32',
296           ],
297         }],
298         ['target_arch == "x64"', {
299           'dependencies': [
300             'arch/x86_64/service_runtime_x86_64.gyp:service_runtime_x86_64',
301             '<(DEPTH)/native_client/src/trusted/validator_x86/validator_x86.gyp:nccopy_x86_64',
302           ],
303         }],
304         ['OS=="linux" or OS=="FreeBSD"', {
305           'dependencies': [
306             'nacl_signal',
307           ],
308         }],
309       ],
310     }, {
311       'target_name': 'nacl_error_code',
312       'type': 'static_library',
313       'sources': [
314         'nacl_error_code.c',
315       ],
316     }, {
317       'target_name': 'env_cleanser',
318       'type': 'static_library',
319       'sources': [
320         'env_cleanser.c',
321       ],
322     }, {
323       'target_name': 'sel_main_chrome',
324       'type': 'none',
325       'dependencies': [
326         'sel',
327       ],
328     }, {
329       'target_name': 'sel_main',
330       'type': 'static_library',
331       'sources': [
332         'sel_main.c',
333       ],
334       'dependencies': [
335         'sel',
336       ],
337     }, {
338       'target_name': 'sel_ldr',
339       'type': 'executable',
340       'dependencies': [
341         'sel_main',
342         '<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform',
343         '<(DEPTH)/native_client/src/trusted/gio/gio_wrapped_desc.gyp:gio_wrapped_desc',
344       ],
345       'sources': [
346         'nacl_test_injection_main.c',
347         'force_cpp.cc',
348       ],
349       'conditions': [
350         ['OS=="linux"', {
351           'dependencies': [
352             'linux/nacl_bootstrap.gyp:nacl_helper_bootstrap',
353           ],
354           'ldflags': [
355             '-pie',
356           ],
357         }],
358       ],
359     },
360   ],
361   'conditions': [
362     ['OS=="win" and target_arch=="ia32"', {
363       'targets': [
364         {
365           'target_name': 'sel64',
366           'type': 'static_library',
367           'variables': {
368             'target_base': 'sel',
369             'win_target': 'x64',
370           },
371           'dependencies': [
372             'env_cleanser64',
373             'nacl_error_code64',
374             '<(DEPTH)/native_client/src/shared/gio/gio.gyp:gio64',
375             '<(DEPTH)/native_client/src/shared/srpc/srpc.gyp:nonnacl_srpc64',
376             '<(DEPTH)/native_client/src/trusted/debug_stub/debug_stub.gyp:debug_stub64',
377             '<(DEPTH)/native_client/src/trusted/desc/desc.gyp:nrd_xfer64',
378             '<(DEPTH)/native_client/src/trusted/desc_cacheability/desc_cacheability.gyp:desc_cacheability64',
379             '<(DEPTH)/native_client/src/trusted/fault_injection/fault_injection.gyp:nacl_fault_inject64',
380             '<(DEPTH)/native_client/src/trusted/gio/gio_wrapped_desc.gyp:gio_wrapped_desc64',
381             '<(DEPTH)/native_client/src/trusted/interval_multiset/interval_multiset.gyp:nacl_interval64',
382             '<(DEPTH)/native_client/src/trusted/perf_counter/perf_counter.gyp:nacl_perf_counter64',
383             '<(DEPTH)/native_client/src/trusted/platform_qualify/platform_qualify.gyp:platform_qual_lib64',
384             '<(DEPTH)/native_client/src/trusted/manifest_name_service_proxy/manifest_name_service_proxy.gyp:manifest_proxy64',
385             '<(DEPTH)/native_client/src/trusted/simple_service/simple_service.gyp:simple_service64',
386             '<(DEPTH)/native_client/src/trusted/threading/threading.gyp:thread_interface64',
387             '<(DEPTH)/native_client/src/trusted/validator_x86/validator_x86.gyp:nccopy_x86_64',
388             '<(DEPTH)/native_client/src/trusted/validator/validator.gyp:validation_cache64',
389             '<(DEPTH)/native_client/src/trusted/validator/validator.gyp:validators64',
390             'arch/x86/service_runtime_x86.gyp:service_runtime_x86_common64',
391             'arch/x86_64/service_runtime_x86_64.gyp:service_runtime_x86_64',
392           ],
393         }, {
394           'target_name': 'nacl_error_code64',
395           'type': 'static_library',
396           'variables': {
397             'win_target': 'x64',
398           },
399           'sources': [
400             'nacl_error_code.c',
401           ],
402         },
403         {
404           'target_name': 'env_cleanser64',
405           'type': 'static_library',
406           'variables': {
407             'win_target': 'x64',
408           },
409           'sources': [
410             'env_cleanser.c',
411           ],
412         },
413         {
414           'target_name': 'sel_main_chrome64',
415           'type': 'none',
416           'variables': {
417             'win_target': 'x64',
418           },
419           'dependencies': [
420             'sel64',
421           ],
422         },
423         {
424           'target_name': 'sel_main64',
425           'type': 'static_library',
426           'sources': [
427             'sel_main.c',
428           ],
429           'dependencies': [
430             'sel64',
431           ],
432           'variables': {
433             'win_target': 'x64',
434           },
435         },
436         {
437           'target_name': 'sel_ldr64',
438           'type': 'executable',
439           'variables': {
440             'win_target': 'x64',
441           },
442           'dependencies': [
443             'sel_main64',
444             '<(DEPTH)/native_client/src/shared/platform/platform.gyp:platform64',
445             '<(DEPTH)/native_client/src/trusted/gio/gio_wrapped_desc.gyp:gio_wrapped_desc64',
446           ],
447           'sources': [
448             'nacl_test_injection_main.c',
449           ],
450         },
451       ],
452     }],
453     ['OS=="linux" or OS=="FreeBSD"', {
454       'targets': [
455         {
456           # This has to be an independent target in order to benefit from
457           # specific flags.
458           'target_name': 'nacl_signal',
459           'type': 'static_library',
460           'conditions': [
461             ['target_arch=="ia32"', {
462               # nacl_signal.c needs to be compiled without the stack
463               # protector on i386.
464               # See https://code.google.com/p/nativeclient/issues/detail?id=3581.
465               'cflags!': [
466                 '-fstack-protector',
467                 '-fstack-protector-all',
468               ],
469               'cflags': [
470                 '-fno-stack-protector',
471               ],
472             }],
473           ],
474           'sources': [
475             'linux/nacl_signal.c',
476           ],
477         },
478       ],
479     }],
480   ],
481 }