Browsers strip POSIX executable permissions (+x) from raw .AppImage files downloaded directly over HTTP, leaving the downloaded binary non-executable in Ubuntu Files (Nautilus). Additionally, Ubuntu displays a generic cog icon for standalone AppImages in both Nautilus and the Ubuntu Dock on Wayland unless desktop metadata, high-DPI icons, and GVfs custom icon attributes are registered. - Wrap `Asteria-<arch>.AppImage` (`0755`) in a `.AppImage.tar.gz` archive in `package-linux.sh` and point CI wiki links to the archive so extracting the download preserves executable permissions out of the box. - Copy `.DirIcon` as a regular PNG file rather than a symlink so SquashFS icon extractors that do not follow symlinks receive valid image bytes. - Add non-blocking first-launch integration in `AppRun` to install `hicolor` icons and `asteria-qt.desktop` (`StartupWMClass=asteria-qt`) under `XDG_DATA_HOME` and apply `metadata::custom-icon` on `$APPIMAGE` via `gio` for Nautilus. - Embed 128x128, 256x256, and 512x512 icons in Qt resources and register them with `QApplication::setWindowIcon()`.
73 lines
2.7 KiB
Bash
Executable File
73 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Package a built Linux binary into an AppImage (supports x86_64 and arm64).
|
|
#
|
|
# Usage:
|
|
# packaging/package-linux.sh <build-dir> <qt-dir> <output-dir> [arch]
|
|
#
|
|
# Example:
|
|
# packaging/package-linux.sh build-linux /opt/qt/6.12.0/gcc_64 dist x86_64
|
|
# packaging/package-linux.sh build-linux-arm64 /opt/qt/6.12.0/gcc_arm64 dist arm64
|
|
|
|
set -euo pipefail
|
|
|
|
BUILD_DIR="${1:?Usage: package-linux.sh <build-dir> <qt-dir> <output-dir> [arch]}"
|
|
QT_DIR="${2:?}"
|
|
OUTPUT_DIR="${3:?}"
|
|
ARCH="${4:-x86_64}"
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
BUILD_DIR="$(cd "$BUILD_DIR" && pwd)"
|
|
QT_DIR="$(cd "$QT_DIR" && pwd)"
|
|
mkdir -p "$OUTPUT_DIR"
|
|
OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd)"
|
|
|
|
if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then
|
|
APPIMAGE_ARCH="aarch64"
|
|
OUTPUT_NAME="Asteria-arm64.AppImage"
|
|
else
|
|
APPIMAGE_ARCH="x86_64"
|
|
OUTPUT_NAME="Asteria-x86_64.AppImage"
|
|
fi
|
|
|
|
APPDIR="$BUILD_DIR/AppDir"
|
|
rm -rf "$APPDIR"
|
|
|
|
# ── Install via CMake into AppDir (or stage binary/assets when using CI artifact) ─
|
|
if [ -f "$BUILD_DIR/cmake_install.cmake" ]; then
|
|
cmake --install "$BUILD_DIR" --prefix "$APPDIR/usr"
|
|
else
|
|
install -Dm755 "$BUILD_DIR/asteria-qt" "$APPDIR/usr/bin/asteria-qt"
|
|
install -Dm644 "$PROJECT_DIR/packaging/asteria-qt.desktop" \
|
|
"$APPDIR/usr/share/applications/asteria-qt.desktop"
|
|
for size in 16 32 48 64 128 256 512; do
|
|
install -Dm644 "$PROJECT_DIR/packaging/icons/${size}x${size}/asteria-qt.png" \
|
|
"$APPDIR/usr/share/icons/hicolor/${size}x${size}/apps/asteria-qt.png"
|
|
done
|
|
fi
|
|
|
|
# ── Bundle Qt plugins, QML modules, and ELF libraries ────────────────────────
|
|
python3 "$PROJECT_DIR/scripts/bundle-linux-appdir.py" \
|
|
--appdir "$APPDIR" \
|
|
--qt-dir "$QT_DIR" \
|
|
--arch "$ARCH"
|
|
|
|
# ── Generate AppImage with appimagetool ──────────────────────────────────────
|
|
APPIMAGETOOL_ARGS=()
|
|
if [ -f "/opt/appimage/runtime-${APPIMAGE_ARCH}" ]; then
|
|
APPIMAGETOOL_ARGS+=(--runtime-file "/opt/appimage/runtime-${APPIMAGE_ARCH}")
|
|
fi
|
|
if [ -n "${JOBS:-}" ]; then
|
|
APPIMAGETOOL_ARGS+=(--mksquashfs-opt -processors --mksquashfs-opt "$JOBS")
|
|
fi
|
|
|
|
ARCH="$APPIMAGE_ARCH" appimagetool "${APPIMAGETOOL_ARGS[@]}" \
|
|
"$APPDIR" "$OUTPUT_DIR/$OUTPUT_NAME"
|
|
|
|
chmod 0755 "$OUTPUT_DIR/$OUTPUT_NAME"
|
|
tar -czf "$OUTPUT_DIR/${OUTPUT_NAME}.tar.gz" -C "$OUTPUT_DIR" "$OUTPUT_NAME"
|
|
|
|
echo "==> AppImage ($ARCH) created: $OUTPUT_DIR/$OUTPUT_NAME ($(du -sh "$OUTPUT_DIR/$OUTPUT_NAME" | cut -f1))"
|
|
echo "==> Archive ($ARCH) created: $OUTPUT_DIR/${OUTPUT_NAME}.tar.gz ($(du -sh "$OUTPUT_DIR/${OUTPUT_NAME}.tar.gz" | cut -f1))"
|