diff options
Diffstat (limited to 'scripts')
-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 |
6 files changed, 107 insertions, 46 deletions
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 . |