# AUR package: carrel-bin (repacks the static musl release artifact).
# BUILD-TESTED 2026-08-20 against the real v2026.8.20 artifact: `makepkg -f`
# produces a package carrying all eight installed files and a binary that
# reports `carrel 2026.8.20`. (The docs long said recipes could not be
# build-tested here; that was the old Mint machine — this one is Arch.)
# Publishing still waits on AUR account registration reopening.
# Maintainer: Joshua Hughes <hughes238@gmail.com>
pkgname=carrel-bin
pkgver=2026.8.21
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=('318cede2295cafda4606b2b8b89d6d2a9788196803366812e40a597530128257')
sha256sums_aarch64=('1a6bb6c6339a26385326f64762090667ac911211112eae55162027a68d705fe5')

# 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"
}
