# AUR package: carrel-bin (repacks the static musl release artifact).
# BUILD-TESTED 2026-08-31 against the real v2026.8.31 artifact: `makepkg -f`
# passes the integrity check and produces a package carrying all eight
# installed files and a binary that reports `carrel 2026.8.31`. (The docs
# long said recipes could not be build-tested here; that was the old Mint
# machine — this one is Arch.) Re-run this on the stamp commit each release:
# it is what catches a bad sha256 before the AUR would.
# Publishing still waits on AUR account registration reopening.
# Maintainer: Joshua Hughes <hughes238@gmail.com>
pkgname=carrel-bin
pkgver=2026.9.1
pkgrel=1
pkgdesc="A quiet place to read your markdown — a terminal markdown reader (prebuilt)"
arch=('x86_64' 'aarch64')
url="https://github.com/VaHughes/carrel"
license=('MIT OR Apache-2.0')
provides=('carrel')
conflicts=('carrel')
source_x86_64=("$url/releases/download/v$pkgver/carrel-x86_64-unknown-linux-musl.tar.xz")
source_aarch64=("$url/releases/download/v$pkgver/carrel-aarch64-unknown-linux-musl.tar.xz")
sha256sums_x86_64=('fdd7cbd7e3368d28b0f38fc73e6ca1dde908c4250349216b27f06b42bd6dd9e7')
sha256sums_aarch64=('6ae011f2619d1d52497f507cd332065516521ca015c465d1d66f8ce8d6317b36')

# dist FLATTENS every `include` entry to the archive root: `contrib/carrel.1`
# arrives as `carrel.1`. The flat paths below were verified against the real
# v2026.8.17 artifact — the earlier `$dir/contrib/...` paths did not exist
# and would have failed the build.
package() {
  local dir="carrel-${CARCH}-unknown-linux-musl"
  install -Dm755 "$dir/carrel" "$pkgdir/usr/bin/carrel"
  install -Dm644 "$dir/carrel.desktop" "$pkgdir/usr/share/applications/carrel.desktop"
  install -Dm644 "$dir/carrel.1" "$pkgdir/usr/share/man/man1/carrel.1"
  install -Dm644 "$dir/carrel.bash" "$pkgdir/usr/share/bash-completion/completions/carrel"
  install -Dm644 "$dir/carrel.zsh" "$pkgdir/usr/share/zsh/site-functions/_carrel"
  install -Dm644 "$dir/carrel.fish" "$pkgdir/usr/share/fish/vendor_completions.d/carrel.fish"
  install -Dm644 "$dir/LICENSE-MIT" "$pkgdir/usr/share/licenses/$pkgname/LICENSE-MIT"
  install -Dm644 "$dir/LICENSE-APACHE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE-APACHE"
}
