sigrok-cross-android: Add a "prepare" option to setup SDK/NDK/toolchain.
authorUwe Hermann <uwe@hermann-uwe.de>
Sat, 1 Nov 2014 15:14:50 +0000 (16:14 +0100)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 1 Nov 2014 15:14:50 +0000 (16:14 +0100)
cross-compile/android/README
cross-compile/android/sigrok-cross-android

index 1b86c45eb47d6416c8fc6284468749e55a19299d..13ecf9b494c8b2ae9603474b411121a84dcf6daf 100644 (file)
@@ -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
 --------
 
index a37f2629c724a7cf301dea95a3d0388c937342d4..57ab3d1f1115cc026c836a806accdb9fcfcfadc1 100755 (executable)
 
 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