diff options
-rw-r--r-- | packaging/android/android-build-wrapper.sh (renamed from scripts/android-build.sh) | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/scripts/android-build.sh b/packaging/android/android-build-wrapper.sh index 802cefdf4..523283f35 100644 --- a/scripts/android-build.sh +++ b/packaging/android/android-build-wrapper.sh @@ -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 |