# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=b3sum
pkgver=1.5.5
pkgrel=0
pkgdesc="Command line implementation of the BLAKE3 hash function"
url="https://github.com/BLAKE3-team/BLAKE3"
arch="all"
license="CC0-1.0 OR Apache-2.0"
makedepends="cargo cargo-auditable"
source="$pkgname-$pkgver.tar.gz::https://crates.io/api/v1/crates/b3sum/$pkgver/download"

case "$CARCH" in
armhf)
	# hang forever, probably due to non-native hardware
	options="$options !check"
	;;
aarch64|armv7)
	_features="neon"
	;;
esac


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen \
		${_features:+--features $_features}
}

check() {
	cargo test --frozen ${_features:+--features $_features}
}

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

sha512sums="
fd62f3938ec679a8dec6cdb44f2cd0e1251dc73c4e473c86fb61fd735b8f0c035d290c6769c72e1af75de8c298d8f23e6bbba691e889cbfcbfd5d2d04eb2087f  b3sum-1.5.5.tar.gz
"
