+VER_GETTEXT=0.19.7
+VER_ZLIB=1.2.11
+VER_PCRE=8.38
+VER_LIBFFI=3.2.1
+VER_GLIB=2.48.1
+VER_GLIB_SHORT=2.48
+VER_GLIBMM=2.48.1
+VER_GLIBMM_SHORT=2.48
+VER_LIBSIGCXX=2.9.2
+VER_LIBSIGCXX_SHORT=2.9
+VER_LIBZIP=1.1
+VER_LIBFTDI1=1.2
+VER_LIBUSB=1.0.19
+VER_PYTHON=3.3.3
+VER_BOOST=1.58.0
+VER_QT=5.6.0
+VER_QT_SHORT=5.6
+VER_SIGROK_FIRMWARE_FX2LAFW=0.1.6
+VER_NDK=10e
+VER_SDK=24.4.1
+VER_AND_BT=23.0.2 # Android build tools version
+VER_AND_API=16 # Target Android API version
+
+SF_MIRROR=download.sourceforge.net
+
+WGET="wget -c --quiet"
+GIT_CLONE="git clone --depth=1"
+
+REPO_BASE="git://sigrok.org"
+
+case "$TOOLCHAIN_TRIPLET" in
+ arm*) TARGET_ARCH=armeabi;;
+ mips*) TARGET_ARCH=mips;;
+ i686*) TARGET_ARCH=x86;;
+ *) echo >&2 "Unknown prefix for TOOLCHAIN_TRIPLET."; exit 1;;
+esac
+
+# -----------------------------------------------------------------------------
+
+# Get the Android NDK and SDK, install required packages and toolchains.
+if [ "x$1" = "xprepare" ]; then
+ mkdir -p $ANDROID_PATH
+ cd $ANDROID_PATH
+
+ # NDK
+ $WGET http://dl.google.com/android/ndk/android-ndk-r$VER_NDK-linux-x86.bin
+ chmod 700 android-ndk-r$VER_NDK-linux-x86.bin
+ ./android-ndk-r$VER_NDK-linux-x86.bin -y
+ cd android-ndk-r$VER_NDK
+ ./build/tools/make-standalone-toolchain.sh --platform=android-$VER_AND_API \
+ --toolchain=arm-linux-androideabi-4.9 \
+ --install-dir=$ANDROID_PATH/android-arm-toolchain
+ ./build/tools/make-standalone-toolchain.sh --platform=android-$VER_AND_API \
+ --toolchain=x86-4.9 \
+ --install-dir=$ANDROID_PATH/android-i686-toolchain
+ ./build/tools/make-standalone-toolchain.sh --platform=android-$VER_AND_API \
+ --toolchain=mipsel-linux-android-4.9 \
+ --install-dir=$ANDROID_PATH/android-mipsel-toolchain
+ cd ..
+
+ # SDK
+ $WGET http://dl.google.com/android/android-sdk_r$VER_SDK-linux.tgz
+ tar xfz android-sdk_r$VER_SDK-linux.tgz
+ cd android-sdk-linux
+ echo y | ./tools/android update sdk --no-ui --all --filter platform-tools,build-tools-$VER_AND_BT,android-$VER_AND_API
+ cd ..
+
+ exit
+fi