# 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.1
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 || return 1

	cd "$builddir"
	update_config_sub || return 1

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

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		|| return 1
	make CFLAGS="$CFLAGS -pthread -I/usr/include/libnl3" || return 1
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1

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

md5sums="ded8a276667493a433e554be1c0521f4  wavemon-0.8.1.tar.gz"
sha256sums="c9ea57da4f8161401bcaaca17b37bcdf16ffb88baad2370afed2e15a7f71af73  wavemon-0.8.1.tar.gz"
sha512sums="6614e7591a55f76cc11391d1694ed8ad786adcf564c4cb1a8b52ce2b4eb591f2da239065ce274aa5e065d799479c65d3dabed3c228b851892f0a989b7ac36eb9  wavemon-0.8.1.tar.gz"
