# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=dnstop
pkgver=20140915
pkgrel=3
pkgdesc="A DNS traffic capture utility"
url="http://dns.measurement-factory.com/tools/dnstop/"
arch="all"
license="BSD"
depends=""
depends_dev=""
makedepends="libpcap-dev ncurses-dev"
install=""
subpackages="$pkgname-doc"
source="http://dns.measurement-factory.com/tools/dnstop/src/$pkgname-$pkgver.tar.gz
	musl-fix.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	mkdir -p "$pkgdir"/usr/bin "$pkgdir"/usr/share/man/man8
	make DESTDIR="$pkgdir" install || return 1
}

md5sums="f0fe1690b114e076196a51d63266eadc  dnstop-20140915.tar.gz
a27ac0ddcc33c73d8104ca19cefc99b4  musl-fix.patch"
sha256sums="b4b03d02005b16e98d923fa79957ea947e3aa6638bb267403102d12290d0c57a  dnstop-20140915.tar.gz
79442a058fd3679d01b8c5e0248a549ca2863e5522ae833a10a42f6c83d8fdd8  musl-fix.patch"
sha512sums="902cf96f7366983cae4bf684e44fbe12f6e982cee8ff489329e25e1a13de60870d356906a99fee56c6da2258c4a39074a504389549c6c2e239a4ea94d8b9a65d  dnstop-20140915.tar.gz
8b1bcfb73f7acf8ab264f44a9fb3bb5bdc7b6beec3ea87ecf9d82898e83c5bd6e43bb12f6d72a9fe362c21210c4c2461c32bb23de03a938f20e2d7f0629f3a3d  musl-fix.patch"
