From: Uwe Hermann Date: Sat, 1 Nov 2014 15:14:50 +0000 (+0100) Subject: sigrok-cross-android: Add a "prepare" option to setup SDK/NDK/toolchain. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3bdccc5597806fd4d6fb057b0d4d05f030694c9a;p=sigrok-util.git sigrok-cross-android: Add a "prepare" option to setup SDK/NDK/toolchain. --- diff --git a/cross-compile/android/README b/cross-compile/android/README index 1b86c45..13ecf9b 100644 --- a/cross-compile/android/README +++ b/cross-compile/android/README @@ -22,14 +22,20 @@ Requirements - pkg-config (>= 0.22) - Android NDK (tested: r10c) - Android cross-compile toolchain (tested: arm-linux-androideabi-4.9) - Create it via: - ./build/tools/make-standalone-toolchain.sh \ - --platform=android-16 \ - --toolchain=arm-linux-androideabi-4.9 \ - --install-dir=$HOME/android/android-arm-toolchain - Android SDK (tested: r23.0.2) +Toolchain setup +--------------- + +You can use the script to install and setup the Android NDK, +SDK, and the respective standalone toolchain: + + $ ./sigrok-cross-android prepare + +This will install everything into $HOME/android. + + Building -------- diff --git a/cross-compile/android/sigrok-cross-android b/cross-compile/android/sigrok-cross-android index a37f262..57ab3d1 100755 --- a/cross-compile/android/sigrok-cross-android +++ b/cross-compile/android/sigrok-cross-android @@ -21,16 +21,19 @@ set -e +# The path where the NDK, SDK, and toolchains are located. +ANDROID_PATH=$HOME/android + # The path where the Android NDK is located. -ANDROID_NDK=$HOME/android/android-ndk-r10c +ANDROID_NDK=$ANDROID_PATH/android-ndk-r10c # The path where the Android SDK is located. -ANDROID_SDK=$HOME/android/android-sdk-linux +ANDROID_SDK=$ANDROID_PATH/android-sdk-linux # The path where your Android toolchain directory is located. -TOOLCHAIN=$HOME/android/android-arm-toolchain -# TOOLCHAIN=$HOME/android/android-mipsel-toolchain -# TOOLCHAIN=$HOME/android/android-i686-toolchain +TOOLCHAIN=$ANDROID_PATH/android-arm-toolchain +# TOOLCHAIN=$ANDROID_PATH/android-mipsel-toolchain +# TOOLCHAIN=$ANDROID_PATH/android-i686-toolchain # Select which Android toolchain to use. # Don't forget to also adapt TOOLCHAIN above if you change TOOLCHAIN_TRIPLET! @@ -66,6 +69,8 @@ VER_LIBUSB=1.0.19 VER_PYTHON=3.3.3 VER_BOOST=1.55.0 VER_QT=5.3.1 +VER_NDK=10c +VER_SDK=23.0.2 SF_MIRROR=switch.dl.sourceforge.net @@ -81,6 +86,33 @@ 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 + cd android-ndk-r$VER_NDK + ./build/tools/make-standalone-toolchain.sh --platform=android-16 \ + --toolchain=arm-linux-androideabi-4.9 \ + --install-dir=$ANDROID_PATH/android-arm-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 + ./tools/android update sdk --no-ui --filter platform-tools,build-tools-21.1.0,android-8,android-10,android-11,android-14,android-16 + cd .. + + exit +fi + +# ----------------------------------------------------------------------------- + # Remove build directory contents (if any) and create a new build dir. rm -rf $BUILDDIR mkdir $BUILDDIR