blob: b5c605550f2bade62b0eba09cc65295b388ef626 [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',
22 'target_conditions': [
23 ['nexe_target!=""', {
24 # These variables are used for nexe building and for library building.
25 'out_newlib32%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_x86_32.nexe',
26 'out_newlib64%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_x86_64.nexe',
27 'out_newlib_arm%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_arm.nexe',
Ben Murdochc5cede92014-04-10 11:22:14 +010028 'out_newlib_mips%': '>(nacl_newlib_out_dir)/>(nexe_target)_newlib_mips32.nexe',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010029 'nmf_newlib%': '>(nacl_newlib_out_dir)/>(nexe_target).nmf',
30 'out_glibc32%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_32.nexe',
31 'out_glibc64%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_64.nexe',
32 'out_glibc_arm%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_arm.nexe',
33 'nmf_glibc%': '>(nacl_glibc_out_dir)/>(nexe_target).nmf',
34 'out_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target)_newlib_pnacl.pexe',
35 'nmf_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target).nmf',
36 }],
37 ],
38 },
39 'dependencies': [
40 '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000041 '<(DEPTH)/ppapi/ppapi_nacl.gyp:ppapi_cpp_lib',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010042 '<(DEPTH)/ppapi/native_client/native_client.gyp:ppapi_lib',
43 ],
44 'target_conditions': [
45 ['test_files!=[] and build_newlib==1', {
46 'copies': [
47 {
48 'destination': '>(nacl_newlib_out_dir)',
49 'files': [
50 '>@(test_files)',
51 ],
52 },
53 ],
54 }],
Ben Murdochc5cede92014-04-10 11:22:14 +010055 ['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 +010056 'copies': [
57 {
58 'destination': '>(nacl_glibc_out_dir)',
59 'files': [
60 '>@(test_files)',
61 ],
62 },
63 ],
64 }],
65 ['test_files!=[] and build_pnacl_newlib==1 and disable_pnacl==0', {
66 'copies': [
67 {
68 'destination': '>(nacl_pnacl_newlib_out_dir)',
69 'files': [
70 '>@(test_files)',
71 ],
72 },
73 ],
74 }],
75 ['nexe_target!=""', {
76 'variables': {
77 # Patch over the fact that untrusted.gypi doesn't define these in all
78 # cases.
79 'enable_x86_64%': 0,
80 'enable_x86_32%': 0,
81 'enable_arm%': 0,
Ben Murdochc5cede92014-04-10 11:22:14 +010082 'enable_mips%': 0,
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010083 'include_dirs': [
84 '<(DEPTH)',
85 ],
86 'link_flags': [
87 '-lppapi_cpp',
88 '-lppapi',
89 '-pthread',
90 ],
91 'extra_args': [
92 '--strip-all',
93 ],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000094 'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
95 'create_nmf_args_portable%': [],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010096 },
97 'target_conditions': [
98 ['generate_nmf==1 and build_newlib==1', {
99 'actions': [
100 {
101 'action_name': 'Generate NEWLIB NMF',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000102 'inputs': ['>(create_nmf)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100103 'outputs': ['>(nmf_newlib)'],
104 'action': [
105 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000106 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100107 '--output=>(nmf_newlib)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000108 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100109 ],
110 'target_conditions': [
111 ['enable_x86_64==1', {
112 'inputs': ['>(out_newlib64)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000113 'action': ['>(out_newlib64)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100114 }],
115 ['enable_x86_32==1', {
116 'inputs': ['>(out_newlib32)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000117 'action': ['>(out_newlib32)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100118 }],
119 ['enable_arm==1', {
120 'inputs': ['>(out_newlib_arm)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000121 'action': ['>(out_newlib_arm)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100122 }],
Ben Murdochc5cede92014-04-10 11:22:14 +0100123 ['enable_mips==1', {
124 'inputs': ['>(out_newlib_mips)'],
125 'action': ['>(out_newlib_mips)'],
126 }],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100127 ],
128 },
129 ],
130 }],
Ben Murdochc5cede92014-04-10 11:22:14 +0100131 ['"<(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 +0100132 'variables': {
133 # NOTE: Use /lib, not /lib64 here; it is a symbolic link which
134 # doesn't work on Windows.
135 'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib',
136 'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32',
137 'nacl_objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump',
138 },
139 'actions': [
140 {
141 'action_name': 'Generate GLIBC NMF and copy libs',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000142 'inputs': ['>(create_nmf)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100143 # NOTE: There is no explicit dependency for the lib32
144 # and lib64 directories created in the PRODUCT_DIR.
145 # They are created as a side-effect of NMF creation.
146 'outputs': ['>(nmf_glibc)'],
147 'action': [
148 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000149 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100150 '--objdump=>(nacl_objdump)',
151 '--output=>(nmf_glibc)',
152 '--path-prefix=>(nexe_target)_libs',
153 '--stage-dependencies=<(nacl_glibc_out_dir)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000154 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100155 ],
156 'target_conditions': [
157 ['enable_x86_64==1', {
158 'inputs': ['>(out_glibc64)'],
159 'action': [
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000160 '>(out_glibc64)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100161 '--library-path=>(libdir_glibc64)',
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100162 '--library-path=>(tc_lib_dir_glibc64)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100163 ],
164 }],
165 ['enable_x86_32==1', {
166 'inputs': ['>(out_glibc32)'],
167 'action': [
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000168 '>(out_glibc32)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100169 '--library-path=>(libdir_glibc32)',
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100170 '--library-path=>(tc_lib_dir_glibc32)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100171 ],
172 }],
173 # TODO(ncbray) handle arm case. We don't have ARM glibc yet.
174 ],
175 },
176 ],
177 }],
178 ['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0', {
179 'actions': [
180 {
181 'action_name': 'Generate PNACL NEWLIB NMF',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000182 # NOTE: create_nmf must be first, it is the script python
183 # executes below.
184 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100185 'outputs': ['>(nmf_pnacl_newlib)'],
186 'action': [
187 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000188 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100189 '--output=>(nmf_pnacl_newlib)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000190 '>(out_pnacl_newlib)',
191 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100192 ],
193 },
194 ],
195 }],
196 ],
197 }],
198 ],
199 },
200}