# Contributor: guddaff <guddaff@protonmail.com>
# Maintainer: guddaff <guddaff@protonmail.com>
pkgname=bottom
pkgver=0.10.2
pkgrel=0
pkgdesc="Graphical process/system monitor with a customizable interface"
url="https://github.com/ClementTsang/bottom"
# s390x: fails to build nix crate
arch="all !s390x"
license="MIT"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-fish-completion
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-doc
	"
source="https://github.com/ClementTsang/bottom/archive/$pkgver/bottom-$pkgver.tar.gz"

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

build() {
	BTM_GENERATE=true cargo auditable build --frozen --release
}

check() {
	CARGO_HUSKY_DONT_INSTALL_HOOKS=true cargo test --frozen
}

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

	install -Dm644 sample_configs/default_config.toml -t "$pkgdir"/usr/share/doc/$pkgname/

	cd target/tmp/bottom/completion
	install -Dm644 _btm "$pkgdir"/usr/share/zsh/site-functions/_btm
	install -Dm644 btm.bash "$pkgdir"/usr/share/bash-completion/completions/btm
	install -Dm644 btm.fish "$pkgdir"/usr/share/fish/vendor_completions.d//btm.fish
}

sha512sums="
79359181d04434bd85496392dd15eb737bc33441a0d8984b15c3caf26e60efb08d93769e499b56732f7c76a0bdb2e0ea946eee7e799de32e80e8ce0ddf4d8945  bottom-0.10.2.tar.gz
"
