OLD | NEW |
| (Empty) |
1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 # for details. All rights reserved. Use of this source code is governed by a | |
3 # BSD-style license that can be found in the LICENSE file. | |
4 | |
5 # Definitions for building standalone Dart binaries to run on Android. | |
6 # This is mostly excerpted from: | |
7 # http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi | |
8 | |
9 { | |
10 'variables': { | |
11 'android_ndk_root': '<(PRODUCT_DIR)/../../third_party/android_tools/ndk', | |
12 }, # variables | |
13 'target_defaults': { | |
14 'configurations': { | |
15 # It is very important to get the order of the linker arguments correct. | |
16 # Therefore, we put them all in the architecture specific configurations, | |
17 # even though there are many flags in common, to avoid splitting them | |
18 # between two configurations and possibly accidentally mixing up the | |
19 # order. | |
20 'Dart_Android_Base': { | |
21 'abstract': 1, | |
22 'cflags': [ | |
23 # No -Werror due to warnings in stl. | |
24 '<@(common_gcc_warning_flags)', | |
25 '-Wnon-virtual-dtor', | |
26 '-Wvla', | |
27 '-Woverloaded-virtual', | |
28 '-g3', | |
29 '-ggdb3', | |
30 '-fno-rtti', | |
31 '-fno-exceptions', | |
32 ], | |
33 'target_conditions': [ | |
34 ['_toolset=="target"', { | |
35 'defines': [ | |
36 'ANDROID', | |
37 'USE_STLPORT=1', | |
38 '__GNU_SOURCE=1', | |
39 '_STLP_USE_PTR_SPECIALIZATIONS=1', | |
40 'HAVE_OFF64_T', | |
41 'HAVE_SYS_UIO_H', | |
42 ], | |
43 'cflags!': [ | |
44 '-pthread', # Not supported by Android toolchain. | |
45 ], | |
46 'cflags': [ | |
47 '-U__linux__', # Don't allow toolchain to claim -D__linux__ | |
48 '-U__linux', | |
49 '-ffunction-sections', | |
50 '-funwind-tables', | |
51 '-fstack-protector', | |
52 '-fno-short-enums', | |
53 '-finline-limit=64', | |
54 '-Wa,--noexecstack', | |
55 ], | |
56 }], | |
57 ], | |
58 }, | |
59 'Dart_Android_Debug': { | |
60 'abstract': 1, | |
61 'defines': [ | |
62 'DEBUG', | |
63 ], | |
64 'cflags': [ | |
65 '-fno-omit-frame-pointer', | |
66 ], | |
67 }, | |
68 'Dart_Android_Release': { | |
69 'abstract': 1, | |
70 'defines': [ | |
71 'NDEBUG', | |
72 ], | |
73 'cflags!': [ | |
74 '-O2', | |
75 '-Os', | |
76 ], | |
77 'cflags': [ | |
78 '-fno-omit-frame-pointer', | |
79 '-fdata-sections', | |
80 '-ffunction-sections', | |
81 '-O3', | |
82 ], | |
83 }, | |
84 'Dart_Android_Product': { | |
85 'abstract': 1, | |
86 'defines': [ | |
87 'NDEBUG', | |
88 'PRODUCT', | |
89 ], | |
90 'cflags!': [ | |
91 '-O2', | |
92 '-Os', | |
93 ], | |
94 'cflags': [ | |
95 '-fdata-sections', | |
96 '-ffunction-sections', | |
97 '-O3', | |
98 ], | |
99 }, | |
100 'Dart_Android_ia32_Base': { | |
101 'abstract': 1, | |
102 'variables': { | |
103 'android_sysroot': '<(android_ndk_root)/platforms/android-14/arch-x86'
, | |
104 'android_ndk_include': '<(android_sysroot)/usr/include', | |
105 'android_ndk_lib': '<(android_sysroot)/usr/lib', | |
106 }, | |
107 'target_conditions': [ | |
108 ['_toolset=="target"', { | |
109 # The x86 toolchain currently has problems with stack-protector. | |
110 'cflags!': [ | |
111 '-fstack-protector', | |
112 ], | |
113 'cflags': [ | |
114 '--sysroot=<(android_sysroot)', | |
115 '-I<(android_ndk_include)', | |
116 '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport', | |
117 '-fno-stack-protector', | |
118 ], | |
119 'target_conditions': [ | |
120 ['_type=="executable"', { | |
121 'ldflags!': ['-Wl,--exclude-libs=ALL,-shared',], | |
122 }], | |
123 ['_type=="shared_library"', { | |
124 'ldflags': ['-Wl,-shared,-Bsymbolic',], | |
125 }], | |
126 ], | |
127 'ldflags': [ | |
128 'ia32', '>(_type)', 'target', | |
129 '-nostdlib', | |
130 '-Wl,--no-undefined', | |
131 # Don't export symbols from statically linked libraries. | |
132 '-Wl,--exclude-libs=ALL', | |
133 '-Wl,-rpath-link=<(android_ndk_lib)', | |
134 '-L<(android_ndk_lib)', | |
135 # NOTE: The stlport header include paths below are specified in | |
136 # cflags rather than include_dirs because they need to come | |
137 # after include_dirs. Think of them like system headers, but | |
138 # don't use '-isystem' because the arm-linux-androideabi-4.4.3 | |
139 # toolchain (circa Gingerbread) will exhibit strange errors. | |
140 # The include ordering here is important; change with caution. | |
141 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86', | |
142 '-z', | |
143 'muldefs', | |
144 '-Bdynamic', | |
145 '-Wl,-dynamic-linker,/system/bin/linker', | |
146 '-Wl,--gc-sections', | |
147 '-Wl,-z,nocopyreloc', | |
148 # crtbegin_dynamic.o should be the last item in ldflags. | |
149 '<(android_ndk_lib)/crtbegin_dynamic.o', | |
150 ], | |
151 'ldflags!': [ | |
152 '-pthread', # Not supported by Android toolchain. | |
153 ], | |
154 }], | |
155 ['_toolset=="host"', { | |
156 'cflags': [ '-m32', '-pthread' ], | |
157 'ldflags': [ '-m32', '-pthread' ], | |
158 }], | |
159 ], | |
160 }, | |
161 'Dart_Android_x64_Base': { | |
162 'abstract': 1, | |
163 'variables': { | |
164 'android_sysroot': '<(android_ndk_root)/platforms/android-21/arch-x86_
64', | |
165 'android_ndk_include': '<(android_sysroot)/usr/include', | |
166 'android_ndk_lib': '<(android_sysroot)/usr/lib64', | |
167 }, | |
168 'target_conditions': [ | |
169 ['_toolset=="target"', { | |
170 'cflags': [ | |
171 '-fPIE', | |
172 '--sysroot=<(android_sysroot)', | |
173 '-I<(android_ndk_include)', | |
174 '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport', | |
175 ], | |
176 'target_conditions': [ | |
177 ['_type=="executable"', { | |
178 'ldflags!': ['-Wl,--exclude-libs=ALL,-shared',], | |
179 }], | |
180 ['_type=="shared_library"', { | |
181 'ldflags': ['-Wl,-shared,-Bsymbolic',], | |
182 }], | |
183 ], | |
184 'ldflags': [ | |
185 'x64', '>(_type)', 'target', | |
186 '-nostdlib', | |
187 '-Wl,--no-undefined', | |
188 # Don't export symbols from statically linked libraries. | |
189 '-Wl,--exclude-libs=ALL', | |
190 '-Wl,-rpath-link=<(android_ndk_lib)', | |
191 '-L<(android_ndk_lib)', | |
192 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86_64', | |
193 '-z', | |
194 'muldefs', | |
195 '-Bdynamic', | |
196 '-pie', | |
197 '-Wl,-dynamic-linker,/system/bin/linker', | |
198 '-Wl,--gc-sections', | |
199 '-Wl,-z,nocopyreloc', | |
200 # crtbegin_dynamic.o should be the last item in ldflags. | |
201 '<(android_ndk_lib)/crtbegin_dynamic.o', | |
202 ], | |
203 'ldflags!': [ | |
204 '-pthread', # Not supported by Android toolchain. | |
205 ], | |
206 }], | |
207 ['_toolset=="host"', { | |
208 'cflags': [ '-pthread' ], | |
209 'ldflags': [ '-pthread' ], | |
210 }], | |
211 ], | |
212 }, | |
213 'Dart_Android_arm_Base': { | |
214 'abstract': 1, | |
215 'variables': { | |
216 'android_sysroot': '<(android_ndk_root)/platforms/android-14/arch-arm'
, | |
217 'android_ndk_include': '<(android_sysroot)/usr/include', | |
218 'android_ndk_lib': '<(android_sysroot)/usr/lib', | |
219 }, | |
220 'target_conditions': [ | |
221 ['_toolset=="target"', { | |
222 'cflags': [ | |
223 '-fPIE', | |
224 '--sysroot=<(android_sysroot)', | |
225 '-I<(android_ndk_include)', | |
226 '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport', | |
227 '-march=armv7-a', | |
228 '-mtune=cortex-a8', | |
229 '-mfpu=vfp3', | |
230 '-mfloat-abi=softfp', | |
231 ], | |
232 'target_conditions': [ | |
233 ['_type=="executable"', { | |
234 'ldflags!': ['-Wl,--exclude-libs=ALL,-shared',], | |
235 }], | |
236 ['_type=="shared_library"', { | |
237 'ldflags': ['-Wl,-shared,-Bsymbolic',], | |
238 }], | |
239 ], | |
240 'ldflags': [ | |
241 'arm', '>(_type)', 'target', | |
242 '-nostdlib', | |
243 '-Wl,--no-undefined', | |
244 # Don't export symbols from statically linked libraries. | |
245 '-Wl,--exclude-libs=ALL', | |
246 '-Wl,-rpath-link=<(android_ndk_lib)', | |
247 '-L<(android_ndk_lib)', | |
248 # Enable identical code folding to reduce size. | |
249 '-Wl,--icf=safe', | |
250 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi-v7a', | |
251 '-z', | |
252 'muldefs', | |
253 '-Bdynamic', | |
254 '-pie', | |
255 '-Wl,-dynamic-linker,/system/bin/linker', | |
256 '-Wl,--gc-sections', | |
257 '-Wl,-z,nocopyreloc', | |
258 # crtbegin_dynamic.o should be the last item in ldflags. | |
259 '<(android_ndk_lib)/crtbegin_dynamic.o', | |
260 ], | |
261 'ldflags!': [ | |
262 '-pthread', # Not supported by Android toolchain. | |
263 ], | |
264 }], | |
265 ['_toolset=="host"', { | |
266 'cflags': [ '-m32', '-pthread' ], | |
267 'ldflags': [ '-m32', '-pthread' ], | |
268 }], | |
269 ], | |
270 }, # Dart_Android_arm_Base | |
271 'Dart_Android_arm64_Base': { | |
272 'abstract': 1, | |
273 'variables': { | |
274 'android_sysroot': '<(android_ndk_root)/platforms/android-21/arch-arm6
4', | |
275 'android_ndk_include': '<(android_sysroot)/usr/include', | |
276 'android_ndk_lib': '<(android_sysroot)/usr/lib', | |
277 }, | |
278 'target_conditions': [ | |
279 ['_toolset=="target"', { | |
280 'cflags': [ | |
281 '-fPIE', | |
282 '--sysroot=<(android_sysroot)', | |
283 '-I<(android_ndk_include)', | |
284 '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport', | |
285 ], | |
286 'target_conditions': [ | |
287 ['_type=="executable"', { | |
288 'ldflags!': ['-Wl,--exclude-libs=ALL,-shared',], | |
289 }], | |
290 ['_type=="shared_library"', { | |
291 'ldflags': ['-Wl,-shared,-Bsymbolic',], | |
292 }], | |
293 ], | |
294 'ldflags': [ | |
295 'arm64', '>(_type)', 'target', | |
296 '-nostdlib', | |
297 '-Wl,--no-undefined', | |
298 # Don't export symbols from statically linked libraries. | |
299 '-Wl,--exclude-libs=ALL', | |
300 '-Wl,-rpath-link=<(android_ndk_lib)', | |
301 '-L<(android_ndk_lib)', | |
302 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/arm64-v8a', | |
303 '-z', | |
304 'muldefs', | |
305 '-Bdynamic', | |
306 '-pie', | |
307 '-Wl,-dynamic-linker,/system/bin/linker64', | |
308 '-Wl,--gc-sections', | |
309 '-Wl,-z,nocopyreloc', | |
310 # crtbegin_dynamic.o should be the last item in ldflags. | |
311 '<(android_ndk_lib)/crtbegin_dynamic.o', | |
312 ], | |
313 'ldflags!': [ | |
314 '-pthread', # Not supported by Android toolchain. | |
315 ], | |
316 }], | |
317 ['_toolset=="host"', { | |
318 'ldflags': [ '-pthread' ], | |
319 }], | |
320 ], | |
321 }, # Dart_Android_arm64_Base | |
322 }, # configurations | |
323 }, # target_defaults | |
324 } | |
OLD | NEW |