58 lines
2.3 KiB
Bash
Executable File
58 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
# SPDX-FileCopyrightText: 2025 ai-ad4 and the FreePDFEditor contributors
|
|
#
|
|
# AppImage build script (§12.1). Builds a manylinux-style AppImage bundling
|
|
# Qt, Skia, ICU and the codecs. The actual bundling uses linuxdeploy +
|
|
# linuxdeploy-plugin-qt, run inside the release container; this script is the
|
|
# entry point the release pipeline (§12.5) calls.
|
|
#
|
|
# AppImage cannot use bubblewrap-style user namespaces on distros that restrict
|
|
# them, so the sandbox falls back to seccomp-only. The app reports its actual
|
|
# sandbox level in About and never silently pretends a stronger level.
|
|
set -euo pipefail
|
|
|
|
APP="FreePDFEditor"
|
|
LOWER="$(echo "$APP" | tr '[:upper:]' '[:lower:]')"
|
|
VERSION="${1:?usage: build-appimage.sh <version> <build_dir>}"
|
|
BUILD_DIR="${2:?missing build_dir}"
|
|
OUTPUT="${3:-${APP}-${VERSION}-x86_64.AppImage}"
|
|
|
|
if [[ ! -d "$BUILD_DIR" ]]; then
|
|
echo "build dir not found: $BUILD_DIR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v linuxdeploy >/dev/null 2>&1; then
|
|
echo "linuxdeploy not on PATH — install it (https://github.com/linuxdeploy/linuxdeploy)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
APPDIR="$BUILD_DIR/AppDir"
|
|
rm -rf "$APPDIR"
|
|
mkdir -p "$APPDIR/usr/bin"
|
|
|
|
# Copy the built binary into the AppDir layout.
|
|
cp "$BUILD_DIR/bin/freepdfeditor" "$APPDIR/usr/bin/"
|
|
|
|
# Install the desktop file, icons, metainfo into AppDir.
|
|
mkdir -p "$APPDIR/usr/share/applications" \
|
|
"$APPDIR/usr/share/icons/hicolor/scalable/apps" \
|
|
"$APPDIR/usr/share/metainfo"
|
|
cp "$SCRIPT_DIR/freepdfeditor.desktop" "$APPDIR/usr/share/applications/"
|
|
cp "$SCRIPT_DIR/icons/hicolor/scalable/apps/freepdfeditor.svg" \
|
|
"$APPDIR/usr/share/icons/hicolor/scalable/apps/"
|
|
cp "$SCRIPT_DIR/org.freepdfeditor.FreePDFEditor.metainfo.xml" \
|
|
"$APPDIR/usr/share/metainfo/"
|
|
|
|
# linuxdeploy bundles the runtime + Qt + library deps via the qt plugin.
|
|
export OUTPUT="$OUTPUT"
|
|
export UPDATE_INFORMATION="zsync|https://download.freepdfeditor.org/nightly/$LOWER-x86_64.AppImage.zsync"
|
|
export LINUXDEPLOY_OUTPUT_VERSION="$VERSION"
|
|
linuxdeploy --appdir "$APPDIR" --desktop-file \
|
|
"$APPDIR/usr/share/applications/freepdfeditor.desktop" \
|
|
--icon-file "$APPDIR/usr/share/icons/hicolor/scalable/apps/freepdfeditor.svg" \
|
|
--output appimage
|
|
|
|
echo "Built $OUTPUT" |