# Maintainer: Michał Polański <michal@polanski.me>
pkgname=committed
pkgver=1.1.1
pkgrel=1
pkgdesc="Nitpicking your commit history"
url="https://github.com/crate-ci/committed"
license="MIT OR Apache-2.0"
# loongarch64: blocked by linux-raw-sys
arch="all !loongarch64"
makedepends="cargo libgit2-dev cargo-auditable"
source="https://github.com/crate-ci/committed/archive/v$pkgver/committed-$pkgver.tar.gz"
options="net" # fetch dependencies

prepare() {
	default_prepare

	# Rust target triple
	local target=$(rustc -vV | sed -n 's/host: //p')

	# Build against system-provided libs
	mkdir -p .cargo
	cat >> .cargo/config.toml <<-EOF
		[target.$target]
		git2 = { rustc-link-lib = ["git2"] }
	EOF

	# open64
	cargo update -p getrandom --precise 0.2.10

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

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

check() {
	cargo test --frozen
}

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

sha512sums="
fb5ed6bb7d218454cc547359e8e238996f67505989859d6c6382bdf383bd7f7c4fc7bc8d6a63e5547dfb121792cd1581abc0974e008098228ff9e66ca3dae962  committed-1.1.1.tar.gz
"
