# Description: Generate C bindings from rust code
# URL: https://github.com/eqrion/cbindgen
# Maintainer: John McQuah, jmcquah at disroot dot org
# Depends on: rust
# Optional: sccache

name=cbindgen
version=0.24.6
release=1
source=(https://github.com/mozilla/$name/archive/v$version/$name-v$version.tar.gz)

build() {
	cd $name-$version

	prt-get isinst sccache && export RUSTC_WRAPPER=/usr/bin/sccache
	mkdir -p "$PKGMK_SOURCE_DIR/rust"
	export CARGO_HOME="$PKGMK_SOURCE_DIR/rust"

	cargo fetch --target x86_64-unknown-linux-gnu
	cargo build --release --frozen --bins
	install -Dt $PKG/usr/bin target/release/cbindgen
}
