mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-30 05:37:13 +09:00
* Update android-armv7-a.sh update HOST_COMPILER variable to be compatible with updated android-build.sh that supports latest ndk and use of prebuilt toolchains. * Update android-build.sh update to allow use of prebuilt toolchains in latest ndk. The latest ndk does not support arm prior to armv7a and the HOST_COMPILER for armv7a must now be armv7a not just arm. * Delete android-arm.sh arm prior to armv7a is no longer supported by android ndk. * Update android-build.sh removing unneeded MAKE_TOOLCHAIN variable * Update Makefile.am removing obsolete android targets * Delete android-mips32.sh * Delete android-mips64.sh
91 lines
2.9 KiB
Bash
Executable File
91 lines
2.9 KiB
Bash
Executable File
#! /bin/sh
|
|
|
|
if [ -z "$NDK_PLATFORM" ]; then
|
|
export NDK_PLATFORM="android-16"
|
|
fi
|
|
export NDK_PLATFORM_COMPAT="${NDK_PLATFORM_COMPAT:-${NDK_PLATFORM}}"
|
|
export NDK_API_VERSION=$(echo "$NDK_PLATFORM" | sed 's/^android-//')
|
|
export NDK_API_VERSION_COMPAT=$(echo "$NDK_PLATFORM_COMPAT" | sed 's/^android-//')
|
|
|
|
if [ -z "$ANDROID_NDK_HOME" ]; then
|
|
echo "You should probably set ANDROID_NDK_HOME to the directory containing"
|
|
echo "the Android NDK"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f ./configure ]; then
|
|
echo "Can't find ./configure. Wrong directory or haven't run autogen.sh?" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ "x$TARGET_ARCH" = 'x' ] || [ "x$ARCH" = 'x' ] || [ "x$HOST_COMPILER" = 'x' ]; then
|
|
echo "You shouldn't use android-build.sh directly, use android-[arch].sh instead" >&2
|
|
exit 1
|
|
fi
|
|
|
|
export PREFIX="$(pwd)/libsodium-android-${TARGET_ARCH}"
|
|
export TOOLCHAIN_OS_DIR="`uname | tr '[:upper:]' '[:lower:]'`-x86_64/"
|
|
export TOOLCHAIN_DIR="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${TOOLCHAIN_OS_DIR}"
|
|
echo "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${TOOLCHAIN_OS_DIR}/${HOST_COMPILER}"
|
|
|
|
export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"
|
|
SDK_VERSION_NUM=`echo $NDK_PLATFORM | cut -d'-' -f2`
|
|
export CC=${CC:-"${HOST_COMPILER}${SDK_VERSION_NUM}-clang"}
|
|
|
|
echo
|
|
echo "Warnings related to headers being present but not usable are due to functions"
|
|
echo "that didn't exist in the specified minimum API version level."
|
|
echo "They can be safely ignored."
|
|
echo
|
|
|
|
echo
|
|
if [ "$NDK_PLATFORM" != "$NDK_PLATFORM_COMPAT" ]; then
|
|
echo "Building for platform [${NDK_PLATFORM}], retaining compatibility with platform [${NDK_PLATFORM_COMPAT}]"
|
|
else
|
|
echo "Building for platform [${NDK_PLATFORM}]"
|
|
fi
|
|
echo
|
|
|
|
|
|
if [ -z "$LIBSODIUM_FULL_BUILD" ]; then
|
|
export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal"
|
|
else
|
|
export LIBSODIUM_ENABLE_MINIMAL_FLAG=""
|
|
fi
|
|
|
|
./configure \
|
|
--disable-soname-versions \
|
|
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
|
|
--host="${HOST_COMPILER}" \
|
|
--prefix="${PREFIX}" \
|
|
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" || exit 1
|
|
|
|
if [ "$NDK_PLATFORM" != "$NDK_PLATFORM_COMPAT" ]; then
|
|
egrep '^#define ' config.log | sort -u >config-def-compat.log
|
|
echo
|
|
echo "Configuring again for platform [${NDK_PLATFORM}]"
|
|
echo
|
|
|
|
./configure \
|
|
--disable-soname-versions \
|
|
${LIBSODIUM_ENABLE_MINIMAL_FLAG} \
|
|
--host="${HOST_COMPILER}" \
|
|
--prefix="${PREFIX}" \
|
|
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" || exit 1
|
|
|
|
egrep '^#define ' config.log | sort -u >config-def.log
|
|
if ! cmp config-def.log config-def-compat.log; then
|
|
echo "Platform [${NDK_PLATFORM}] is not backwards-compatible with [${NDK_PLATFORM_COMPAT}]" >&2
|
|
diff -u config-def.log config-def-compat.log >&2
|
|
exit 1
|
|
fi
|
|
rm -f config-def.log config-def-compat.log
|
|
fi
|
|
|
|
NPROCESSORS=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
|
|
PROCESSORS=${NPROCESSORS:-3}
|
|
|
|
make clean &&
|
|
make -j${PROCESSORS} install &&
|
|
echo "libsodium has been installed into ${PREFIX}"
|