OLD | NEW |
1 function exportVar { | 1 function exportVar { |
2 NAME=$1 | 2 NAME=$1 |
3 VALUE=$2 | 3 VALUE=$2 |
4 echo export $NAME=\"$VALUE\" | 4 echo export $NAME=\"$VALUE\" |
5 export $NAME="$VALUE" | 5 export $NAME="$VALUE" |
6 } | 6 } |
7 | 7 |
8 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 8 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
9 | 9 |
10 # A valid Android SDK installation is required to build the sample app. | 10 # A valid Android SDK installation is required to build the sample app. |
(...skipping 24 matching lines...) Expand all Loading... |
35 echo " target_os = ['android']" | 35 echo " target_os = ['android']" |
36 echo "" | 36 echo "" |
37 exit 1; | 37 exit 1; |
38 fi | 38 fi |
39 | 39 |
40 # determine the toolchain that we will be using | 40 # determine the toolchain that we will be using |
41 API_LEVEL=14 | 41 API_LEVEL=14 |
42 | 42 |
43 if [[ -z "$NDK_REV" ]]; | 43 if [[ -z "$NDK_REV" ]]; |
44 then | 44 then |
45 NDK_REV="8e" | 45 NDK_REV="8e" |
46 fi | 46 fi |
47 | 47 |
48 if [[ -z "$ANDROID_ARCH" ]]; | 48 if [[ -z "$ANDROID_ARCH" ]]; |
49 then | 49 then |
50 ANDROID_ARCH="arm" | 50 ANDROID_ARCH="arm" |
51 fi | 51 fi |
52 | 52 |
53 TOOLCHAIN_DIR=${SCRIPT_DIR}/../toolchains | 53 TOOLCHAIN_DIR=${SCRIPT_DIR}/../toolchains |
54 if [ $(uname) == "Linux" ]; then | 54 if [ $(uname) == "Linux" ]; then |
55 echo "Using Linux toolchain." | 55 echo "Using Linux toolchain." |
56 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL | 56 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL |
57 elif [ $(uname) == "Darwin" ]; then | 57 elif [ $(uname) == "Darwin" ]; then |
58 echo "Using Mac toolchain." | 58 echo "Using Mac toolchain." |
59 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-mac_v$API_LEVEL | 59 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-mac_v$API_LEVEL |
60 else | 60 else |
61 echo "Could not automatically determine toolchain! Defaulting to Linux." | 61 echo "Could not automatically determine toolchain! Defaulting to Linux." |
62 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL | 62 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL |
63 fi | 63 fi |
64 exportVar ANDROID_TOOLCHAIN ${TOOLCHAIN_DIR}/${TOOLCHAIN_TYPE}/bin | 64 exportVar ANDROID_TOOLCHAIN ${TOOLCHAIN_DIR}/${TOOLCHAIN_TYPE}/bin |
65 | 65 |
66 # if the toolchain doesn't exist on your machine then we need to fetch it | 66 # if the toolchain doesn't exist on your machine then we need to fetch it |
67 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then | 67 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then |
68 # create the toolchain directory if needed | 68 # create the toolchain directory if needed |
69 if [ ! -d "$TOOLCHAIN_DIR" ]; then | 69 if [ ! -d "$TOOLCHAIN_DIR" ]; then |
70 mkdir $TOOLCHAIN_DIR | 70 mkdir $TOOLCHAIN_DIR |
71 fi | 71 fi |
72 # enter the toolchain directory then download, unpack, and remove the tarball | 72 # enter the toolchain directory then download, unpack, and remove the tarball |
(...skipping 17 matching lines...) Expand all Loading... |
90 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then | 90 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then |
91 echo "ERROR: unable to download/setup the required toolchain (${TOOLCHAIN_TYPE
})" | 91 echo "ERROR: unable to download/setup the required toolchain (${TOOLCHAIN_TYPE
})" |
92 return 1; | 92 return 1; |
93 fi | 93 fi |
94 | 94 |
95 echo "The build is targeting NDK API level $API_LEVEL for use on Android 4.0 (ND
K Revision $NDK_REV) and above" | 95 echo "The build is targeting NDK API level $API_LEVEL for use on Android 4.0 (ND
K Revision $NDK_REV) and above" |
96 | 96 |
97 LS="/bin/ls" # Use directly to avoid any 'ls' alias that might be defined. | 97 LS="/bin/ls" # Use directly to avoid any 'ls' alias that might be defined. |
98 GCC=$($LS $ANDROID_TOOLCHAIN/*-gcc | head -n1) | 98 GCC=$($LS $ANDROID_TOOLCHAIN/*-gcc | head -n1) |
99 if [ -z "$GCC" ]; then | 99 if [ -z "$GCC" ]; then |
100 echo "ERROR: Could not find Android cross-compiler in: $ANDROID_TOOLCHAIN" | 100 echo "ERROR: Could not find Android cross-compiler in: $ANDROID_TOOLCHAIN" |
101 return 1 | 101 return 1 |
102 fi | 102 fi |
103 | 103 |
104 # Remove the '-gcc' at the end to get the full toolchain prefix | 104 # Remove the '-gcc' at the end to get the full toolchain prefix |
105 ANDROID_TOOLCHAIN_PREFIX=${GCC%%-gcc} | 105 ANDROID_TOOLCHAIN_PREFIX=${GCC%%-gcc} |
106 | 106 |
107 exportVar AR "$ANDROID_TOOLCHAIN_PREFIX-ar" | 107 exportVar AR "$ANDROID_TOOLCHAIN_PREFIX-ar" |
108 if [[ -z "$ANDROID_MAKE_CCACHE" ]]; then | 108 if [[ -z "$ANDROID_MAKE_CCACHE" ]]; then |
109 exportVar CC "$ANDROID_TOOLCHAIN_PREFIX-gcc" | 109 exportVar CC "$ANDROID_TOOLCHAIN_PREFIX-gcc" |
110 exportVar CXX "$ANDROID_TOOLCHAIN_PREFIX-g++" | 110 exportVar CXX "$ANDROID_TOOLCHAIN_PREFIX-g++" |
111 exportVar LINK "$ANDROID_TOOLCHAIN_PREFIX-gcc" | 111 exportVar LINK "$ANDROID_TOOLCHAIN_PREFIX-gcc" |
(...skipping 22 matching lines...) Expand all Loading... |
134 # Setup the build variation depending on the target device | 134 # Setup the build variation depending on the target device |
135 TARGET_DEVICE="$1" | 135 TARGET_DEVICE="$1" |
136 | 136 |
137 if [ -z "$TARGET_DEVICE" ]; then | 137 if [ -z "$TARGET_DEVICE" ]; then |
138 echo "INFO: no target device type was specified so using the default 'arm_v7
'" | 138 echo "INFO: no target device type was specified so using the default 'arm_v7
'" |
139 TARGET_DEVICE="arm_v7" | 139 TARGET_DEVICE="arm_v7" |
140 fi | 140 fi |
141 | 141 |
142 case $TARGET_DEVICE in | 142 case $TARGET_DEVICE in |
143 nexus_s) | 143 nexus_s) |
144 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thum
b=1" | 144 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=
1" |
145 DEFINES="${DEFINES} skia_texture_cache_mb_limit=24" | 145 DEFINES="${DEFINES} skia_texture_cache_mb_limit=24" |
146 ;; | 146 ;; |
147 nexus_4 | nexus_7 | nexus_10) | 147 nexus_4 | nexus_7 | nexus_10) |
148 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thum
b=1" | 148 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=
1" |
149 ;; | 149 ;; |
150 xoom) | 150 xoom) |
151 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_version=7 arm_thum
b=1" | 151 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_version=7 arm_thumb=
1" |
152 ;; | 152 ;; |
153 galaxy_nexus) | 153 galaxy_nexus) |
154 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thum
b=1" | 154 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb=
1" |
155 DEFINES="${DEFINES} skia_texture_cache_mb_limit=32" | 155 DEFINES="${DEFINES} skia_texture_cache_mb_limit=32" |
156 ;; | 156 ;; |
157 razr_i) | 157 razr_i) |
158 DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32" | 158 DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32" |
159 DEFINES="${DEFINES} skia_texture_cache_mb_limit=32" | 159 DEFINES="${DEFINES} skia_texture_cache_mb_limit=32" |
160 ;; | 160 ;; |
161 arm_v7) | 161 arm_v7) |
162 DEFINES="${DEFINES} skia_arch_type=arm arm_neon_optional=1 arm_version=7
arm_thumb=0" | 162 DEFINES="${DEFINES} skia_arch_type=arm arm_neon_optional=1 arm_version=7 a
rm_thumb=0" |
163 ;; | 163 ;; |
164 arm_v7_thumb) | 164 arm_v7_thumb) |
165 DEFINES="${DEFINES} skia_arch_type=arm arm_neon_optional=1 arm_version=7
arm_thumb=1" | 165 DEFINES="${DEFINES} skia_arch_type=arm arm_neon_optional=1 arm_version=7 a
rm_thumb=1" |
166 ;; | 166 ;; |
167 arm) | 167 arm) |
168 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_thumb=0" | 168 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_thumb=0" |
169 ;; | 169 ;; |
170 arm_thumb) | 170 arm_thumb) |
171 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_thumb=1" | 171 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=0 arm_thumb=1" |
172 ;; | 172 ;; |
173 x86) | 173 x86) |
174 DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32" | 174 DEFINES="${DEFINES} skia_arch_type=x86 skia_arch_width=32" |
175 DEFINES="${DEFINES} skia_texture_cache_mb_limit=32" | 175 DEFINES="${DEFINES} skia_texture_cache_mb_limit=32" |
176 ;; | 176 ;; |
177 *) | 177 *) |
178 echo -n "ERROR: unknown device specified ($TARGET_DEVICE), valid values:
" | 178 echo -n "ERROR: unknown device specified ($TARGET_DEVICE), valid values: " |
179 echo "nexus_[s,4,7,10] xoom galaxy_nexus razr_i arm arm_thumb arm_v7 arm
_v7_thumb x86" | 179 echo "nexus_[s,4,7,10] xoom galaxy_nexus razr_i arm arm_thumb arm_v7 arm_v
7_thumb x86" |
180 return 1; | 180 return 1; |
181 ;; | 181 ;; |
182 esac | 182 esac |
183 | 183 |
184 echo "The build is targeting the device: $TARGET_DEVICE" | 184 echo "The build is targeting the device: $TARGET_DEVICE" |
185 | 185 |
186 exportVar GYP_DEFINES "$DEFINES" | 186 exportVar GYP_DEFINES "$DEFINES" |
187 exportVar SKIA_OUT "out/config/android-${TARGET_DEVICE}" | 187 exportVar SKIA_OUT "out/config/android-${TARGET_DEVICE}" |
188 } | 188 } |
189 | 189 |
190 # adb_pull_if_needed(android_src, host_dst) | 190 # adb_pull_if_needed(android_src, host_dst) |
191 adb_pull_if_needed() { | 191 adb_pull_if_needed() { |
(...skipping 21 matching lines...) Expand all Loading... |
213 if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; | 213 if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; |
214 then | 214 then |
215 $ADB pull $ANDROID_SRC $HOST_DST | 215 $ADB pull $ANDROID_SRC $HOST_DST |
216 # else | 216 # else |
217 # echo "md5 match of android [$ANDROID_SRC] and host [$HOST_DST]" | 217 # echo "md5 match of android [$ANDROID_SRC] and host [$HOST_DST]" |
218 fi | 218 fi |
219 else | 219 else |
220 $ADB pull $ANDROID_SRC $HOST_DST | 220 $ADB pull $ANDROID_SRC $HOST_DST |
221 fi | 221 fi |
222 } | 222 } |
OLD | NEW |