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