# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=efivar
pkgdesc="Tools and libraries to work with EFI variables"
pkgver=39
_commit=a77a4ffec000ad5dfc5d6394d208784672acda82  # refs/tags/39
pkgrel=1
arch=(x86_64)
url="https://github.com/rhboot/efivar"
license=(LGPL-2.1-or-later)
depends=(glibc)
makedepends=(
  git
  mandoc
)
checkdepends=(grub)
provides=(
  libefiboot.so
  libefisec.so
  libefivar.so
)
source=(
  "git+$url#tag=$_commit?signed"
)
sha512sums=('SKIP')
b2sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  # disable -Werror by default by setting ERRORS to empty string
  make ERRORS='' all -C $pkgname
}

check() {
  make GRUB_PREFIX=grub test -k -j1 -C $pkgname
}

package() {
  local make_options=(
    V=1
    DESTDIR="$pkgdir/"
    libdir=/usr/lib/
    bindir=/usr/bin/
    mandir=/usr/share/man/
    includedir=/usr/include/
    install
    -j1
    -C $pkgname
  )

  make "${make_options[@]}"
  install -vDm 644 $pkgname/{README.md,TODO} -t "$pkgdir/usr/share/doc/$pkgname/"
}
