# Template file for 'efivar'
pkgname=efivar
version=0.15
revision=3
build_style=gnu-configure
makedepends="popt-devel"
short_desc="Tools to manipulate EFI variables"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="LGPL-2.1"
homepage="https://github.com/vathpela/efivar"

only_for_archs="i686 i686-musl x86_64 x86_64-musl"

distfiles="https://github.com/rhinstaller/$pkgname/archive/$version.tar.gz"
checksum=8e5a45ebbd116a96a43176e96b211c73f3ec8452da3bd0ce75a5716f86d4343f

do_configure() {
	sed 's|-rpath=$(TOPDIR)/src/|-rpath=$(libdir)|g' -i src/test/Makefile
        sed "s|-O0|${CFLAGS}|g" -i Make.defaults
}
do_build() {
	make CC=$CC libdir="/usr/lib/" bindir="/usr/bin/" \
		mandir="/usr/share/man/" includedir="/usr/include/" V=1
}
do_install() {
	make -j1 V=1 DESTDIR=${DESTDIR} libdir="/usr/lib/" \
		bindir="/usr/bin/" mandir="/usr/share/man/" \
		includedir="/usr/include/" install
	vinstall src/test/tester 755 usr/bin efivar-tester
}

libefivar_package() {
	short_desc="Library to manipulate EFI variables"
	pkg_install() {
		vmove usr/lib/*.so.*
	}
}
libefivar-devel_package() {
	short_desc="Library to manipulate EFI variables - development files"
	depends="libefivar>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove usr/lib/*.so
		vmove usr/share/man/man3
	}
}
