OLD | NEW |
---|---|
1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 15 matching lines...) Expand all Loading... | |
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 # Definitions for building standalone V8 binaries to run on Android. | 28 # Definitions for building standalone V8 binaries to run on Android. |
29 # This is mostly excerpted from: | 29 # This is mostly excerpted from: |
30 # http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi | 30 # http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi |
31 | 31 |
32 { | 32 { |
33 'variables': { | 33 'variables': { |
34 # Location of Android NDK. | 34 # Location of Android NDK. |
35 'variables': { | 35 'variables': { |
36 'variables': { | 36 'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)', |
37 'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)', | 37 'android_toolchain%': '<!(/bin/echo -n $ANDROID_TOOLCHAIN)', |
38 | 38 # Switch between different build types, currently only '0' is |
39 # Switch between different build types, currently only '0' is | 39 # supported. |
40 # supported. | 40 'android_build_type%': 0, |
41 'android_build_type%': 0, | |
42 }, | |
43 'android_ndk_root%': '<(android_ndk_root)', | |
44 'android_ndk_sysroot': '<(android_ndk_root)/platforms/android-9/arch-<(and roid_target_arch)', | |
45 'android_build_type%': '<(android_build_type)', | |
46 }, | 41 }, |
47 'android_ndk_root%': '<(android_ndk_root)', | 42 'conditions': [ |
48 'android_ndk_sysroot': '<(android_ndk_sysroot)', | 43 ['android_ndk_root==""', { |
49 'android_ndk_include': '<(android_ndk_sysroot)/usr/include', | 44 'variables': { |
50 'android_ndk_lib': '<(android_ndk_sysroot)/usr/lib', | 45 'android_sysroot': '<(android_toolchain)/sysroot/', |
46 'android_stlport': '<(android_toolchain)/sources/cxx-stl/stlport/', | |
47 }, | |
48 'android_include': '<(android_sysroot)/usr/include', | |
49 'android_lib': '<(android_sysroot)/usr/lib', | |
50 'android_stlport_include': '<(android_stlport)/stlport', | |
51 'android_stlport_libs': '<(android_stlport)/libs', | |
52 }, { | |
53 'variables': { | |
54 'android_sysroot': '<(android_ndk_root)/platforms/android-9/arch-<(and roid_target_arch)', | |
55 'android_stlport': '<(android_ndk_root)/sources/cxx-stl/stlport/', | |
56 }, | |
57 'android_include': '<(android_sysroot)/usr/include', | |
58 'android_lib': '<(android_sysroot)/usr/lib', | |
59 'android_stlport_include': '<(android_stlport)/stlport', | |
60 'android_stlport_libs': '<(android_stlport)/libs', | |
61 }] | |
Jakob Kummerow
2012/09/03 11:18:18
nit: trailing comma please
| |
62 ], | |
51 # Enable to use the system stlport, otherwise statically | 63 # Enable to use the system stlport, otherwise statically |
52 # link the NDK one? | 64 # link the NDK one? |
53 'use_system_stlport%': '<(android_build_type)', | 65 'use_system_stlport%': '<(android_build_type)', |
54 'android_stlport_library': 'stlport_static', | 66 'android_stlport_library': 'stlport_static', |
55 # Copy it out one scope. | 67 # Copy it out one scope. |
56 'android_build_type%': '<(android_build_type)', | 68 'android_build_type%': '<(android_build_type)', |
57 | |
58 'OS': 'android', | 69 'OS': 'android', |
59 }, # variables | 70 }, # variables |
60 'target_defaults': { | 71 'target_defaults': { |
61 'defines': [ | 72 'defines': [ |
62 'ANDROID', | 73 'ANDROID', |
63 'V8_ANDROID_LOG_STDOUT', | 74 'V8_ANDROID_LOG_STDOUT', |
64 ], | 75 ], |
65 'configurations': { | 76 'configurations': { |
66 'Release': { | 77 'Release': { |
67 'cflags!': [ | 78 'cflags!': [ |
(...skipping 19 matching lines...) Expand all Loading... | |
87 '-U__linux__', # Don't allow toolchain to claim -D__linux__ | 98 '-U__linux__', # Don't allow toolchain to claim -D__linux__ |
88 '-ffunction-sections', | 99 '-ffunction-sections', |
89 '-funwind-tables', | 100 '-funwind-tables', |
90 '-fstack-protector', | 101 '-fstack-protector', |
91 '-fno-short-enums', | 102 '-fno-short-enums', |
92 '-finline-limit=64', | 103 '-finline-limit=64', |
93 '-Wa,--noexecstack', | 104 '-Wa,--noexecstack', |
94 '-Wno-error=non-virtual-dtor', # TODO(michaelbai): Fix warnings. | 105 '-Wno-error=non-virtual-dtor', # TODO(michaelbai): Fix warnings. |
95 # Note: This include is in cflags to ensure that it comes after | 106 # Note: This include is in cflags to ensure that it comes after |
96 # all of the includes. | 107 # all of the includes. |
97 '-I<(android_ndk_include)', | 108 '-I<(android_include)', |
98 ], | 109 ], |
99 'defines': [ | 110 'defines': [ |
100 'ANDROID', | 111 'ANDROID', |
101 #'__GNU_SOURCE=1', # Necessary for clone() | 112 #'__GNU_SOURCE=1', # Necessary for clone() |
102 'USE_STLPORT=1', | 113 'USE_STLPORT=1', |
103 '_STLP_USE_PTR_SPECIALIZATIONS=1', | 114 '_STLP_USE_PTR_SPECIALIZATIONS=1', |
104 'HAVE_OFF64_T', | 115 'HAVE_OFF64_T', |
105 'HAVE_SYS_UIO_H', | 116 'HAVE_SYS_UIO_H', |
106 'ANDROID_BINSIZE_HACK', # Enable temporary hacks to reduce binsize. | 117 'ANDROID_BINSIZE_HACK', # Enable temporary hacks to reduce binsize. |
107 ], | 118 ], |
(...skipping 19 matching lines...) Expand all Loading... | |
127 # Manually link the libgcc.a that the cross compiler uses. | 138 # Manually link the libgcc.a that the cross compiler uses. |
128 '<!($CC -print-libgcc-file-name)', | 139 '<!($CC -print-libgcc-file-name)', |
129 '-lc', | 140 '-lc', |
130 '-ldl', | 141 '-ldl', |
131 '-lstdc++', | 142 '-lstdc++', |
132 '-lm', | 143 '-lm', |
133 ], | 144 ], |
134 'conditions': [ | 145 'conditions': [ |
135 ['android_build_type==0', { | 146 ['android_build_type==0', { |
136 'ldflags': [ | 147 'ldflags': [ |
137 '-Wl,-rpath-link=<(android_ndk_lib)', | 148 '-Wl,-rpath-link=<(android_lib)', |
138 '-L<(android_ndk_lib)', | 149 '-L<(android_lib)', |
139 ], | 150 ], |
140 }], | 151 }], |
141 ['target_arch == "arm"', { | 152 ['target_arch == "arm"', { |
142 'ldflags': [ | 153 'ldflags': [ |
143 # Enable identical code folding to reduce size. | 154 # Enable identical code folding to reduce size. |
144 '-Wl,--icf=safe', | 155 '-Wl,--icf=safe', |
145 ], | 156 ], |
146 }], | 157 }], |
147 ['target_arch=="arm" and armv7==1', { | 158 ['target_arch=="arm" and armv7==1', { |
148 'cflags': [ | 159 'cflags': [ |
149 '-march=armv7-a', | 160 '-march=armv7-a', |
150 '-mtune=cortex-a8', | 161 '-mtune=cortex-a8', |
151 '-mfpu=vfp3', | 162 '-mfpu=vfp3', |
152 ], | 163 ], |
153 }], | 164 }], |
154 # NOTE: The stlport header include paths below are specified in | 165 # NOTE: The stlport header include paths below are specified in |
155 # cflags rather than include_dirs because they need to come | 166 # cflags rather than include_dirs because they need to come |
156 # after include_dirs. Think of them like system headers, but | 167 # after include_dirs. Think of them like system headers, but |
157 # don't use '-isystem' because the arm-linux-androideabi-4.4.3 | 168 # don't use '-isystem' because the arm-linux-androideabi-4.4.3 |
158 # toolchain (circa Gingerbread) will exhibit strange errors. | 169 # toolchain (circa Gingerbread) will exhibit strange errors. |
159 # The include ordering here is important; change with caution. | 170 # The include ordering here is important; change with caution. |
160 ['use_system_stlport==0', { | 171 ['use_system_stlport==0', { |
161 'cflags': [ | 172 'cflags': [ |
162 '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport', | 173 '-I<(android_stlport_include)', |
163 ], | 174 ], |
164 'conditions': [ | 175 'conditions': [ |
165 ['target_arch=="arm" and armv7==1', { | 176 ['target_arch=="arm" and armv7==1', { |
166 'ldflags': [ | 177 'ldflags': [ |
167 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi-v7 a', | 178 '-L<(android_stlport_libs)/armeabi-v7a', |
168 ], | 179 ], |
169 }], | 180 }], |
170 ['target_arch=="arm" and armv7==0', { | 181 ['target_arch=="arm" and armv7==0', { |
171 'ldflags': [ | 182 'ldflags': [ |
172 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi', | 183 '-L<(android_stlport_libs)/armeabi', |
173 ], | 184 ], |
174 }], | 185 }], |
175 ['target_arch=="ia32"', { | 186 ['target_arch=="ia32"', { |
176 'ldflags': [ | 187 'ldflags': [ |
177 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86', | 188 '-L<(android_stlport_libs)/x86', |
178 ], | 189 ], |
179 }], | 190 }], |
180 ], | 191 ], |
181 }], | 192 }], |
182 ['target_arch=="ia32"', { | 193 ['target_arch=="ia32"', { |
183 # The x86 toolchain currently has problems with stack-protector. | 194 # The x86 toolchain currently has problems with stack-protector. |
184 'cflags!': [ | 195 'cflags!': [ |
185 '-fstack-protector', | 196 '-fstack-protector', |
186 ], | 197 ], |
187 'cflags': [ | 198 'cflags': [ |
188 '-fno-stack-protector', | 199 '-fno-stack-protector', |
189 ], | 200 ], |
190 }], | 201 }], |
191 ], | 202 ], |
192 'target_conditions': [ | 203 'target_conditions': [ |
193 ['_type=="executable"', { | 204 ['_type=="executable"', { |
194 'ldflags': [ | 205 'ldflags': [ |
195 '-Bdynamic', | 206 '-Bdynamic', |
196 '-Wl,-dynamic-linker,/system/bin/linker', | 207 '-Wl,-dynamic-linker,/system/bin/linker', |
197 '-Wl,--gc-sections', | 208 '-Wl,--gc-sections', |
198 '-Wl,-z,nocopyreloc', | 209 '-Wl,-z,nocopyreloc', |
199 # crtbegin_dynamic.o should be the last item in ldflags. | 210 # crtbegin_dynamic.o should be the last item in ldflags. |
200 '<(android_ndk_lib)/crtbegin_dynamic.o', | 211 '<(android_lib)/crtbegin_dynamic.o', |
201 ], | 212 ], |
202 'libraries': [ | 213 'libraries': [ |
203 # crtend_android.o needs to be the last item in libraries. | 214 # crtend_android.o needs to be the last item in libraries. |
204 # Do not add any libraries after this! | 215 # Do not add any libraries after this! |
205 '<(android_ndk_lib)/crtend_android.o', | 216 '<(android_lib)/crtend_android.o', |
206 ], | 217 ], |
207 }], | 218 }], |
208 ['_type=="shared_library"', { | 219 ['_type=="shared_library"', { |
209 'ldflags': [ | 220 'ldflags': [ |
210 '-Wl,-shared,-Bsymbolic', | 221 '-Wl,-shared,-Bsymbolic', |
211 ], | 222 ], |
212 }], | 223 }], |
213 ], | 224 ], |
214 }], # _toolset=="target" | 225 }], # _toolset=="target" |
215 # Settings for building host targets using the system toolchain. | 226 # Settings for building host targets using the system toolchain. |
216 ['_toolset=="host"', { | 227 ['_toolset=="host"', { |
217 'cflags': [ '-m32', '-pthread' ], | 228 'cflags': [ '-m32', '-pthread' ], |
218 'ldflags': [ '-m32', '-pthread' ], | 229 'ldflags': [ '-m32', '-pthread' ], |
219 'ldflags!': [ | 230 'ldflags!': [ |
220 '-Wl,-z,noexecstack', | 231 '-Wl,-z,noexecstack', |
221 '-Wl,--gc-sections', | 232 '-Wl,--gc-sections', |
222 '-Wl,-O1', | 233 '-Wl,-O1', |
223 '-Wl,--as-needed', | 234 '-Wl,--as-needed', |
224 ], | 235 ], |
225 }], | 236 }], |
226 ], # target_conditions | 237 ], # target_conditions |
227 }, # target_defaults | 238 }, # target_defaults |
228 } | 239 } |
OLD | NEW |