From 6659af8510267af247682577328b1e34a2115474 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 18 Sep 2013 12:50:46 +0200 Subject: [PATCH] Added building of external profiler library. --- scripts/android_setup_build_env.sh | 78 ++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 scripts/android_setup_build_env.sh diff --git a/scripts/android_setup_build_env.sh b/scripts/android_setup_build_env.sh new file mode 100755 index 000000000..d96f5de72 --- /dev/null +++ b/scripts/android_setup_build_env.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# +# This script checks out or updates and builds third party libraries +# required for the android build. +# +# Specifically these are: +# - OpenSSL +# - Android NDK Profiler +# +# Usage: +# android_setup_build_env.sh + +OPENSSL_SCM=https://github.com/bmiklautz/android-external-openssl-ndk-static +NDK_PROFILER_SCM=https://github.com/richq/android-ndk-profiler + +SCRIPT_NAME=`basename $0` + +if [ $# -ne 1 ]; then + + echo "Missing command line argument." + echo "$SCRIPT_NAME " + exit -1 +fi + +if [ ! -d $1 ]; then + echo "Argument '$1' is not a directory." + exit -2 +fi +SRC=`realpath $1` + +echo "Using '$SRC' as root." + +echo "Preparing OpenSSL..." +OPENSSL_SRC=$SRC/external/openssl +if [ -d $OPENSSL_SRC ]; then + cd $OPENSSL_SRC + git pull + RETVAL=$? +else + git clone $OPENSSL_SCM $OPENSSL_SRC + RETVAL=$? + cd $OPENSSL_SRC +fi +if [ $RETVAL -ne 0 ]; then + echo "Failed to execute git command [$RETVAL]" + exit -3 +fi +ndk-build +RETVAL=$? +if [ $RETVAL -ne 0 ]; then + echo "Failed to execute ndk-build command [$RETVAL]" + exit -4 +fi + +echo "Preparing NDK profiler..." +NDK_PROFILER_SRC=$SRC/external/android-ndk-profiler +if [ -d $NDK_PROFILER_SRC ]; then + cd $NDK_PROFILER_SRC + git pull + RETVAL=$? +else + git clone $NDK_PROFILER_SCM $NDK_PROFILER_SRC + RETVAL=$? + cd $NDK_PROFILER_SRC +fi +if [ $RETVAL -ne 0 ]; then + echo "Failed to execute git command [$RETVAL]" + exit -5 +fi +ndk-build +RETVAL=$? +if [ $RETVAL -ne 0 ]; then + echo "Failed to execute ndk-build command [$RETVAL]" + exit -6 +fi + +echo "Prepared external libraries, you can now build the application." +exit 0