blob: e495914449c8ab69d10cb73766be9434d6515efe [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',
28 'nmf_newlib%': '>(nacl_newlib_out_dir)/>(nexe_target).nmf',
29 'out_glibc32%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_32.nexe',
30 'out_glibc64%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_x86_64.nexe',
31 'out_glibc_arm%': '>(nacl_glibc_out_dir)/>(nexe_target)_glibc_arm.nexe',
32 'nmf_glibc%': '>(nacl_glibc_out_dir)/>(nexe_target).nmf',
33 'out_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target)_newlib_pnacl.pexe',
34 'nmf_pnacl_newlib%': '>(nacl_pnacl_newlib_out_dir)/>(nexe_target).nmf',
35 }],
36 ],
37 },
38 'dependencies': [
39 '<(DEPTH)/native_client/src/untrusted/nacl/nacl.gyp:nacl_lib',
Torne (Richard Coles)a1401312014-03-18 10:20:56 +000040 '<(DEPTH)/ppapi/ppapi_nacl.gyp:ppapi_cpp_lib',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010041 '<(DEPTH)/ppapi/native_client/native_client.gyp:ppapi_lib',
42 ],
43 'target_conditions': [
44 ['test_files!=[] and build_newlib==1', {
45 'copies': [
46 {
47 'destination': '>(nacl_newlib_out_dir)',
48 'files': [
49 '>@(test_files)',
50 ],
51 },
52 ],
53 }],
54 ['test_files!=[] and "<(target_arch)"!="arm" and disable_glibc==0 and build_glibc==1', {
55 'copies': [
56 {
57 'destination': '>(nacl_glibc_out_dir)',
58 'files': [
59 '>@(test_files)',
60 ],
61 },
62 ],
63 }],
64 ['test_files!=[] and build_pnacl_newlib==1 and disable_pnacl==0', {
65 'copies': [
66 {
67 'destination': '>(nacl_pnacl_newlib_out_dir)',
68 'files': [
69 '>@(test_files)',
70 ],
71 },
72 ],
73 }],
74 ['nexe_target!=""', {
75 'variables': {
76 # Patch over the fact that untrusted.gypi doesn't define these in all
77 # cases.
78 'enable_x86_64%': 0,
79 'enable_x86_32%': 0,
80 'enable_arm%': 0,
81 'include_dirs': [
82 '<(DEPTH)',
83 ],
84 'link_flags': [
85 '-lppapi_cpp',
86 '-lppapi',
87 '-pthread',
88 ],
89 'extra_args': [
90 '--strip-all',
91 ],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +000092 'create_nmf': '<(DEPTH)/native_client_sdk/src/tools/create_nmf.py',
93 'create_nmf_args_portable%': [],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +010094 },
95 'target_conditions': [
96 ['generate_nmf==1 and build_newlib==1', {
97 'actions': [
98 {
99 'action_name': 'Generate NEWLIB NMF',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000100 'inputs': ['>(create_nmf)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100101 'outputs': ['>(nmf_newlib)'],
102 'action': [
103 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000104 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100105 '--output=>(nmf_newlib)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000106 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100107 ],
108 'target_conditions': [
109 ['enable_x86_64==1', {
110 'inputs': ['>(out_newlib64)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000111 'action': ['>(out_newlib64)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100112 }],
113 ['enable_x86_32==1', {
114 'inputs': ['>(out_newlib32)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000115 'action': ['>(out_newlib32)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100116 }],
117 ['enable_arm==1', {
118 'inputs': ['>(out_newlib_arm)'],
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000119 'action': ['>(out_newlib_arm)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100120 }],
121 ],
122 },
123 ],
124 }],
125 ['"<(target_arch)"!="arm" and generate_nmf==1 and disable_glibc==0 and build_glibc==1', {
126 'variables': {
127 # NOTE: Use /lib, not /lib64 here; it is a symbolic link which
128 # doesn't work on Windows.
129 'libdir_glibc64': '>(nacl_glibc_tc_root)/x86_64-nacl/lib',
130 'libdir_glibc32': '>(nacl_glibc_tc_root)/x86_64-nacl/lib32',
131 'nacl_objdump': '>(nacl_glibc_tc_root)/bin/x86_64-nacl-objdump',
132 },
133 'actions': [
134 {
135 'action_name': 'Generate GLIBC NMF and copy libs',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000136 'inputs': ['>(create_nmf)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100137 # NOTE: There is no explicit dependency for the lib32
138 # and lib64 directories created in the PRODUCT_DIR.
139 # They are created as a side-effect of NMF creation.
140 'outputs': ['>(nmf_glibc)'],
141 'action': [
142 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000143 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100144 '--objdump=>(nacl_objdump)',
145 '--output=>(nmf_glibc)',
146 '--path-prefix=>(nexe_target)_libs',
147 '--stage-dependencies=<(nacl_glibc_out_dir)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000148 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100149 ],
150 'target_conditions': [
151 ['enable_x86_64==1', {
152 'inputs': ['>(out_glibc64)'],
153 'action': [
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000154 '>(out_glibc64)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100155 '--library-path=>(libdir_glibc64)',
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100156 '--library-path=>(tc_lib_dir_glibc64)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100157 ],
158 }],
159 ['enable_x86_32==1', {
160 'inputs': ['>(out_glibc32)'],
161 'action': [
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000162 '>(out_glibc32)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100163 '--library-path=>(libdir_glibc32)',
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +0100164 '--library-path=>(tc_lib_dir_glibc32)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100165 ],
166 }],
167 # TODO(ncbray) handle arm case. We don't have ARM glibc yet.
168 ],
169 },
170 ],
171 }],
172 ['generate_nmf==1 and build_pnacl_newlib==1 and disable_pnacl==0', {
173 'actions': [
174 {
175 'action_name': 'Generate PNACL NEWLIB NMF',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000176 # NOTE: create_nmf must be first, it is the script python
177 # executes below.
178 'inputs': ['>(create_nmf)', '>(out_pnacl_newlib)'],
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100179 'outputs': ['>(nmf_pnacl_newlib)'],
180 'action': [
181 'python',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000182 '>(create_nmf)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100183 '--output=>(nmf_pnacl_newlib)',
Torne (Richard Coles)5d1f7b12014-02-21 12:16:55 +0000184 '>(out_pnacl_newlib)',
185 '>@(create_nmf_args_portable)',
Torne (Richard Coles)b2df76e2013-05-13 16:52:09 +0100186 ],
187 },
188 ],
189 }],
190 ],
191 }],
192 ],
193 },
194}