# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=gdnsd
pkgver=2.2.4
pkgrel=0
pkgdesc="Geographic Authoritative DNS server"
url="https://github.com/gdnsd/gdnsd/"
arch="all"
license="GPL-3.0"
makedepends="userspace-rcu-dev libev-dev libcap-dev ragel autoconf automake libtool"
install="$pkgname.pre-install"
subpackages="$pkgname-dev $pkgname-doc"
source="gdnsd-$pkgver.tar.gz::https://github.com/gdnsd/gdnsd/archive/v$pkgver.tar.gz
	gdnsd.initd"

builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	default_prepare
	autoreconf -vif
}

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--enable-fast-install
	make
	install -Dm755 "$srcdir"/gdnsd.initd \
		"$pkgdir"/etc/init.d/gdnsd
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
        install -Dm755 "$srcdir"/gdnsd.initd \
		"$pkgdir"/etc/init.d/gdnsd
}
sha512sums="618d5418b9e601d7ba256e4334425a41b5c39072b1d544d299b5698e81325fd5f33df564f0f0ff190d2728f6d44d29b566ebeb8b3b14b7bf1d9b8d812c9246fb  gdnsd-2.2.4.tar.gz
9abfeb63156828f98b9a96ddb51c3828311331e56c98f17f0a3bdbd261d351549aef55c6cbcf351fdf2ac0a22f2be7b8e8930e3a0d89d74b6b5bec90bc422f16  gdnsd.initd"
