mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Android: Improve build instructions
Improve the build instructions for Android. Provide a complete script for building in a re-usable container. Also changed the Android packaging README to markdown. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
2aa13ea9d7
commit
9e059be4ca
2 changed files with 112 additions and 70 deletions
|
@ -1,70 +0,0 @@
|
|||
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 https://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 https://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.
|
||||
|
112
packaging/android/README.md
Normal file
112
packaging/android/README.md
Normal file
|
@ -0,0 +1,112 @@
|
|||
# Over-simplistic instructions to building the Android package from source
|
||||
|
||||
## In a Container
|
||||
|
||||
The easiest way to build things is using our container. The following script will download and build the dependencies on the first run of the container, and from there on in re-use the same container to speed up build time:
|
||||
|
||||
```.sh
|
||||
#!/bin/bash
|
||||
|
||||
# Change these to match your setup
|
||||
SUBSURFACE_ROOT=<root directory of your local subsurface repository>
|
||||
GIT_NAME="<name to use in git>"
|
||||
GIT_EMAIL="<email to use in git>"
|
||||
|
||||
CONTAINER_NAME=android-builder-docker
|
||||
|
||||
# Check if our container exists
|
||||
CONTAINER_ID=$(docker container ls -a -q -f name=${CONTAINER_NAME})
|
||||
|
||||
# Create the image if it does not exist
|
||||
if [[ -z "${CONTAINER_ID}" ]]; then
|
||||
docker create -v ${SUBSURFACE_ROOT}:/android/subsurface -w /android --name=${CONTAINER_NAME} subsurface/android-build-container:5.15.1 sleep infinity
|
||||
fi
|
||||
|
||||
docker start ${CONTAINER_NAME}
|
||||
|
||||
BUILD_PARAMETERS=""
|
||||
if [[ -n "${CONTAINER_ID}" ]]; then
|
||||
BUILD_PARAMETERS="-quick"
|
||||
else
|
||||
# Prepare the image for first use
|
||||
docker exec -t ${CONTAINER_NAME} rm /android/5.15.1/android/lib/cmake/Qt5Test/Qt5TestConfig.cmake
|
||||
docker exec -t ${CONTAINER_NAME} apt-get install --reinstall cpp-7 gcc-7-base libgcc-7-dev libcc1-0 gcc-7
|
||||
|
||||
# Set the git id
|
||||
docker exec -t ${CONTAINER_NAME} git config --global user.name "${GIT_NAME}"
|
||||
docker exec -t ${CONTAINER_NAME} git config --global user.email "${GIT_EMAIL}"
|
||||
fi
|
||||
|
||||
# Build. Do not rebuild the dependencies if this is not the first build
|
||||
docker exec -t ${CONTAINER_NAME} /bin/bash -x ./subsurface/packaging/android/qmake-build.sh ${BUILD_PARAMETERS}
|
||||
|
||||
# Copy the output files into the 'android-debug' directory in the source directory
|
||||
docker cp ${CONTAINER_NAME}:/android/subsurface-mobile-build/android-build/build/outputs/apk/debug/. ${SUBSURFACE_ROOT}/android-debug/
|
||||
|
||||
# Stop the container
|
||||
docker stop ${CONTAINER_NAME}
|
||||
```
|
||||
|
||||
_Caveat:_ With this build script `libdivecomputer` is pulled from git in the version specified in the submodule, so if you have changed `libdivecomputer` make sure to commit any changes and update the git submodule version before building.
|
||||
|
||||
|
||||
## On a Linux host
|
||||
|
||||
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:
|
||||
|
||||
```.sh
|
||||
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 https://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.
|
||||
|
||||
```.sh
|
||||
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:
|
||||
|
||||
```.sh
|
||||
./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.
|
Loading…
Reference in a new issue