From f7e35652a9319b131e86e7bee99049d86379535e Mon Sep 17 00:00:00 2001 From: Seth Freiberg Date: Wed, 29 Apr 2026 11:39:02 -0400 Subject: [PATCH] fix: prune unused binary from each AppDir before linuxdeploy bundling Previously cmake --install populated both AppDirs with both binaries, causing the batch AppImage (57MB) to be larger than the GUI AppImage (47MB). Add rm lines after the sanity-check block to strip the unwanted binary from each AppDir before linuxdeploy runs. Also prune the upstream GUI desktop files from the batch AppDir (they reference Exec=glabels-qt which is now absent) and supply --icon-file + --icon-filename so --create-desktop-file resolves the icon lookup. Both AppImages now contain only their respective binary (~33-34MB each). Also document the QMAKE=/usr/bin/qmake6 workaround (Debian 13 Qt6 qmake discovery failure in linuxdeploy-plugin-qt). Co-Authored-By: Claude Sonnet 4.6 --- scripts/build-appimages.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/build-appimages.sh b/scripts/build-appimages.sh index 5d6830a..d7c2c8e 100755 --- a/scripts/build-appimages.sh +++ b/scripts/build-appimages.sh @@ -34,8 +34,9 @@ PATH="$PLUGIN_DIR:$PATH" PLUGIN_LINK="$PLUGIN_DIR/linuxdeploy-plugin-qt" ln -sf "$LINUXDEPLOY_PLUGIN_QT_BIN" "$PLUGIN_LINK" chmod +x "$PLUGIN_LINK" -# On Debian 13 / Qt6, the qmake symlink may resolve via qtchooser to qt5. -# Force the plugin to use the Qt6 qmake directly. +# Debian 13 has Qt6 only; linuxdeploy-plugin-qt's default qmake lookup looks +# for `qmake` (Qt5 era) or `/usr/lib/qt5/bin/qmake` (neither exists). Force it +# to the Qt6 binary explicitly so plugin staging works. export QMAKE=/usr/bin/qmake6 echo "==> [2/6] Out-of-tree cmake build (install prefix /usr)" @@ -58,6 +59,16 @@ DESTDIR="$APPDIR_BATCH" cmake --install "$BUILD_DIR" test -x "$APPDIR_GUI/usr/bin/glabels-qt" || { echo "ERROR: GUI binary missing in AppDir-gui" >&2; exit 1; } test -x "$APPDIR_BATCH/usr/bin/glabels-batch-qt" || { echo "ERROR: batch binary missing in AppDir-batch" >&2; exit 1; } +# Prune the unwanted binary from each AppDir so linuxdeploy bundles only the +# libs needed by the remaining binary (otherwise both AppImages carry both +# binaries; spec ยง5.3 step 3 implies "AppDir-batch" should be batch-only). +rm "$APPDIR_GUI/usr/bin/glabels-batch-qt" +rm "$APPDIR_BATCH/usr/bin/glabels-qt" +# Also prune the GUI desktop files from the batch AppDir: linuxdeploy's +# --create-desktop-file doesn't suppress pre-existing desktop files, and +# the upstream desktop files reference Exec=glabels-qt (now pruned). +find "$APPDIR_BATCH/usr/share/applications" -name '*.desktop' -delete + echo "==> [4/6] Bundle GUI AppImage" DESKTOP_FILE="$APPDIR_GUI/usr/share/applications/glabels-qt.desktop" ICON_FILE="$APPDIR_GUI/usr/share/icons/hicolor/scalable/apps/glabels.svg" @@ -92,13 +103,17 @@ chmod +x "$GUI_OUT" cd "$REPO_ROOT" echo "==> [5/6] Bundle batch AppImage" -# Batch doesn't need a desktop file or icon (CLI only). +# Batch is CLI-only; reuse the upstream SVG icon so --create-desktop-file has +# an icon to reference (linuxdeploy errors if the Icon= entry has no match). +BATCH_ICON_FILE="$APPDIR_BATCH/usr/share/icons/hicolor/scalable/apps/glabels.svg" cd "$BUILD_DIR" APPIMAGE_EXTRACT_AND_RUN=1 \ "$LINUXDEPLOY_BIN" \ --appdir "$APPDIR_BATCH" \ --plugin qt \ --executable "$APPDIR_BATCH/usr/bin/glabels-batch-qt" \ + --icon-file "$BATCH_ICON_FILE" \ + --icon-filename glabels-batch-qt \ --create-desktop-file \ --output appimage