scripts/build_android: add an example script to build aubio on android, add reference...
authorPaul Brossier <piem@piem.org>
Sun, 8 Jan 2017 15:38:04 +0000 (16:38 +0100)
committerPaul Brossier <piem@piem.org>
Sun, 8 Jan 2017 15:38:04 +0000 (16:38 +0100)
doc/android.rst [new file with mode: 0644]
scripts/build_android [new file with mode: 0755]

diff --git a/doc/android.rst b/doc/android.rst
new file mode 100644 (file)
index 0000000..c46eb30
--- /dev/null
@@ -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) <https://developer.android.com/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 (executable)
index 0000000..e1e790c
--- /dev/null
@@ -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