2013-01-22 00:25:49 -05:00
|
|
|
#! /bin/sh
|
|
|
|
|
2013-06-13 04:11:28 -04:00
|
|
|
if [ -z "$NDK_ROOT" ]; then
|
|
|
|
echo "You should probably set NDK_ROOT to the directory containing"
|
|
|
|
echo "the Android NDK"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f ./configure ]; then
|
2013-12-31 10:06:19 -05:00
|
|
|
echo "Can't find ./configure. Wrong directory or haven't run autogen.sh?"
|
2013-06-13 04:11:28 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-12-31 10:06:19 -05:00
|
|
|
export NDK_PLATFORM=${NDK_PLATFORM:-android-14}
|
2013-09-04 03:16:00 -04:00
|
|
|
export NDK_ROOT=${NDK_ROOT:-/usr/local/Cellar/android-ndk/9}
|
2013-12-31 10:06:19 -05:00
|
|
|
export TARGET_ARCH=arm
|
|
|
|
export TARGET="${TARGET_ARCH}-linux-androideabi"
|
|
|
|
export MAKE_TOOLCHAIN="${NDK_ROOT}/build/tools/make-standalone-toolchain.sh"
|
|
|
|
|
2013-05-31 01:56:18 -04:00
|
|
|
export PREFIX="$(pwd)/libsodium-android"
|
2013-12-31 10:06:19 -05:00
|
|
|
export TOOLCHAIN_DIR="$(pwd)/android-toolchain"
|
|
|
|
export PATH="${PATH}:${TOOLCHAIN_DIR}"
|
|
|
|
export CFLAGS="-Os -mthumb"
|
|
|
|
export LDFLAGS="-mthumb"
|
|
|
|
|
|
|
|
$MAKE_TOOLCHAIN --platform="$NDK_PLATFORM" --arch="$TARGET_ARCH" \
|
|
|
|
--install-dir="$TOOLCHAIN_DIR"
|
2013-01-22 00:25:49 -05:00
|
|
|
|
2013-05-31 01:56:18 -04:00
|
|
|
./configure --host=arm-linux-androideabi \
|
2013-12-31 10:06:19 -05:00
|
|
|
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" \
|
2013-06-09 15:14:31 -04:00
|
|
|
--disable-pie \
|
2013-05-31 01:56:18 -04:00
|
|
|
--disable-shared \
|
|
|
|
--prefix="$PREFIX" && \
|
2013-09-07 20:06:56 -04:00
|
|
|
make clean && \
|
|
|
|
make -j3 install && \
|
2013-05-31 01:56:18 -04:00
|
|
|
echo "libsodium has been installed into $PREFIX"
|