# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=cbindgen
# Please be VERY careful bumping this - Firefox regularly fails to build
# with new versions!
pkgver=0.26.0
pkgrel=1
pkgdesc="Tool to generate C bindings from Rust code"
url="https://github.com/eqrion/cbindgen"
arch="all"
license="MPL-2.0"
makedepends="cargo cargo-auditable"
checkdepends="cython"
source="$pkgname-$pkgver.tar.gz::https://crates.io/api/v1/crates/cbindgen/$pkgver/download
	cargo-update.patch"
options="net"

prepare() {
	default_prepare

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

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

check() {
	# Failing tests
	rm -rf tests/rust/expand*
	cargo test --frozen
}

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

sha512sums="
2de81f46c9c68c985241a349f13125876667d1460d3658ead8c4ee9788cd139c30dbc08bebddc172cf0bd4644f3f17c02cf66f2a3ef706c52366fdaf0f9d8059  cbindgen-0.26.0.tar.gz
4da57855cfb9e785bfd2fde099270e53d7b0182df9eddbc2f8da6efdfb590cefe0bba88f47936c8ce88b88abceecf96dfd38368d99faf719cce786b23662418f  cargo-update.patch
"
