# Maintainer: Daniel Sabogal <dsabogalcc@gmail.com>
pkgname=hwloc
pkgver=1.11.8
pkgrel=0
pkgdesc="Portable abstraction of hierarchical hardware architectures"
url="https://www.open-mpi.org/"
arch="all"
license="BSD"
makedepends="cairo-dev eudev-dev libxml2-dev ncurses-dev"
if [ "$CARCH" != "armhf" ]; then
	makedepends="$makedepends numactl-dev"
fi
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools:_tools"
source="https://www.open-mpi.org/software/hwloc/v${pkgver%.*}/downloads/$pkgname-$pkgver.tar.bz2"
builddir="$srcdir/$pkgname-$pkgver"

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

check() {
	make -C "$builddir" check
}

package() {
	make -C "$builddir" DESTDIR="$pkgdir" install
}

_tools() {
	pkgdesc="Portable hardware locality tools"

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

sha512sums="6ade049b1de2204ba876fa49344a8389c8128a4082f8e1bc1196a659e862dd4222e954aac64bdb8560dd59412b629d5a41c161a4746199b8994c4e490fae89f7  hwloc-1.11.8.tar.bz2"
