build-android/build.sh
changeset 337 ea7d347eaf6c
parent 333 77d486037ec9
child 353 f1ca187ee8cb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build-android/build.sh	Thu Aug 20 11:58:05 2015 +0200
     1.3 @@ -0,0 +1,53 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +build_version=1
     1.7 +ANDROID_PLATFORM=android-21
     1.8 +openssl_build_version=1
     1.9 +cyrus_sasl_build_version=1
    1.10 +libetpan_build_version=1
    1.11 +archs="armeabi armeabi-v7a x86 x86_64"
    1.12 +package_name=pEpEngine-android
    1.13 +
    1.14 +current_dir="`pwd`"
    1.15 +libetpan_dir="$current_dir/../../libetpan/build-android"
    1.16 +
    1.17 +if test "x$ANDROID_NDK" = x ; then
    1.18 +  echo should set ANDROID_NDK before running this script.
    1.19 +  exit 1
    1.20 +fi
    1.21 +
    1.22 +function build {
    1.23 +  rm -rf "$current_dir/obj"
    1.24 +  
    1.25 +  cd "$current_dir/jni"
    1.26 +  $ANDROID_NDK/ndk-build V=1 TARGET_PLATFORM=$ANDROID_PLATFORM TARGET_ARCH_ABI=$TARGET_ARCH_ABI \
    1.27 +    OPENSSL_PATH="$current_dir/third-party/openssl-android-$openssl_build_version" \
    1.28 +    CYRUS_SASL_PATH="$current_dir/third-party/cyrus-sasl-android-$cyrus_sasl_build_version" \
    1.29 +    LIBETPAN_PATH="$current_dir/third-party/libetpan-android-$libetpan_build_version"
    1.30 +
    1.31 +  mkdir -p "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    1.32 +  cp "$current_dir/obj/local/$TARGET_ARCH_ABI/libpEpEngine.a" "$current_dir/$package_name-$build_version/libs/$TARGET_ARCH_ABI"
    1.33 +  rm -rf "$current_dir/obj"
    1.34 +}
    1.35 +
    1.36 +mkdir -p "$current_dir/third-party"
    1.37 +cd "$current_dir/third-party"
    1.38 +unzip -qo "$libetpan_dir/dependencies/openssl/openssl-android-$openssl_build_version.zip"
    1.39 +unzip -qo "$libetpan_dir/dependencies/cyrus-sasl/cyrus-sasl-android-$cyrus_sasl_build_version.zip"
    1.40 +unzip -qo "$libetpan_dir/libetpan-android-$libetpan_build_version.zip"
    1.41 +
    1.42 +# Copy public headers to include
    1.43 +mkdir -p "$current_dir/$package_name-$build_version/include/pEp"
    1.44 +cd "$current_dir/../src"
    1.45 +cp *.h "$current_dir/$package_name-$build_version/include/pEp"
    1.46 +
    1.47 +# Start building.
    1.48 +for arch in $archs ; do
    1.49 +  TARGET_ARCH_ABI=$arch
    1.50 +  build
    1.51 +done
    1.52 +
    1.53 +rm -rf "$current_dir/third-party"
    1.54 +cd "$current_dir"
    1.55 +zip -qry "$package_name-$build_version.zip" "$package_name-$build_version"
    1.56 +rm -rf "$package_name-$build_version"