Cleanup: Improve (Android) Build Scripts.

Add a script for building the Android APK in the docker container.
Also make some improvements to the Windows build scripts, and update the
documentation for both builds.

Signed-off-by: Michael Keller <mikeller@042.ch>
This commit is contained in:
Michael Keller 2024-04-30 16:40:02 +12:00 committed by Michael Keller
parent 3153a139b3
commit 5ac1922d84
5 changed files with 92 additions and 49 deletions

View file

@ -4,11 +4,12 @@
# Build the Subsurface Windows installer and the Smtk2ssrf Windows installer in a Docker container
#
# Needs the following environment variables to be set
# GIT_AUTHOR_NAME=<your name>
# GIT_AUTHOR_EMAIL=<email to be used with github>
croak() {
echo "$0: $*" >&2
exit 1
}
CONTAINER_NAME=windows-builder-docker
CONTAINER_NAME=subsurface-windows-builder
pushd .
cd "$(dirname "$0")/../.."
@ -28,22 +29,23 @@ CONTAINER_ID=$(docker container ls -a -q -f name=${CONTAINER_NAME})
# Create the container if it does not exist
if [[ -z "${CONTAINER_ID}" ]]; then
# We'll need these later
if [ -z ${GIT_AUTHOR_NAME+X} -o -z ${GIT_AUTHOR_EMAIL+X} ]; then
croak "Please make sure GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are set for the first run of this script."
fi
docker create -v ${SUBSURFACE_ROOT}:${CONTAINER_SUBSURFACE_DIR} --name=${CONTAINER_NAME} subsurface/mxe-build:3.1.0 sleep infinity
fi
# Start the container
docker start ${CONTAINER_NAME}
BUILD_PARAMETERS=""
if [[ -z "${CONTAINER_ID}" ]]; then
# Prepare the image for first use
docker exec -t ${CONTAINER_NAME} groupadd $(id -g -n) -o -g ${LOGIN_GROUP}
docker exec -t ${CONTAINER_NAME} useradd $(id -u -n) -o -u ${LOGIN_USER} -g ${LOGIN_GROUP} -d ${CONTAINER_ROOT_DIR}
docker exec -t ${CONTAINER_NAME} find ${CONTAINER_ROOT_DIR} -type d -exec chown ${FULL_USER} {} \;
docker exec -u ${FULL_USER} -t ${CONTAINER_NAME} git config --global --add safe.directory ${CONTAINER_SUBSURFACE_DIR}
docker exec -u ${FULL_USER} -t ${CONTAINER_NAME} git config --global --add safe.directory ${CONTAINER_SUBSURFACE_DIR}/libdivecomputer
docker exec -u ${FULL_USER} -t ${CONTAINER_NAME} git config --global --add safe.directory ${CONTAINER_SUBSURFACE_DIR}/nightly-builds
docker exec -u ${FULL_USER} -t ${CONTAINER_NAME} git config --global user.name "${GIT_AUTHOR_NAME}"
docker exec -u ${FULL_USER} -t ${CONTAINER_NAME} git config --global user.email "${GIT_AUTHOR_EMAIL}"