summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/android/android-build-wrapper.sh62
-rwxr-xr-xpackaging/android/build.sh90
-rw-r--r--packaging/android/qt-installer-noninteractive.qs61
-rw-r--r--packaging/android/variables.sh12
-rw-r--r--packaging/android/warning-ndk18b.txt21
5 files changed, 175 insertions, 71 deletions
diff --git a/packaging/android/android-build-wrapper.sh b/packaging/android/android-build-wrapper.sh
index 999cca221..5da08b533 100755
--- a/packaging/android/android-build-wrapper.sh
+++ b/packaging/android/android-build-wrapper.sh
@@ -17,26 +17,30 @@ exec 1> >(tee ./build.log) 2>&1
USE_X=$(case $- in *x*) echo "-x" ;; esac)
+# deal with the command line arguments
+while [[ $# -gt 0 ]] ; do
+ arg="$1"
+ case $arg in
+ -prep-only)
+ # only download the dependencies, don't build
+ PREP_ONLY="1"
+ ;;
+ *)
+ echo "Unknown command line argument $arg"
+ echo "Usage: $0 [-prep-only]"
+ exit 1
+ ;;
+ esac
+ shift
+done
+
# these are the current versions for Qt, Android SDK & NDK:
-source subsurface/packaging/android/variables.sh
-
-# avoid timeouts on Travis when downloads take a long time
-SLOW_PROG=""
-if [ -n "${TRAVIS:-}" ]; then
- source subsurface/scripts/travis-wait.sh
- set -x # make debugging Travis easier
- SLOW_PROG="travis_wait"
- # since we are running on Travis, let's just get our minimal Qt install
- mkdir -p Qt/"${LATEST_QT}"
- $SLOW_PROG wget -q https://storage.googleapis.com/travis-cache/Qt-"${LATEST_QT}"-android.tar.xz
- tar -xJ -C Qt/"${LATEST_QT}" -f Qt-"${LATEST_QT}"-android.tar.xz
-fi
+SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
+source "$SCRIPTDIR"/variables.sh
PLATFORM=$(uname)
-pushd $(dirname "$0")/../../
-export SUBSURFACE_SOURCE=$PWD
-popd
+export SUBSURFACE_SOURCE="$SCRIPTDIR"/../..
if [ "$PLATFORM" = Linux ] ; then
QT_BINARIES=qt-opensource-linux-x64-${LATEST_QT}.run
@@ -68,7 +72,7 @@ fi
# first we need to get the Android SDK and NDK
if [ ! -d "$ANDROID_NDK" ] ; then
if [ ! -f "$NDK_BINARIES" ] ; then
- $SLOW_PROG wget -q https://dl.google.com/android/repository/"$NDK_BINARIES"
+ wget -q https://dl.google.com/android/repository/"$NDK_BINARIES"
fi
unzip -q "$NDK_BINARIES"
fi
@@ -76,7 +80,7 @@ fi
if [ ! -d "$ANDROID_SDK"/build-tools/"${ANDROID_BUILDTOOLS_REVISION}" ] ; then
if [ ! -d "$ANDROID_SDK" ] ; then
if [ ! -f "$SDK_TOOLS" ] ; then
- $SLOW_PROG wget -q https://dl.google.com/android/repository/"$SDK_TOOLS"
+ wget -q https://dl.google.com/android/repository/"$SDK_TOOLS"
fi
mkdir "$ANDROID_SDK"
pushd "$ANDROID_SDK"
@@ -102,15 +106,19 @@ if [ ! -d Qt/"${LATEST_QT}"/android_armv7 ] ; then
echo "Qt installation found, backing it up to Qt_OLD."
fi
if [ ! -f "${QT_BINARIES}" ] ; then
- $SLOW_PROG wget -q "${QT_DOWNLOAD_URL}"
+ wget -q "${QT_DOWNLOAD_URL}"
fi
chmod +x ./"${QT_BINARIES}"
- ./"${QT_BINARIES}" --platform minimal --script "$SUBSURFACE_SOURCE"/qt-installer-noninteractive.qs --no-force-installations
+ ./"${QT_BINARIES}" --platform minimal --script "$SCRIPTDIR"/qt-installer-noninteractive.qs --no-force-installations
fi
# 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/"${LATEST_QT}"/android_armv7/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake
+if [ ! -z ${PREP_ONLY+x} ] ; then
+ exit 0
+fi
+
if [ ! -d subsurface/libdivecomputer/src ] ; then
pushd subsurface
git submodule init
@@ -118,12 +126,12 @@ if [ ! -d subsurface/libdivecomputer/src ] ; then
popd
fi
-if [ ! -f subsurface/libdivecomputer/configure ] ; then
- pushd subsurface/libdivecomputer
- autoreconf --install
- autoreconf --install
- popd
-fi
+# always reconfigure here
+rm -f subsurface/libdivecomputer/configure
+pushd subsurface/libdivecomputer
+autoreconf --install --force
+autoreconf --install --force
+popd
# and now we need a monotonic build number...
if [ ! -f ./buildnr.dat ] ; then
@@ -141,8 +149,10 @@ rm -df ./subsurface-mobile-build-arm/AndroidManifest.xml
if [ "$USE_X" ] ; then
bash "$USE_X" "$SUBSURFACE_SOURCE"/packaging/android/build.sh -buildnr "$BUILDNR" arm "$@"
+ bash "$USE_X" "$SUBSURFACE_SOURCE"/packaging/android/build.sh -buildnr "$BUILDNR" arm64 "$@"
else
bash "$SUBSURFACE_SOURCE"/packaging/android/build.sh -buildnr "$BUILDNR" arm "$@"
+ bash "$SUBSURFACE_SOURCE"/packaging/android/build.sh -buildnr "$BUILDNR" arm64 "$@"
fi
ls -l ./subsurface-mobile-build-arm/build/outputs/apk/*.apk
diff --git a/packaging/android/build.sh b/packaging/android/build.sh
index 81db27488..99addc346 100755
--- a/packaging/android/build.sh
+++ b/packaging/android/build.sh
@@ -63,7 +63,7 @@ while [ "$#" -gt 0 ] ; do
SUBSURFACE_DESKTOP=ON
shift
;;
- arm|x86)
+ arm|arm64|x86)
ARCH=$1
shift
;;
@@ -117,10 +117,17 @@ if [ "$ARCH" = "arm" ] ; then
QT_ARCH=armv7
BUILDCHAIN=arm-linux-androideabi
OPENSSL_MACHINE=armv7
+ ANDROID_ABI=armeabi-v7a
+elif [ "$ARCH" = "arm64" ] ; then # requires Qt 5.12
+ QT_ARCH=arm64_v8a
+ BUILDCHAIN=aarch64-linux-android
+ ANDROID_ABI=arm64-v8a
+ OPENSSL_MACHINE=aarch64
elif [ "$ARCH" = "x86" ] ; then
QT_ARCH=$ARCH
BUILDCHAIN=i686-linux-android
OPENSSL_MACHINE=i686
+ ANDROID_ABI=x86
fi
# Verify Qt install and adjust for single-arch Qt install layout
@@ -136,21 +143,20 @@ else
fi
if [ ! -e ndk-"$ARCH" ] ; then
- "$ANDROID_NDK_ROOT/build/tools/make_standalone_toolchain.py" --arch="$ARCH" --install-dir=ndk-"$ARCH" --api=16
+ "$ANDROID_NDK_ROOT/build/tools/make_standalone_toolchain.py" --arch="$ARCH" --install-dir=ndk-"$ARCH" --api=$ANDROID_PLATFORM_LEVEL
fi
export BUILDROOT=$PWD
export PATH=${BUILDROOT}/ndk-$ARCH/bin:$PATH
export PREFIX=${BUILDROOT}/ndk-$ARCH/sysroot/usr
export PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig
-export CC=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-gcc
-export CXX=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-g++
+export CC=${BUILDROOT}/ndk-$ARCH/bin/clang
+export CXX=${BUILDROOT}/ndk-$ARCH/bin/clang++
# autoconf seems to get lost without this
export SYSROOT=${BUILDROOT}/ndk-$ARCH/sysroot
-export CFLAGS=--sysroot=${SYSROOT}
-export CPPFLAGS=--sysroot=${SYSROOT}
-export CXXFLAGS=--sysroot=${SYSROOT}
-# Junk needed for qt-android-cmake
-export ANDROID_STANDALONE_TOOLCHAIN=${BUILDROOT}/ndk-$ARCH
+export CFLAGS="--sysroot=${SYSROOT} -fPIC"
+export CPPFLAGS="--sysroot=${SYSROOT} -fPIC"
+export CXXFLAGS="--sysroot=${SYSROOT} -fPIC"
+
if [ "$PLATFORM" = "Darwin" ] ; then
JAVA_HOME=$(/usr/libexec/java_home)
export JAVA_HOME
@@ -159,7 +165,8 @@ else
fi
# find qmake
-QMAKE=$QT5_ANDROID/android_armv7/bin/qmake
+QMAKE=$QT5_ANDROID/android_$QT_ARCH/bin/qmake
+echo $QMAKE
$QMAKE -query
# if we are just doing a quick rebuild, don't bother with any of the dependencies
@@ -170,7 +177,7 @@ if [ "$QUICK" = "" ] ; then
# build google maps plugin
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . googlemaps
# find qmake
- QMAKE=$QT5_ANDROID/android_armv7/bin/qmake
+ QMAKE=$QT5_ANDROID/android_$QT_ARCH/bin/qmake
$QMAKE -query
QT_PLUGINS_PATH=$($QMAKE -query QT_INSTALL_PLUGINS)
GOOGLEMAPS_BIN=libqtgeoservices_googlemaps.so
@@ -228,8 +235,33 @@ if [ "$QUICK" = "" ] ; then
make install
popd
fi
+
+
+ "${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . openssl
+ if [ ! -e "$PKG_CONFIG_LIBDIR/libssl.pc" ] ; then
+ mkdir -p openssl-build-"$ARCH"
+ cp -r openssl/* openssl-build-"$ARCH"
+ pushd openssl-build-"$ARCH"
+ perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
+ perl -pi -e 's/-mandroid//g' Configure
+ # Use env to make all these temporary, so they don't pollute later builds.
+ env SYSTEM=android \
+ CROSS_COMPILE=${BUILDCHAIN}- \
+ MACHINE=$OPENSSL_MACHINE \
+ HOSTCC=clang \
+ CC=clang \
+ ANDROID_DEV="$PREFIX" \
+ bash -x ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine no-asm --openssldir="$PREFIX"
+ # sed -i.bak -e 's/soname=\$\$SHLIB\$\$SHLIB_SOVER\$\$SHLIB_SUFFIX/soname=\$\$SHLIB/g' Makefile.shared
+ make depend
+ make
+ # now fix the reference to libcrypto.so.1.0.0 to be just to libcrypto.so
+ perl -pi -e 's/libcrypto.so.1.0.0/libcrypto.so\x00\x00\x00\x00\x00\x00/' libssl.so.1.0.0
+ make install_sw
+ popd
+ fi
- "${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libzip
+"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libzip
if [ ! -e "$PKG_CONFIG_LIBDIR/libzip.pc" ] ; then
# libzip expects a predefined macro that isn't there for our compiler
pushd libzip
@@ -244,6 +276,7 @@ if [ "$QUICK" = "" ] ; then
-DCMAKE_C_COMPILER="$CC" \
-DCMAKE_LINKER="$CC" \
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
+ -DCMAKE_INSTALL_LIBDIR="lib" \
-DBUILD_SHARED_LIBS=OFF \
../libzip/
make
@@ -251,30 +284,6 @@ if [ "$QUICK" = "" ] ; then
popd
fi
- "${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . openssl
- if [ ! -e openssl-build-"$ARCH" ] ; then
- mv openssl openssl-build-"$ARCH"
- fi
- if [ ! -e "$PKG_CONFIG_LIBDIR/libssl.pc" ] ; then
- pushd openssl-build-"$ARCH"
- perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
- # Use env to make all these temporary, so they don't pollute later builds.
- env SYSTEM=android \
- CROSS_COMPILE=${BUILDCHAIN}- \
- MACHINE=$OPENSSL_MACHINE \
- HOSTCC=gcc \
- CC=gcc \
- ANDROID_DEV="$PREFIX" \
- bash -x ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir="$PREFIX"
- # sed -i.bak -e 's/soname=\$\$SHLIB\$\$SHLIB_SOVER\$\$SHLIB_SUFFIX/soname=\$\$SHLIB/g' Makefile.shared
- make depend
- make
- # now fix the reference to libcrypto.so.1.0.0 to be just to libcrypto.so
- perl -pi -e 's/libcrypto.so.1.0.0/libcrypto.so\x00\x00\x00\x00\x00\x00/' libssl.so.1.0.0
- make install_sw
- popd
- fi
-
"${SUBSURFACE_SOURCE}"/scripts/get-dep-lib.sh singleAndroid . libgit2
if [ ! -e "$PKG_CONFIG_LIBDIR/libgit2.pc" ] ; then
# We don't want to find the HTTP_Parser package of the build host by mistake
@@ -395,14 +404,15 @@ fi
PKGCONF=$(which pkg-config)
cmake $MOBILE_CMAKE \
- -DPKG_CONFIG_EXECUTABLE="$PKGCONF" \
+ -DCMAKE_SYSTEM_NAME="Android" \
+ -DANDROID_ABI=$ANDROID_ABI \
+ -DANDROID_PLATFORM="$ANDROID_PLATFORM" \
-DQT_ANDROID_SDK_ROOT="$ANDROID_SDK_ROOT" \
-DQT_ANDROID_NDK_ROOT="$ANDROID_NDK_ROOT" \
- -DANDROID_TOOLCHAIN="gcc" \
- -DANDROID_PLATFORM="android-16" \
+ -DPKG_CONFIG_EXECUTABLE="$PKGCONF" \
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_ROOT"/build/cmake/android.toolchain.cmake \
-DQT_ANDROID_CMAKE="$BUILDROOT"/qt-android-cmake/AddQtAndroidApk.cmake \
- -DANDROID_STL="gnustl_shared" \
+ -DANDROID_STL="c++_shared" \
-DFORCE_LIBSSH=OFF \
-DLIBDC_FROM_PKGCONFIG=ON \
-DLIBGIT2_FROM_PKGCONFIG=ON \
diff --git a/packaging/android/qt-installer-noninteractive.qs b/packaging/android/qt-installer-noninteractive.qs
new file mode 100644
index 000000000..4cfa65208
--- /dev/null
+++ b/packaging/android/qt-installer-noninteractive.qs
@@ -0,0 +1,61 @@
+// http://stackoverflow.com/a/34032216/78204
+
+function Controller() {
+ installer.autoRejectMessageBoxes();
+ installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes);
+ installer.installationFinished.connect(function() {
+ gui.clickButton(buttons.NextButton);
+ })
+}
+
+Controller.prototype.WelcomePageCallback = function() {
+ gui.clickButton(buttons.NextButton,3000);
+}
+
+Controller.prototype.CredentialsPageCallback = function() {
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.IntroductionPageCallback = function() {
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.TargetDirectoryPageCallback = function()
+{
+ //gui.currentPageWidget().TargetDirectoryLineEdit.setText(installer.value("HomeDir") + "/Qt");
+ gui.currentPageWidget().TargetDirectoryLineEdit.setText(installer.value("InstallerDirPath") + "/Qt");
+ //gui.currentPageWidget().TargetDirectoryLineEdit.setText("/scratch/Qt");
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.ComponentSelectionPageCallback = function() {
+ var widget = gui.currentPageWidget();
+
+ widget.deselectAll();
+ widget.selectComponent('qt.qt5.5120.android_armv7');
+ widget.selectComponent('qt.qt5.5120.android_arm64_v8a');
+
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.LicenseAgreementPageCallback = function() {
+ gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.StartMenuDirectoryPageCallback = function() {
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.ReadyForInstallationPageCallback = function()
+{
+ gui.clickButton(buttons.NextButton);
+}
+
+Controller.prototype.FinishedPageCallback = function() {
+var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm
+if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox) {
+ checkBoxForm.launchQtCreatorCheckBox.checked = false;
+}
+ gui.clickButton(buttons.FinishButton);
+}
diff --git a/packaging/android/variables.sh b/packaging/android/variables.sh
index 0fde53bbb..49802cc8e 100644
--- a/packaging/android/variables.sh
+++ b/packaging/android/variables.sh
@@ -1,11 +1,13 @@
#!/bin/bash
# When changing Qt version remember to update the
# qt-installer-noninteractive file as well.
-QT_VERSION=5.11
-LATEST_QT=5.11.1
-NDK_VERSION=r14b
-SDK_VERSION=3859397
-ANDROID_BUILDTOOLS_REVISION=25.0.3
+QT_VERSION=5.12
+LATEST_QT=5.12.0
+NDK_VERSION=r18b
+SDK_VERSION=4333796
+ANDROID_BUILDTOOLS_REVISION=28.0.2
+ANDROID_PLATFORM_LEVEL=21
+ANDROID_PLATFORM=android-21
ANDROID_PLATFORMS=android-27
ANDROID_NDK=android-ndk-${NDK_VERSION}
ANDROID_SDK=android-sdk-linux
diff --git a/packaging/android/warning-ndk18b.txt b/packaging/android/warning-ndk18b.txt
new file mode 100644
index 000000000..64d49ef52
--- /dev/null
+++ b/packaging/android/warning-ndk18b.txt
@@ -0,0 +1,21 @@
+WARNING
+-------
+
+Using Cmake, Clang, NDK 18b, Qt 5.12 beta 4, some Subsurface code does
+not compile. At this point in time, its fully unclear to me why we see the
+error as it is.
+
+Thing fail deep down in Qt and NDK headers on #include <cmath>. Error like
+"::signbit is not in the global namespace". The most logic reason is an
+improper order in which include paths are constructed in the build process.
+Any attempt to find the real reason failed. Even very similar command lines
+from a qmake build that succeed fail with a cmake style build.
+
+The very very dirty hack is commenting out some lines in NDK 18b:
+
+"./android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/cmath
+
+Comment lines 313-325, and all build, links and runs with no errors
+related to this known at this point.
+
+Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>