# Contributor: Matthias Ahouansou <matthias@ahouansou.cz>
maintainer="Matthias Ahouansou <matthias@ahouansou.cz>"
pkgname=rmpc
pkgver=0.9.0
pkgrel=0
pkgdesc="Configurable, terminal based Media Player Client with album art support via various terminal image protocols"
url="https://mierak.github.io/rmpc/"
arch="all"
license="BSD-3-Clause"
makedepends="cargo-auditable"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/mierak/rmpc/archive/refs/tags/v$pkgver.tar.gz
	0001-fix-use-32-bit-usize-constants-in-tests.patch
"
options="net" # cargo packages

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

check() {
	cargo test --frozen
}

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

package() {
	install -Dm755 target/release/rmpc -t "$pkgdir"/usr/bin

	install -Dm644 target/completions/rmpc.bash "$pkgdir"/usr/share/bash-completion/completions/rmpc
	install -Dm644 target/completions/rmpc.fish "$pkgdir"/usr/share/fish/vendor_completions.d/rmpc.fish
	install -Dm644 target/completions/_rmpc "$pkgdir"/usr/share/zsh/site-functions/_rmpc

	install -Dm644 target/man/rmpc.1 -t "$pkgdir"/usr/share/man/man1
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
f644fb7c7cc0cbd1c5a81ad743b6282e722df75a1bbeca800e6337d42c742fd488add2c9f818b88fb36635dc7127523e2e325797f46795d72773a8b385923d49  rmpc-0.9.0.tar.gz
8825ecc9d672bbe7c9fb702255a10848daaaed0fc756c094313ddf6114c5818b029166ee166ee352eae512362d9c89ffd19d3a2a147c61e18880559279b427a0  0001-fix-use-32-bit-usize-constants-in-tests.patch
"
