moar ci changes

This commit is contained in:
Agel committed 2026-11-13 10:56:08 +01:00
1 parent 5940d86ed2
commit 1ef94b910a
19 files changed
+1313 -663

No files matched your search

+41 -21
View File
@@ -1,35 +1,55 @@
#!/bin/bash
# Package Linux build as AppImage
# Usage: package-linux.sh <build-dir> <qt-dir> <output-dir>
#!/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>}"
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)"
APPDIR="${BUILD_DIR}/AppDir"
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"
# linuxdeploy handles AppDir structure, library bundling, and AppRun
export QMAKE="$QT_DIR/bin/qmake"
export QML_SOURCES_PATHS="$PROJECT_DIR/src/qml"
export LD_LIBRARY_PATH="$QT_DIR/lib:${LD_LIBRARY_PATH:-}"
export OUTPUT="Asteria-x86_64.AppImage"
# ── Install via CMake into AppDir ────────────────────────────────────────────
cmake --install "$BUILD_DIR" --prefix "$APPDIR/usr"
linuxdeploy \
# ── Bundle Qt plugins, QML modules, and ELF libraries ────────────────────────
python3 "$PROJECT_DIR/scripts/bundle-linux-appdir.py" \
--appdir "$APPDIR" \
--executable "$BUILD_DIR/asteria-qt" \
--desktop-file "$PROJECT_DIR/packaging/asteria-qt.desktop" \
--icon-file "$PROJECT_DIR/packaging/icons/256x256/asteria-qt.png" \
--plugin qt \
--output appimage
--qt-dir "$QT_DIR" \
--arch "$ARCH"
mkdir -p "$OUTPUT_DIR"
SRC="$(pwd)/$OUTPUT"
DEST="$(cd "$OUTPUT_DIR" && pwd)/$OUTPUT"
if [ "$SRC" != "$DEST" ]; then
mv "$SRC" "$DEST"
# ── Generate AppImage with appimagetool ──────────────────────────────────────
RUNTIME_ARGS=()
if [ -f "/opt/appimage/runtime-${APPIMAGE_ARCH}" ]; then
RUNTIME_ARGS=(--runtime-file "/opt/appimage/runtime-${APPIMAGE_ARCH}")
fi
ARCH="$APPIMAGE_ARCH" appimagetool "${RUNTIME_ARGS[@]}" \
"$APPDIR" "$OUTPUT_DIR/$OUTPUT_NAME"
echo "==> AppImage ($ARCH) created: $OUTPUT_DIR/$OUTPUT_NAME ($(du -sh "$OUTPUT_DIR/$OUTPUT_NAME" | cut -f1))"
+78 -95
View File
@@ -1,119 +1,102 @@
#!/bin/bash
# Package Windows build as a portable directory with all DLLs
# Usage: package-windows.sh <build-dir> <qt-dir> <mingw-sysroot> <output-dir> [arch]
#!/usr/bin/env bash
# Package a cross-compiled Windows build into a portable folder / zip.
# Runs on Linux inside the CI Docker image (no windeployqt available).
#
# Usage:
# packaging/package-windows.sh <build-dir> <qt-windows-dir> <mingw-sysroot> <output-dir> [arch]
#
# Example:
# packaging/package-windows.sh build-windows /opt/qt/6.12.0/mingw_64 /opt/mingw-sysroot dist x86_64
# packaging/package-windows.sh build-windows-arm64 /opt/qt/6.12.0/mingw_arm64 /opt/mingw-arm64-sysroot dist arm64
set -euo pipefail
BUILD_DIR="${1:?Usage: package-windows.sh <build-dir> <qt-dir> <mingw-sysroot> <output-dir> [arch]}"
BUILD_DIR="${1:?Usage: package-windows.sh <build-dir> <qt-windows-dir> <mingw-sysroot> <output-dir> [arch]}"
QT_DIR="${2:?}"
MINGW_SYSROOT="${3:?}"
OUTPUT_DIR="${4:?}"
ARCH="${5:-x86_64}"
PROJECT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
DIST_DIR="${BUILD_DIR}/dist"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
BUILD_DIR="$(cd "$BUILD_DIR" && pwd)"
QT_DIR="$(cd "$QT_DIR" && pwd)"
if [ -d "$MINGW_SYSROOT" ]; then
MINGW_SYSROOT="$(cd "$MINGW_SYSROOT" && pwd)"
fi
mkdir -p "$OUTPUT_DIR"
OUTPUT_DIR="$(cd "$OUTPUT_DIR" && pwd)"
if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then
STAGE_NAME="asteria-qt-windows-arm64"
MINGW_TRIPLE="aarch64-w64-mingw32"
else
STAGE_NAME="asteria-qt-windows"
MINGW_TRIPLE="x86_64-w64-mingw32"
fi
DIST_DIR="$BUILD_DIR/dist"
rm -rf "$DIST_DIR"
mkdir -p "$DIST_DIR"
# Copy the main executable
# ── Main executable ──────────────────────────────────────────────────────────
cp "$BUILD_DIR/asteria-qt.exe" "$DIST_DIR/"
# Use windeployqt to gather Qt dependencies
# windeployqt6 from the cross-compiled Qt may not work on Linux host,
# so we manually copy the required DLLs
# Qt DLLs — copy all Qt6*.dll and related runtime DLLs from Qt bin directory
cp "$QT_DIR/bin/"*.dll "$DIST_DIR/" 2>/dev/null || true
# Qt plugins (support standard Qt layout and MSYS2 share/qt6 layout)
PLUGIN_DIR="$QT_DIR/plugins"
if [ ! -d "$PLUGIN_DIR" ] && [ -d "$QT_DIR/share/qt6/plugins" ]; then
PLUGIN_DIR="$QT_DIR/share/qt6/plugins"
# ── Qt plugins ───────────────────────────────────────────────────────────────
if [ -d "$QT_DIR/share/qt6/plugins" ]; then
QT_PLUGINS_SRC="$QT_DIR/share/qt6/plugins"
else
QT_PLUGINS_SRC="$QT_DIR/plugins"
fi
mkdir -p "$DIST_DIR/platforms"
cp "$PLUGIN_DIR/platforms/qwindows.dll" "$DIST_DIR/platforms/" 2>/dev/null || true
mkdir -p "$DIST_DIR/imageformats"
cp "$PLUGIN_DIR/imageformats/"*.dll "$DIST_DIR/imageformats/" 2>/dev/null || true
mkdir -p "$DIST_DIR/iconengines"
cp "$PLUGIN_DIR/iconengines/"*.dll "$DIST_DIR/iconengines/" 2>/dev/null || true
mkdir -p "$DIST_DIR/tls"
cp "$PLUGIN_DIR/tls/"*.dll "$DIST_DIR/tls/" 2>/dev/null || true
if [ -d "$PLUGIN_DIR/styles" ]; then
mkdir -p "$DIST_DIR/styles"
cp "$PLUGIN_DIR/styles/"*.dll "$DIST_DIR/styles/" 2>/dev/null || true
fi
# QML modules (support standard Qt layout and MSYS2 share/qt6 layout)
QML_DIR="$QT_DIR/qml"
if [ ! -d "$QML_DIR" ] && [ -d "$QT_DIR/share/qt6/qml" ]; then
QML_DIR="$QT_DIR/share/qt6/qml"
fi
mkdir -p "$DIST_DIR/qml"
for mod in QtCore Qt QtQuick QtQml Qt5Compat; do
if [ -d "$QML_DIR/$mod" ]; then
cp -r "$QML_DIR/$mod" "$DIST_DIR/qml/"
for plugin_dir in platforms imageformats iconengines tls styles; do
if [ -d "$QT_PLUGINS_SRC/$plugin_dir" ]; then
mkdir -p "$DIST_DIR/$plugin_dir"
if [ "$plugin_dir" = "platforms" ]; then
cp "$QT_PLUGINS_SRC/platforms/qwindows.dll" "$DIST_DIR/platforms/"
else
cp "$QT_PLUGINS_SRC/$plugin_dir/"*.dll "$DIST_DIR/$plugin_dir/" 2>/dev/null || true
fi
fi
done
# Architecture-specific runtime DLLs
if [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then
PKG_NAME="asteria-qt-windows-arm64"
# LLVM-MinGW runtime DLLs for ARM64
ARM64_DLLS=(
libc++.dll
libunwind.dll
libwinpthread-1.dll
)
for dll in "${ARM64_DLLS[@]}"; do
if [ ! -f "$DIST_DIR/$dll" ]; then
find /opt/llvm-mingw/aarch64-w64-mingw32/ -name "$dll" -exec cp {} "$DIST_DIR/" \; 2>/dev/null || true
fi
if [ ! -f "$DIST_DIR/$dll" ] && [ -f "$MINGW_SYSROOT/bin/$dll" ]; then
cp "$MINGW_SYSROOT/bin/$dll" "$DIST_DIR/"
fi
done
# ── QML modules ──────────────────────────────────────────────────────────────
if [ -d "$QT_DIR/share/qt6/qml" ]; then
QT_QML_SRC="$QT_DIR/share/qt6/qml"
else
PKG_NAME="asteria-qt-windows"
# MinGW-w64 runtime DLLs for x86_64
MINGW_DLLS=(
libgcc_s_seh-1.dll
libstdc++-6.dll
libwinpthread-1.dll
)
for dll in "${MINGW_DLLS[@]}"; do
find /usr/lib/gcc/x86_64-w64-mingw32/ -name "$dll" -exec cp {} "$DIST_DIR/" \; 2>/dev/null || true
if [ ! -f "$DIST_DIR/$dll" ] && [ -f "/usr/x86_64-w64-mingw32/lib/$dll" ]; then
cp "/usr/x86_64-w64-mingw32/lib/$dll" "$DIST_DIR/"
fi
done
QT_QML_SRC="$QT_DIR/qml"
fi
# Third-party DLLs from sysroot (if dynamically built)
if [ -f "$MINGW_SYSROOT/lib/libuchardet.dll" ]; then
cp "$MINGW_SYSROOT/lib/libuchardet.dll" "$DIST_DIR/"
elif [ -f "$MINGW_SYSROOT/bin/libuchardet.dll" ]; then
cp "$MINGW_SYSROOT/bin/libuchardet.dll" "$DIST_DIR/"
fi
mkdir -p "$DIST_DIR/qml"
for mod in QtCore Qt QtQuick QtQml; do
if [ -d "$QT_QML_SRC/$mod" ]; then
cp -r "$QT_QML_SRC/$mod" "$DIST_DIR/qml/"
fi
done
# Create qt.conf for portable deployment
cat > "$DIST_DIR/qt.conf" << 'EOF'
[Paths]
Plugins = .
Qml2Imports = qml
EOF
# Prune unused heavy QML subdirectories so unneeded DLLs are not pulled in
for unused_qml in tooling LocalStorage Particles Pdf Scene2D Scene3D Timeline VirtualKeyboard; do
rm -rf "$DIST_DIR/qml/QtQuick/$unused_qml"
done
# Verify all PE binary dependencies in DIST_DIR
echo "==> Verifying bundled DLL dependencies in $DIST_DIR..."
python3 "$PROJECT_DIR/scripts/verify-windows-dlls.py" "$DIST_DIR"
# ── Bundle transitive runtime DLLs & verify all PE imports ───────────────────
echo "==> Bundling and verifying DLL dependencies in $DIST_DIR..."
python3 "$PROJECT_DIR/scripts/verify-windows-dlls.py" "$DIST_DIR" \
--bundle-from \
"$QT_DIR/bin" \
"$MINGW_SYSROOT/bin" \
"/opt/llvm-mingw/$MINGW_TRIPLE/bin" \
"/usr/lib/gcc/$MINGW_TRIPLE"/* \
"/usr/$MINGW_TRIPLE/lib" \
"/usr/$MINGW_TRIPLE/bin"
# Output flat directory — GitLab zips the artifact directory on download
mkdir -p "$OUTPUT_DIR/$PKG_NAME"
cp -r "$DIST_DIR/"* "$OUTPUT_DIR/$PKG_NAME/"
# ── Clean up non-runtime files from QML dirs ─────────────────────────────────
find "$DIST_DIR/qml" -name '*.qmltypes' -o -name '*.metainfo' -o -name '*.prl' | xargs rm -f 2>/dev/null || true
# ── Copy to output directory ─────────────────────────────────────────────────
STAGE_DIR="$OUTPUT_DIR/$STAGE_NAME"
rm -rf "$STAGE_DIR"
cp -r "$DIST_DIR" "$STAGE_DIR"
echo "==> Windows ($ARCH) package created: $STAGE_DIR ($(du -sh "$STAGE_DIR" | cut -f1))"