Extend Android wrapper shell to be smarter

Move it to packaging/android where it belongs
Use direct URLs to download Android components
Make sure required packages are installed (only tested on Ubuntu)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-02-03 17:27:45 -08:00
parent ca6a241a97
commit 9a754b663a

View file

@ -10,7 +10,7 @@
exec 1> >(tee ./build.log) 2>&1
USE_X=`case "$-" in *x*) echo "-x" ;; esac`
USE_X=$(case "$-" in *x*) echo "-x" ;; esac)
# these are the current versions for Qt, Android SDK & NDK:
@ -33,29 +33,51 @@ else
exit 1
fi
# make sure we have the required commands installed
MISSING=""
for i in git cmake autoconf libtool java ant; do
which $i > /dev/null 2>&1 ||
if [ "$i" = "libtool" ] ; then
MISSING="${MISSING}libtool-bin "
elif [ "$i" = "java" ] ; then
MISSING="${MISSING}openjdk-8-jdk "
else
MISSING="${MISSING}${i} "
fi
done
if [ "$MISSING" != "" ] ; then
echo "The following packages are missing: $MISSING"
echo "Please install via your package manager."
exit
fi
# download the Qt installer including Android bits and unpack / install
QT_DOWNLOAD_URL=https://download.qt.io/archive/qt/${QT_VERSION}/${LATEST_QT}/${QT_BINARIES}
if [ ! -f ${QT_BINARIES} ] ; then
wget ${QT_DOWNLOAD_URL}
if [ ! -d Qt${LATEST_QT} ] ; then
if [ ! -f ${QT_BINARIES} ] ; then
wget ${QT_DOWNLOAD_URL}
fi
echo "In the binary installer select $(pwd)/${LATEST_QT} as install directory"
bash ./${QT_BINARIES}
chmod +x ./${QT_BINARIES}
./${QT_BINARIES}
fi
[ -e Qt ] || ln -s Qt${LATEST_QT} Qt
# patch the cmake / Qt5.7.1 incompatibility mentioned above
sed -i 's/set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)/# set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)/' Qt/5.7/android_armv7/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake
# next we need to get the Android SDK and NDK
if [ ! -d $ANDROID_NDK ] ; then
if [ ! -f $NDK_BINARIES ] ; then
echo "Please download the Android NDK $NDK_BINARIES from Google's servers and place it in this directory"
exit
wget https://dl.google.com/android/repository/$NDK_BINARIES
fi
unzip $NDK_BINARIES
fi
if [ ! -d $ANDROID_SDK ] ; then
if [ ! -f $SDK_TOOLS ] ; then
echo "Please download the Android SDK $SDK_TOOLS from Google's servers and place it in this directory"
exit
wget https://dl.google.com/android/repository/$SDK_TOOLS
fi
mkdir $ANDROID_SDK
pushd $ANDROID_SDK
@ -94,7 +116,7 @@ if [ ! -f "./buildnr.dat" ] ; then
else
BUILDNR=$(cat ./buildnr.dat)
fi
BUILDNR=`expr ${BUILDNR} + 1`
((BUILDNR++))
echo "${BUILDNR}" > ./buildnr.dat
echo "Building Subsurface-mobile ${VERSION} for Android, build nr ${BUILDNR} as Subsurface-mobile-$VERSION-${NAME}arm.apk"
@ -109,5 +131,7 @@ fi
rm -f ./subsurface-mobile-build-arm/bin/QtApp-debug.apk
rm -d ./subsurface-mobile-build-arm/AndroidManifest.xml
rm -d ./subsurface-mobile-build-arm/bin/AndroidManifest.xml
bash $USE_X subsurface/packaging/android/build.sh $RELEASE -buildnr ${BUILDNR} arm $@
bash "$USE_X" subsurface/packaging/android/build.sh "$RELEASE" -buildnr "$BUILDNR" arm "$@"
ls -l ./subsurface-mobile-build-arm/bin/*.apk