Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / native_client / tools.gyp
1 # Copyright (c) 2011 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.
4
5 {
6   ######################################################################
7   'includes': [
8     'build/common.gypi',
9   ],
10   ######################################################################
11   'variables': {
12     'disable_glibc%': 0,
13     'disable_newlib%': 0,
14     'disable_pnacl%': 0,
15     'disable_arm%': 0,
16     'disable_glibc_untar%': 0,
17     'disable_newlib_untar%': 0,
18     'disable_arm_untar%': 0,
19     'disable_pnacl_untar%': 0,
20     'conditions': [
21       ['OS=="android"', {
22         'TOOLCHAIN_OS': 'linux',
23       }, {
24         'TOOLCHAIN_OS': '<(OS)',
25       }],
26     ]
27   },
28   'targets' : [
29     {
30       'target_name': 'prep_toolchain',
31       'type': 'none',
32       'dependencies': [
33         'untar_toolchains',
34         'prep_nacl_sdk',
35       ],
36       'conditions': [
37         ['target_arch=="ia32" or target_arch=="x64"', {
38           'dependencies': [
39             'crt_init_32',
40             'crt_fini_32',
41             'crt_init_64',
42             'crt_fini_64',
43           ],
44         }],
45         ['target_arch=="arm"', {
46           'dependencies': [
47             'crt_init_arm',
48             'crt_fini_arm',
49           ]
50         }],
51       ],
52     },
53     {
54       'target_name': 'untar_toolchains',
55       'type': 'none',
56       'conditions': [
57         ['disable_newlib==0 and disable_newlib_untar==0', {
58           'actions': [
59             {
60               'action_name': 'Untar x86 newlib toolchain',
61               'msvs_cygwin_shell': 0,
62               'description': 'Untar x86 newlib toolchain',
63               'inputs': [
64                  '<(DEPTH)/native_client/build/package_version/package_version.py',
65                  '<(DEPTH)/native_client/toolchain/.tars/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib.json',
66               ],
67               'outputs': ['<(SHARED_INTERMEDIATE_DIR)/sdk/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib/nacl_x86_newlib.json'],
68               'action': [
69                 'python',
70                 '<(DEPTH)/native_client/build/package_version/package_version.py',
71                 '--quiet',
72                 '--packages', 'nacl_x86_newlib',
73                 '--tar-dir', '<(DEPTH)/native_client/toolchain/.tars',
74                 '--dest-dir', '<(SHARED_INTERMEDIATE_DIR)/sdk',
75                 'extract',
76               ],
77             },
78           ]
79         }],
80         ['disable_glibc==0 and disable_glibc_untar==0', {
81           'actions': [
82             {
83               'action_name': 'Untar x86 glibc toolchain',
84               'msvs_cygwin_shell': 0,
85               'description': 'Untar x86 glibc toolchain',
86               'inputs': [
87                 '<(DEPTH)/native_client/build/package_version/package_version.py',
88                 '<(DEPTH)/native_client/toolchain/.tars/<(TOOLCHAIN_OS)_x86/nacl_x86_glibc.json',
89               ],
90               'outputs': ['<(SHARED_INTERMEDIATE_DIR)/sdk/<(TOOLCHAIN_OS)_x86/nacl_x86_glibc/nacl_x86_glibc.json'],
91               'action': [
92                 'python',
93                 '<(DEPTH)/native_client/build/package_version/package_version.py',
94                 '--quiet',
95                 '--packages', 'nacl_x86_glibc',
96                 '--tar-dir', '<(DEPTH)/native_client/toolchain/.tars',
97                 '--dest-dir', '<(SHARED_INTERMEDIATE_DIR)/sdk',
98                 'extract',
99               ],
100             },
101           ]
102         }],
103         ['disable_pnacl==0 and disable_pnacl_untar==0', {
104           'actions': [
105             {
106               'action_name': 'Untar pnacl toolchain',
107               'msvs_cygwin_shell': 0,
108               'description': 'Untar pnacl toolchain',
109               'inputs': [
110                 '<(DEPTH)/native_client/build/package_version/package_version.py',
111                 '<(DEPTH)/native_client/toolchain/.tars/<(TOOLCHAIN_OS)_x86/pnacl_newlib.json',
112               ],
113               'outputs': ['<(SHARED_INTERMEDIATE_DIR)/sdk/<(TOOLCHAIN_OS)_x86/pnacl_newlib/pnacl_newlib.json'],
114               'action': [
115                 'python',
116                 '<(DEPTH)/native_client/build/package_version/package_version.py',
117                 '--quiet',
118                 '--packages', 'pnacl_newlib',
119                 '--tar-dir', '<(DEPTH)/native_client/toolchain/.tars',
120                 '--dest-dir', '<(SHARED_INTERMEDIATE_DIR)/sdk',
121                 'extract',
122               ],
123             },
124           ]
125         }],
126         ['target_arch=="arm" and disable_arm==0 and disable_arm_untar==0', {
127           'actions': [
128             {
129               'action_name': 'Untar arm toolchain',
130               'msvs_cygwin_shell': 0,
131               'description': 'Untar arm toolchain',
132               'inputs': [
133                 '<(DEPTH)/native_client/build/package_version/package_version.py',
134                 '<(DEPTH)/native_client/toolchain/.tars/<(TOOLCHAIN_OS)_x86/nacl_arm_newlib.json',
135               ],
136               'outputs': ['<(SHARED_INTERMEDIATE_DIR)/sdk/<(TOOLCHAIN_OS)_x86/nacl_arm_newlib/nacl_arm_newlib.json'],
137               'action': [
138                 'python',
139                 '<(DEPTH)/native_client/build/package_version/package_version.py',
140                 '--quiet',
141                 '--packages', 'nacl_arm_newlib',
142                 '--tar-dir', '<(DEPTH)/native_client/toolchain/.tars',
143                 '--dest-dir', '<(SHARED_INTERMEDIATE_DIR)/sdk',
144                 'extract',
145               ],
146             },
147           ]
148         }],
149       ]
150     },
151     {
152       'target_name': 'prep_nacl_sdk',
153       'type': 'none',
154       'dependencies': [
155         'untar_toolchains',
156       ],
157       'variables': {
158         'newlib_dir': '<(SHARED_INTERMEDIATE_DIR)/sdk/<(TOOLCHAIN_OS)_x86/nacl_x86_newlib',
159         'glibc_dir': '<(SHARED_INTERMEDIATE_DIR)/sdk/<(TOOLCHAIN_OS)_x86/nacl_x86_glibc',
160         'pnacl_dir': '<(SHARED_INTERMEDIATE_DIR)/sdk/<(TOOLCHAIN_OS)_x86/pnacl_newlib',
161         'arm_dir': '<(SHARED_INTERMEDIATE_DIR)/sdk/<(TOOLCHAIN_OS)_x86/nacl_arm_newlib',
162       },
163       'conditions': [
164         ['disable_newlib==0', {
165           'actions': [
166             {
167               'action_name': 'Prep x86 newlib toolchain',
168               'msvs_cygwin_shell': 0,
169               'description': 'Prep x86 newlib toolchain',
170               'inputs': [
171                  '<(newlib_dir)/nacl_x86_newlib.json',
172                  '>!@pymod_do_main(prep_nacl_sdk --inputs --tool x86_newlib)',
173               ],
174               'outputs': ['<(newlib_dir)/stamp.prep'],
175               'action': [
176                 'python',
177                 '<(DEPTH)/native_client/build/prep_nacl_sdk.py',
178                 '--tool', 'x86_newlib',
179                 '--path', '<(newlib_dir)',
180               ],
181             },
182           ]
183         }],
184         ['disable_glibc==0', {
185           'actions': [
186             {
187               'action_name': 'Prep x86 glibc toolchain',
188               'msvs_cygwin_shell': 0,
189               'description': 'Prep x86 glibc toolchain',
190               'inputs': [
191                  '<(glibc_dir)/nacl_x86_glibc.json',
192                  '>!@pymod_do_main(prep_nacl_sdk --inputs --tool x86_glibc)',
193               ],
194               'outputs': ['<(glibc_dir)/stamp.prep'],
195               'action': [
196                 'python',
197                 '<(DEPTH)/native_client/build/prep_nacl_sdk.py',
198                 '--tool', 'x86_glibc',
199                 '--path', '<(glibc_dir)',
200               ],
201             },
202           ]
203         }],
204         ['target_arch=="arm" and disable_arm==0', {
205           'actions': [
206             {
207               'action_name': 'Prep arm toolchain',
208               'msvs_cygwin_shell': 0,
209               'description': 'Prep arm toolchain',
210               'inputs': [
211                  '<(arm_dir)/nacl_arm_newlib.json',
212                  '>!@pymod_do_main(prep_nacl_sdk --inputs --tool arm_newlib)',
213               ],
214               'outputs': ['<(arm_dir)/stamp.prep'],
215               'action': [
216                 'python',
217                 '<(DEPTH)/native_client/build/prep_nacl_sdk.py',
218                 '--tool', 'arm_newlib',
219                 '--path', '<(arm_dir)',
220               ],
221             },
222           ]
223         }],
224         ['disable_pnacl==0', {
225           'actions': [
226             {
227               'action_name': 'Prep pnacl toolchain',
228               'msvs_cygwin_shell': 0,
229               'description': 'Prep pnacl toolchain',
230               'inputs': [
231                  '<(pnacl_dir)/pnacl_newlib.json',
232                  '>!@pymod_do_main(prep_nacl_sdk --inputs --tool pnacl)',
233               ],
234               'outputs': ['<(pnacl_dir)/stamp.prep'],
235               'action': [
236                 'python',
237                 '<(DEPTH)/native_client/build/prep_nacl_sdk.py',
238                 '--tool', 'pnacl',
239                 '--path', '<(pnacl_dir)',
240               ],
241             },
242           ]
243         }],
244       ]
245     },
246   ],
247   # The crt_init_* targets only need to be built for non-pnacl newlib-based
248   # toolchains (and for the IRT if the IRT is built with such a toolchain).
249   'conditions': [
250     ['target_arch=="ia32" or target_arch=="x64"', {
251       'targets' : [
252         {
253           'target_name': 'crt_init_64',
254           'type': 'none',
255           'dependencies': [
256             'untar_toolchains',
257             'prep_nacl_sdk'
258           ],
259           'variables': {
260             'nlib_target': 'crti.o',
261             'windows_asm_rule': 0,
262             'build_glibc': 0,
263             'build_newlib': 1,
264             'build_irt': 0,
265             'enable_x86_32': 0,
266             'extra_args': [
267               '--compile',
268               '--no-suffix',
269               '--strip=_x86_64'
270             ],
271           },
272           'sources': [
273             'src/untrusted/stubs/crti_x86_64.S',
274           ]
275         },
276         {
277           'target_name': 'crt_fini_64',
278           'type': 'none',
279           'dependencies': [
280             'untar_toolchains',
281             'prep_nacl_sdk'
282           ],
283           'variables': {
284             'nlib_target': 'crtn.o',
285             'windows_asm_rule': 0,
286             'build_glibc': 0,
287             'build_newlib': 1,
288             'build_irt': 0,
289             'enable_x86_32': 0,
290             'extra_args': [
291               '--compile',
292               '--no-suffix',
293               '--strip=_x86_64'
294             ],
295           },
296           'sources': [
297             'src/untrusted/stubs/crtn_x86_64.S'
298           ],
299         }
300       ],
301     }],
302     ['target_arch=="ia32" or target_arch=="x64"', {
303       'targets' : [
304         {
305           'target_name': 'crt_init_32',
306           'type': 'none',
307           'dependencies': [
308             'untar_toolchains',
309             'prep_nacl_sdk'
310           ],
311           'variables': {
312             'nlib_target': 'crti.o',
313             'windows_asm_rule': 0,
314             'build_glibc': 0,
315             'build_newlib': 1,
316             'build_irt': 0,
317             'enable_x86_64': 0,
318             'extra_args': [
319               '--compile',
320               '--no-suffix',
321               '--strip=_x86_32'
322             ],
323           },
324           'sources': [
325             'src/untrusted/stubs/crti_x86_32.S',
326           ],
327         },
328         {
329           'target_name': 'crt_fini_32',
330           'type': 'none',
331           'dependencies': [
332             'untar_toolchains',
333             'prep_nacl_sdk'
334           ],
335           'variables': {
336             'nlib_target': 'crtn.o',
337             'windows_asm_rule': 0,
338             'build_glibc': 0,
339             'build_newlib': 1,
340             'build_irt': 0,
341             'enable_x86_64': 0,
342             'extra_args': [
343               '--compile',
344               '--no-suffix',
345               '--strip=_x86_32'
346             ],
347           },
348           'sources': [
349             'src/untrusted/stubs/crtn_x86_32.S'
350           ],
351         }
352       ],
353     }],
354     ['target_arch=="arm"', {
355       'targets' : [
356         {
357           'target_name': 'crt_init_arm',
358           'type': 'none',
359           'dependencies': [
360             'untar_toolchains',
361             'prep_nacl_sdk'
362           ],
363           'variables': {
364             'nlib_target': 'crti.o',
365             'windows_asm_rule': 0,
366             'build_glibc': 0,
367             'build_newlib': 1,
368             'build_irt': 1,
369             'extra_args': [
370               '--compile',
371               '--no-suffix',
372               '--strip=_arm'
373             ],
374           },
375           'sources': [
376             'src/untrusted/stubs/crti_arm.S',
377           ],
378         },
379         {
380           'target_name': 'crt_fini_arm',
381           'type': 'none',
382           'dependencies': [
383             'untar_toolchains',
384             'prep_nacl_sdk'
385           ],
386           'variables': {
387             'nlib_target': 'crtn.o',
388             'windows_asm_rule': 0,
389             'build_glibc': 0,
390             'build_newlib': 1,
391             'build_irt': 1,
392             'extra_args': [
393               '--compile',
394               '--no-suffix',
395               '--strip=_arm'
396             ],
397           },
398           'sources': [
399             'src/untrusted/stubs/crtn_arm.S'
400           ],
401         }
402       ],
403     }],
404   ],
405 }