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 "Error: $0 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 *) |
| 46 echo "Host platform ${host_os} is not supported" >& 2 |
| 47 exit 1 |
| 48 esac |
| 49 |
| 50 case "${ARCH}" in |
| 51 "android_arm") |
| 52 DEFINES=" target_arch=arm v8_target_arch=arm android_target_arch=arm" |
| 53 DEFINES+=" arm_neon=0 armv7=1" |
| 54 toolchain_arch="arm-linux-androideabi-4.4.3" |
| 55 ;; |
| 56 "android_ia32") |
| 57 DEFINES=" target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86" |
| 58 toolchain_arch="x86-4.4.3" |
| 59 ;; |
| 60 *) |
| 61 echo "Architecture: ${ARCH} is not supported." >& 2 |
| 62 echo "Current supported architectures: arm|ia32." >& 2 |
| 63 exit 1 |
| 64 esac |
| 65 |
| 66 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/" |
| 67 ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin" |
| 68 if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then |
| 69 echo "Can not find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2 |
| 70 echo "The NDK version might be wrong." >& 2 |
| 71 exit 1 |
| 72 fi |
| 73 |
| 74 # The set of GYP_DEFINES to pass to gyp. |
| 75 export GYP_DEFINES="${DEFINES}" |
| 76 |
| 77 export GYP_GENERATORS=make |
| 78 export CC=${ANDROID_TOOLCHAIN}/*-gcc |
| 79 export CXX=${ANDROID_TOOLCHAIN}/*-g++ |
| 80 build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ |
| 81 -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ |
| 82 -S.${ARCH}.${MODE} ${GYPFLAGS} |
| 83 |
| 84 export AR=${ANDROID_TOOLCHAIN}/*-ar |
| 85 export RANLIB=${ANDROID_TOOLCHAIN}/*-ranlib |
| 86 export LD=${ANDROID_TOOLCHAIN}/*-ld |
| 87 export LINK=${ANDROID_TOOLCHAIN}/*-g++ |
| 88 export BUILDTYPE=${MODE[@]^} |
| 89 export builddir=$(readlink -f ${PWD})/${OUTDIR}/${ARCH}.${MODE} |
| 90 make -C "${OUTDIR}" -f Makefile.${ARCH}.${MODE} |
OLD | NEW |