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 'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)', |
| 38 |
| 39 # Switch between different build types, currently only '0' is |
| 40 # supported. |
| 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 }, |
| 47 'android_ndk_root%': '<(android_ndk_root)', |
| 48 'android_ndk_sysroot': '<(android_ndk_sysroot)', |
| 49 'android_ndk_include': '<(android_ndk_sysroot)/usr/include', |
| 50 'android_ndk_lib': '<(android_ndk_sysroot)/usr/lib', |
| 51 # Enable to use the system stlport, otherwise statically |
| 52 # link the NDK one? |
| 53 'use_system_stlport%': '<(android_build_type)', |
| 54 'android_stlport_library': 'stlport_static', |
| 55 # Copy it out one scope. |
| 56 'android_build_type%': '<(android_build_type)', |
| 57 |
| 58 'OS': 'android', |
| 59 }, # variables |
| 60 'target_defaults': { |
| 61 'defines': [ |
| 62 'ANDROID', |
| 63 'V8_ANDROID_LOG_STDOUT', |
| 64 ], |
| 65 'configurations': { |
| 66 'Release': { |
| 67 'cflags!': [ |
| 68 '-O2', |
| 69 '-Os', |
| 70 ], |
| 71 'cflags': [ |
| 72 '-fdata-sections', |
| 73 '-ffunction-sections', |
| 74 '-fomit-frame-pointer', |
| 75 '-O3', |
| 76 ], |
| 77 }, # Release |
| 78 }, # configurations |
| 79 'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter', |
| 80 '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions', ], |
| 81 'target_conditions': [ |
| 82 ['_toolset=="target"', { |
| 83 'cflags!': [ |
| 84 '-pthread', # Not supported by Android toolchain. |
| 85 ], |
| 86 'cflags': [ |
| 87 '-U__linux__', # Don't allow toolchain to claim -D__linux__ |
| 88 '-ffunction-sections', |
| 89 '-funwind-tables', |
| 90 '-fstack-protector', |
| 91 '-fno-short-enums', |
| 92 '-finline-limit=64', |
| 93 '-Wa,--noexecstack', |
| 94 '-Wno-error=non-virtual-dtor', # TODO(michaelbai): Fix warnings. |
| 95 # Note: This include is in cflags to ensure that it comes after |
| 96 # all of the includes. |
| 97 '-I<(android_ndk_include)', |
| 98 ], |
| 99 'defines': [ |
| 100 'ANDROID', |
| 101 #'__GNU_SOURCE=1', # Necessary for clone() |
| 102 'USE_STLPORT=1', |
| 103 '_STLP_USE_PTR_SPECIALIZATIONS=1', |
| 104 'HAVE_OFF64_T', |
| 105 'HAVE_SYS_UIO_H', |
| 106 'ANDROID_BINSIZE_HACK', # Enable temporary hacks to reduce binsize. |
| 107 ], |
| 108 'ldflags!': [ |
| 109 '-pthread', # Not supported by Android toolchain. |
| 110 ], |
| 111 'ldflags': [ |
| 112 '-nostdlib', |
| 113 '-Wl,--no-undefined', |
| 114 # Don't export symbols from statically linked libraries. |
| 115 '-Wl,--exclude-libs=ALL', |
| 116 ], |
| 117 'libraries!': [ |
| 118 '-lrt', # librt is built into Bionic. |
| 119 # Not supported by Android toolchain. |
| 120 # Where do these come from? Can't find references in |
| 121 # any Chromium gyp or gypi file. Maybe they come from |
| 122 # gyp itself? |
| 123 '-lpthread', '-lnss3', '-lnssutil3', '-lsmime3', '-lplds4', '-lplc4'
, '-lnspr4', |
| 124 ], |
| 125 'libraries': [ |
| 126 '-l<(android_stlport_library)', |
| 127 # Manually link the libgcc.a that the cross compiler uses. |
| 128 '<!(${ANDROID_TOOLCHAIN}/*-gcc -print-libgcc-file-name)', |
| 129 '-lc', |
| 130 '-ldl', |
| 131 '-lstdc++', |
| 132 '-lm', |
| 133 ], |
| 134 'conditions': [ |
| 135 ['android_build_type==0', { |
| 136 'ldflags': [ |
| 137 '-Wl,-rpath-link=<(android_ndk_lib)', |
| 138 '-L<(android_ndk_lib)', |
| 139 ], |
| 140 }], |
| 141 ['target_arch == "arm"', { |
| 142 'ldflags': [ |
| 143 # Enable identical code folding to reduce size. |
| 144 '-Wl,--icf=safe', |
| 145 ], |
| 146 }], |
| 147 ['target_arch=="arm" and armv7==1', { |
| 148 'cflags': [ |
| 149 '-march=armv7-a', |
| 150 '-mtune=cortex-a8', |
| 151 '-mfpu=vfp3', |
| 152 ], |
| 153 }], |
| 154 # NOTE: The stlport header include paths below are specified in |
| 155 # cflags rather than include_dirs because they need to come |
| 156 # after include_dirs. Think of them like system headers, but |
| 157 # don't use '-isystem' because the arm-linux-androideabi-4.4.3 |
| 158 # toolchain (circa Gingerbread) will exhibit strange errors. |
| 159 # The include ordering here is important; change with caution. |
| 160 ['use_system_stlport==0', { |
| 161 'cflags': [ |
| 162 '-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport', |
| 163 ], |
| 164 'conditions': [ |
| 165 ['target_arch=="arm" and armv7==1', { |
| 166 'ldflags': [ |
| 167 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi-v7
a', |
| 168 ], |
| 169 }], |
| 170 ['target_arch=="arm" and armv7==0', { |
| 171 'ldflags': [ |
| 172 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi', |
| 173 ], |
| 174 }], |
| 175 ['target_arch=="ia32"', { |
| 176 'ldflags': [ |
| 177 '-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86', |
| 178 ], |
| 179 }], |
| 180 ], |
| 181 }], |
| 182 ['target_arch=="ia32"', { |
| 183 # The x86 toolchain currently has problems with stack-protector. |
| 184 'cflags!': [ |
| 185 '-fstack-protector', |
| 186 ], |
| 187 'cflags': [ |
| 188 '-fno-stack-protector', |
| 189 ], |
| 190 }], |
| 191 ], |
| 192 'target_conditions': [ |
| 193 ['_type=="executable"', { |
| 194 'ldflags': [ |
| 195 '-Bdynamic', |
| 196 '-Wl,-dynamic-linker,/system/bin/linker', |
| 197 '-Wl,--gc-sections', |
| 198 '-Wl,-z,nocopyreloc', |
| 199 # crtbegin_dynamic.o should be the last item in ldflags. |
| 200 '<(android_ndk_lib)/crtbegin_dynamic.o', |
| 201 ], |
| 202 'libraries': [ |
| 203 # crtend_android.o needs to be the last item in libraries. |
| 204 # Do not add any libraries after this! |
| 205 '<(android_ndk_lib)/crtend_android.o', |
| 206 ], |
| 207 }], |
| 208 ['_type=="shared_library"', { |
| 209 'ldflags': [ |
| 210 '-Wl,-shared,-Bsymbolic', |
| 211 ], |
| 212 }], |
| 213 ], |
| 214 }], # _toolset=="target" |
| 215 # Settings for building host targets using the system toolchain. |
| 216 ['_toolset=="host"', { |
| 217 'cflags': [ '-m32', '-pthread' ], |
| 218 'ldflags': [ '-m32', '-pthread' ], |
| 219 'ldflags!': [ |
| 220 '-Wl,-z,noexecstack', |
| 221 '-Wl,--gc-sections', |
| 222 '-Wl,-O1', |
| 223 '-Wl,--as-needed', |
| 224 ], |
| 225 }], |
| 226 ], # target_conditions |
| 227 }, # target_defaults |
| 228 } |
OLD | NEW |