# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Francesco Colista <francesco.colista@gmail.com>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=wavemon
pkgver=0.8.2
pkgrel=0
pkgdesc="Ncurses-based monitoring application for wireless network devices"
url="https://github.com/uoaerg/wavemon"
arch="all"
license="GPL-2.0-or-later"
makedepends="ncurses-dev libcap-dev libnl3-dev autoconf automake"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/uoaerg/$pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare

	cd "$builddir"
	update_config_sub

	sed -i '/^CFLAGS/d' configure.ac
	autoreconf -fi
}

build() {
	cd "$builddir"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make CFLAGS="$CFLAGS -pthread -I/usr/include/libnl3"
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

	mkdir -p "$pkgdir"/usr/share/doc
	mv "$pkgdir"/usr/share/$pkgname "$pkgdir"/usr/share/doc/
}

sha512sums="383e8444602f1262015e5706ad76ae0cfd5ff9560cf8037edc92242bd89c1f8d4044a83d24009cac2c25b5bf3bda3ef52f0302d2ff0f21959c51ffdebe76ef25  wavemon-0.8.2.tar.gz"
