From: Paul Brossier Date: Sun, 8 Jan 2017 15:38:04 +0000 (+0100) Subject: scripts/build_android: add an example script to build aubio on android, add reference... X-Git-Tag: 0.4.4~4 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=cd8dc521a6038d92396d2571df5ff9365e1b6635;p=aubio.git scripts/build_android: add an example script to build aubio on android, add reference to it in doc/android.rst --- diff --git a/doc/android.rst b/doc/android.rst new file mode 100644 index 00000000..c46eb309 --- /dev/null +++ b/doc/android.rst @@ -0,0 +1,9 @@ +.. _android: + +Building aubio for Android +-------------------------- + +To compile aubio for android, you will need to get the `Android Native +Development Toolkit (NDK) `_, prepare a +standalone toolchain, and tell waf to use the NDK toolchain. An example script +to complete these tasks is available in ``scripts/build_android``. diff --git a/scripts/build_android b/scripts/build_android new file mode 100755 index 00000000..e1e790cd --- /dev/null +++ b/scripts/build_android @@ -0,0 +1,41 @@ +#! /bin/bash + +set -e +set -x + +# location of android NDK +NDK_PATH=$PWD/../contrib/android-ndk-r12 + +WAFOPTS="--disable-avcodec --disable-samplerate --disable-jack --disable-sndfile" + +# set these variables to change the default values +[ -z $PLATFORM ] && PLATFORM=android-19 +[ -z $ARCH ] && ARCH=arm + +# location nof the standalone toolchains, created with +# $NDK_PATH/build/tools/make-standalone-toolchains.sh +NDK_TOOLCHAINS=$PWD/contrib + +# location of the current toolchain +CURRENT_TOOLCHAIN=$NDK_TOOLCHAINS/toolchain-$PLATFORM-$ARCH + +# if it does not exist, create the toolchain +[ -d $CURRENT_TOOLCHAIN ] || \ + $NDK_PATH/build/tools/make-standalone-toolchain.sh \ + --platform=$PLATFORM --arch=$ARCH \ + --install-dir=$CURRENT_TOOLCHAIN + +# aubio install destination directory +DESTDIR=$PWD/dist-$PLATFORM-$ARCH + +# wipe it out if it exists +[ -d $DESTDIR ] && rm -rf $DESTDIR + +# get the link to gcc +CC=`ls $CURRENT_TOOLCHAIN/*-linux-android*/bin/gcc` + +CFLAGS="-Os" \ + CC=$CC \ + ./waf distclean configure build install --destdir=$DESTDIR \ + --verbose \ + --with-target-platform=android $WAFOPTS