summaryrefslogtreecommitdiff
path: root/dist-build/android-build.sh
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2014-08-11 13:49:21 -0400
committerMicah Anderson <micah@riseup.net>2014-08-11 13:49:21 -0400
commit2e59f9740a29439df7c7a56cf0ae83dec3081d31 (patch)
treed5e7c4e74c9a0f1ea999327d2e68b1dd27be00e0 /dist-build/android-build.sh
initial import of debian version from mentors0.6.1
Diffstat (limited to 'dist-build/android-build.sh')
-rwxr-xr-xdist-build/android-build.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/dist-build/android-build.sh b/dist-build/android-build.sh
new file mode 100755
index 0000000..deb333e
--- /dev/null
+++ b/dist-build/android-build.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+if [ -z "$ANDROID_NDK_HOME" ]; then
+ echo "You should probably set ANDROID_NDK_HOME to the directory containing"
+ echo "the Android NDK"
+ exit
+fi
+
+if [ ! -f ./configure ]; then
+ echo "Can't find ./configure. Wrong directory or haven't run autogen.sh?"
+ exit 1
+fi
+
+if [ "x$TARGET_ARCH" = 'x' ] || [ "x$HOST_COMPILER" = 'x' ]; then
+ echo "You shouldn't use android-build.sh directly, use android-[arch].sh instead"
+ exit 1
+fi
+
+export MAKE_TOOLCHAIN="${ANDROID_NDK_HOME}/build/tools/make-standalone-toolchain.sh"
+
+export PREFIX="$(pwd)/libsodium-android-${TARGET_ARCH}"
+export TOOLCHAIN_DIR="$(pwd)/android-toolchain-${TARGET_ARCH}"
+export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"
+
+# Clean up before build
+rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}"
+
+$MAKE_TOOLCHAIN --platform="${NDK_PLATFORM:-android-14}" \
+ --arch="$TARGET_ARCH" \
+ --install-dir="$TOOLCHAIN_DIR" && \
+./configure --host="${HOST_COMPILER}" \
+ --with-sysroot="${TOOLCHAIN_DIR}/sysroot" \
+ --prefix="${PREFIX}" \
+ --disable-soname-versions && \
+make clean && \
+make -j3 install && \
+echo "libsodium has been installed into $PREFIX"