diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | Documentation/mobile-manual.txt | 4 | ||||
-rw-r--r-- | android-mobile/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | core/windows.c | 14 | ||||
-rw-r--r-- | desktop-widgets/about.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.ui | 2 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferencesdialog.cpp | 1 | ||||
-rw-r--r-- | mobile-widgets/qml/About.qml | 2 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 6 | ||||
-rwxr-xr-x | packaging/android/android-build-wrapper.sh | 62 | ||||
-rwxr-xr-x | packaging/android/build.sh | 90 | ||||
-rw-r--r-- | packaging/android/qt-installer-noninteractive.qs (renamed from qt-installer-noninteractive.qs) | 3 | ||||
-rw-r--r-- | packaging/android/variables.sh | 12 | ||||
-rw-r--r-- | packaging/android/warning-ndk18b.txt | 21 | ||||
-rw-r--r-- | scripts/android/after_success.sh | 4 | ||||
-rw-r--r-- | scripts/android/before_install.sh | 26 | ||||
-rw-r--r-- | scripts/android/travisbuild.sh | 14 | ||||
-rwxr-xr-x | scripts/build.sh | 42 | ||||
-rw-r--r-- | scripts/docker/android-build-container/Dockerfile | 56 | ||||
-rw-r--r-- | scripts/docker/android-build-container/setup-docker.sh | 11 |
20 files changed, 244 insertions, 131 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e120b76a..a3746d168 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- Core, Windows: fix a bug related to non-ASCII characters in user names - Shearwater import: add suppport for importing Shearwater Cloud logs - Core, Mobile: all controller states other than powered off are valid [#1903] - Core: shift dive time in correct direction [#1893] diff --git a/Documentation/mobile-manual.txt b/Documentation/mobile-manual.txt index 2a869674d..b151c21c6 100644 --- a/Documentation/mobile-manual.txt +++ b/Documentation/mobile-manual.txt @@ -272,6 +272,10 @@ needs to be pasted. The same three icons appear on the target dive. Select the m notification briefly appears on the screen. This completes the copy-and-paste action. Continue by reviewing this new (pasted) information by manually editing the target dive. +To choose what dive details to copy, long-press the copy button. This will open +up a configuration page where you can toggle the details you want to copy over +to the destination. + == Deleting a dive Delete a dive from the dive list by long-pressing a dive diff --git a/android-mobile/AndroidManifest.xml b/android-mobile/AndroidManifest.xml index de4ff68ab..682454b09 100644 --- a/android-mobile/AndroidManifest.xml +++ b/android-mobile/AndroidManifest.xml @@ -83,7 +83,7 @@ </activity> </application> - <uses-sdk android:minSdkVersion="16" + <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="26" /> <supports-screens diff --git a/core/windows.c b/core/windows.c index 77b7f5755..85ef1bbf2 100644 --- a/core/windows.c +++ b/core/windows.c @@ -50,16 +50,20 @@ static char *utf16_to_utf8_fl(const wchar_t *utf16, char *file, int line) assert(file != NULL); assert(line); /* estimate buffer size */ - const int sz = wcslen(utf16) + 1; + const int sz = WideCharToMultiByte(CP_UTF8, 0, utf16, -1, NULL, 0, NULL, NULL); + if (!sz) { + fprintf(stderr, "%s:%d: cannot estimate buffer size\n", file, line); + return NULL; + } char *utf8 = (char *)malloc(sz); if (!utf8) { - fprintf(stderr, "%s:%d: %s %d.", file, line, "cannot allocate buffer of size", sz); + fprintf(stderr, "%s:%d: cannot allocate buffer of size: %d\n", file, line, sz); return NULL; } if (WideCharToMultiByte(CP_UTF8, 0, utf16, -1, utf8, sz, NULL, NULL)) { return utf8; } - fprintf(stderr, "%s:%d: %s", file, line, "cannot convert string."); + fprintf(stderr, "%s:%d: cannot convert string\n", file, line); free((void *)utf8); return NULL; } @@ -78,12 +82,12 @@ static wchar_t *utf8_to_utf16_fl(const char *utf8, char *file, int line) const int sz = strlen(utf8) + 1; wchar_t *utf16 = (wchar_t *)malloc(sizeof(wchar_t) * sz); if (!utf16) { - fprintf(stderr, "%s:%d: %s %d.", file, line, "cannot allocate buffer of size", sz); + fprintf(stderr, "%s:%d: cannot allocate buffer of size: %d\n", file, line, sz); return NULL; } if (MultiByteToWideChar(CP_UTF8, 0, utf8, -1, utf16, sz)) return utf16; - fprintf(stderr, "%s:%d: %s", file, line, "cannot convert string."); + fprintf(stderr, "%s:%d: cannot convert string\n", file, line); free((void *)utf16); return NULL; } diff --git a/desktop-widgets/about.cpp b/desktop-widgets/about.cpp index a9ec03f58..b2f04ba1a 100644 --- a/desktop-widgets/about.cpp +++ b/desktop-widgets/about.cpp @@ -21,7 +21,7 @@ SubsurfaceAbout::SubsurfaceAbout(QWidget *parent, Qt::WindowFlags f) : QDialog(p "Subsurface %1 </span><br><br>" "Multi-platform divelog software<br>" "<span style='font-size: 8pt'>" - "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, and others, 2011-2018" + "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, and others, 2011-2019" "</span>").arg(versionString)); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); diff --git a/desktop-widgets/preferences/preferences_defaults.ui b/desktop-widgets/preferences/preferences_defaults.ui index 2c357c0dc..7fcd53a36 100644 --- a/desktop-widgets/preferences/preferences_defaults.ui +++ b/desktop-widgets/preferences/preferences_defaults.ui @@ -49,7 +49,7 @@ <item> <widget class="QGroupBox" name="groupBox_3"> <property name="title"> - <string>Dives</string> + <string>Default file</string> </property> <layout class="QFormLayout" name="formLayout_2"> <property name="horizontalSpacing"> diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp index 49b1f87bd..59dbdf59b 100644 --- a/desktop-widgets/preferences/preferencesdialog.cpp +++ b/desktop-widgets/preferences/preferencesdialog.cpp @@ -39,6 +39,7 @@ PreferencesDialog::PreferencesDialog() //s.endGroup(); setWindowIcon(QIcon(":subsurface-icon")); + setWindowTitle(tr("Preferences")); pagesList = new QListWidget(); pagesStack = new QStackedWidget(); buttonBox = new QDialogButtonBox( diff --git a/mobile-widgets/qml/About.qml b/mobile-widgets/qml/About.qml index 15ca59f2a..075e3fd47 100644 --- a/mobile-widgets/qml/About.qml +++ b/mobile-widgets/qml/About.qml @@ -46,7 +46,7 @@ Kirigami.ScrollablePage { } Kirigami.Heading { - text: qsTr("Version: %1\n\n© Subsurface developer team\n2011-2018").arg(manager.getVersion()) + text: qsTr("Version: %1\n\n© Subsurface developer team\n2011-2019").arg(manager.getVersion()) level: 5 font.pointSize: subsurfaceTheme.smallPointSize + 1 Layout.alignment: Qt.AlignHCenter diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 232b50cfa..d02f18cdd 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -887,11 +887,9 @@ bool QMLManager::checkLocation(DiveObjectHelper *myDive, struct dive *d, QString qDebug() << "checkLocation" << location << "gps" << gps << "dive had" << myDive->location() << "gps" << myDive->gas(); if (myDive->location() != location) { diveChanged = true; - if (!ds) - ds = get_dive_site_by_name(qPrintable(location)); - if (!ds && !location.isEmpty()) { + ds = get_dive_site_by_name(qPrintable(location)); + if (!ds && !location.isEmpty()) ds = create_dive_site(qPrintable(location), d->when); - } d->dive_site = ds; } // now make sure that the GPS coordinates match - if the user changed the name but not 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/qt-installer-noninteractive.qs b/packaging/android/qt-installer-noninteractive.qs index b0ec88022..4cfa65208 100644 --- a/qt-installer-noninteractive.qs +++ b/packaging/android/qt-installer-noninteractive.qs @@ -32,7 +32,8 @@ Controller.prototype.ComponentSelectionPageCallback = function() { var widget = gui.currentPageWidget(); widget.deselectAll(); - widget.selectComponent('qt.qt5.5111.android_armv7'); + widget.selectComponent('qt.qt5.5120.android_armv7'); + widget.selectComponent('qt.qt5.5120.android_arm64_v8a'); gui.clickButton(buttons.NextButton); } 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> diff --git a/scripts/android/after_success.sh b/scripts/android/after_success.sh index c1a8d7e01..702cb9660 100644 --- a/scripts/android/after_success.sh +++ b/scripts/android/after_success.sh @@ -8,8 +8,8 @@ fi source ${TRAVIS_BUILD_DIR}/scripts/release-message.sh echo "Submitting the folloing apk for continuous build release:" -ls -lh $TRAVIS_BUILD_DIR/apk/*.apk +ls -lh ../subsurface-mobile-build-docker-arm*/build/outputs/apk/*.apk # get and run the upload script wget -c https://raw.githubusercontent.com/dirkhh/uploadtool/master/upload.sh -bash ./upload.sh $TRAVIS_BUILD_DIR/apk/*.apk +bash ./upload.sh ../subsurface-mobile-build-docker-arm*/build/outputs/apk/*.apk diff --git a/scripts/android/before_install.sh b/scripts/android/before_install.sh index 22c55aec8..a903b1fc0 100644 --- a/scripts/android/before_install.sh +++ b/scripts/android/before_install.sh @@ -6,14 +6,18 @@ git fetch --unshallow git pull --tags git describe -# Ugly, but keeps it running during the build -docker run -v $PWD:/workspace/subsurface --name=builder -w /workspace -d ubuntu:bionic /bin/sleep 60m -docker exec -t builder apt-get update -# subsurface android build dependencies -docker exec -t builder apt-get install -y git cmake autoconf libtool-bin openjdk-8-jdk-headless wget unzip python bzip2 pkg-config -# Qt installer dependencies -docker exec -t builder apt-get install -y libx11-xcb1 libgl1-mesa-glx libglib2.0-0 -# Inject cached 3pp's (if none exists in 3pp dir, we inject zero ones, and all is downloaded in the container) -# TODO: caching -#docker cp 3pp builder:/workspace -docker exec -t builder mkdir -p /workspace/3pp +# setup build dir on the host, not inside of the container +mkdir -p ../subsurface-mobile-build-docker-arm +mkdir -p ../subsurface-mobile-build-docker-arm64 + +# this uses a custom built Ubuntu image that includes Qt for Android and +# Android NDK/SDK +# Running sleep to keep the container running during the build +PARENT="$( cd .. && pwd )" +docker run -v $PWD:/android/subsurface \ + -v $PARENT/subsurface-mobile-build-docker-arm:/android/subsurface-mobile-build-arm \ + -v $PARENT/subsurface-mobile-build-docker-arm64:/android/subsurface-mobile-build-arm64 \ + --name=android-builder \ + -w /android \ + -d dirkhh/android-builder:5.12.03 \ + /bin/sleep 60m diff --git a/scripts/android/travisbuild.sh b/scripts/android/travisbuild.sh index 84ce42f6d..b11aca482 100644 --- a/scripts/android/travisbuild.sh +++ b/scripts/android/travisbuild.sh @@ -3,13 +3,9 @@ set -x set -e -docker exec -e TRAVIS="$TRAVIS" -t builder subsurface/packaging/android/android-build-wrapper.sh +# by running the build wrapper again we should be able to test newer +# versions of the dependencies even without updating the docker image +# (but of course having the right things in place will save a ton of time) +docker exec -e TRAVIS="$TRAVIS" -t android-builder subsurface/packaging/android/android-build-wrapper.sh -# Extract the built apk from the builder container -docker cp builder:/workspace/subsurface-mobile-build-arm/build/outputs/apk/ . - -# TODO: Caching -# Yank Qt, android-sdk, android-ndk and other 3pp source tar balls out from the container and cache them. -#docker exec builder mkdir -p 3pp -#docker exec builder sh -c 'mv Qt android-sdk-linux android-ndk-* *.tar.gz *.tar.bz2 3pp/' -#docker cp builder:/workspace/3pp . +ls -l ../subsurface-mobile-build-docker-arm*/build/outputs/apk/ diff --git a/scripts/build.sh b/scripts/build.sh index f8cb30c8f..f63c0d2c1 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -59,17 +59,13 @@ while [[ $# -gt 0 ]] ; do # we are building an AppImage as by product CREATE_APPDIR="1" ;; - -skip-googlemaps) - # hack for Travix Mac build - SKIP_GOOGLEMAPS="1" - ;; -release) # don't build Debug binaries DEBUGRELEASE="Release" ;; *) echo "Unknown command line argument $arg" - echo "Usage: build.sh [-no-bt] [-build-deps] [-build-with-webkit] [-mobile] [-desktop] [-both] [-create-appdir] [-skip-googlemaps] [-release]" + echo "Usage: build.sh [-no-bt] [-build-deps] [-build-with-webkit] [-mobile] [-desktop] [-both] [-create-appdir] [-release]" exit 1 ;; esac @@ -421,27 +417,25 @@ else PRINTING="-DNO_PRINTING=ON" fi -if [ "$SKIP_GOOGLEMAPS" != "1" ] ; then - # build the googlemaps map plugin +# build the googlemaps map plugin - cd $SRC - ./subsurface/scripts/get-dep-lib.sh single . googlemaps - pushd googlemaps - mkdir -p build - mkdir -p J10build - cd build - $QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro - # on Travis the compiler doesn't support c++1z, yet qmake adds that flag; - # since things compile fine with c++11, let's just hack that away - # similarly, don't use -Wdata-time - if [ "$TRAVIS" = "true" ] ; then - mv Makefile Makefile.bak - cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile - fi - make -j4 - make install - popd +cd $SRC +./subsurface/scripts/get-dep-lib.sh single . googlemaps +pushd googlemaps +mkdir -p build +mkdir -p J10build +cd build +$QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro +# on Travis the compiler doesn't support c++1z, yet qmake adds that flag; +# since things compile fine with c++11, let's just hack that away +# similarly, don't use -Wdata-time +if [ "$TRAVIS" = "true" ] ; then + mv Makefile Makefile.bak + cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile fi +make -j4 +make install +popd # finally, build Subsurface diff --git a/scripts/docker/android-build-container/Dockerfile b/scripts/docker/android-build-container/Dockerfile new file mode 100644 index 000000000..53039399e --- /dev/null +++ b/scripts/docker/android-build-container/Dockerfile @@ -0,0 +1,56 @@ +From ubuntu:18.04 + +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + autoconf \ + automake \ + git \ + libtool-bin \ + make \ + wget \ + unzip \ + python \ + bzip2 \ + pkg-config \ + libx11-xcb1 \ + libgl1-mesa-glx \ + libglib2.0-0 \ + openjdk-8-jdk + +# create our working directory and place the local copies of the Qt +# install, NDK and SDK there, plus the three files from the Subsurface +# sources that we need to get the prep routines to run +RUN mkdir -p /android +ADD qt-opensource-linux-x64-5.*.run /android/ +ADD android-ndk-r*-linux-x86_64.zip /android/ +ADD sdk-tools-linux-*.zip /android/ +ADD android-build-wrapper.sh variables.sh qt-installer-noninteractive.qs /android/ + +# install current cmake +ADD cmake-3.13.2.tar.gz /android/ +RUN cd /android/cmake-3.13.2 && \ + bash ./bootstrap && \ + make -j6 && make install + +# run the build wrapper in prep mode +RUN cd /android && bash -x /android/android-build-wrapper.sh -prep-only + +# uggly hack to work around some breakage in the NDK which makes our +# compiles fail +RUN sed -i '313,+13s/^using/\/\/using/' /android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/cmath + +# clean up the files that we don't need to keep the container smaller +RUN cd /android && \ + rm -rf qt-opensource-linux-x64-*.run \ + Qt/[a-zA-Z]* \ + sdk-tools-linux-*.zip \ + android-ndk-r*-linux-x86_64.zip \ + android-sdk-linux/emulator \ + $( find android-ndk*/platforms -name arch-mips -o -name arch-x86 ) \ + android-ndk*/toolchains/x86-* android-ndk*/toolchains/llvm/prebuilt/x86-* \ + cmake-3.13* && \ + ls -l && \ + du -sh * +RUN apt-get clean +RUN touch /android/finished-`date` diff --git a/scripts/docker/android-build-container/setup-docker.sh b/scripts/docker/android-build-container/setup-docker.sh new file mode 100644 index 000000000..98c13ec48 --- /dev/null +++ b/scripts/docker/android-build-container/setup-docker.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Use this to re-create a docker container for building Android binaries + +# copy the dependency script into this folder +cp ../../../packaging/android/android-build-wrapper.sh . +cp ../../../packaging/android/variables.sh . +cp ../../../packaging/android/qt-installer-noninteractive.qs . + +# create the container (this takes a while) +sudo docker build -t android-builder --squash . |