# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=dust
pkgver=1.2.0
pkgrel=0
pkgdesc="A more intuitive version of du in Rust"
url="https://github.com/bootandy/dust"
arch="all"
license="Apache-2.0"
makedepends="cargo cargo-auditable"
options="net"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/bootandy/dust/archive/v$pkgver/dust-$pkgver.tar.gz"

export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
	# this test runs dust and expects the output to match 100%,
	# which fails a lot of the time on various systems as you can't guarantee that
	rm tests/test_exact_output.rs
}

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

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/
	install -D -m644 completions/dust.bash "$pkgdir"/usr/share/bash-completion/completions/dust
	install -D -m644 completions/dust.fish "$pkgdir"/usr/share/fish/vendor_completions.d/dust.fish
	install -D -m644 completions/_dust "$pkgdir"/usr/share/zsh/site-functions/_dust
	install -D -m644 man-page/dust.1 "$pkgdir"/usr/share/man/man1/dust.1
}

sha512sums="
5db1d3622b7149f663d228f25975fa0b2604d46ce302343c3405ab62f8d20bfbd512297959c197194498bbba33912a955d5e16274cd93dd1c3b5171822ed406f  dust-1.2.0.tar.gz
"
