Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ci/Jenkinsfile.fdroid
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.9.40'
library 'status-jenkins-lib@fdroid-apk-signing'

/* Options section can't access functions in objects. */
def isPRBuild = utils.isPRBuild()
Expand Down Expand Up @@ -93,6 +93,12 @@ pipeline {
}
}

stage('Sign') {
steps { script {
status.signFdroidApk(env.STATUS_FDROID_APK)
} }
}

stage('Upload') {
steps {
script {
Expand Down
39 changes: 39 additions & 0 deletions fdroid/build-qt.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,46 @@
#!/usr/bin/env bash
set -eo pipefail

# Reproducibility env
export LC_ALL=C
export LANG=C
export SOURCE_DATE_EPOCH="$(git -C "$BUILD_DIR" log -1 --pretty=%ct 2>/dev/null || echo 0)"

QT_VERSION="${QT_VERSION:-6.9.2}"

QT_MODULES=qtbase,qtdeclarative,qt5compat,qtmultimedia,qtshadertools,qtimageformats,qtwebview,qtscxml,qtsvg,qtconnectivity,qtwebsockets,qtpositioning,qtlottie,qtwebchannel
(cd "$QT_SRCDIR" && perl init-repository --module-subset="$QT_MODULES")

# Reproducibility:
# add_link_options: strips .note.gnu.build-id from every .so
# add_compile_options: make sure that paths dont leak into final build.
QT5_CMAKELISTS="$QT_SRCDIR/CMakeLists.txt"
if ! grep -q 'build-id=none' "$QT5_CMAKELISTS"; then
sed -i '/^project(Qt$/,/^)$/{/^)$/a\
add_link_options("LINKER:--build-id=none")\
add_compile_options("-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.")\
add_compile_options("-ffile-prefix-map=${CMAKE_BINARY_DIR}=.")\
add_compile_options("-ffile-prefix-map=$ENV{HOME}=.")
}' "$QT5_CMAKELISTS"
fi

# Reproducibility: force qmlcachegen --only-bytecode for every Qt-internal QML module.
# Otherwise we end up with +800 bytes of AOT code in one libQt6QuickControls2Fusion.
QT_QML_MACROS="$QT_SRCDIR/qtdeclarative/src/qml/Qt6QmlMacros.cmake"
if [ -f "$QT_QML_MACROS" ] && ! grep -q 'REPRODUCIBILITY_ONLY_BYTECODE' "$QT_QML_MACROS"; then
sed -i '/MATCHES "-NOTFOUND\$"/,/endforeach()/{
/endforeach()/a\
# REPRODUCIBILITY_ONLY_BYTECODE: pin every Qt-internal QML module to\
# qmlcachegen --only-bytecode so AOT C++ codegen does not introduce\
# per-build non-determinism in compiled .so files.\
get_target_property(_qmlcg_args ${target} QT_QMLCACHEGEN_ARGUMENTS)\
if(NOT "--only-bytecode" IN_LIST _qmlcg_args)\
list(APPEND _qmlcg_args "--only-bytecode")\
set_target_properties(${target} PROPERTIES QT_QMLCACHEGEN_ARGUMENTS "${_qmlcg_args}")\
endif()
}' "$QT_QML_MACROS"
fi

# Build Qt for host (required as cross-compilation toolchain for Android)
mkdir -p build_qt_host && cd build_qt_host

Expand All @@ -18,6 +53,8 @@ mkdir -p build_qt_host && cd build_qt_host
-nomake tests \
-- \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_UNITY_BUILD=OFF \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
-DCMAKE_MESSAGE_LOG_LEVEL=WARNING \
-Wno-dev

Expand Down Expand Up @@ -50,6 +87,8 @@ mkdir -p build_qt_android && cd build_qt_android
-DFFMPEG_DIR="$FFMPEG_DIR" \
-DFEATURE_ffmpeg=ON \
-DQT_DEFAULT_MEDIA_BACKEND=ffmpeg \
-DCMAKE_UNITY_BUILD=OFF \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF \
-DCMAKE_MESSAGE_LOG_LEVEL=WARNING \
-Wno-dev

Expand Down
36 changes: 0 additions & 36 deletions fdroid/generate-keystore.sh

This file was deleted.

44 changes: 0 additions & 44 deletions fdroid/sign-apk.sh

This file was deleted.

6 changes: 6 additions & 0 deletions mobile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ $(STATUS_GO_LIB):
@echo "Building status-go mobile library"
@mkdir -p $(LIB_PATH)
ifeq ($(OS),android)
# Reproducibility envs for status-go
GOFLAGS="-trimpath -buildvcs=false" \
GOMODCACHE="$(BUILD_PATH)/.gomodcache" \
CGO_CFLAGS="-ffile-prefix-map=$(HOME)=. -ffile-prefix-map=$(BUILD_PATH)=. -ffile-prefix-map=$(ROOT_DIR)=. -ffile-prefix-map=$(ANDROID_NDK_ROOT)=." \
CGO_CXXFLAGS="-ffile-prefix-map=$(HOME)=. -ffile-prefix-map=$(BUILD_PATH)=. -ffile-prefix-map=$(ROOT_DIR)=. -ffile-prefix-map=$(ANDROID_NDK_ROOT)=." \
CGO_LDFLAGS="-Wl,--build-id=none" \
CC="$(CC)" $(MAKE) -C ../vendor/status-go statusgo-android-library \
ARCH=$(ARCH) \
ANDROID_NDK_ROOT="$(ANDROID_NDK_ROOT)" \
Expand Down
30 changes: 17 additions & 13 deletions mobile/scripts/buildApp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ if [[ "${OS}" == "android" ]]; then
export BUILD_VARIANT
export BUNDLE_IDENTIFIER

if [[ "$GRADLE_TARGETS" == *"Fdroid"* ]]; then
# shellcheck source=../../fdroid/generate-keystore.sh
source "$REPO_ROOT/fdroid/generate-keystore.sh" "$REPO_ROOT/status-fdroid.keystore"
fi

# Reproducibility flags for fdroid rebuilds:
# --build-id=none drops the .note.gnu.build-id section
# -ffile-prefix-map remaps absolute source paths so they don't depend on $HOME or $BUILD_DIR.
QMAKE_REPRO_ARGS=(
"QMAKE_LFLAGS+=-Wl,--build-id=none"
"QMAKE_CFLAGS+=-ffile-prefix-map=${BUILD_DIR}=."
"QMAKE_CFLAGS+=-ffile-prefix-map=${REPO_ROOT}=."
"QMAKE_CFLAGS+=-ffile-prefix-map=${HOME}=."
"QMAKE_CXXFLAGS+=-ffile-prefix-map=${BUILD_DIR}=."
"QMAKE_CXXFLAGS+=-ffile-prefix-map=${REPO_ROOT}=."
"QMAKE_CXXFLAGS+=-ffile-prefix-map=${HOME}=."
)
"$QMAKE_BIN" "$CWD/../wrapperApp/Status.pro" "${QMAKE_CONFIG[@]}" -spec android-clang \
ANDROID_ABIS="${ANDROID_ABI:-arm64-v8a}" VERSION="$VERSION" "${QMAKE_DEFINES[@]}" -after
ANDROID_ABIS="${ANDROID_ABI:-arm64-v8a}" VERSION="$VERSION" "${QMAKE_DEFINES[@]}" \
-after "${QMAKE_REPRO_ARGS[@]}"

make -j"$(nproc)" apk_install_target

Expand Down Expand Up @@ -117,18 +125,14 @@ if [[ "${OS}" == "android" ]]; then
echo "APK outputs:"
find build/outputs/apk -name '*.apk' 2>/dev/null || echo "No APKs found"

# If Gradle produced an unsigned APK (e.g. fdroid build where signing configs
# are stripped by fdroid's remove_signing_keys), sign it via the dedicated script.
if [[ ! -f "$APK_OUT" && -f "$APK_OUT_UNSIGNED" && -n "${FDROID_STORE_FILE:-}" ]]; then
echo "Signing unsigned APK..."
"$REPO_ROOT/fdroid/sign-apk.sh"
fi

# Copy whichever artifacts were built
BUILT=""
if [[ -f "$APK_OUT" ]]; then
cp "$APK_OUT" "$BIN_DIR/${OUTPUT_NAME}.apk"
BUILT="$BIN_DIR/${OUTPUT_NAME}.apk"
elif [[ -f "$APK_OUT_UNSIGNED" ]]; then
cp "$APK_OUT_UNSIGNED" "$BIN_DIR/${OUTPUT_NAME}.apk"
BUILT="$BIN_DIR/${OUTPUT_NAME}.apk"
fi
if [[ -f "$AAB_OUT" ]]; then
cp "$AAB_OUT" "$BIN_DIR/${OUTPUT_NAME}.aab"
Expand Down
2 changes: 1 addition & 1 deletion vendor/status-go
Loading