2014-11-03 02:33:23 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2014-11-04 21:57:39 +01:00
|
|
|
# Use directory of current script as the build directory and working directory
|
|
|
|
cd "$( dirname "${BASH_SOURCE[0]}" )"
|
|
|
|
ANDROID_BUILD_DIR="$(pwd)"
|
2014-11-03 02:33:23 +01:00
|
|
|
|
|
|
|
# Get access to android_build functions and variables
|
|
|
|
source ${ANDROID_BUILD_DIR}/android_build_helper.sh
|
|
|
|
|
|
|
|
# Choose a C++ standard library implementation from the ndk
|
|
|
|
ANDROID_BUILD_CXXSTL="gnustl_shared_48"
|
|
|
|
|
|
|
|
# Set up android build environment and set ANDROID_BUILD_OPTS array
|
|
|
|
android_build_env
|
|
|
|
android_build_opts
|
|
|
|
|
2014-11-04 21:57:39 +01:00
|
|
|
# Use a temporary build directory
|
2014-11-03 02:33:23 +01:00
|
|
|
cache="/tmp/android_build/${TOOLCHAIN_NAME}"
|
2015-01-29 02:30:35 +01:00
|
|
|
rm -rf "${cache}"
|
2014-11-03 02:33:23 +01:00
|
|
|
mkdir -p "${cache}"
|
|
|
|
|
2015-01-29 02:30:35 +01:00
|
|
|
# Check for environment variable to clear the prefix and do a clean build
|
|
|
|
if [[ $ANDROID_BUILD_CLEAN ]]; then
|
|
|
|
echo "Doing a clean build (removing previous build and depedencies)..."
|
|
|
|
rm -rf "${ANDROID_BUILD_PREFIX}"/*
|
|
|
|
fi
|
|
|
|
|
2014-11-04 21:57:39 +01:00
|
|
|
##
|
2015-04-28 10:42:56 +02:00
|
|
|
# Build libsodium from latest master branch
|
2014-11-04 21:57:39 +01:00
|
|
|
|
|
|
|
(android_build_verify_so "libsodium.so" &> /dev/null) || {
|
|
|
|
rm -rf "${cache}/libsodium"
|
2015-12-19 13:17:22 +01:00
|
|
|
(cd "${cache}" && git clone --depth 1 git://github.com/jedisct1/libsodium.git) || exit 1
|
2014-11-04 21:57:39 +01:00
|
|
|
(cd "${cache}/libsodium" && ./autogen.sh \
|
|
|
|
&& ./configure "${ANDROID_BUILD_OPTS[@]}" --disable-soname-versions \
|
|
|
|
&& make \
|
|
|
|
&& make install) || exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
##
|
|
|
|
# Build libzmq from local source
|
|
|
|
|
|
|
|
LIBTOOL_EXTRA_LDFLAGS='-avoid-version'
|
|
|
|
|
|
|
|
(android_build_verify_so "libzmq.so" "libsodium.so" &> /dev/null) || {
|
|
|
|
rm -rf "${cache}/libzmq"
|
|
|
|
(cp -r ../.. "${cache}/libzmq" && cd "${cache}/libzmq" && make clean)
|
|
|
|
|
|
|
|
(cd "${cache}/libzmq" && ./autogen.sh \
|
|
|
|
&& ./configure "${ANDROID_BUILD_OPTS[@]}" --with-libsodium=yes \
|
|
|
|
&& make \
|
|
|
|
&& make install) || exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
##
|
|
|
|
# Verify shared libraries in prefix
|
2014-11-03 02:33:23 +01:00
|
|
|
|
|
|
|
android_build_verify_so "libzmq.so" "libsodium.so"
|
2015-12-16 11:58:44 +01:00
|
|
|
echo "libzmq android build succeeded"
|