# Packager = Tuxcore <dev@tuxcore.org> 
pkgname=numactl
pkgver=2.0.19
pkgrel=1
pkgdesc="Simple NUMA policy support"
arch=(x86_64)
url="https://github.com/numactl/numactl"
license=(
  GPL-2.0-only
  LGPL-2.1-only
)
depends=(glibc)
provides=(libnuma.so)
source=($pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz)
sha512sums=('a9aa93bdc6333b620c10ff3573d6ff645ab54beece75e67be8cdddb27d062cc56cea34db342005a171877f85f05eb1d24e43f8466be907ba3b7c8b1f897cd954')
b2sums=('4e98de90a3c3abede9eb5a86c9427ab363c5c1fbb048985b2b7e7e3a150e541b5f99464540f600d2c0771b8fd518af7f6a27d2302077f41f4f67b886c3c0d9bc')

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

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  # prevent excessive overlinking due to libtool
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  make -k -C $pkgname-$pkgver VERBOSE=1 check
}

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"
}
