From 56551b42d30b78c2968daaea631bfdce1b6d66d0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 27 Mar 2016 01:43:51 +0100 Subject: android: update libuecc to v7, libsodium to 1.0.8 Also, script fixes and cleanup. --- doc/build-fastd-android.sh | 85 +++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 54 deletions(-) (limited to 'doc') diff --git a/doc/build-fastd-android.sh b/doc/build-fastd-android.sh index 3a8623c..9793253 100755 --- a/doc/build-fastd-android.sh +++ b/doc/build-fastd-android.sh @@ -1,6 +1,8 @@ # Helper script for building fastd-android and its dependencies #!/bin/bash +set -e + if [ x${PWD##*/} == xdoc ]; then echo "Warning: it seems you're currently in the doc/ folder. This script needs to run under the top folder of fastd source code." echo "See README-Android.md for more info." @@ -16,26 +18,25 @@ echo " * for Mac OS X: brew install automake libtool cmake bison" echo "Hit ctrl-c now if you don't have all needed stuff yet." read -SODIUM_VER=1.0.1 -UECC_VER=5 -LIBUECC_DOWNLOAD_ID=80 +SODIUM_VER=1.0.8 +UECC_VER=7 +LIBUECC_DOWNLOAD_ID=85 LIBSODIUM_PATH=libsodium-${SODIUM_VER} LIBUECC_PATH=libuecc-${UECC_VER} + ANDROID_NATIVE_LEVEL=16 -ARM_TOOLCHAIN=arm-linux-androideabi-4.9 -X86_TOOLCHAIN=x86-4.9 -if [ x$ANDROID_NDK_HOME == x ]; then +if [ x$ANDROID_NDK_HOME = x ]; then echo "Set ANDROID_NDK_HOME first"; exit 1; fi -if [ ! -d "build" ]; then - mkdir build -fi +mkdir -p android -pushd build > /dev/null +pushd android > /dev/null WORK_DIR=${PWD} +mkdir -p pkgconfig/armeabi-v7a pkgconfig/x86 + if [ -d "${LIBSODIUM_PATH}" ]; then echo "It seems you already have libsodium downloaded."; else @@ -44,22 +45,21 @@ else fi pushd ${LIBSODIUM_PATH} > /dev/null -if [ ! -f "dist-build/android-armv7.sh" ]; then - echo "Patching libsodium build scripts..." - sed -i.bak 's/--enable-minimal//' dist-build/android-build.sh - sed -i "" 's/--arch=/--toolchain="$NDK_TOOLCHAIN" --arch=/' dist-build/android-build.sh - sed -e 's/-mthumb -marm -march=armv6/-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16/' dist-build/android-arm.sh > dist-build/android-armv7.sh - chmod +x dist-build/android-armv7.sh -fi -if [ ! -d "libsodium-android-arm" ]; then - NDK_PLATFORM=android-${ANDROID_NATIVE_LEVEL} NDK_TOOLCHAIN=${ARM_TOOLCHAIN} dist-build/android-armv7.sh || exit 2 + +echo "Patching libsodium build scripts..." +sed -i -e 's/--enable-minimal//' dist-build/android-build.sh + +if [ ! -d "libsodium-android-armv7-a" ]; then + NDK_PLATFORM=android-${ANDROID_NATIVE_LEVEL} dist-build/android-armv7-a.sh || exit 2 # for static link using cmake - rm libsodium-android-arm/lib/libsodium.so + rm libsodium-android-armv7-a/lib/libsodium.so + cp libsodium-android-armv7-a/lib/pkgconfig/libsodium.pc ../pkgconfig/armeabi-v7a/ fi -if [ ! -d "libsodium-android-x86" ]; then - NDK_PLATFORM=android-${ANDROID_NATIVE_LEVEL} NDK_TOOLCHAIN=${X86_TOOLCHAIN} dist-build/android-x86.sh || exit 2 +if [ ! -d "libsodium-android-i686" ]; then + NDK_PLATFORM=android-${ANDROID_NATIVE_LEVEL} dist-build/android-x86.sh || exit 2 # for static link using cmake - rm libsodium-android-x86/lib/libsodium.so + rm libsodium-android-i686/lib/libsodium.so + cp libsodium-android-i686/lib/pkgconfig/libsodium.pc ../pkgconfig/x86/ fi popd > /dev/null @@ -80,34 +80,20 @@ if [ -d "${LIBUECC_PATH}" ]; then else curl -k -L https://projects.universe-factory.net/attachments/download/${LIBUECC_DOWNLOAD_ID}/libuecc-${UECC_VER}.tar.xz | tar Jxf - || exit 4 fi -for ARCH in arm x86; do +for ARCH in armeabi-v7a x86; do BUILD_DIR=libuecc-${ARCH} if [ ! -d "${BUILD_DIR}" ]; then mkdir ${BUILD_DIR} && pushd ${BUILD_DIR} > /dev/null - if [ ${ARCH} == arm ]; then - _USE_ABI="armeabi-v7a" - else - _USE_ABI=${ARCH} - fi - ${ANDROID_CMAKE} -DANDROID_ABI="$_USE_ABI" ${CMAKE_COMMON_DEFS} -DCMAKE_INSTALL_PREFIX=`pwd`/output ../${LIBUECC_PATH} || exit 5 + ${ANDROID_CMAKE} -DANDROID_ABI="${ARCH}" ${CMAKE_COMMON_DEFS} -DCMAKE_INSTALL_PREFIX=`pwd`/output ../${LIBUECC_PATH} || exit 5 make && make install || exit 6 # for static link using cmake rm output/lib/libuecc.so* - popd > /dev/null; + cp output/lib/pkgconfig/libuecc.pc ../pkgconfig/${ARCH} + popd > /dev/null echo ">> libuecc ${ARCH} built." fi done -if [ ! -d "pkgconfig" ]; then - mkdir pkgconfig - for ARCH in arm x86; do - mkdir pkgconfig/${ARCH} - cp libuecc-${ARCH}/output/lib/pkgconfig/libuecc.pc pkgconfig/${ARCH} - cp ${LIBSODIUM_PATH}/libsodium-android-${ARCH}/lib/pkgconfig/libsodium.pc pkgconfig/${ARCH} - done - echo ">> pkgconfig files prepared." -fi - # detect HomeBrew installed bison for OS X HOMEBREW_BISON_PATH="/usr/local/opt/bison/bin" if [ -x "${HOMEBREW_BISON_PATH}/bison" ]; then @@ -118,26 +104,17 @@ fi FASTD_ANDROID_DEFS="-DWITH_CAPABILITIES=OFF -DWITH_STATUS_SOCKET=OFF -DWITH_CIPHER_AES128_CTR=FALSE -DWITH_METHOD_XSALSA20_POLY1305=FALSE -DWITH_METHOD_GENERIC_POLY1305=FALSE -DWITH_CMDLINE_COMMANDS=FALSE" -for ARCH in arm x86; do +for ARCH in armeabi-v7a x86; do BUILD_DIR=fastd-${ARCH} - if [ ! -d "${BUILD_DIR}" ]; then - mkdir ${BUILD_DIR} - fi + mkdir -p ${BUILD_DIR} pushd ${BUILD_DIR} > /dev/null if [ ! -f "Makefile" ]; then - if [ ${ARCH} == arm ]; then - _USE_ABI="armeabi-v7a" - ADD_DEFS="-DWITH_CIPHER_SALSA2012_NACL=TRUE -DWITH_CIPHER_SALSA20_NACL=TRUE" - else - _USE_ABI=${ARCH} - ADD_DEFS="-DWITH_CIPHER_SALSA2012_NACL=FALSE -DWITH_CIPHER_SALSA20_NACL=FALSE" - fi PATH=${USE_PATH} PKG_CONFIG_LIBDIR=../pkgconfig/${ARCH} \ ${ANDROID_CMAKE} \ - -DANDROID_ABI="$_USE_ABI" ${CMAKE_COMMON_DEFS} \ + -DANDROID_ABI="${ARCH}" ${CMAKE_COMMON_DEFS} \ ${FASTD_ANDROID_DEFS} \ - ${ADD_DEFS} -DEXECUTABLE_OUTPUT_PATH=`pwd`/src -DCMAKE_INSTALL_PREFIX=`pwd` \ + -DEXECUTABLE_OUTPUT_PATH=`pwd`/src -DCMAKE_INSTALL_PREFIX=`pwd` \ ../.. || exit 7 fi -- cgit v1.2.3