# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Alessio 'mOLOk' Bolognino <themolok@gmail.com>
# Contributor: daniel g. siegel <dgsiegel@gmail.com>

pkgname=libsmbios
pkgver=2.4.3
pkgrel=8
pkgdesc="A library for providing access to as much BIOS information as possible"
arch=('x86_64')
url="https://github.com/dell/libsmbios"
license=('GPL' 'custom')
depends=('glibc')
makedepends=('libxml2' 'python' 'chrpath' 'doxygen' git cppunit help2man)
optdepends=('python: tools')
_commit=5b72244ca0d09c7f228d571ec2d5d20183486c11  # tags/v2.4.3
source=("git+https://github.com/dell/libsmbios.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  cd $pkgname
  ./autogen.sh --no-configure
}

build() {
  unset MAKEFLAGS
  cd $pkgname
  mkdir build
  cd build
  ../configure --prefix=/usr --sbindir=/usr/bin --sysconfdir=/etc --disable-static
  make
}

package() {
  cd $pkgname/build
  make DESTDIR="${pkgdir}" install

  chrpath -d "${pkgdir}/usr/bin/smbios-sys-info-lite"
  install -m755 -d "${pkgdir}/usr/include"

  cp -a ../src/include/* "${pkgdir}/usr/include/"
  cp -a out/public-include/* "${pkgdir}/usr/include/"

  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 ../COPYING-OSL "${pkgdir}/usr/share/licenses/${pkgname}/"
}
