3 # Abort execution as soon as an error is encountered
4 # That way the script do not let the user think the process completed correctly
5 # and leave the opportunity to fix the problem and restart compilation where
9 # http://developer.android.com/sdk/index.html
10 SDK_URL_LNX
="http://dl.google.com/android/android-sdk_r11-linux_x86.tgz"
11 SDK_URL_MAC
="http://dl.google.com/android/android-sdk_r11-mac_x86.zip"
12 SDK_URL_WIN
="http://dl.google.com/android/android-sdk_r11-windows.zip"
13 # http://developer.android.com/sdk/ndk/index.html
14 NDK_URL_LNX
="http://dl.google.com/android/ndk/android-ndk-r5c-linux-x86.tar.bz2"
15 NDK_URL_MAC
="http://dl.google.com/android/ndk/android-ndk-r5c-darwin-x86.tar.bz2"
16 NDK_URL_WIN
="http://dl.google.com/android/ndk/android-ndk-r5c-windows.zip"
35 ANDROID
=tools
/android.bat
39 prefix
="${INSTALL_PREFIX:-$HOME}"
40 dldir
="${DOWNLOAD_DIR:-/tmp}"
42 SDK_PATH
=$
(find $prefix -maxdepth 1 -name "android-sdk-*")
43 NDK_PATH
=$
(find $prefix -maxdepth 1 -name "android-ndk-*")
45 download_and_extract
() {
48 local_file
="$dldir/$name"
49 if [ \
! -f "$local_file" ]; then
50 echo " * Downloading $name..."
51 wget
-O "$local_file" $1
54 echo " * Extracting $name..."
55 case ${local_file#*.} in
57 unzip -qo -d "$prefix" "$local_file"
60 (cd $prefix; tar -xf "$local_file")
63 (cd $prefix; tar -xjf "$local_file")
66 echo "Couldn't figure out how to extract $local_file" ! 1>&2
71 if [ -z "$SDK_PATH" ]; then
72 download_and_extract
$SDK_URL
73 # OS X doesn't know about realname, use basename instead.
74 SDK_PATH
=$prefix/$
(basename $prefix/android-sdk-
*)
76 if [ -z "$NDK_PATH" ]; then
77 download_and_extract
$NDK_URL
78 NDK_PATH
=$prefix/$
(basename $prefix/android-ndk-
*)
81 if [ -z "$(find $SDK_PATH/platforms -type d -name 'android-*')" ]; then
82 echo " * Installing Android platforms..."
83 $SDK_PATH/$ANDROID update sdk
--no-ui --filter platform
,tool
89 Please set the following environment variables before running tools/configure:
90 export ANDROID_SDK_PATH=$SDK_PATH
91 export ANDROID_NDK_PATH=$NDK_PATH