build-android/build.sh
author Hussein Kasem
Wed, 18 May 2016 15:53:12 +0200
changeset 660 e1905543313b
parent 470 dcf000a08a7c
child 1268 10397798d2b3
permissions -rwxr-xr-x
Added generate asn.1 step to android build script, using wildcard instead of list of file in Android.mk
     1 #!/bin/sh
     2 
     3 set -e
     4 
     5 build_version=1
     6 ANDROID_PLATFORM=android-21
     7 libetpan_build_version=1
     8 archs="armeabi armeabi-v7a x86 x86_64"
     9 package_name=pEpEngine-android
    10 
    11 current_dir="`pwd`"
    12 
    13 if test "x$ANDROID_NDK" = x ; then
    14   echo should set ANDROID_NDK before running this script.
    15   exit 1
    16 fi
    17 
    18 if test "x$GPGME_INCLUDE_PATH" = x ; then
    19   echo should set GPGME_INCLUDE_PATH before running this script.
    20   exit 1
    21 fi
    22 
    23 if test "x$LIBETPAN_PATH" = x ; then
    24   echo should set LIBETPAN_PATH before running this script.
    25   exit 1
    26 fi
    27 
    28 libetpan_dir=$LIBETPAN_PATH
    29 
    30 function build {
    31   rm -rf "$current_dir/obj"
    32   
    33   cd "$current_dir/jni"
    34   $ANDROID_NDK/ndk-build V=1 TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
    35     LIBETPAN_PATH="$current_dir/third-party/libetpan-android-$libetpan_build_version"
    36 
    37   mkdir -p "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    38   cp "$current_dir/obj/local/$TARGET_ARCH_ABI/libpEpEngine.a" "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    39   rm -rf "$current_dir/obj"
    40 }
    41 
    42 mkdir -p "$current_dir/third-party"
    43 cd "$current_dir/third-party"
    44 unzip -qo "$libetpan_dir/libetpan-android-$libetpan_build_version.zip"
    45 
    46 # Copy public headers to include
    47 mkdir -p "$current_dir/$package_name-$build_version/include/pEp"
    48 cd "$current_dir/../src"
    49 cp *.h "$current_dir/$package_name-$build_version/include/pEp"
    50 
    51 # Generate asn.1
    52 cd "$current_dir/../asn.1"
    53 make generate
    54 
    55 # Start building.
    56 for arch in $archs ; do
    57   TARGET_ARCH_ABI=$arch
    58   build
    59 done
    60 
    61 rm -rf "$current_dir/third-party"
    62 cd "$current_dir"
    63 zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
    64 rm -rf "$package_name-$build_version"