# Template file for 'fwupdate'
pkgname=fwupdate
version=10
revision=2
build_style=gnu-makefile
hostmakedepends="pkg-config"
makedepends="popt-devel libefivar-devel gnu-efi-libs elfutils-devel"
short_desc="Tool for using the ESRT and UpdateCapsule() to apply firmware updates"
maintainer="maxice8 <thinkabit.ukim@gmail.com>"
license="GPL-2.0-or-later"
homepage="https://github.com/rhboot/fwupdate"
distfiles="https://github.com/rhboot/fwupdate/releases/download/${version}/fwupdate-${version}.tar.bz2"
checksum=73f42c6097049ab4490e88bd7742ac962f892e6660ee2af40254605d011ef33a
make_build_args="EFIDIR=void GNUEFIDIR=/usr/lib"
make_install_args="EFIDIR=void LIBDIR=/usr/lib"
nocross="fails to find efi.h"

case "$XBPS_TARGET_MACHINE" in
	x86_64|i686) makedepends+=" libsmbios-devel" ;;
esac

post_install() {
	vmkdir usr/lib/fwupdate
	mv "${DESTDIR}"/boot/efi/EFI "${DESTDIR}"/usr/lib/fwupdate/EFI
	rm -rf "${DESTDIR}"/boot
	rm -rf "${DESTDIR}"/usr/src
	rm -rf "${DESTDIR}"/usr/lib/debug
	rm -rf "${DESTDIR}"/usr/lib/systemd
}

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