X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-util.git;a=blobdiff_plain;f=cross-compile%2Fandroid%2Fsigrok-cross-android;h=57ab3d1f1115cc026c836a806accdb9fcfcfadc1;hp=2bc0eb26cd22a4bc63478628e1685c629a1d69f0;hb=3bdccc5597806fd4d6fb057b0d4d05f030694c9a;hpb=9773a798a17b8c1a766a9be027319a3563766fa7 diff --git a/cross-compile/android/sigrok-cross-android b/cross-compile/android/sigrok-cross-android index 2bc0eb2..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 @@ -370,11 +402,16 @@ make $PARALLEL V=1 make install cd .. +# Strip all shared libs to reduce size. +find $PREFIX -iname "*.so" -exec ${TOOLCHAIN_TRIPLET}-strip -S {} \; + # PulseView $GIT_CLONE git://sigrok.org/pulseview cd pulseview cmake $CM -DANDROID_STL_PATH=${ANDROID_NDK}/sources/cxx-stl . make $PARALLEL VERBOSE=1 +make install +${TOOLCHAIN_TRIPLET}-strip -S libs/$TARGET_ARCH/libpulseview.so cd android "${ANDROID_SDK}/tools/android" update project -p . -t android-14 -n PulseView ant debug