# Contributor: justin13888 <20733699+justin13888@users.noreply.github.com>
# Maintainer: justin13888 <20733699+justin13888@users.noreply.github.com>
pkgname=purr
pkgver=1.0.0
pkgrel=0
pkgdesc="Fast, neofetch-compatible system information tool"
url="https://github.com/justin13888/purrfetch"
# Edition 2024 needs a recent rustc; target the edge/community toolchain.
arch="all"
license="MIT"
makedepends="cargo"
subpackages="$pkgname-doc $pkgname-bash-completion $pkgname-zsh-completion $pkgname-fish-completion"
source="$pkgname-$pkgver.tar.gz::https://github.com/justin13888/purrfetch/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/purrfetch-$pkgver"

prepare() {
	default_prepare
	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test --frozen --release
}

package() {
	install -Dm755 target/release/purr "$pkgdir"/usr/bin/purr
	install -Dm644 man/purr.1 "$pkgdir"/usr/share/man/man1/purr.1
	install -Dm644 completions/purr.bash \
		"$pkgdir"/usr/share/bash-completion/completions/purr
	install -Dm644 completions/_purr \
		"$pkgdir"/usr/share/zsh/site-functions/_purr
	install -Dm644 completions/purr.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/purr.fish
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# Run `abuild checksum` to fill this once the v$pkgver release tarball exists.
sha512sums=""
