#!/bin/bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" cd "$PROJECT_DIR" echo "==> Building release binary..." cargo build --release -p outlay-gtk echo "==> Creating AppDir structure..." rm -rf AppDir mkdir -p AppDir/usr/bin mkdir -p AppDir/usr/share/applications mkdir -p AppDir/usr/share/icons/hicolor/scalable/apps mkdir -p AppDir/usr/share/glib-2.0/schemas mkdir -p AppDir/usr/share/fonts/truetype/liberation # Copy binary cp target/release/outlay-gtk AppDir/usr/bin/ # Copy desktop file cp outlay-gtk/data/io.github.outlay.desktop AppDir/ cp outlay-gtk/data/io.github.outlay.desktop AppDir/usr/share/applications/ # Copy icon cp outlay-gtk/data/icons/hicolor/scalable/apps/io.github.outlay.svg AppDir/usr/share/icons/hicolor/scalable/apps/ # Copy GSettings schema cp outlay-gtk/data/io.github.outlay.gschema.xml AppDir/usr/share/glib-2.0/schemas/ glib-compile-schemas AppDir/usr/share/glib-2.0/schemas/ # Bundle Liberation Sans fonts (needed for PDF report generation) FONT_DIR="/usr/share/fonts/truetype/liberation" if [ -d "$FONT_DIR" ]; then cp "$FONT_DIR"/LiberationSans-*.ttf AppDir/usr/share/fonts/truetype/liberation/ echo "==> Bundled Liberation Sans fonts" fi # Download linuxdeploy if not present LINUXDEPLOY="linuxdeploy-x86_64.AppImage" if [ ! -f "$LINUXDEPLOY" ]; then echo "==> Downloading linuxdeploy..." wget -q "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LINUXDEPLOY" chmod +x "$LINUXDEPLOY" fi # Download GTK plugin if not present GTK_PLUGIN="linuxdeploy-plugin-gtk.sh" if [ ! -f "$GTK_PLUGIN" ]; then echo "==> Downloading linuxdeploy GTK plugin..." wget -q "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/$GTK_PLUGIN" chmod +x "$GTK_PLUGIN" fi echo "==> Building AppImage..." export DEPLOY_GTK_VERSION=4 ./"$LINUXDEPLOY" \ --appdir AppDir \ --plugin gtk \ --output appimage \ --desktop-file AppDir/io.github.outlay.desktop \ --icon-file AppDir/usr/share/icons/hicolor/scalable/apps/io.github.outlay.svg echo "==> Done! AppImage created." ls -lh Outlay-*.AppImage 2>/dev/null || echo "Note: Output filename may vary."