Updated script to set up external android libraries.

This commit is contained in:
Armin Novak 2013-11-18 10:27:11 +01:00
parent 693506ab9f
commit 4dd596c1d5

View File

@ -10,28 +10,26 @@
# Usage:
# android_setup_build_env.sh <source root>
OPENSSL_SCM=https://github.com/bmiklautz/android-external-openssl-ndk-static
OPENSSL_SCM=https://github.com/akallabeth/openssl-android
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 <FreeRDP source>"
exit -1
echo "Missing command line argument, current directory as root."
ROOT=`pwd`
ROOT=$ROOT/external
else
ROOT=`readlink -f $1`
fi
if [ ! -d $1 ]; then
echo "Argument '$1' is not a directory."
if [ ! -d $ROOT ]; then
echo "Argument '$ROOT' is not a directory."
exit -2
fi
SRC=`realpath $1`
echo "Using '$SRC' as root."
echo "Using '$ROOT' as root."
echo "Preparing OpenSSL..."
OPENSSL_SRC=$SRC/external/openssl
OPENSSL_SRC=$ROOT/openssl-build
if [ -d $OPENSSL_SRC ]; then
cd $OPENSSL_SRC
git pull
@ -39,21 +37,35 @@ if [ -d $OPENSSL_SRC ]; then
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=$?
cd $OPENSSL_SRC
make clean
# The makefile has a bug, which aborts during
# first compilation. Rerun make to build the whole lib.
make
make
RETVAL=0 # TODO: Check, why 2 is returned.
if [ $RETVAL -ne 0 ]; then
echo "Failed to execute ndk-build command [$RETVAL]"
echo "Failed to execute make command [$RETVAL]"
exit -4
fi
# Copy the created library to the default openssl directory,
# so that CMake will detect it automatically.
SSL_ROOT=`find $OPENSSL_SRC -type d -name "openssl-?.?.*"`
rm -f $ROOT/openssl
ln -s $SSL_ROOT $ROOT/openssl
mkdir -p $ROOT/openssl/obj/local/armeabi/
cp $ROOT/openssl/libssl.a $ROOT/openssl/obj/local/armeabi/
cp $ROOT/openssl/libcrypto.a $ROOT/openssl/obj/local/armeabi/
echo "Preparing NDK profiler..."
NDK_PROFILER_SRC=$SRC/external/android-ndk-profiler
NDK_PROFILER_SRC=$ROOT/android-ndk-profiler
if [ -d $NDK_PROFILER_SRC ]; then
cd $NDK_PROFILER_SRC
git pull
@ -61,13 +73,14 @@ if [ -d $NDK_PROFILER_SRC ]; then
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
cd $NDK_PROFILER_SRC
ndk-build V=1 APP_ABI=armeabi-v7a clean
ndk-build V=1 APP_ABI=armeabi-v7a
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "Failed to execute ndk-build command [$RETVAL]"