libretroshare/misc/Android/GitlabCI_images_prepare.sh
Gioacchino Mazzurco ba90b27199
Fix Android build for ndk r29 on ubuntu 26.04
Drop armeabi-v7a and minapi16 (EOL), build arm64-v8a at API 21/24 only.

Toolchain:
- Replace make_standalone_toolchain.py with direct NDK toolchain copy
- Use NDK r29 compiler triple naming and llvm-ar/llvm-ranlib
- Add gentoo_disturl() for hash-based Gentoo mirror URLs

Dependencies:
- Add librnp (openssl backend) with json-c and sexpp support
- Add qemu-user for librnp cross-compilation feature detection
- Replace sqlcipher with plain sqlite (RS_SQLCIPHER=OFF)
- Switch rapidjson to git source for C++17 compatibility
- Bump bzip2, zlib, libpng, xapian, tiff, cimg, sqlite versions

CMake:
- Remove Android C++14 workaround (NDK r29 std::filesystem works)
- Refactor RS_RNPLIB to support inline, pre-built, and FetchContent
- Add CMAKE_POLICY_VERSION_MINIMUM for CMake 4.x compatibility

Dockerfile:
- Move to Ubuntu 26.04, python-is-python3
- Split COPY for layer caching of SDK and toolchain builds
2026-06-14 11:44:03 +02:00

80 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# Script to prepare libretroshare Android testing and publishing Docker images
#
# Copyright (C) 2016-2026 Gioacchino Mazzurco <gio@retroshare.cc>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>
#
# SPDX-FileCopyrightText: Retroshare Team <contact@retroshare.cc>
# SPDX-License-Identifier: AGPL-3.0-only
set -e
## Define default value for variable, take two arguments, $1 variable name,
## $2 default variable value, if the variable is not already define define it
## with default value.
function define_default_value()
{
VAR_NAME="${1}"
DEFAULT_VALUE="${2}"
[ -z "${!VAR_NAME}" ] && export ${VAR_NAME}="${DEFAULT_VALUE}" || true
}
define_default_value LIBRETROSHARE_SOURCE_VERSION "$(git describe --always)"
define_default_value ANDROID_MIN_API_LEVELS "21 24"
define_default_value JNI_NATIVE_LIBS_ARCHS "arm64-v8a"
define_default_value GRADLE_FULL_TASK "build" # set to "none" to disable
define_default_value GRADLE_SPLIT_TASKS "bundleDebugAar bundleReleaseAar"
function buildDetachPush()
{
IMAGE_NAME="$1"
docker build --squash --tag "${IMAGE_NAME}" \
--build-arg ANDROID_MIN_API_LEVEL=${ANDROID_MIN_API_LEVEL} \
--build-arg LIBRETROSHARE_SOURCE_VERSION="$LIBRETROSHARE_SOURCE_VERSION" \
--build-arg GRADLE_BUILD_TASK="$GRADLE_BUILD_TASK" \
--build-arg JNI_NATIVE_LIBS_ARCHS="$CURR_JNI_NATIVE_LIBS_ARCHS" \
--file misc/Android/Dockerfile .
# Start pushing in parallel with other build
((sleep 1m ; docker push "$IMAGE_NAME")&)
}
for mApiLevel in $(shuf --echo $ANDROID_MIN_API_LEVELS) ; do
ANDROID_MIN_API_LEVEL=$mApiLevel
CURR_JNI_NATIVE_LIBS_ARCHS="$JNI_NATIVE_LIBS_ARCHS"
[ "$GRADLE_FULL_TASK" == "none" ] ||
{
GRADLE_BUILD_TASK="$GRADLE_FULL_TASK"
CI_IMAGE_NAME="registry.gitlab.com/retroshare/retroshare:android_aar_base_${ANDROID_MIN_API_LEVEL}"
buildDetachPush "$CI_IMAGE_NAME"
}
[ "$GRADLE_SPLIT_TASKS" == "none" ] ||
for mArch in $(shuf --echo $CURR_JNI_NATIVE_LIBS_ARCHS) ; do
for mTask in $(shuf --echo $GRADLE_SPLIT_TASKS); do
GRADLE_BUILD_TASK=$mTask
CURR_JNI_NATIVE_LIBS_ARCHS=$mArch
CI_IMAGE_NAME="registry.gitlab.com/retroshare/retroshare:android_aar_base_${ANDROID_MIN_API_LEVEL}_${CURR_JNI_NATIVE_LIBS_ARCHS}_${GRADLE_BUILD_TASK}"
buildDetachPush "$CI_IMAGE_NAME"
done
done
done