#!/usr/bin/env bash # scripts/make-pkg.sh: assemble a pacman .pkg.tar.zst for sheaf-bin from a # prebuilt binary, without makepkg. .tangled/workflows/release.yml uses it. # You can run it locally if you have a built binary and `zstd` + `fakeroot`. # # bash scripts/make-pkg.sh # # For example: bash scripts/make-pkg.sh 1.0.0 build/bin/sheaf dist set -euo pipefail VERSION="${1:?version (e.g. 1.0.0)}" BINARY="${2:?path to built sheaf binary}" OUT_DIR="${3:?output directory for .pkg.tar.zst}" REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" PKG_NAME="sheaf-bin-${VERSION}-1-x86_64.pkg.tar.zst" OUT="${OUT_DIR}/${PKG_NAME}" ROOT="$(mktemp -d)"; PKGDIR="$ROOT/pkg"; mkdir -p "$PKGDIR" # The hicolor PNG size set is generated from packaging/linux/sheaf.svg. Render # it now if a from-source consumer did not run scripts/render-icons.sh yet, # or re-render if the source SVG has changed. if [ ! -f "$REPO_ROOT/build/icons/1024x1024/com.doubledecimal.sheaf.png" ] || \ [ "$REPO_ROOT/packaging/linux/sheaf.svg" -nt "$REPO_ROOT/build/icons/1024x1024/com.doubledecimal.sheaf.png" ]; then bash "$REPO_ROOT/scripts/render-icons.sh" fi install -Dm755 "$BINARY" "$PKGDIR/usr/bin/sheaf" install -Dm644 "$REPO_ROOT/packaging/linux/com.doubledecimal.sheaf.desktop" \ "$PKGDIR/usr/share/applications/com.doubledecimal.sheaf.desktop" install -Dm644 "$REPO_ROOT/packaging/linux/com.doubledecimal.sheaf.metainfo.xml" \ "$PKGDIR/usr/share/metainfo/com.doubledecimal.sheaf.metainfo.xml" # icon: canonical SVG + per-size PNGs (rendered by scripts/render-icons.sh), # named for the reverse-DNS app-id. The scalable entry is what lets Qt/KWin # resolve the Wayland titlebar/taskbar icon at any size. The PNGs are the # fallback. install -Dm644 "$REPO_ROOT/packaging/linux/sheaf.svg" \ "$PKGDIR/usr/share/icons/hicolor/scalable/apps/com.doubledecimal.sheaf.svg" for s in 16 32 48 64 128 256 512 1024; do install -Dm644 "$REPO_ROOT/build/icons/${s}x${s}/com.doubledecimal.sheaf.png" \ "$PKGDIR/usr/share/icons/hicolor/${s}x${s}/apps/com.doubledecimal.sheaf.png" done install -Dm644 "$REPO_ROOT/LICENSE.md" \ "$PKGDIR/usr/share/licenses/sheaf-bin/LICENSE.md" SIZE="$(du -sb "$PKGDIR" | cut -f1)" cat > "$ROOT/.PKGINFO" <