mirror of
https://github.com/status-im/status-app.git
synced 2026-08-27 15:11:20 +00:00
- `mobile/Makefile` -> Added `apk-fdroid` build target, used by `fdroid/build-app.sh`. F-Droid requires an unsigned APK without Google Play services. - `mobile/android/qt6/build.gradle` -> Added F-Droid gradle build flavor, used during `apk-fdroid` target. Separates F-Droid builds from Play Store builds and no signing configuration since it's supposed to be unsigned. - `mobile/scripts/buildApp.sh` -> Updated to copy F-Droid APK instead of usual locations from Jenkins build. - `mobile/scripts/buildOpenSSL.sh` -> Moved from iOS dir, shared between iOS and F-Droid builds. Reusing the OpenSSL build logic that was previously iOS-only but is now needed for F-Droid's from-source requirement. - `mobile/scripts/Common.mk` -> Updated path to `buildOpenSSL.sh` which is no longer inside iOS dir. - `mobile/scripts/openssl-patch.diff` -> Moved from iOS dir, applied by `buildOpenSSL.sh`, so that the patch is co-located with the script that uses it. - `ci/Jenkinsfile.fdroid` -> Had to make a new pipeline script because integrating this into `ci/Jenkinsfile.android` was causing issues with the generated `AppImage` and steps had to be fully sequential, so I figured it's good to separate them out. - `fdroid/entrypoint-fdroid.sh` -> Docker entrypoint, used by `fdroid/Dockerfile`. Sets up the container user/permissions before the F-Droid build starts. - `fdroid/Dockerfile` -> A minimalistic Docker image for the F-Droid Jenkins build environment, used by `ci/Jenkinsfile.fdroid`. I didn't add to existing Qt Android `Dockerfile` because this one only needs a minimal environment with Docker-in-Docker to run the `fdroidserver` VM. - `fdroid/build-app.sh` -> Called by `fdroiddata` metadata build step. Sets up Qt and Android NDK environment, detects `JAVA_HOME`, configures `Go`/`Nim` env vars, and runs the `make` targets for the F-Droid APK. - `fdroid/build-openssl.sh` -> F-Droid requires OpenSSL to be built from source rather than using prebuilt binaries. - `fdroid/build-qt-android.sh` -> F-Droid requires Qt to be built from source; this handles the Android cross-compilation. - `fdroid/build-qt-host.sh` -> Qt's cross-compilation requires host tools (`moc`, `rcc`, etc.) to be built first. - `fdroid/cleanup-binaries.sh` -> Removes binaries flagged by `fdroid` scanner, called by `fdroiddata` metadata `prebuild` step. F-Droid's scanner rejects repos containing prebuilt binaries in test/vendor directories. - `fdroid/cleanup-fdroiddata.sh` -> Removes stale `fdroiddata` clones, called by `ci/Jenkinsfile.fdroid`. Prevents disk space issues from accumulating `fdroiddata` clones across builds. - `fdroid/fdroid-container-build.sh` -> Runs `fdroid build` inside Docker container, called by `scripts/fdroid-local-build.sh`. Isolates the build in a container to match F-Droid's official build environment. - `scripts/fdroid-local-build.sh` -> A handy script to build F-Droid locally, also called by `ci/Jenkinsfile.fdroid`. Manages the full lifecycle of cloning `fdroiddata`, launching the `fdroidserver`, and extracting the output APK. - `fdroid/generate-keystore.sh` -> Generates a single-use keystore for signing the F-Droid APK. Sourced by `buildApp.sh` to export signing credentials into the build environment. fixes: https://github.com/status-im/status-app/issues/19741
124 lines
3.2 KiB
Bash
Executable File
124 lines
3.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
show_help() {
|
|
cat << EOF
|
|
F-Droid Local Build Script
|
|
|
|
Runs the F-Droid build inside the fdroidserver Docker container.
|
|
|
|
USAGE:
|
|
$0 [OPTIONS] [appid:versioncode]
|
|
|
|
OPTIONS:
|
|
--no-cleanup Don't remove container after build (useful for debugging)
|
|
-h, --help Show this help message
|
|
|
|
EXAMPLES:
|
|
$0 # Build default (app.status.mobile:29500000)
|
|
$0 app.status.mobile:29500000 # Build specific version
|
|
$0 --no-cleanup app.status.mobile:29500000 # Keep container after build
|
|
|
|
ENVIRONMENT VARIABLES:
|
|
FDROIDDATA_PATH Path to fdroiddata repo (default: ./fdroiddata)
|
|
|
|
NOTE:
|
|
The Status app build requires many hours due to Qt compilation.
|
|
Make sure you have sufficient disk space (~100GB recommended).
|
|
EOF
|
|
}
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
DOCKER_IMAGE="registry.gitlab.com/fdroid/fdroidserver:buildserver-trixie"
|
|
FDROIDDATA_PATH="${FDROIDDATA_PATH:-$SCRIPT_DIR/fdroiddata}"
|
|
DEFAULT_BUILD="app.status.mobile:29500000"
|
|
CONTAINER_NAME="fdroid-local-build-$$"
|
|
ENTRYPOINT_SCRIPT="$SCRIPT_DIR/../fdroid/fdroid-container-build.sh"
|
|
|
|
log_info() { echo "[INFO] $1"; }
|
|
log_error() { echo "[ERROR] $1" >&2; }
|
|
|
|
# shellcheck disable=SC2317 # Used by trap
|
|
cleanup() {
|
|
log_info "Cleaning up container..."
|
|
docker rm -f "$CONTAINER_NAME" 2>/dev/null || true
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
NO_CLEANUP=false
|
|
BUILD_TARGET=""
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--no-cleanup)
|
|
NO_CLEANUP=true
|
|
shift
|
|
;;
|
|
-h|--help)
|
|
show_help
|
|
exit 0
|
|
;;
|
|
-*)
|
|
log_error "Unknown option: $1"
|
|
show_help
|
|
exit 1
|
|
;;
|
|
*)
|
|
BUILD_TARGET="$1"
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
|
|
BUILD_TARGET="${BUILD_TARGET:-$DEFAULT_BUILD}"
|
|
|
|
if [[ ! -d "$FDROIDDATA_PATH" ]]; then
|
|
log_error "fdroiddata directory not found at: $FDROIDDATA_PATH"
|
|
log_error "Set FDROIDDATA_PATH environment variable to the correct path"
|
|
exit 1
|
|
fi
|
|
|
|
FDROIDDATA_PATH=$(cd "$FDROIDDATA_PATH" && pwd)
|
|
log_info "Using fdroiddata at: $FDROIDDATA_PATH"
|
|
|
|
APPID="${BUILD_TARGET%:*}"
|
|
if [[ ! -f "$FDROIDDATA_PATH/metadata/${APPID}.yml" ]]; then
|
|
log_error "Metadata file not found: $FDROIDDATA_PATH/metadata/${APPID}.yml"
|
|
exit 1
|
|
fi
|
|
|
|
log_info "Build target: $BUILD_TARGET"
|
|
log_info "Starting F-Droid build container..."
|
|
log_info "This may take a very long time (hours) for complex builds like Status app"
|
|
log_info "Container name: $CONTAINER_NAME"
|
|
|
|
if $NO_CLEANUP; then
|
|
trap - EXIT
|
|
fi
|
|
|
|
BUILD_EXIT_CODE=0
|
|
docker run -i \
|
|
--name "$CONTAINER_NAME" \
|
|
-v "$FDROIDDATA_PATH:/fdroiddata" \
|
|
-v "$ENTRYPOINT_SCRIPT:/entrypoint.sh:ro" \
|
|
-e "BUILD_TARGET=$BUILD_TARGET" \
|
|
-w /fdroiddata \
|
|
"$DOCKER_IMAGE" \
|
|
/bin/bash /entrypoint.sh || BUILD_EXIT_CODE=$?
|
|
|
|
if [[ $BUILD_EXIT_CODE -eq 0 ]]; then
|
|
log_info "Build completed successfully!"
|
|
log_info "Check $FDROIDDATA_PATH/tmp/ for output files"
|
|
else
|
|
log_error "Build failed with exit code: $BUILD_EXIT_CODE"
|
|
if $NO_CLEANUP; then
|
|
log_info "Container preserved for debugging: $CONTAINER_NAME"
|
|
log_info "Attach with: docker exec -it $CONTAINER_NAME /bin/bash"
|
|
fi
|
|
fi
|
|
|
|
exit $BUILD_EXIT_CODE
|