diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-11-27 22:18:39 +0000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-12-17 09:17:54 -0800 |
commit | fb3d1b3073ed2dc51048b7e11153d41ab1ed5dfe (patch) | |
tree | 126a214fee3345bdfa8244f021eb92eacbcd41a2 /packaging | |
parent | dbf2e3a85796d97f31939cb35a0b9b8347eabcb0 (diff) | |
download | subsurface-fb3d1b3073ed2dc51048b7e11153d41ab1ed5dfe.tar.gz |
Android: improve documentation and setup script
This has now been verified to work on a fresh clean Ubuntu 20.04 install, both
using the docker image route as well as the full local build system.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/android/README | 129 | ||||
-rwxr-xr-x | packaging/android/android-build-setup.sh | 4 |
2 files changed, 71 insertions, 62 deletions
diff --git a/packaging/android/README b/packaging/android/README index f822e7f0c..cd4325103 100644 --- a/packaging/android/README +++ b/packaging/android/README @@ -1,61 +1,70 @@ -Tool repo to crosscompile subsurface to android-arm ---------------------------------------------------- +over-simplistic instructions to building the Android package from source +------------------------------------------------------------------------ + +The easiest way to build things is using our container: + +mkdir $HOME/src +cd $HOME/src +git clone git://github.com/subsurface/subsurface +cd subsurface +git checkout version or branch you are testing +cd .. +sudo docker run -v $HOME/src/subsurface:/android/subsurface -w /android --name=android-builder-docker -d subsurface/android-build-container:5.15.1 /bin/sleep 60m +sudo docker exec -t android-builder-docker git config --global user.email "ci@subsurface-divelog.org" +sudo docker exec -t android-builder-docker git config --global user.name "Subsurface CI" +sudo docker exec -t android-builder-docker apt-get install --reinstall cpp-7 gcc-7-base libgcc-7-dev libcc1-0 gcc-7 +sudo docker exec -t android-builder-docker /bin/bash -x ./subsurface/packaging/android/qmake-build.sh + + +alternatively you can build locally without the help of our container. + +Setup your build environment on a Ubuntu 20.04 Linux box + +I think these packages should be enough: +sudo apt-get update +sudo apt-get install -y \ + autoconf \ + automake \ + cmake \ + git \ + libtool-bin \ + make \ + wget \ + unzip \ + python \ + python3-pip \ + bzip2 \ + pkg-config \ + libx11-xcb1 \ + libgl1-mesa-glx \ + libglib2.0-0 \ + openjdk-8-jdk \ + curl \ + coreutils \ + p7zip-full + +sudo mkdir /android +sudo chown `id -un` /android +cd /android +wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip +unzip commandlinetools-linux-*.zip + +git clone git://github.com/subsurface/subsurface + +# now get the SDK, NDK, Qt, everything that's needed +bash /android/subsurface/packaging/android/android-build-setup.sh + +Once this has completed, you should have a working build environment. + +bash -x subsurface/packaging/android/qmake-build.sh + +should build a working .aab as well as a .apk that can be installed on +your attached device: + +./platform-tools/adb install ./subsurface-mobile-build/android-build/build/outputs/apk/debug/android-build-debug.apk + +Note that since you don't have the same signing key that I have, +you'll have to uninstalled the 'official' Subsurface-mobile binary in +order for this to work. And likewise you have to uninstall yours +before you'll be able to install an official binary again. -Dependencies: - -1. android_sdk, android_ndk and Qt for android. See step 0. -2. cmake -3. ant -4. Java JDK -5. working adb is recommended -6. dependencies of libdivecomputer and subsurface - - visit http://subsurface.hohndel.org/documentation/building/ - -By far the easiest way to do this is using the Android build container which is -used to create the official builds. That has all the dependencies ready and -makes things a lot easier. - -Run the docker image: docker://subsurface/android-builder:5.13.10 - -Check out the sources inside the container, make sure the following links -are available in parallel to the source directory - - ln -s /android/Qt . - ln -s /android/android-ndk-r18b . - ln -s /android/android-sdk-linux . - -and run the build wrapper from the directory above the source directory - - bash -x subsurface/packaging/android/android-build-wrapper.sh - -This should create a pair of unsigned but otherwise working APKs (for 32 and 64 -bit ARM). - -Alternatively, steps to install using your own Linux machine: - -Step 0. -Grab.. -Android ndk from: http://developer.android.com/tools/sdk/ndk/index.html -Android sdk from: http://developer.android.com/sdk/index.html#download -And QT for android from: http://qt-project.org/downloads - -Step 1. -Extract and install these into known directories. -Have a look in the top of build.sh for where the cross build tool expects -them. By default thats is: ../../../android-ndk-r9d ../../../android-sdk-linux -and ../../../Qt/5.5 (or Qt/5.6) - -Step 2. -Run bash build.sh in the terminal. By default it builds for arm but you -can pass x86 as first arg to build.sh to have it build for x86. Nice when -debugging in a fast emulator. -The script will download and build the whole dependency chain. - -After this, subsurface will be built for android. - -The output folder is subsurface-build-arm/android_build and your newly -created apk shows up as: -subsurface-build-arm/android_build/bin/QtApp-debug.apk - -Where the x86 apk shows up when built for x86 is left as a exercise for the -reader. diff --git a/packaging/android/android-build-setup.sh b/packaging/android/android-build-setup.sh index 20aff7edd..572eda22d 100755 --- a/packaging/android/android-build-setup.sh +++ b/packaging/android/android-build-setup.sh @@ -52,11 +52,11 @@ yes | sdkmanager --sdk_root=/android --licenses # next check that Qt is installed if [ ! -d "$LATEST_QT" ] ; then pip3 install aqtinstall - aqt install -O /android "$LATEST_QT" linux android -m qtcharts + $HOME/.local/bin/aqt install -O /android "$LATEST_QT" linux android -m qtcharts fi # now that we have an NDK, copy the font that we need for OnePlus phones # due to https://bugreports.qt.io/browse/QTBUG-69494 -cp "$ANDROID_HOME"/platforms/"$ANDROID_PLATFORMS"/data/fonts/Roboto-Regular.ttf "$SUBSURFACE_SOURCE"/android-mobile || exit 1 +cp "$ANDROID_HOME"/platforms/"$ANDROID_PLATFORMS"/data/fonts/Roboto-Regular.ttf "$SCRIPTDIR"/../../android-mobile || exit 1 echo "things are set up for the Android build" |