2015-02-08 09:04:15 -07:00
|
|
|
#! /bin/sh
|
2014-02-17 02:07:47 -07:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2015-02-08 02:34:39 -07:00
|
|
|
if [ "x$TARGET_ARCH" = 'x' ] || [ "x$ARCH" = 'x' ] || [ "x$HOST_COMPILER" = 'x' ]; then
|
2014-02-17 02:07:47 -07:00
|
|
|
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"
|
|
|
|
|
|
|
|
rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}"
|
|
|
|
|
2015-03-10 07:08:44 -07:00
|
|
|
bash $MAKE_TOOLCHAIN --platform="${NDK_PLATFORM:-android-21}" \
|
2015-02-08 02:34:39 -07:00
|
|
|
--arch="$ARCH" \
|
2014-02-17 02:07:47 -07:00
|
|
|
--install-dir="$TOOLCHAIN_DIR" && \
|
|
|
|
./configure --host="${HOST_COMPILER}" \
|
|
|
|
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" \
|
2014-02-20 09:56:54 -07:00
|
|
|
--prefix="${PREFIX}" \
|
2014-08-13 23:32:26 -07:00
|
|
|
--enable-minimal \
|
2014-02-20 09:56:54 -07:00
|
|
|
--disable-soname-versions && \
|
2014-02-17 02:07:47 -07:00
|
|
|
make clean && \
|
|
|
|
make -j3 install && \
|
|
|
|
echo "libsodium has been installed into $PREFIX"
|