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