Skip to content

Commit

Permalink
Sync the Android build scripts with libsodium's
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 committed May 1, 2014
1 parent cdf3ece commit 2bc8a40
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 37 deletions.
3 changes: 3 additions & 0 deletions dist-build/android-arm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
export CFLAGS="-Os -mthumb -marm -march=armv6"
TARGET_ARCH=arm HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh"
3 changes: 3 additions & 0 deletions dist-build/android-armv7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
export CFLAGS="-Os -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -marm -march=armv7-a"
TARGET_ARCH=armv7 HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh"
43 changes: 43 additions & 0 deletions dist-build/android-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#! /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)/dnscrypt-proxy-android-${TARGET_ARCH}"
export TOOLCHAIN_DIR="$(pwd)/android-toolchain-${TARGET_ARCH}"
export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"

export SODIUM_ANDROID_PREFIX=${SODIUM_ANDROID_PREFIX:-/tmp/libsodium-android-${TARGET_ARCH}}
export CPPFLAGS="$CPPFLAGS -I${SODIUM_ANDROID_PREFIX}/include"
export CPPFLAGS="$CPPFLAGS -DUSE_ONLY_PORTABLE_IMPLEMENTATIONS=1"
export LDFLAGS="$LDFLAGS -L${SODIUM_ANDROID_PREFIX}/lib"

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 \
--disable-shared \
--disable-pie && \
make clean && \
make -j3 install && \
echo "dnscrypt-proxy has been installed into $PREFIX"
3 changes: 3 additions & 0 deletions dist-build/android-mips.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
export CFLAGS="-Os"
TARGET_ARCH=mips HOST_COMPILER=mipsel-linux-android "$(dirname "$0")/android-build.sh"
3 changes: 3 additions & 0 deletions dist-build/android-x86.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
export CFLAGS="-Os"
TARGET_ARCH=x86 HOST_COMPILER=i686-linux-android "$(dirname "$0")/android-build.sh"
37 changes: 0 additions & 37 deletions dist-build/android.sh

This file was deleted.

0 comments on commit 2bc8a40

Please sign in to comment.