build-android/build.sh
author Edouard Tisserant
Mon, 12 Oct 2015 13:26:19 +0200
changeset 394 a872e68c2104
parent 371 2b34176e3fd7
child 470 dcf000a08a7c
permissions -rwxr-xr-x
Android : re-enable armeabi-v7a, x86, and x86_64. Disabed accidentaly.
     1 #!/bin/sh
     2 
     3 set -e
     4 
     5 build_version=1
     6 ANDROID_PLATFORM=android-21
     7 openssl_build_version=1
     8 cyrus_sasl_build_version=1
     9 libetpan_build_version=1
    10 archs="armeabi armeabi-v7a x86 x86_64"
    11 package_name=pEpEngine-android
    12 
    13 current_dir="`pwd`"
    14 
    15 if test "x$ANDROID_NDK" = x ; then
    16   echo should set ANDROID_NDK before running this script.
    17   exit 1
    18 fi
    19 
    20 if test "x$GPGME_INCLUDE_PATH" = x ; then
    21   echo should set GPGME_INCLUDE_PATH before running this script.
    22   exit 1
    23 fi
    24 
    25 if test "x$LIBETPAN_PATH" = x ; then
    26   echo should set LIBETPAN_PATH before running this script.
    27   exit 1
    28 fi
    29 
    30 libetpan_dir=$LIBETPAN_PATH
    31 
    32 function build {
    33   rm -rf "$current_dir/obj"
    34   
    35   cd "$current_dir/jni"
    36   $ANDROID_NDK/ndk-build V=1 TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
    37     OPENSSL_PATH="$current_dir/third-party/openssl-android-$openssl_build_version" \
    38     CYRUS_SASL_PATH="$current_dir/third-party/cyrus-sasl-android-$cyrus_sasl_build_version" \
    39     LIBETPAN_PATH="$current_dir/third-party/libetpan-android-$libetpan_build_version"
    40 
    41   mkdir -p "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    42   cp "$current_dir/obj/local/$TARGET_ARCH_ABI/libpEpEngine.a" "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    43   rm -rf "$current_dir/obj"
    44 }
    45 
    46 mkdir -p "$current_dir/third-party"
    47 cd "$current_dir/third-party"
    48 unzip -qo "$libetpan_dir/dependencies/openssl/openssl-android-$openssl_build_version.zip"
    49 unzip -qo "$libetpan_dir/dependencies/cyrus-sasl/cyrus-sasl-android-$cyrus_sasl_build_version.zip"
    50 unzip -qo "$libetpan_dir/libetpan-android-$libetpan_build_version.zip"
    51 
    52 # Copy public headers to include
    53 mkdir -p "$current_dir/$package_name-$build_version/include/pEp"
    54 cd "$current_dir/../src"
    55 cp *.h "$current_dir/$package_name-$build_version/include/pEp"
    56 
    57 # Start building.
    58 for arch in $archs ; do
    59   TARGET_ARCH_ABI=$arch
    60   build
    61 done
    62 
    63 rm -rf "$current_dir/third-party"
    64 cd "$current_dir"
    65 zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
    66 rm -rf "$package_name-$build_version"