# Template file for 'vboot-utils'
pkgname=vboot-utils
version=44.7077
_githash=ea71df260e9041dd5260425dae3d6f5412516b9b
revision=3
build_style=gnu-makefile
hostmakedepends="pkg-config git"
makedepends="libressl-devel libuuid-devel"
short_desc="Verified boot kernel utilities"
maintainer="Enno Boland <gottox@voidlinux.eu>"
license="BSD"
homepage="https://chromium.googlesource.com/chromiumos/platform/vboot_reference.git"
distfiles="$homepage/+archive/refs/heads/release-R${version//./-}.B.tar.gz"
checksum=67be2192c7db1e11d652a62d1472190764e336c758feb8db912b42d2cab70965
CFLAGS=-D_GNU_SOURCE
make_install_args="MINIMAL=1"

do_fetch() {
	git clone https://chromium.googlesource.com/chromiumos/platform/vboot_reference.git $pkgname-$version || true
	cd $pkgname-$version
	git checkout $_githash
}

do_build() {
	local _arch=
	case $XBPS_TARGET_MACHINE in
		x86_64*) _arch=x86_64 ;;
		i686*) _arch=x86 ;;
		arm*) _arch=arm ;;
	esac
	make CC="$CC" LD="$CC" AR="$AR" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" MINIMAL=1 ARCH=$_arch ${makejobs} \
		cgpt utils futil
}

post_install() {
	rm -r $DESTDIR/usr/lib/pkgconfig
	vcopy tests/devkeys usr/share/vboot/devkeys
}
