maintainer="Armin Weigl <tb46305@gmail.com>"
pkgname=usbtop
pkgver=1.0
pkgrel=0
pkgdesc="a top-like utility that shows an estimated instantaneous bandwidth on USB buses and devices"
url="https://github.com/aguinet/usbtop"
arch="all"
license="BSD-3-Clause"
makedepends="
	cmake
	ninja
	boost-dev
	libpcap-dev
"
source="https://github.com/aguinet/usbtop/archive/release-$pkgver/usbtop-$pkgver.tar.gz"
builddir="$srcdir/usbtop-release-$pkgver"
options="!check"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		$crossopts
	cmake --build build
}

check() {
	ctest --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
bc2003c1085fae238d99347bbf3caa1da7e44aa8f5b07abbde3f96b4124b301bbbc896f7b5e341665db1cdba44a59752884e3b9fe3a6104ef804aa94c510a5c0  usbtop-1.0.tar.gz
"
