# Template file for 'efibootmgr'
pkgname=efibootmgr
version=14
revision=3
hostmakedepends="pkg-config"
makedepends="libefivar-devel zlib-devel pciutils-devel"
short_desc="Tool to modify UEFI Firmware Boot Manager Variables"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
homepage="https://github.com/rhinstaller/efibootmgr"
distfiles="https://github.com/rhinstaller/efibootmgr/releases/download/${version}/${pkgname}-${version}.tar.bz2"
checksum=377ec16484414b80afd1b8a586153d7ef55ccf048638080101d49b7c77f37ad8
only_for_archs="i686 i686-musl x86_64 x86_64-musl"
conf_files="/etc/default/efibootmgr-kernel-hook"

CPPFLAGS="-I${XBPS_CROSS_BASE}/usr/include/efivar"

do_build() {
	make EXTRA_CFLAGS="$CFLAGS" ${makejobs}
}
do_install() {
	vbin src/efibootdump
	vman src/efibootdump.8
	vbin src/efibootmgr
	vman src/efibootmgr.8
}
post_install() {
	vlicense COPYING
	vmkdir etc/
	vinstall "${FILESDIR}/efibootmgr-kernel-hook.confd" 644 etc/default efibootmgr-kernel-hook
	vinstall ${FILESDIR}/kernel.d/efibootmgr.post-install 744 \
		etc/kernel.d/post-install 50-efibootmgr
	vinstall ${FILESDIR}/kernel.d/efibootmgr.post-remove 744 \
		etc/kernel.d/post-remove 50-efibootmgr
}
