| OLD | NEW |
| (Empty) |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | |
| 2 # Redistribution and use in source and binary forms, with or without | |
| 3 # modification, are permitted provided that the following conditions are | |
| 4 # met: | |
| 5 # | |
| 6 # * Redistributions of source code must retain the above copyright | |
| 7 # notice, this list of conditions and the following disclaimer. | |
| 8 # * Redistributions in binary form must reproduce the above | |
| 9 # copyright notice, this list of conditions and the following | |
| 10 # disclaimer in the documentation and/or other materials provided | |
| 11 # with the distribution. | |
| 12 # * Neither the name of Google Inc. nor the names of its | |
| 13 # contributors may be used to endorse or promote products derived | |
| 14 # from this software without specific prior written permission. | |
| 15 # | |
| 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | |
| 28 # Definitions for building standalone V8 binaries to run on Android. | |
| 29 # This is mostly excerpted from: | |
| 30 # http://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi | |
| 31 | |
| 32 { | |
| 33 'variables': { | |
| 34 # Location of Android NDK. | |
| 35 'variables': { | |
| 36 'variables': { | |
| 37 # The Android toolchain needs to use the absolute path to the NDK | |
| 38 # because it is used at different levels in the GYP files. | |
| 39 'android_ndk_root%': '<!(cd <(DEPTH) && pwd -P)/third_party/android_tool
s/ndk/', | |
| 40 'android_host_arch%': "<!(uname -m | sed -e 's/i[3456]86/x86/')", | |
| 41 'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')", | |
| 42 }, | |
| 43 | |
| 44 # Copy conditionally-set variables out one scope. | |
| 45 'android_ndk_root%': '<(android_ndk_root)', | |
| 46 | |
| 47 'conditions': [ | |
| 48 ['target_arch == "ia32"', { | |
| 49 'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.9/prebuilt
/<(host_os)-<(android_host_arch)/bin', | |
| 50 }], | |
| 51 ['target_arch == "x64"', { | |
| 52 'android_toolchain%': '<(android_ndk_root)/toolchains/x86_64-4.9/prebu
ilt/<(host_os)-<(android_host_arch)/bin', | |
| 53 }], | |
| 54 ['target_arch=="arm"', { | |
| 55 'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androi
deabi-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin', | |
| 56 }], | |
| 57 ['target_arch == "arm64"', { | |
| 58 'android_toolchain%': '<(android_ndk_root)/toolchains/aarch64-linux-an
droid-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin', | |
| 59 }], | |
| 60 ['target_arch == "mipsel"', { | |
| 61 'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-and
roid-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin', | |
| 62 }], | |
| 63 ['target_arch == "mips64el"', { | |
| 64 'android_toolchain%': '<(android_ndk_root)/toolchains/mips64el-linux-a
ndroid-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin', | |
| 65 }], | |
| 66 ], | |
| 67 }, | |
| 68 | |
| 69 'conditions': [ | |
| 70 ['android_ndk_root==""', { | |
| 71 'variables': { | |
| 72 'android_sysroot': '<(android_toolchain)/sysroot/', | |
| 73 'android_stlport': '<(android_toolchain)/sources/cxx-stl/stlport/', | |
| 74 }, | |
| 75 'android_include': '<(android_sysroot)/usr/include', | |
| 76 'conditions': [ | |
| 77 ['target_arch=="x64"', { | |
| 78 'android_lib': '<(android_sysroot)/usr/lib64', | |
| 79 }, { | |
| 80 'android_lib': '<(android_sysroot)/usr/lib', | |
| 81 }], | |
| 82 ], | |
| 83 'android_stlport_include': '<(android_stlport)/stlport', | |
| 84 'android_stlport_libs': '<(android_stlport)/libs', | |
| 85 }, { | |
| 86 'variables': { | |
| 87 'android_sysroot': '<(android_ndk_root)/platforms/android-<(android_ta
rget_platform)/arch-<(android_target_arch)', | |
| 88 'android_stlport': '<(android_ndk_root)/sources/cxx-stl/stlport/', | |
| 89 }, | |
| 90 'android_include': '<(android_sysroot)/usr/include', | |
| 91 'conditions': [ | |
| 92 ['target_arch=="x64"', { | |
| 93 'android_lib': '<(android_sysroot)/usr/lib64', | |
| 94 }, { | |
| 95 'android_lib': '<(android_sysroot)/usr/lib', | |
| 96 }], | |
| 97 ], | |
| 98 'android_stlport_include': '<(android_stlport)/stlport', | |
| 99 'android_stlport_libs': '<(android_stlport)/libs', | |
| 100 }], | |
| 101 ], | |
| 102 'android_stlport_library': 'stlport_static', | |
| 103 }, # variables | |
| 104 'target_defaults': { | |
| 105 'defines': [ | |
| 106 'ANDROID', | |
| 107 'V8_ANDROID_LOG_STDOUT', | |
| 108 ], | |
| 109 'configurations': { | |
| 110 'Release': { | |
| 111 'cflags': [ | |
| 112 '-fomit-frame-pointer', | |
| 113 ], | |
| 114 }, # Release | |
| 115 }, # configurations | |
| 116 'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter'], | |
| 117 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions', | |
| 118 # Note: Using -std=c++0x will define __STRICT_ANSI__, which | |
| 119 # in turn will leave out some template stuff for 'long | |
| 120 # long'. What we want is -std=c++11, but this is not | |
| 121 # supported by GCC 4.6 or Xcode 4.2 | |
| 122 '-std=gnu++0x' ], | |
| 123 'target_conditions': [ | |
| 124 ['_toolset=="target"', { | |
| 125 'cflags!': [ | |
| 126 '-pthread', # Not supported by Android toolchain. | |
| 127 ], | |
| 128 'cflags': [ | |
| 129 '-ffunction-sections', | |
| 130 '-funwind-tables', | |
| 131 '-fstack-protector', | |
| 132 '-fno-short-enums', | |
| 133 '-finline-limit=64', | |
| 134 '-Wa,--noexecstack', | |
| 135 # Note: This include is in cflags to ensure that it comes after | |
| 136 # all of the includes. | |
| 137 '-I<(android_include)', | |
| 138 '-I<(android_stlport_include)', | |
| 139 ], | |
| 140 'cflags_cc': [ | |
| 141 '-Wno-error=non-virtual-dtor', # TODO(michaelbai): Fix warnings. | |
| 142 ], | |
| 143 'defines': [ | |
| 144 'ANDROID', | |
| 145 #'__GNU_SOURCE=1', # Necessary for clone() | |
| 146 'USE_STLPORT=1', | |
| 147 '_STLP_USE_PTR_SPECIALIZATIONS=1', | |
| 148 'HAVE_OFF64_T', | |
| 149 'HAVE_SYS_UIO_H', | |
| 150 'ANDROID_BINSIZE_HACK', # Enable temporary hacks to reduce binsize. | |
| 151 ], | |
| 152 'ldflags!': [ | |
| 153 '-pthread', # Not supported by Android toolchain. | |
| 154 ], | |
| 155 'ldflags': [ | |
| 156 '-nostdlib', | |
| 157 '-Wl,--no-undefined', | |
| 158 '-Wl,-rpath-link=<(android_lib)', | |
| 159 '-L<(android_lib)', | |
| 160 ], | |
| 161 'libraries!': [ | |
| 162 '-lrt', # librt is built into Bionic. | |
| 163 # Not supported by Android toolchain. | |
| 164 # Where do these come from? Can't find references in | |
| 165 # any Chromium gyp or gypi file. Maybe they come from | |
| 166 # gyp itself? | |
| 167 '-lpthread', '-lnss3', '-lnssutil3', '-lsmime3', '-lplds4', '-lplc4'
, '-lnspr4', | |
| 168 ], | |
| 169 'libraries': [ | |
| 170 '-l<(android_stlport_library)', | |
| 171 # Manually link the libgcc.a that the cross compiler uses. | |
| 172 '<!($CC -print-libgcc-file-name)', | |
| 173 '-lc', | |
| 174 '-ldl', | |
| 175 '-lstdc++', | |
| 176 '-lm', | |
| 177 ], | |
| 178 'conditions': [ | |
| 179 ['target_arch == "arm"', { | |
| 180 'ldflags': [ | |
| 181 # Enable identical code folding to reduce size. | |
| 182 '-Wl,--icf=safe', | |
| 183 ], | |
| 184 }], | |
| 185 ['target_arch=="arm" and arm_version==7', { | |
| 186 'cflags': [ | |
| 187 '-march=armv7-a', | |
| 188 '-mtune=cortex-a8', | |
| 189 '-mfpu=vfp3', | |
| 190 ], | |
| 191 'ldflags': [ | |
| 192 '-L<(android_stlport_libs)/armeabi-v7a', | |
| 193 ], | |
| 194 }], | |
| 195 ['target_arch=="arm" and arm_version < 7', { | |
| 196 'ldflags': [ | |
| 197 '-L<(android_stlport_libs)/armeabi', | |
| 198 ], | |
| 199 }], | |
| 200 ['target_arch=="x64"', { | |
| 201 'ldflags': [ | |
| 202 '-L<(android_stlport_libs)/x86_64', | |
| 203 ], | |
| 204 }], | |
| 205 ['target_arch=="arm64"', { | |
| 206 'ldflags': [ | |
| 207 '-L<(android_stlport_libs)/arm64-v8a', | |
| 208 ], | |
| 209 }], | |
| 210 ['target_arch=="ia32" or target_arch=="x87"', { | |
| 211 # The x86 toolchain currently has problems with stack-protector. | |
| 212 'cflags!': [ | |
| 213 '-fstack-protector', | |
| 214 ], | |
| 215 'cflags': [ | |
| 216 '-fno-stack-protector', | |
| 217 ], | |
| 218 'ldflags': [ | |
| 219 '-L<(android_stlport_libs)/x86', | |
| 220 ], | |
| 221 }], | |
| 222 ['target_arch=="mipsel"', { | |
| 223 # The mips toolchain currently has problems with stack-protector. | |
| 224 'cflags!': [ | |
| 225 '-fstack-protector', | |
| 226 '-U__linux__' | |
| 227 ], | |
| 228 'cflags': [ | |
| 229 '-fno-stack-protector', | |
| 230 ], | |
| 231 'ldflags': [ | |
| 232 '-L<(android_stlport_libs)/mips', | |
| 233 ], | |
| 234 }], | |
| 235 ['(target_arch=="arm" or target_arch=="arm64" or target_arch=="x64" or
target_arch=="ia32") and component!="shared_library"', { | |
| 236 'cflags': [ | |
| 237 '-fPIE', | |
| 238 ], | |
| 239 'ldflags': [ | |
| 240 '-pie', | |
| 241 ], | |
| 242 }], | |
| 243 ], | |
| 244 'target_conditions': [ | |
| 245 ['_type=="executable"', { | |
| 246 'conditions': [ | |
| 247 ['target_arch=="arm64" or target_arch=="x64"', { | |
| 248 'ldflags': [ | |
| 249 '-Wl,-dynamic-linker,/system/bin/linker64', | |
| 250 ], | |
| 251 }, { | |
| 252 'ldflags': [ | |
| 253 '-Wl,-dynamic-linker,/system/bin/linker', | |
| 254 ], | |
| 255 }] | |
| 256 ], | |
| 257 'ldflags': [ | |
| 258 '-Bdynamic', | |
| 259 '-Wl,-z,nocopyreloc', | |
| 260 # crtbegin_dynamic.o should be the last item in ldflags. | |
| 261 '<(android_lib)/crtbegin_dynamic.o', | |
| 262 ], | |
| 263 'libraries': [ | |
| 264 # crtend_android.o needs to be the last item in libraries. | |
| 265 # Do not add any libraries after this! | |
| 266 '<(android_lib)/crtend_android.o', | |
| 267 ], | |
| 268 }], | |
| 269 ['_type=="shared_library"', { | |
| 270 'ldflags': [ | |
| 271 '-Wl,-shared,-Bsymbolic', | |
| 272 '<(android_lib)/crtbegin_so.o', | |
| 273 ], | |
| 274 }], | |
| 275 ['_type=="static_library"', { | |
| 276 'ldflags': [ | |
| 277 # Don't export symbols from statically linked libraries. | |
| 278 '-Wl,--exclude-libs=ALL', | |
| 279 ], | |
| 280 }], | |
| 281 ], | |
| 282 }], # _toolset=="target" | |
| 283 # Settings for building host targets using the system toolchain. | |
| 284 ['_toolset=="host"', { | |
| 285 'cflags': [ '-pthread' ], | |
| 286 'ldflags': [ '-pthread' ], | |
| 287 'ldflags!': [ | |
| 288 '-Wl,-z,noexecstack', | |
| 289 '-Wl,--gc-sections', | |
| 290 '-Wl,-O1', | |
| 291 '-Wl,--as-needed', | |
| 292 ], | |
| 293 }], | |
| 294 ], # target_conditions | |
| 295 }, # target_defaults | |
| 296 } | |
| OLD | NEW |