godot/misc/dist/docker/scripts/install-android-tools
Rémi Verschelde b87a232668 Reorder the folders in tools to prepare moving tools/editor
- `certs` and `editor_fonts` go to `thirdparty`
- `dist` and `scripts` go to a new `misc` folder
- `collada` and `doc` go to `tools/editor`

The next step will be to rename `tools/editor` to `editor` directly,
but this will be done at the right time to avoid breaking too many PRs.
2017-02-09 00:08:27 +01:00

90 lines
2.5 KiB
Bash

#!/bin/bash
BASH_RC=~/.bashrc
GODOT_BUILD_TOOLS_PATH=/godot-dev/build-tools
mkdir -p $GODOT_BUILD_TOOLS_PATH
cd $GODOT_BUILD_TOOLS_PATH
ANDROID_BASE_URL=http://dl.google.com/android
ANDROID_SDK_RELEASE=android-sdk_r24.4.1
ANDROID_SDK_DIR=android-sdk-linux
ANDROID_SDK_FILENAME=$ANDROID_SDK_RELEASE-linux.tgz
ANDROID_SDK_URL=$ANDROID_BASE_URL/$ANDROID_SDK_FILENAME
ANDROID_SDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_SDK_DIR
ANDROID_SDK_SHA1=725bb360f0f7d04eaccff5a2d57abdd49061326d
ANDROID_NDK_RELEASE=android-ndk-r10e
ANDROID_NDK_DIR=$ANDROID_NDK_RELEASE
ANDROID_NDK_FILENAME=$ANDROID_NDK_RELEASE-linux-x86_64.bin
ANDROID_NDK_URL=$ANDROID_BASE_URL/ndk/$ANDROID_NDK_FILENAME
ANDROID_NDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_NDK_DIR
ANDROID_NDK_MD5=19af543b068bdb7f27787c2bc69aba7f
echo
echo "Download and install Android development tools ..."
echo
if [ ! -e $ANDROID_SDK_FILENAME ]; then
echo "Downloading: Android SDK ..."
wget $ANDROID_SDK_URL
else
echo $ANDROID_SDK_SHA1 $ANDROID_SDK_FILENAME > $ANDROID_SDK_FILENAME.sha1
sha1sum --check --strict $ANDROID_SDK_FILENAME.sha1
if [ ! $? -eq 0 ]; then
echo "Downloading: Android SDK ..."
wget $ANDROID_SDK_URL
fi
fi
if [ ! -d $ANDROID_SDK_DIR ]; then
tar -xvzf $ANDROID_SDK_FILENAME
fi
if [ ! -e $ANDROID_NDK_FILENAME ]; then
echo "Downloading: Android NDK ..."
wget $ANDROID_NDK_URL
else
echo $ANDROID_NDK_MD5 $ANDROID_NDK_FILENAME > $ANDROID_NDK_FILENAME.md5
md5sum --check --strict $ANDROID_NDK_FILENAME.md5
if [ ! $? -eq 0 ]; then
echo "Downloading: Android NDK ..."
wget $ANDROID_NDK_URL
fi
fi
if [ ! -d $ANDROID_NDK_DIR ]; then
chmod a+x $ANDROID_NDK_FILENAME
./$ANDROID_NDK_FILENAME
echo
fi
cd $ANDROID_SDK_DIR/tools
chmod a+x android
if ! ./android list target | grep -q 'android-19'; then
echo "Installing: Android Tools ..."
echo y | ./android update sdk --no-ui --all --filter "platform-tools,android-19,build-tools-19.1.0,\
extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,\
extra-google-play_apk_expansion,extra-google-play_billing,extra-google-play_licensing"
fi
EXPORT_VAL="export ANDROID_HOME=$ANDROID_SDK_PATH"
if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
echo $EXPORT_VAL >> ~/.bashrc
fi
EXPORT_VAL="export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH"
if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
echo $EXPORT_VAL >> ~/.bashrc
fi
EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools"
if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools.*" $BASH_RC; then
echo $EXPORT_VAL >> ~/.bashrc
fi
echo
echo "Done!"
echo