Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: build/install-build-deps-android.sh

Issue 8144012: Upstream: The script to install Android SDK, NDK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash -e
Mark Mentovai 2011/10/05 18:16:05 I don’t think this is as portable as making “set -
michaelbai 2011/10/05 20:55:18 Done.
2
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
5 # found in the LICENSE file.
6
7 # The script is to install Android SDK, NDK for build chromium on Android, and
8 # doesn't need to run as root.
9
10 # Using Android 3.2, API Level: 13 (Honeycomb). The SDK package is about 30M.
11 SDK_FILE_NAME="android-sdk_r13-linux_x86.tgz"
12 SDK_DOWNLOAD_URL="http://dl.google.com/android/android-sdk_r13-linux_x86.tgz"
13 SDK_MD5SUM="d80d7530a46c665644ae76084a9a0dc4"
14 # Using "ADROID_SDK_ROOT/tools/android list targets" to get the matching target
Mark Mentovai 2011/10/05 18:16:05 Blank line before. Also, you misspelled ANDROID_S
michaelbai 2011/10/05 20:55:18 Done.
15 # id which will be loaded in simulator for testing.
16 # For example: the output of the listed the target could be below, and the
17 # 'android-13' is the SDK_TARGET_ID in this case.
18 # id: 9 or "android-13"
19 # Name: Android 3.2
20 # Type: Platform
21 # API level: 13
22 # Revision: 1
23 # Skins: WXGA (default)
24 SDK_TARGET_ID=android-13
25
26 # Using NDK r6b; The package is about 44M.
27 NDK_FILE_NAME="android-ndk-r6b-linux-x86.tar.bz2"
28 NDK_DOWNLOAD_URL="http://dl.google.com/android/ndk/android-ndk-r6b-linux-x86.tar .bz2"
29 NDK_MD5SUM="309f35e49b64313cfb20ac428df4cec2"
30
31 # Download and install a tgz package by wget and tar -xvf.
32 # This should be called as:
33 # install local_file_name download_url md5 install_path
34 install_dev_kit() {
35 test -f $1 || wget $2
Mark Mentovai 2011/10/05 18:16:05 Always use {braces} like ${1} and ${2}. Also, alwa
michaelbai 2011/10/05 20:55:18 Done.
36 if test "`md5sum $1 |cut -d' ' -f1`" != $3; then
Mark Mentovai 2011/10/05 18:16:05 Don’t write “if test”, use “if [[”. Don’t use `ba
michaelbai 2011/10/05 20:55:18 Done.
37 echo "Bad md5sum of $2" >& 2
38 rm $1
39 exit 1
40 fi
41
42 echo "Install $1"
43 mv $1 $4
44 pushd .
Mark Mentovai 2011/10/05 18:16:05 Rather than pushd/cd/operate/popd, you can do (cd
michaelbai 2011/10/05 20:55:18 Done.
45 cd $4
46 tar -xvf $4/$1
47 popd
48 }
49
50 if [ -z "${ANDROID_SDK_ROOT}" ]; then
Mark Mentovai 2011/10/05 18:16:05 [[ double brackets ]] throughout (see e-mail comin
michaelbai 2011/10/05 20:55:18 Done.
51 echo "Please set ANDROID_SDK_ROOT to where they should installed to." >& 2
52 echo "For example: /usr/local/android-sdk-linux_x86" >& 2
53 exit 1
54 fi
55
56 if [ -z "${ANDROID_NDK_ROOT}" ]; then
57 echo "Please set ANDROID_NDK_ROOT to where they should installed to." >& 2
58 echo "For example: /usr/local/android-ndk-r6b" >& 2
59 exit 1
60 fi
61
62 # Install Android SDK if it doesn't exist.
63 if [ ! -d ${ANDROID_SDK_ROOT} ]; then
64 echo 'Install ANDROID SDK ...'
65 install_dev_kit ${SDK_FILE_NAME} ${SDK_DOWNLOAD_URL} ${SDK_MD5SUM} \
66 $(dirname ${ANDROID_SDK_ROOT})
67 fi
68
69 # Install the target if it doesn't exist. The package installed above contains
70 # no platform, platform-tool or tool, all those should be installed by
71 # ${ANDROID_SDK_ROOT}/tools/android.
72 if [ $(${ANDROID_SDK_ROOT}/tools/android list targets \
Mark Mentovai 2011/10/05 18:16:05 Don’t forget to quote things like ANDROID_SDK_ROOT
michaelbai 2011/10/05 20:55:18 Done.
73 | grep "${SDK_TARGET_ID}" | wc -w) == 0 ]; then
Mark Mentovai 2011/10/05 18:16:05 What’s the wc about? Why not test grep’s exit stat
michaelbai 2011/10/05 20:55:18 Done.
74 # Updates the SDK by installing the necessary components.
75 # From current configuration, all android platforms will be installed.
76 # This will take a little bit long time.
77 $echo "Install platform, platform-tool and tool ..."
Mark Mentovai 2011/10/05 18:16:05 What’s $echo?
michaelbai 2011/10/05 20:55:18 Done.
78 ${ANDROID_SDK_ROOT}/tools/android update sdk --no-ui \
79 --filter platform,platform-tool,tool
80 fi
81
82 # Create a AVD named 'buildbot' with default hw configuration and override the
Mark Mentovai 2011/10/05 18:16:05 I don’t know what AVD means. This comment can expl
michaelbai 2011/10/05 20:55:18 Done.
83 # existing one since there is no easy way to check whether current AVD has
84 # correct configuration and it takes almost no time to create a new one.
85 echo no | ${ANDROID_SDK_ROOT}/tools/android --silent create avd \
Mark Mentovai 2011/10/05 18:16:05 Since you’re a bash script, you can use <<< to giv
michaelbai 2011/10/05 20:55:18 Done.
86 --name buildbot --target ${SDK_TARGET_ID} --force
87
88 # Install Android NDK if it doesn't exist.
89 if [ ! -d ${ANDROID_NDK_ROOT} ]; then
90 echo 'Install ANDROID NDK ...'
91 install_dev_kit ${NDK_FILE_NAME} ${NDK_DOWNLOAD_URL} ${NDK_MD5SUM} \
92 $(dirname ${ANDROID_NDK_ROOT})
93 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698