1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 12:36:01 -07:00

Android: compile for platform 24, check compat with 16 or 21 (64 bit)

This commit is contained in:
Frank Denis 2016-06-05 22:00:56 +02:00
parent cc7b57b4a6
commit f8cc885b6f
4 changed files with 43 additions and 7 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
export TARGET_ARCH=armv8-a export TARGET_ARCH=armv8-a
export CFLAGS="-Os -march=${TARGET_ARCH}" export CFLAGS="-Os -march=${TARGET_ARCH}"
ARCH=arm64 HOST_COMPILER=aarch64-linux-android "$(dirname "$0")/android-build.sh" NDK_PLATFORM_COMPAT=android-21 ARCH=arm64 HOST_COMPILER=aarch64-linux-android "$(dirname "$0")/android-build.sh"

View File

@ -1,5 +1,12 @@
#! /bin/sh #! /bin/sh
if [ -z "$NDK_PLATFORM" ]; then
export NDK_PLATFORM="android-24"
export NDK_PLATFORM_COMPAT="${NDK_PLATFORM_COMPAT:-android-16}"
else
export NDK_PLATFORM_COMPAT="${NDK_PLATFORM_COMPAT:-${NDK_PLATFORM}}"
fi
if [ -z "$ANDROID_NDK_HOME" ]; then if [ -z "$ANDROID_NDK_HOME" ]; then
echo "You should probably set ANDROID_NDK_HOME to the directory containing" echo "You should probably set ANDROID_NDK_HOME to the directory containing"
echo "the Android NDK" echo "the Android NDK"
@ -24,14 +31,43 @@ export PATH="${PATH}:${TOOLCHAIN_DIR}/bin"
rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}" rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}"
bash $MAKE_TOOLCHAIN --platform="${NDK_PLATFORM:-android-16}" \ echo "Building for platform [${NDK_PLATFORM}], retaining compatibility with platform [${NDK_PLATFORM_COMPAT}]"
--arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" && \ echo
bash $MAKE_TOOLCHAIN --platform="$NDK_PLATFORM_COMPAT" \
--arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" || exit 1
./configure \ ./configure \
--disable-soname-versions \ --disable-soname-versions \
--enable-minimal \ --enable-minimal \
--host="${HOST_COMPILER}" \ --host="${HOST_COMPILER}" \
--prefix="${PREFIX}" \ --prefix="${PREFIX}" \
--with-sysroot="${TOOLCHAIN_DIR}/sysroot" && \ --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
bash $MAKE_TOOLCHAIN --platform="$NDK_PLATFORM" \
--arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" || exit 1
./configure \
--disable-soname-versions \
--enable-minimal \
--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
make clean && \ make clean && \
make -j3 install && \ make -j3 install && \
echo "libsodium has been installed into ${PREFIX}" echo "libsodium has been installed into ${PREFIX}"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
export TARGET_ARCH=mips64r6 export TARGET_ARCH=mips64r6
export CFLAGS="-Os -march=${TARGET_ARCH}" export CFLAGS="-Os -march=${TARGET_ARCH}"
ARCH=mips64 HOST_COMPILER=mips64el-linux-android "$(dirname "$0")/android-build.sh" NDK_PLATFORM_COMPAT=android-21 ARCH=mips64 HOST_COMPILER=mips64el-linux-android "$(dirname "$0")/android-build.sh"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
export TARGET_ARCH=x86_64 export TARGET_ARCH=westmere
export CFLAGS="-Os -march=${TARGET_ARCH}" export CFLAGS="-Os -march=${TARGET_ARCH}"
ARCH=x86_64 HOST_COMPILER=x86_64-linux-android "$(dirname "$0")/android-build.sh" NDK_PLATFORM_COMPAT=android-21 ARCH=x86_64 HOST_COMPILER=x86_64-linux-android "$(dirname "$0")/android-build.sh"