Roll src/third_party/WebKit ef7cfd7:80927b2 (svn 194570:194575)
[chromium-blink-merge.git] / ppapi / ppapi_nacl_test_common.gypi
blob50ea539f476322de5197550204d0dff7dbb9a05d
1 # Copyright (c) 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   'includes': [
7     '../build/common_untrusted.gypi',
8   ],
9   'target_defaults': {
10     # We need to override the variables in untrusted.gypi outside of a
11     # target_condition block because the target_condition block in
12     # untrusted gypi is fully evaluated and interpolated before any of the
13     # target_condition blocks in this file are expanded.  This means that any
14     # variables overriden inside a target_condition block in this file will not
15     # affect the values in untrusted.gypi.
16     'variables': {
17       'test_files': [],
18       'generate_nmf%': 1,
19       'nacl_newlib_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/newlib',
20       'nacl_glibc_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/glibc',
21       'nacl_pnacl_newlib_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/pnacl',
22       'nacl_pnacl_newlib_nonsfi_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/nonsfi',
23       'target_conditions': [
24         ['nexe_target!=""', {
25           # These variables are used for nexe building and for library building.
26           'out_newlib32%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_x86_32.nexe',
27           'out_newlib64%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_x86_64.nexe',
28           'out_newlib_arm%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_arm.nexe',
29           'out_newlib_mips%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_mips32.nexe',
30           'nmf_newlib%': '>(nacl_newlib_out_dir)/>(nexe_target).nmf',
31           'out_glibc32%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_32.nexe',
32           'out_glibc64%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_64.nexe',
33           'out_glibc_arm%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_arm.nexe',
34           'nmf_glibc%': '>(nacl_glibc_out_dir)/>(nexe_target).nmf',
35           'out_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target)_newlib_pnacl.pexe',
36           'nmf_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target).nmf',
37           'out_pnacl_newlib_x86_32_nonsfi_nexe': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target)_pnacl_newlib_x32_nonsfi.nexe',
38           'out_pnacl_newlib_arm_nonsfi_nexe': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target)_pnacl_newlib_arm_nonsfi.nexe',
39           'nmf_pnacl_newlib_nonsfi%': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target).nmf',
40         }],
41       ],
42     },
43     'dependencies': [
44        '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
45        '<(DEPTH)/native_client/src/untrusted/pthread/pthread.gyp:pthread_lib',
46        '<(DEPTH)/ppapi/ppapi_nacl.gyp:ppapi_cpp_lib',
47        '<(DEPTH)/ppapi/native_client/native_client.gyp:ppapi_lib',
48     ],
49     'target_conditions': [
50       ['test_files!=[] and build_newlib==1', {
51         'copies': [
52           {
53             'destination': '>(nacl_newlib_out_dir)',
54             'files': [
55               '>@(test_files)',
56             ],
57           },
58         ],
59       }],
60       ['test_files!=[] and "<(target_arch)"!="arm" and "<(target_arch)"!="mipsel" and disable_glibc==0 and build_glibc==1', {
61         'copies': [
62           {
63             'destination': '>(nacl_glibc_out_dir)',
64             'files': [
65               '>@(test_files)',
66             ],
67           },
68         ],
69       }],
70       # Nonsfi pnacl copy is covered below.
71       ['test_files!=[] and build_pnacl_newlib==1 and disable_pnacl==0', {
72         'copies': [
73           {
74             'destination': '>(nacl_pnacl_newlib_out_dir)',
75             'files': [
76               '>@(test_files)',
77             ],
78           },
79         ],
80       }],
81       ['test_files!=[] and build_pnacl_newlib==1 and (enable_x86_32_nonsfi==1 or enable_arm_nonsfi==1)', {
82         'copies': [
83           {
84             'destination': '>(nacl_pnacl_newlib_nonsfi_out_dir)',
85             'files': [
86               '>@(test_files)',
87             ],
88           },
89         ],
90       }],
91       ['nexe_target!=""', {
92         'variables': {
93           # Patch over the fact that untrusted.gypi doesn't define these in all
94           # cases.
95           'enable_x86_64%': 0,
96           'enable_x86_32%': 0,
97           'enable_arm%': 0,
98           'enable_mips%': 0,
99           'include_dirs': [
100             '<(DEPTH)',
101           ],
102           'link_flags': [
103             '-lppapi_cpp',
104             '-lppapi',
105             '-pthread',
106           ],
107           'extra_args': [
108             '--strip-all',
109           ],
110           'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
111           'create_nmf_args_portable%': [],
112           'create_nonsfi_test_nmf': '<(DEPTH)/ppapi/tests/create_nonsfi_test_nmf.py',
113           'create_nmf_args': [
114             '--no-default-libpath',
115             '--objdump=>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump',
116           ],
117         },
118         'target_conditions': [
119           ['generate_nmf==1 and build_newlib==1', {
120             'actions': [
121               {
122                 'action_name': 'Generate NEWLIB NMF',
123                 'inputs': ['>(create_nmf)'],
124                 'outputs': ['>(nmf_newlib)'],
125                 'action': [
126                   'python',
127                   '>(create_nmf)',
128                   '>@(create_nmf_args)',
129                   '--output=>(nmf_newlib)',
130                   '>@(create_nmf_args_portable)',
131                 ],
132                 'target_conditions': [
133                   ['enable_x86_64==1', {
134                     'inputs': ['>(out_newlib64)'],
135                     'action': ['>(out_newlib64)'],
136                   }],
137                   ['enable_x86_32==1', {
138                     'inputs': ['>(out_newlib32)'],
139                     'action': ['>(out_newlib32)'],
140                   }],
141                   ['enable_arm==1', {
142                     'inputs': ['>(out_newlib_arm)'],
143                     'action': ['>(out_newlib_arm)'],
144                   }],
145                   ['enable_mips==1', {
146                     'inputs': ['>(out_newlib_mips)'],
147                     'action': ['>(out_newlib_mips)'],
148                   }],
149                 ],
150               },
151             ],
152           }],
153           ['"<(target_arch)"!="arm" and "<(target_arch)"!="mipsel" and generate_nmf==1 and disable_glibc==0 and build_glibc==1', {
154             'variables': {
155               # NOTE: Use /lib, not /lib64 here; it is a symbolic link which
156               # doesn't work on Windows.
157               'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib',
158               'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32',
159             },
160             'actions': [
161               {
162                 'action_name': 'Generate GLIBC NMF and copy libs',
163                 'inputs': ['>(create_nmf)'],
164                 # NOTE: There is no explicit dependency for the lib32
165                 # and lib64 directories created in the PRODUCT_DIR.
166                 # They are created as a side-effect of NMF creation.
167                 'outputs': ['>(nmf_glibc)'],
168                 'action': [
169                   'python',
170                   '>@(_inputs)',
171                   '>@(create_nmf_args)',
172                   '--output=>(nmf_glibc)',
173                   '--path-prefix=>(nexe_target)_libs',
174                   '--stage-dependencies=<(nacl_glibc_out_dir)',
175                   '>@(create_nmf_args_portable)',
176                 ],
177                 'target_conditions': [
178                   ['enable_x86_64==1', {
179                     'inputs': ['>(out_glibc64)'],
180                     'action': [
181                       '--library-path=>(libdir_glibc64)',
182                       '--library-path=>(tc_lib_dir_glibc64)',
183                     ],
184                   }],
185                   ['enable_x86_32==1', {
186                     'inputs': ['>(out_glibc32)'],
187                     'action': [
188                       '--library-path=>(libdir_glibc32)',
189                       '--library-path=>(tc_lib_dir_glibc32)',
190                     ],
191                   }],
192                   # TODO(ncbray) handle arm case.  We don't have ARM glibc yet.
193                 ],
194               },
195             ],
196           }],
197           ['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0', {
198             'actions': [
199               {
200                 'action_name': 'Generate PNACL NEWLIB NMF',
201                 # NOTE: create_nmf must be first, it is the script python
202                 # executes below.
203                 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib)'],
204                 'outputs': ['>(nmf_pnacl_newlib)'],
205                 'action': [
206                   'python',
207                   '>(create_nmf)',
208                   '>@(create_nmf_args)',
209                   '--output=>(nmf_pnacl_newlib)',
210                   '>(out_pnacl_newlib)',
211                   '>@(create_nmf_args_portable)',
212                 ],
213               },
214             ],
215           }],
216           ['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0 and (enable_x86_32_nonsfi==1 or enable_arm_nonsfi==1)', {
217             'actions': [
218               {
219                 'action_name': 'Generate PNACL NEWLIB nonsfi NMF',
220                 'inputs': ['>(create_nonsfi_test_nmf)'],
221                 'outputs': ['>(nmf_pnacl_newlib_nonsfi)'],
222                 'action': [
223                   'python',
224                   '>(create_nonsfi_test_nmf)',
225                   '>@(create_nmf_args_portable)',
226                   '--output=>(nmf_pnacl_newlib_nonsfi)',
227                 ],
228                 'target_conditions': [
229                   ['enable_x86_32_nonsfi==1 and "<(target_arch)"=="ia32"', {
230                     'inputs': ['>(out_pnacl_newlib_x86_32_nonsfi_nexe)'],
231                     'action': [
232                       '--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)',
233                       '--arch=x86-32',
234                     ]
235                   }],
236                   ['enable_x86_32_nonsfi==1 and "<(target_arch)"=="x64"', {
237                     'inputs': ['>(out_pnacl_newlib_x86_32_nonsfi_nexe)'],
238                     'action': [
239                       '--program=>(out_pnacl_newlib_x86_32_nonsfi_nexe)',
240                       # This should be used only for nacl_helper_nonsfi test.
241                       # In theory this should be x86-32. However, currently
242                       # fallback logic to x86-32-nonsfi is not implemented,
243                       # and, moreover, it would break the tests for current
244                       # nacl_helper in Non-SFI mode on x64 Chrome.
245                       # So, here we introduce the hack to use "x86-64" in order
246                       # to take the benefit to run nacl_helper_nonsfi tests on
247                       # x64 Chrome.
248                       # TODO(hidehiko): Remove this hack.
249                       '--arch=x86-64',
250                     ]
251                   }],
252                   ['enable_arm_nonsfi==1', {
253                     'inputs': ['>(out_pnacl_newlib_arm_nonsfi_nexe)'],
254                     'action': [
255                       '--program=>(out_pnacl_newlib_arm_nonsfi_nexe)',
256                       '--arch=arm',
257                     ]
258                   }],
259                 ],
260               },
261             ],
262           }],
263         ],
264       }],
265     ],
266   },