OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/bash | |
cshapiro
2012/08/07 22:39:40
#!/bin/sh unless we actually need bash
jackpal
2012/08/08 00:26:19
Done.
| |
2 # Copyright 2012 the Dart 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 2 ] ; then | |
30 echo "$0: Error: needs 2 arguments." | |
31 exit 1 | |
32 fi | |
33 | |
34 ARCH=$1 | |
35 MODE=$2 | |
36 | |
37 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | |
38 | |
39 case "${host_os}" in | |
40 "linux") | |
41 toolchain_dir="linux-x86" | |
42 ;; | |
43 "mac") | |
44 toolchain_dir="darwin-x86" | |
45 ;; | |
46 *) | |
47 echo "$0: Host platform ${host_os} is not supported" >& 2 | |
48 exit 1 | |
49 esac | |
50 | |
51 case "${ARCH}" in | |
52 "android_arm") | |
53 DEFINES=" target_arch=arm v8_target_arch=arm android_target_arch=arm" | |
54 DEFINES+=" arm_neon=0 armv7=1" | |
55 toolchain_arch="arm-linux-androideabi-4.4.3" | |
56 ;; | |
57 "android_ia32") | |
58 DEFINES=" target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86" | |
59 toolchain_arch="x86-4.4.3" | |
60 ;; | |
61 *) | |
62 echo "$0: Target architecture ${ARCH} is not supported." >& 2 | |
63 echo "$0: Current supported architectures: android_arm|android_ia32." >& 2 | |
64 exit 1 | |
65 esac | |
66 | |
67 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/" | |
68 ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin" | |
69 if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then | |
70 echo "$0: Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2 | |
71 echo "$0: The NDK version might be wrong." >& 2 | |
72 exit 1 | |
73 fi | |
74 | |
75 # For mksnapshot host generation. | |
76 DEFINES+=" host_os=${host_os}" | |
77 | |
78 # The set of GYP_DEFINES to pass to gyp. | |
79 export GYP_DEFINES="${DEFINES}" | |
80 | |
81 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | |
82 export GYP_GENERATORS=make-android | |
83 export CC=${ANDROID_TOOLCHAIN}/*-gcc | |
84 export CXX=${ANDROID_TOOLCHAIN}/*-g++ | |
85 | |
86 export AR=${ANDROID_TOOLCHAIN}/*-ar | |
87 export RANLIB=${ANDROID_TOOLCHAIN}/*-ranlib | |
88 export LD=${ANDROID_TOOLCHAIN}/*-ld | |
89 export LINK=${ANDROID_TOOLCHAIN}/*-g++ | |
90 | |
91 | |
92 tools/build.py -m ${MODE} dart --toolchainprefix ${ANDROID_TOOLCHAIN}/i686-linux -android | |
OLD | NEW |