OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash -x |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 4.0, API Level: 14 (ice cream sandwich). The SDK package is | 12 # Using Android 4.0, API Level: 14 (ice cream sandwich). The SDK package is |
13 # about 25M. | 13 # about 25M. |
14 SDK_FILE_NAME="android-sdk_r18-linux.tgz" | 14 SDK_FILE_NAME="android-sdk_r20-linux.tgz" |
15 SDK_DOWNLOAD_URL="http://dl.google.com/android/${SDK_FILE_NAME}" | 15 SDK_DOWNLOAD_URL="http://dl.google.com/android/${SDK_FILE_NAME}" |
16 SDK_MD5SUM="6cd716d0e04624b865ffed3c25b3485c" | 16 SDK_MD5SUM="22a81cf1d4a951c62f71a8758290e9bb" |
17 | 17 |
18 # 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 |
19 # id which will be loaded in simulator for testing. | 19 # id which will be loaded in simulator for testing. |
20 # 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 |
21 # 'android-13' is the SDK_TARGET_ID in this case. | 21 # 'android-13' is the SDK_TARGET_ID in this case. |
22 # id: 9 or "android-13" | 22 # id: 9 or "android-13" |
23 # Name: Android 3.2 | 23 # Name: Android 3.2 |
24 # Type: Platform | 24 # Type: Platform |
25 # API level: 13 | 25 # API level: 13 |
26 # Revision: 1 | 26 # Revision: 1 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 local computed_md5=$(md5sum "${local_file_name}" | cut -d' ' -f1) | 67 local computed_md5=$(md5sum "${local_file_name}" | cut -d' ' -f1) |
68 if [[ "${computed_md5}" != "${md5}" ]]; then | 68 if [[ "${computed_md5}" != "${md5}" ]]; then |
69 echo "Downloaded ${local_file_name} has bad md5sum, which is expected" >& 2 | 69 echo "Downloaded ${local_file_name} has bad md5sum, which is expected" >& 2 |
70 echo "to be ${md5} but was ${computed_md5}" >& 2 | 70 echo "to be ${md5} but was ${computed_md5}" >& 2 |
71 exit 1 | 71 exit 1 |
72 fi | 72 fi |
73 | 73 |
74 echo "Install ${local_file_name}" | 74 echo "Install ${local_file_name}" |
75 mv "${local_file_name}" "${install_path}" | 75 mv "${local_file_name}" "${install_path}" |
76 cd "${install_path}" | 76 cd "${install_path}" |
77 tar -xvf "${local_file_name}" | 77 tar -xf "${local_file_name}" |
78 } | 78 } |
79 | 79 |
80 if [[ -z "${ANDROID_SDK_ROOT}" ]]; then | 80 if [[ -z "${ANDROID_SDK_ROOT}" ]]; then |
81 echo "Please set ANDROID_SDK_ROOT to where they should installed to." >& 2 | 81 echo "Please set ANDROID_SDK_ROOT to where they should installed to." >& 2 |
82 echo "For example: /usr/local/android-sdk-linux_x86" >& 2 | 82 echo "For example: /usr/local/android-sdk-linux_x86" >& 2 |
83 exit 1 | 83 exit 1 |
84 fi | 84 fi |
85 | 85 |
86 if [[ -z "${ANDROID_NDK_ROOT}" ]]; then | 86 if [[ -z "${ANDROID_NDK_ROOT}" ]]; then |
87 echo "Please set ANDROID_NDK_ROOT to where they should installed to." >& 2 | 87 echo "Please set ANDROID_NDK_ROOT to where they should installed to." >& 2 |
(...skipping 30 matching lines...) Expand all Loading... |
118 fi | 118 fi |
119 # Updates the SDK to latest version firstly. | 119 # Updates the SDK to latest version firstly. |
120 "${ANDROID_SDK_ROOT}"/tools/android update sdk ${update_flag} --no-ui \ | 120 "${ANDROID_SDK_ROOT}"/tools/android update sdk ${update_flag} --no-ui \ |
121 --filter platform-tool,tool,system-image,${SDK_TARGET_ID} | 121 --filter platform-tool,tool,system-image,${SDK_TARGET_ID} |
122 fi | 122 fi |
123 | 123 |
124 # Create a Android Virtual Device named 'buildbot' with default hardware | 124 # Create a Android Virtual Device named 'buildbot' with default hardware |
125 # configuration and override the existing one, since there is no easy way to | 125 # configuration and override the existing one, since there is no easy way to |
126 # check whether current AVD has correct configuration and it takes almost no | 126 # check whether current AVD has correct configuration and it takes almost no |
127 # time to create a new one. Create one ARM AVD and one x86 AVD. | 127 # time to create a new one. Create one ARM AVD and one x86 AVD. |
128 "${ANDROID_SDK_ROOT}/tools/android" --silent create avd --name buildbot \ | 128 "${ANDROID_SDK_ROOT}/tools/android" --silent create avd --name avd_armeabi \ |
129 --abi armeabi-v7a --target ${SDK_TARGET_ID} --force <<< "no" | 129 --abi armeabi-v7a --target ${SDK_TARGET_ID} --force <<< "no" |
130 | 130 |
131 "${ANDROID_SDK_ROOT}/tools/android" --silent create avd --name buildbot \ | 131 "${ANDROID_SDK_ROOT}/tools/android" --silent create avd --name avd_x86 \ |
132 --abi x86 --target ${SDK_TARGET_ID} --force <<< "no" | 132 --abi x86 --target ${SDK_TARGET_ID} --force <<< "no" |
133 | 133 |
134 # Install Android NDK if it doesn't exist. | 134 # Install Android NDK if it doesn't exist. |
135 if [[ ! -d "${ANDROID_NDK_ROOT}" ]]; then | 135 if [[ ! -d "${ANDROID_NDK_ROOT}" ]]; then |
136 echo 'Install ANDROID NDK ...' | 136 echo 'Install ANDROID NDK ...' |
137 (install_dev_kit "${NDK_FILE_NAME}" "${NDK_DOWNLOAD_URL}" "${NDK_MD5SUM}" \ | 137 (install_dev_kit "${NDK_FILE_NAME}" "${NDK_DOWNLOAD_URL}" "${NDK_MD5SUM}" \ |
138 $(dirname "${ANDROID_NDK_ROOT}")) | 138 $(dirname "${ANDROID_NDK_ROOT}")) |
139 fi | 139 fi |
140 | 140 |
141 # Install the 64-bit linker if needed. | 141 # Install the 64-bit linker if needed. |
(...skipping 23 matching lines...) Expand all Loading... |
165 if [[ ! -f "$linker_dirname/$NEW_LINKER" ]]; then | 165 if [[ ! -f "$linker_dirname/$NEW_LINKER" ]]; then |
166 echo "Could not copy linker" | 166 echo "Could not copy linker" |
167 exit 1 | 167 exit 1 |
168 fi | 168 fi |
169 fi | 169 fi |
170 fi | 170 fi |
171 } | 171 } |
172 | 172 |
173 replace_linker $LINKER_DIRNAME_1 $LINKER_BASENAME_1 | 173 replace_linker $LINKER_DIRNAME_1 $LINKER_BASENAME_1 |
174 replace_linker $LINKER_DIRNAME_2 $LINKER_BASENAME_2 | 174 replace_linker $LINKER_DIRNAME_2 $LINKER_BASENAME_2 |
OLD | NEW |