build-android/build.sh
author Krista Bennett <krista@pep-project.org>
Fri, 09 Jun 2017 14:31:58 +0200
changeset 1841 ca925aadd9fe
parent 1528 f0ed0f1f2b56
permissions -rwxr-xr-x
adding ENGINE-9 fix for external revoke test
     1 #!/bin/sh
     2 
     3 # This file is under GNU General Public License 3.0
     4 # see LICENSE.txt
     5 
     6 set -e
     7 
     8 build_version=1
     9 ANDROID_PLATFORM=android-18
    10 libetpan_build_version=1
    11 archs="armeabi armeabi-v7a x86 x86_64"
    12 package_name=pEpEngine-android
    13 
    14 current_dir="`pwd`"
    15 
    16 if test "x$ANDROID_NDK" = x ; then
    17   echo should set ANDROID_NDK before running this script.
    18   exit 1
    19 fi
    20 
    21 if test "x$GPGME_INCLUDE_PATH" = x ; then
    22   echo should set GPGME_INCLUDE_PATH before running this script.
    23   exit 1
    24 fi
    25 
    26 if test "x$LIBETPAN_PATH" = x ; then
    27   echo should set LIBETPAN_PATH before running this script.
    28   exit 1
    29 fi
    30 
    31 libetpan_dir=$LIBETPAN_PATH
    32 
    33 function build {
    34   rm -rf "$current_dir/obj"
    35   
    36   cd "$current_dir/jni"
    37   $ANDROID_NDK/ndk-build V=1 TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
    38     LIBETPAN_PATH="$current_dir/third-party/libetpan-android-$libetpan_build_version"
    39 
    40   mkdir -p "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    41   cp "$current_dir/obj/local/$TARGET_ARCH_ABI/libpEpEngine.a" "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    42   rm -rf "$current_dir/obj"
    43 }
    44 
    45 mkdir -p "$current_dir/third-party"
    46 cd "$current_dir/third-party"
    47 unzip -qo "$libetpan_dir/libetpan-android-$libetpan_build_version.zip"
    48 
    49 # Copy public headers to include
    50 mkdir -p "$current_dir/$package_name-$build_version/include/pEp"
    51 cd "$current_dir/../src"
    52 cp *.h "$current_dir/$package_name-$build_version/include/pEp"
    53 
    54 # Generate asn.1
    55 cd "$current_dir/../asn.1"
    56 make generate
    57 
    58 # Generate asn.1
    59 cd "$current_dir/../sync"
    60 make
    61 
    62 # Start building.
    63 for arch in $archs ; do
    64   TARGET_ARCH_ABI=$arch
    65   build
    66 done
    67 
    68 rm -rf "$current_dir/third-party"
    69 cd "$current_dir"
    70 zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
    71 rm -rf "$package_name-$build_version"