2013-01-21 22:25:49 -07:00
|
|
|
#! /bin/sh
|
|
|
|
|
2013-06-13 01:11:28 -07:00
|
|
|
# Note that this script requires droid-wrapper
|
|
|
|
if [ x`which droid-gcc` = x ]; then
|
|
|
|
echo "This build script requires droid-wrapper."
|
|
|
|
echo https://github.com/tmurakam/droid-wrapper
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
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
|
|
|
|
echo "Can't find ./configure. Wrong directory or haven't run autogen.sh?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-01-21 22:25:49 -07:00
|
|
|
export CFLAGS="-Os -mthumb"
|
|
|
|
export DROID_HOST=darwin-x86
|
2013-06-13 01:11:28 -07:00
|
|
|
if uname -a | grep -q -i linux; then
|
|
|
|
export DROID_HOST=linux-x86
|
|
|
|
fi
|
2013-01-21 22:25:49 -07:00
|
|
|
export LDFLAGS="-mthumb"
|
2013-04-27 11:18:08 -07:00
|
|
|
export NDK_PLATFORM=9
|
2013-06-13 01:11:28 -07:00
|
|
|
export NDK_ROOT=${NDK_ROOT:-/usr/local/Cellar/android-ndk/r8e}
|
2013-05-04 13:16:57 -07:00
|
|
|
export NDK_ANDROID_SOURCES="${NDK_ROOT}/sources/android"
|
2013-04-27 11:18:08 -07:00
|
|
|
export TARGET_TOOLCHAIN_VERSION=4.4.3
|
2013-01-21 22:25:49 -07:00
|
|
|
export TARGET=arm-linux-androideabi
|
|
|
|
export NDK_TARGET="arm-linux-androideabi-${TARGET_TOOLCHAIN_VERSION}"
|
|
|
|
export AR=droid-ar
|
|
|
|
export AS=droid-as
|
|
|
|
export CC=droid-gcc
|
|
|
|
export LD=droid-ld
|
|
|
|
export NM=droid-nm
|
|
|
|
export OBJCOPY=droid-objcopy
|
|
|
|
export RANLIB=droid-ranlib
|
|
|
|
export STRIP=droid-strip
|
2013-05-30 22:56:18 -07:00
|
|
|
export PREFIX="$(pwd)/libsodium-android"
|
2013-01-21 22:25:49 -07:00
|
|
|
|
2013-05-30 22:56:18 -07:00
|
|
|
./configure --host=arm-linux-androideabi \
|
2013-06-09 12:14:31 -07:00
|
|
|
--disable-pie \
|
2013-05-30 22:56:18 -07:00
|
|
|
--disable-shared \
|
|
|
|
--prefix="$PREFIX" && \
|
|
|
|
make -j3 install &&
|
|
|
|
echo "libsodium has been installed into $PREFIX"
|