# Maintainer: Daniel Sabogal <dsabogalcc@gmail.com>
pkgname=numactl
pkgver=2.0.11
pkgrel=3
pkgdesc="Simple NUMA policy support"
url="https://github.com/numactl/numactl"
# ARM lacks the __NR_migrate_pages syscall
arch="all !armhf"
license="GPL-2.0 LGPL-2.0"
makedepends="autoconf automake libtool linux-headers"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools"
options="!check"
source="$pkgname-$pkgver.tar.gz::https://github.com/numactl/$pkgname/archive/v$pkgver.tar.gz
	musl.patch"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare

	cd "$builddir"
	./autogen.sh
}

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--mandir=/usr/share/man
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	# provided by linux man-pages
	rm -r "$pkgdir"/usr/share/man/man2
}

tools() {
	pkgdesc="NUMA policy control tools"

	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}

sha512sums="610c9b5fee8d1d1a6ff4117c96eedff48d3a047a115abfe7819f98664aff61bc0f694efc49eaee3f9b6135c057b4365d4cce1bcc38dd2094055d61df5efbb1e2  numactl-2.0.11.tar.gz
c24affa5a8a8ea83d7f0ee384dc0629e17a5c4201357132f770f894ad4236772116d96d8389d54fb99095af40d1ccbffc3170b5fb9cc88cfca39179f50bee9c9  musl.patch"
