#!/usr/bin/env bash # Builds Mulberry for Linux from source: the app folder, a tarball and an AppImage. # Same steps as the "linux" job in .github/workflows/build.yml. # # Needs: python3 (3.11+), curl, internet for the first run. # Run: bash packaging/linux/build-linux.sh # Output: dist/Mulberry-Linux-x86_64.tar.gz and dist/Mulberry-x86_64.AppImage # # The result runs on distros at least as new as the one it was built on (glibc), so build on an # older distro (CI uses Ubuntu 22.04) for downloads you share. set -euo pipefail cd "$(dirname "$0")/../.." # ---- Python environment (.venv in the repo) [ -x .venv/bin/python ] || python3 -m venv .venv .venv/bin/pip install --upgrade pip .venv/bin/pip install -r requirements.txt pyinstaller # ---- App .venv/bin/python packaging/make_icons.py .venv/bin/pyinstaller packaging/mulberry.spec --noconfirm --distpath build/dist --workpath build/work # ---- Tarball mkdir -p dist cp mulberry.desktop mulberry/assets/mulberry.svg build/dist/Mulberry/ tar -C build/dist -czf dist/Mulberry-Linux-x86_64.tar.gz Mulberry echo "== dist/Mulberry-Linux-x86_64.tar.gz" # ---- AppImage APPDIR=build/AppDir rm -rf "$APPDIR" mkdir -p $APPDIR/usr/lib $APPDIR/usr/share/icons/hicolor/256x256/apps $APPDIR/usr/share/applications cp -r build/dist/Mulberry $APPDIR/usr/lib/mulberry cp packaging/linux/AppRun $APPDIR/AppRun && chmod +x $APPDIR/AppRun grep -v '^Actions=\|^\[Desktop Action\|^Name=Play\|^Name=Next\|^Name=Previous\|^Exec=dbus' mulberry.desktop > $APPDIR/mulberry.desktop cp $APPDIR/mulberry.desktop $APPDIR/usr/share/applications/ cp packaging/build-icons/mulberry-256.png $APPDIR/mulberry.png cp packaging/build-icons/mulberry-256.png $APPDIR/usr/share/icons/hicolor/256x256/apps/mulberry.png if [ ! -x build/appimagetool ]; then curl -sSfL -o build/appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage chmod +x build/appimagetool fi ARCH=x86_64 build/appimagetool --appimage-extract-and-run $APPDIR dist/Mulberry-x86_64.AppImage echo "== dist/Mulberry-x86_64.AppImage"