OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 set -e | 7 set -e |
8 | 8 |
9 # The script is to install Android SDK, NDK for build chromium on Android, and | 9 # The script is to install Android SDK, NDK for build chromium on Android, and |
10 # doesn't need to run as root. | 10 # doesn't need to run as root. |
11 | 11 |
12 # Using Android 3.2, API Level: 13 (Honeycomb). The SDK package is about 30M. | 12 # Using Android 4.0, API Level: 14 (ice cream sandwich). The SDK package is |
13 SDK_FILE_NAME="android-sdk_r13-linux_x86.tgz" | 13 # about 25M. |
14 SDK_FILE_NAME="android-sdk_r16-linux.tgz" | |
14 SDK_DOWNLOAD_URL="http://dl.google.com/android/${SDK_FILE_NAME}" | 15 SDK_DOWNLOAD_URL="http://dl.google.com/android/${SDK_FILE_NAME}" |
15 SDK_MD5SUM="d80d7530a46c665644ae76084a9a0dc4" | 16 SDK_MD5SUM="3ba457f731d51da3741c29c8830a4583" |
16 | 17 |
17 # Using "ANDROID_SDK_ROOT/tools/android list targets" to get the matching target | 18 # Using "ANDROID_SDK_ROOT/tools/android list targets" to get the matching target |
18 # id which will be loaded in simulator for testing. | 19 # id which will be loaded in simulator for testing. |
19 # For example: the output of the listed the target could be below, and the | 20 # For example: the output of the listed the target could be below, and the |
20 # 'android-13' is the SDK_TARGET_ID in this case. | 21 # 'android-13' is the SDK_TARGET_ID in this case. |
21 # id: 9 or "android-13" | 22 # id: 9 or "android-13" |
22 # Name: Android 3.2 | 23 # Name: Android 3.2 |
23 # Type: Platform | 24 # Type: Platform |
24 # API level: 13 | 25 # API level: 13 |
25 # Revision: 1 | 26 # Revision: 1 |
26 # Skins: WXGA (default) | 27 # Skins: WXGA (default) |
27 SDK_TARGET_ID=android-13 | 28 SDK_TARGET_ID=android-14 |
28 | 29 |
29 # Using NDK r7; The package is about 64M. | 30 # Using NDK r7; The package is about 64M. |
30 NDK_FILE_NAME="android-ndk-r7-linux-x86.tar.bz2" | 31 NDK_FILE_NAME="android-ndk-r7-linux-x86.tar.bz2" |
31 NDK_DOWNLOAD_URL="http://dl.google.com/android/ndk/${NDK_FILE_NAME}" | 32 NDK_DOWNLOAD_URL="http://dl.google.com/android/ndk/${NDK_FILE_NAME}" |
32 NDK_MD5SUM="bf15e6b47bf50824c4b96849bf003ca3" | 33 NDK_MD5SUM="bf15e6b47bf50824c4b96849bf003ca3" |
33 | 34 |
34 # The temporary directory used to store the downloaded file. | 35 # The temporary directory used to store the downloaded file. |
35 TEMPDIR=$(mktemp -d) | 36 TEMPDIR=$(mktemp -d) |
36 cleanup() { | 37 cleanup() { |
37 local status=${?} | 38 local status=${?} |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 # Install the target if it doesn't exist. The package installed above contains | 97 # Install the target if it doesn't exist. The package installed above contains |
97 # no platform, platform-tool or tool, all those should be installed by | 98 # no platform, platform-tool or tool, all those should be installed by |
98 # ${ANDROID_SDK_ROOT}/tools/android. | 99 # ${ANDROID_SDK_ROOT}/tools/android. |
99 if [[ ! $("${ANDROID_SDK_ROOT}/tools/android" list targets \ | 100 if [[ ! $("${ANDROID_SDK_ROOT}/tools/android" list targets \ |
100 | grep -q "${SDK_TARGET_ID}") ]]; then | 101 | grep -q "${SDK_TARGET_ID}") ]]; then |
101 # Updates the SDK by installing the necessary components. | 102 # Updates the SDK by installing the necessary components. |
102 # From current configuration, all android platforms will be installed. | 103 # From current configuration, all android platforms will be installed. |
103 # This will take a little bit long time. | 104 # This will take a little bit long time. |
104 echo "Install platform, platform-tool and tool ..." | 105 echo "Install platform, platform-tool and tool ..." |
105 | 106 |
106 # This needs to be called twice. The first time, "android" itself | 107 "${ANDROID_SDK_ROOT}"/tools/android update sdk -o --no-ui \ |
107 # references | 108 --filter platform,platform-tool,tool,system-image |
108 # https://dl-ssl.google.com/android/repository/addons_list.xml, | |
109 # which no longer exists. On the second run, "android" (or one of | |
110 # it's config files) has been updated to now reference curl | |
111 # https://dl-ssl.google.com/android/repository/addons_list-1.xml, | |
112 # which contains what we need. | |
113 for try in 1 2 ; do | |
John Grabowski
2011/12/15 23:44:44
Are you absolutely sure this is no longer needed?
michaelbai
2011/12/16 00:08:38
Yes, I think the first addons_list.xml corresponds
| |
114 echo "==== SDK update $try" | |
115 "${ANDROID_SDK_ROOT}"/tools/android update sdk --no-ui \ | |
116 --filter platform,platform-tool,tool | |
117 done | |
118 fi | 109 fi |
119 | 110 |
120 # Create a Android Virtual Device named 'buildbot' with default hardware | 111 # Create a Android Virtual Device named 'buildbot' with default hardware |
121 # configuration and override the existing one, since there is no easy way to | 112 # configuration and override the existing one, since there is no easy way to |
122 # check whether current AVD has correct configuration and it takes almost no | 113 # check whether current AVD has correct configuration and it takes almost no |
123 # time to create a new one. | 114 # time to create a new one. |
124 "${ANDROID_SDK_ROOT}/tools/android" --silent create avd --name buildbot \ | 115 "${ANDROID_SDK_ROOT}/tools/android" --silent create avd --name buildbot \ |
125 --target ${SDK_TARGET_ID} --force <<< "no" | 116 --target ${SDK_TARGET_ID} --force <<< "no" |
126 | 117 |
127 # Install Android NDK if it doesn't exist. | 118 # Install Android NDK if it doesn't exist. |
128 if [[ ! -d "${ANDROID_NDK_ROOT}" ]]; then | 119 if [[ ! -d "${ANDROID_NDK_ROOT}" ]]; then |
129 echo 'Install ANDROID NDK ...' | 120 echo 'Install ANDROID NDK ...' |
130 (install_dev_kit "${NDK_FILE_NAME}" "${NDK_DOWNLOAD_URL}" "${NDK_MD5SUM}" \ | 121 (install_dev_kit "${NDK_FILE_NAME}" "${NDK_DOWNLOAD_URL}" "${NDK_MD5SUM}" \ |
131 $(dirname "${ANDROID_NDK_ROOT}")) | 122 $(dirname "${ANDROID_NDK_ROOT}")) |
132 fi | 123 fi |
OLD | NEW |