blob: 0d9b676884821509868a0cb8600822b1f6d9e91c [file] [log] [blame]
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +01001# 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.
4
5{
6 'includes': [
7 '../native_client/build/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',
Torne (Richard Coles)010d83a2014-05-14 12:12:37 +010022 'nacl_pnacl_newlib_nonsfi_out_dir': '<(PRODUCT_DIR)/>(nexe_destination_dir)/nonsfi',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010023 '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',
Ben Murdochc5cede92014-04-10 11:22:14 +010029 'out_newlib_mips%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_mips32.nexe',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010030 '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',
Torne (Richard Coles)010d83a2014-05-14 12:12:37 +010037 'out_pnacl_newlib_x86_32_nonsfi_nexe': '>(nacl_pnacl_newlib_nonsfi_out_dir)/>(nexe_target)_pnacl_newlib_x32_nonsfi.nexe',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010038 }],
39 ],
40 },
41 'dependencies': [
42 '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000043 '<(DEPTH)/ppapi/ppapi_nacl.gyp:ppapi_cpp_lib',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010044 '<(DEPTH)/ppapi/native_client/native_client.gyp:ppapi_lib',
45 ],
46 'target_conditions': [
47 ['test_files!=[] and build_newlib==1', {
48 'copies': [
49 {
50 'destination': '>(nacl_newlib_out_dir)',
51 'files': [
52 '>@(test_files)',
53 ],
54 },
55 ],
56 }],
Ben Murdochc5cede92014-04-10 11:22:14 +010057 ['test_files!=[] and "<(target_arch)"!="arm" and "<(target_arch)"!="mipsel" and disable_glibc==0 and build_glibc==1', {
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010058 'copies': [
59 {
60 'destination': '>(nacl_glibc_out_dir)',
61 'files': [
62 '>@(test_files)',
63 ],
64 },
65 ],
66 }],
Torne (Richard Coles)010d83a2014-05-14 12:12:37 +010067 # Nonsfi pnacl copy is covered below. Currently, these are exclusive.
68 ['test_files!=[] and build_pnacl_newlib==1 and disable_pnacl==0 and enable_x86_32_nonsfi==0', {
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010069 'copies': [
70 {
71 'destination': '>(nacl_pnacl_newlib_out_dir)',
72 'files': [
73 '>@(test_files)',
74 ],
75 },
76 ],
77 }],
Torne (Richard Coles)010d83a2014-05-14 12:12:37 +010078 ['test_files!=[] and build_pnacl_newlib==1 and enable_x86_32_nonsfi==1', {
79 'copies': [
80 {
81 'destination': '>(nacl_pnacl_newlib_nonsfi_out_dir)',
82 'files': [
83 '>@(test_files)',
84 ],
85 },
86 ],
87 }],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010088 ['nexe_target!=""', {
89 'variables': {
90 # Patch over the fact that untrusted.gypi doesn't define these in all
91 # cases.
92 'enable_x86_64%': 0,
93 'enable_x86_32%': 0,
94 'enable_arm%': 0,
Ben Murdochc5cede92014-04-10 11:22:14 +010095 'enable_mips%': 0,
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010096 'include_dirs': [
97 '<(DEPTH)',
98 ],
99 'link_flags': [
100 '-lppapi_cpp',
101 '-lppapi',
102 '-pthread',
103 ],
104 'extra_args': [
105 '--strip-all',
106 ],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000107 'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
108 'create_nmf_args_portable%': [],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100109 },
110 'target_conditions': [
111 ['generate_nmf==1 and build_newlib==1', {
112 'actions': [
113 {
114 'action_name': 'Generate NEWLIB NMF',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000115 'inputs': ['>(create_nmf)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100116 'outputs': ['>(nmf_newlib)'],
117 'action': [
118 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000119 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100120 '--output=>(nmf_newlib)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000121 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100122 ],
123 'target_conditions': [
124 ['enable_x86_64==1', {
125 'inputs': ['>(out_newlib64)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000126 'action': ['>(out_newlib64)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100127 }],
128 ['enable_x86_32==1', {
129 'inputs': ['>(out_newlib32)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000130 'action': ['>(out_newlib32)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100131 }],
132 ['enable_arm==1', {
133 'inputs': ['>(out_newlib_arm)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000134 'action': ['>(out_newlib_arm)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100135 }],
Ben Murdochc5cede92014-04-10 11:22:14 +0100136 ['enable_mips==1', {
137 'inputs': ['>(out_newlib_mips)'],
138 'action': ['>(out_newlib_mips)'],
139 }],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100140 ],
141 },
142 ],
143 }],
Ben Murdochc5cede92014-04-10 11:22:14 +0100144 ['"<(target_arch)"!="arm" and "<(target_arch)"!="mipsel" and generate_nmf==1 and disable_glibc==0 and build_glibc==1', {
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100145 'variables': {
146 # NOTE: Use /lib, not /lib64 here; it is a symbolic link which
147 # doesn't work on Windows.
148 'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib',
149 'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32',
150 'nacl_objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump',
151 },
152 'actions': [
153 {
154 'action_name': 'Generate GLIBC NMF and copy libs',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000155 'inputs': ['>(create_nmf)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100156 # NOTE: There is no explicit dependency for the lib32
157 # and lib64 directories created in the PRODUCT_DIR.
158 # They are created as a side-effect of NMF creation.
159 'outputs': ['>(nmf_glibc)'],
160 'action': [
161 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000162 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100163 '--objdump=>(nacl_objdump)',
164 '--output=>(nmf_glibc)',
165 '--path-prefix=>(nexe_target)_libs',
166 '--stage-dependencies=<(nacl_glibc_out_dir)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000167 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100168 ],
169 'target_conditions': [
170 ['enable_x86_64==1', {
171 'inputs': ['>(out_glibc64)'],
172 'action': [
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000173 '>(out_glibc64)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100174 '--library-path=>(libdir_glibc64)',
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100175 '--library-path=>(tc_lib_dir_glibc64)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100176 ],
177 }],
178 ['enable_x86_32==1', {
179 'inputs': ['>(out_glibc32)'],
180 'action': [
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000181 '>(out_glibc32)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100182 '--library-path=>(libdir_glibc32)',
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100183 '--library-path=>(tc_lib_dir_glibc32)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100184 ],
185 }],
186 # TODO(ncbray) handle arm case. We don't have ARM glibc yet.
187 ],
188 },
189 ],
190 }],
191 ['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0', {
192 'actions': [
193 {
194 'action_name': 'Generate PNACL NEWLIB NMF',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000195 # NOTE: create_nmf must be first, it is the script python
196 # executes below.
197 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100198 'outputs': ['>(nmf_pnacl_newlib)'],
199 'action': [
200 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000201 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100202 '--output=>(nmf_pnacl_newlib)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000203 '>(out_pnacl_newlib)',
204 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100205 ],
206 },
207 ],
208 }],
209 ],
210 }],
211 ],
212 },
213}