# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=libdnet
pkgver=%version%
pkgrel=%release%
pkgdesc='A simplified, portable interface to several low-level networking routines'
arch=('x86_64')
checkdepends=('check')
license=('BSD')
url='https://github.com/ofalk/libdnet'
source=("https://github.com/ofalk/${pkgname}/archive/${pkgname}-${pkgver}.tar.gz")
sha256sums=('a4a82275c7d83b85b1daac6ebac9461352731922161f1dcdcccd46c318f583c9')

prepare() {
  cd "$srcdir"/$pkgname-$pkgname-$pkgver

  autoreconf -I config --force --install
}

build() {
  cd "$srcdir"/$pkgname-$pkgname-$pkgver

  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin
  make
}

check() {
  cd "$srcdir"/$pkgname-$pkgname-$pkgver

  # fails in build container
  #make check
}

package() {
  cd "$srcdir"/$pkgname-$pkgname-$pkgver

  make DESTDIR="$pkgdir/" install

  install -D -m0644 LICENSE "$pkgdir"/usr/share/licenses/libdnet/license
}
