build-android/build.sh
author Edouard Tisserant
Thu, 20 Aug 2015 11:58:05 +0200
changeset 337 ea7d347eaf6c
parent 333 android/build.sh@77d486037ec9
child 353 f1ca187ee8cb
permissions -rwxr-xr-x
Moved android -> build-android. Updated .hgignore.
     1 #!/bin/sh
     2 
     3 build_version=1
     4 ANDROID_PLATFORM=android-21
     5 openssl_build_version=1
     6 cyrus_sasl_build_version=1
     7 libetpan_build_version=1
     8 archs="armeabi armeabi-v7a x86 x86_64"
     9 package_name=pEpEngine-android
    10 
    11 current_dir="`pwd`"
    12 libetpan_dir="$current_dir/../../libetpan/build-android"
    13 
    14 if test "x$ANDROID_NDK" = x ; then
    15   echo should set ANDROID_NDK before running this script.
    16   exit 1
    17 fi
    18 
    19 function build {
    20   rm -rf "$current_dir/obj"
    21   
    22   cd "$current_dir/jni"
    23   $ANDROID_NDK/ndk-build V=1 TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
    24     OPENSSL_PATH="$current_dir/third-party/openssl-android-$openssl_build_version" \
    25     CYRUS_SASL_PATH="$current_dir/third-party/cyrus-sasl-android-$cyrus_sasl_build_version" \
    26     LIBETPAN_PATH="$current_dir/third-party/libetpan-android-$libetpan_build_version"
    27 
    28   mkdir -p "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    29   cp "$current_dir/obj/local/$TARGET_ARCH_ABI/libpEpEngine.a" "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    30   rm -rf "$current_dir/obj"
    31 }
    32 
    33 mkdir -p "$current_dir/third-party"
    34 cd "$current_dir/third-party"
    35 unzip -qo "$libetpan_dir/dependencies/openssl/openssl-android-$openssl_build_version.zip"
    36 unzip -qo "$libetpan_dir/dependencies/cyrus-sasl/cyrus-sasl-android-$cyrus_sasl_build_version.zip"
    37 unzip -qo "$libetpan_dir/libetpan-android-$libetpan_build_version.zip"
    38 
    39 # Copy public headers to include
    40 mkdir -p "$current_dir/$package_name-$build_version/include/pEp"
    41 cd "$current_dir/../src"
    42 cp *.h "$current_dir/$package_name-$build_version/include/pEp"
    43 
    44 # Start building.
    45 for arch in $archs ; do
    46   TARGET_ARCH_ABI=$arch
    47   build
    48 done
    49 
    50 rm -rf "$current_dir/third-party"
    51 cd "$current_dir"
    52 zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
    53 rm -rf "$package_name-$build_version"