Fixed autobuild scripts to read NDK root path from android/local.properties file

This commit is contained in:
Alex Zolotarev 2011-12-28 19:27:18 +03:00 committed by Alex Zolotarev
parent 8e01578207
commit 4446f0cc0e
2 changed files with 37 additions and 3 deletions

View file

@ -11,15 +11,17 @@ if [[ $# < 1 ]]; then
fi
CONFIGURATION="$1"
source "$LOCAL_DIRNAME/build.sh"
source "$LOCAL_DIRNAME/ndk_helper.sh"
MKSPEC="$LOCAL_DIRNAME/../mkspecs/android-g++"
QMAKE_PARAMS="CONFIG+=${CONFIGURATION}"
SHADOW_DIR_BASE="$LOCAL_DIRNAME/../../../omim-android"
export NDK_HOST=darwin-x86
export NDK_ROOT=/Developer/android-ndk-r7
# Try to read ndk root path from android/local.properties file
export NDK_ROOT=$(GetNdkRoot) || ( echo "Can't read NDK root path from android/local.properties"; exit 1 )
export NDK_HOST=$(GetNdkHost) || ( echo "Can't get your OS type, please check tools/autobuild/ndk_helper.sh script"; exit 1 )
NDK_ABI_TO_BUILD=(armeabi armeabi-v7a)
for abi in "${NDK_ABI_TO_BUILD[@]}"; do

View file

@ -0,0 +1,32 @@
set -e -u
LOCAL_DIRNAME="${PWD}/$(dirname "$0")"
# Echoes found NDK root path or nothing if not found
# return 1 on error and 0 on success
GetNdkRoot()
{
local FILENAME="$LOCAL_DIRNAME/../../android/local.properties"
while read line
do
if [[ "${line:0:7}" == "ndk.dir" ]]; then
echo "${line:8}"
return 0
fi
done < $FILENAME
return 1
}
GetNdkHost()
{
if [[ "${OSTYPE:0:5}" == "linux" ]]; then
echo "linux-x86"
return 0
fi
if [[ "${OSTYPE:0:6}" == "darwin" ]]; then
echo "darwin-x86"
return 0
fi
# TODO add Windows
return 1
}