Files
SaraSort/Packaging/BuildAppImage.sh
T
2026-10-13 09:47:15 +02:00

48 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# Builds dist/SaraSort-x86_64.AppImage: a PyInstaller one-file build (with
# the font and icon bundled) wrapped by appimagetool, the same way SaraSuite's
# and SaraFem's AppImages are made. Needs podman and
# appimagetool on PATH.
set -euo pipefail
cd "$(dirname "$(readlink -f "$0")")/.."
# PyInstaller runs in a manylinux_2_28 container (glibc 2.28) with uv's
# portable Python, not with Fedora's: PyInstaller bundles libpython, and
# Fedora's needs a newer glibc than many distros have ("GLIBC_ABI_GNU2_TLS
# not found"). The Python, venv and downloads are cached in build/Container.
# --collect-data flet: without it ft.Icons crashes when frozen.
mkdir -p build/Container
podman run --rm --security-opt label=disable -v "$PWD:/src" -w /src \
-e UV_CACHE_DIR=/src/build/Container/cache -e UV_PYTHON_INSTALL_DIR=/src/build/Container/python \
quay.io/pypa/manylinux_2_28_x86_64 bash -euo pipefail -c '
uv venv --quiet --allow-existing --managed-python --python 3.14 build/Container/venv
uv pip install --quiet --python build/Container/venv -r requirements.txt pyinstaller
build/Container/venv/bin/pyinstaller --noconfirm --clean --log-level WARN \
--onefile --windowed --name SaraSort --collect-data flet \
--runtime-hook "$PWD/Packaging/RestoreLibraryPath.py" \
--add-data "$PWD/assets:assets" \
--distpath build/PyInstaller/dist --workpath build/PyInstaller/work --specpath build/PyInstaller \
"$PWD/Main.py"'
AppDir=build/AppDir
rm -rf "$AppDir"
mkdir -p "$AppDir/usr/bin"
cp build/PyInstaller/dist/SaraSort "$AppDir/usr/bin/SaraSort"
ln -s usr/bin/SaraSort "$AppDir/AppRun"
cp assets/Icon.png "$AppDir/SaraSort.png"
ln -s SaraSort.png "$AppDir/.DirIcon"
cat > "$AppDir/SaraSort.desktop" << DESKTOP
[Desktop Entry]
Type=Application
Name=SaraSort
Comment=Configure SaraSortd, the file sorting daemon
Exec=SaraSort
Icon=SaraSort
Terminal=false
Categories=Utility;
DESKTOP
mkdir -p dist
ARCH=x86_64 appimagetool --no-appstream "$AppDir" dist/SaraSort-x86_64.AppImage
echo "Built dist/SaraSort-x86_64.AppImage"