Something went wrong. Try again.
A fast, lightweight, read-only Markdown viewer.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970#!/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 <version> <binary> <out-dir>## For example: bash scripts/make-pkg.sh 1.0.0 build/bin/sheaf distset -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"doneinstall -Dm644 "$REPO_ROOT/LICENSE.md" \ "$PKGDIR/usr/share/licenses/sheaf-bin/LICENSE.md"
SIZE="$(du -sb "$PKGDIR" | cut -f1)"
cat > "$ROOT/.PKGINFO" <<EOFpkgname = sheaf-binpkgbase = sheaf-binpkgver = ${VERSION}-1pkgdesc = A fast, lightweight, read-only Markdown viewer (prebuilt binary release)url = https://tangled.org/katsuricata.com/Sheafbuilddate = $(date +%s)packager = sheaf release pipeline (spindle.tangled.sh)size = ${SIZE}arch = x86_64license = custom:MutuaL-1.3depend = gtk4depend = webkitgtk-6.0provides = sheaf=${VERSION}conflict = sheafconflict = sheaf-gitEOF
mkdir -p "$OUT_DIR"fakeroot tar -C "$ROOT" -cf - .PKGINFO -C "$PKGDIR" . | zstd -q -19 -T0 -o "$OUT" -echo "built $OUT"