| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash | |
| 2 # Copyright 2012 the V8 project authors. All rights reserved. | |
| 3 # Redistribution and use in source and binary forms, with or without | |
| 4 # modification, are permitted provided that the following conditions are | |
| 5 # met: | |
| 6 # | |
| 7 # * Redistributions of source code must retain the above copyright | |
| 8 # notice, this list of conditions and the following disclaimer. | |
| 9 # * Redistributions in binary form must reproduce the above | |
| 10 # copyright notice, this list of conditions and the following | |
| 11 # disclaimer in the documentation and/or other materials provided | |
| 12 # with the distribution. | |
| 13 # * Neither the name of Google Inc. nor the names of its | |
| 14 # contributors may be used to endorse or promote products derived | |
| 15 # from this software without specific prior written permission. | |
| 16 # | |
| 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 28 | |
| 29 if [ ${#@} -lt 4 ] ; then | |
| 30 echo "$0: Error: needs 4 arguments." | |
| 31 exit 1 | |
| 32 fi | |
| 33 | |
| 34 ARCH=$1 | |
| 35 MODE=$2 | |
| 36 OUTDIR=$3 | |
| 37 GYPFLAGS=$4 | |
| 38 | |
| 39 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | |
| 40 | |
| 41 case "${host_os}" in | |
| 42 "linux") | |
| 43 toolchain_dir="linux-x86" | |
| 44 ;; | |
| 45 "mac") | |
| 46 toolchain_dir="darwin-x86" | |
| 47 ;; | |
| 48 *) | |
| 49 echo "$0: Host platform ${host_os} is not supported" >& 2 | |
| 50 exit 1 | |
| 51 esac | |
| 52 | |
| 53 case "${ARCH}" in | |
| 54 "android_arm") | |
| 55 DEFINES=" target_arch=arm v8_target_arch=arm android_target_arch=arm" | |
| 56 DEFINES+=" arm_neon=0 armv7=1" | |
| 57 toolchain_arch="arm-linux-androideabi-4.4.3" | |
| 58 ;; | |
| 59 "android_ia32") | |
| 60 DEFINES=" target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86" | |
| 61 toolchain_arch="x86-4.4.3" | |
| 62 ;; | |
| 63 *) | |
| 64 echo "$0: Target architecture ${ARCH} is not supported." >& 2 | |
| 65 echo "$0: Current supported architectures: android_arm|android_ia32." >& 2 | |
| 66 exit 1 | |
| 67 esac | |
| 68 | |
| 69 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/" | |
| 70 ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin" | |
| 71 if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then | |
| 72 echo "$0: Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2 | |
| 73 echo "$0: The NDK version might be wrong." >& 2 | |
| 74 exit 1 | |
| 75 fi | |
| 76 | |
| 77 # For mksnapshot host generation. | |
| 78 DEFINES+=" host_os=${host_os}" | |
| 79 | |
| 80 # The set of GYP_DEFINES to pass to gyp. | |
| 81 export GYP_DEFINES="${DEFINES}" | |
| 82 | |
| 83 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | |
| 84 export GYP_GENERATORS=make-android | |
| 85 export CC=${ANDROID_TOOLCHAIN}/*-gcc | |
| 86 export CXX=${ANDROID_TOOLCHAIN}/*-g++ | |
| 87 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ | |
| 88 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ | |
| 89 -S.${ARCH} ${GYPFLAGS} | |
| 90 | |
| 91 export AR=${ANDROID_TOOLCHAIN}/*-ar | |
| 92 export RANLIB=${ANDROID_TOOLCHAIN}/*-ranlib | |
| 93 export LD=${ANDROID_TOOLCHAIN}/*-ld | |
| 94 export LINK=${ANDROID_TOOLCHAIN}/*-g++ | |
| 95 export BUILDTYPE=$(echo ${MODE} | python -c "print raw_input().capitalize()") | |
| 96 export builddir=${PWD}/${OUTDIR}/${ARCH}.${MODE} | |
| 97 make -C "${OUTDIR}" -f Makefile.${ARCH} | |
| OLD | NEW |