# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Dan McGee <dan@archlinux.org>
# Contributor: Florian Zeitz <florob at babelmonkeys dot de>

pkgname=numactl
pkgver=2.0.14
pkgrel=2
pkgdesc="Simple NUMA policy support"
arch=(x86_64)
url="http://oss.sgi.com/projects/libnuma/"
license=(LGPL2.1 GPL2)
depends=(glibc)
provides=(libnuma.so)
# NOTE: debug pkg currently unavailable as it contains /build dir
source=("https://github.com/numactl/numactl/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('28b95985d6b2f26c5f6f15fe235224c998c86f534adf5fdaa355a292cf2fd65515c91ba2a76c899d552d439b18ea1209a1712bd6755f8ee3a442f3935993b2e6')
b2sums=('5f2abe25061ac29ecad8a6b24fe800d72c3538d9a155358f4b329ed1140053c7dbd93f01891904f76db94ed01113a34b4ebcbbf40e4060caf747958785ac9590')

prepare(){
  cd "${pkgname}-${pkgver}"
  autoreconf -fiv
}

build() {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr
  make
}

check() {
  make -k test -C $pkgname-$pkgver || echo "Tests known to fail depending on system load."
}

package() {
  make DESTDIR="$pkgdir" install -C $pkgname-$pkgver
  install -vDm 644 $pkgname-$pkgver/README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  # move_pages(2) is provided by man-pages and is more up-to-date there anyway
  rm -rf "$pkgdir/usr/share/man/man2"
}
