# Template file for 'rav1e'
pkgname=rav1e
version=0.6.3
revision=1
build_style=cargo
hostmakedepends="nasm cargo-c"
short_desc="Fastest and safest AV1 encoder"
maintainer="oreo639 <oreo6391@gmail.com>"
license="BSD-2-Clause"
homepage="https://crates.io/crates/rav1e"
distfiles="https://static.crates.io/crates/rav1e/rav1e-${version}.crate"
checksum=277898094f0d03c6a609e491324102daf5080e71c06b4b25e5acf8b89d26c945

if [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
	# error: ran out of registers during register allocation
	# LLVM ERROR: Cannot emit physreg copy instruction
	make_check=no # Tests fail to compile
fi

post_build() {
	cargo auditable cbuild --release --target ${RUST_TARGET} \
		--library-type cdylib --library-type staticlib \
		--destdir="${DESTDIR}" --prefix="/usr" ${configure_args}
}

post_install() {
	cargo auditable cinstall --release --target ${RUST_TARGET} \
		--library-type cdylib --library-type staticlib \
		--destdir="${DESTDIR}" --prefix="/usr" --offline --locked ${configure_args}

	vlicense LICENSE
}

rav1e-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
		vmove usr/include
	}
}
