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 1 ] ; then |
| 30 echo "Error: architecture (arm|ia32) required" |
| 31 return 1 |
| 32 fi |
| 33 |
| 34 ARCH=$1 |
| 35 |
| 36 if [ ! -d "${ANDROID_NDK_ROOT}" ]; then |
| 37 echo "ANDROID_NDK_ROOT must be set to the path of Android NDK, Revision 8." \ |
| 38 >& 2 |
| 39 return 1 |
| 40 fi |
| 41 |
| 42 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') |
| 43 |
| 44 case "${host_os}" in |
| 45 "linux") |
| 46 toolchain_dir="linux-x86" |
| 47 ;; |
| 48 *) |
| 49 echo "Host platform ${host_os} is not supported" >& 2 |
| 50 return 1 |
| 51 esac |
| 52 |
| 53 case "${ARCH}" in |
| 54 "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 "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 "Architecture: ${ARCH} is not supported." >& 2 |
| 65 echo "Current supported architectures: arm|ia32." >& 2 |
| 66 return 1 |
| 67 esac |
| 68 |
| 69 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/" |
| 70 export ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin/" |
| 71 if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then |
| 72 echo "Can not find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2 |
| 73 echo "The NDK version might be wrong." >& 2 |
| 74 return 1 |
| 75 fi |
| 76 |
| 77 # The set of GYP_DEFINES to pass to gyp. |
| 78 export GYP_DEFINES="${DEFINES}" |
OLD | NEW |