+VER_PCRE=8.37
+VER_LIBFFI=3.2.1
+VER_GLIB=2.45.4
+VER_GLIB_SHORT=2.45
+VER_GLIBMM=2.45.41
+VER_GLIBMM_SHORT=2.45
+VER_LIBSIGCXX=2.5.1
+VER_LIBSIGCXX_SHORT=2.5
+VER_LIBZIP=0.11.2
+VER_LIBFTDI1=1.2
+VER_LIBUSB=1.0.19
+VER_PYTHON=3.3.3
+VER_BOOST=1.58.0
+VER_QT=5.4.1
+VER_SIGROK_FIRMWARE_FX2LAFW=0.1.2
+VER_NDK=10e
+VER_SDK=24.3.3
+VER_AND_BT=22.0.1 # 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"
+
+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 ..