# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=radvd
pkgver=2.17
pkgrel=2
pkgdesc="IPv6 router advertisement daemon"
url="http://www.litech.org/radvd"
arch="all"
license="BSD with advertising"
depends=""
makedepends="flex bison libdaemon-dev linux-headers"
checkdepends="check-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-openrc"
source="http://www.litech.org/radvd/dist/radvd-$pkgver.tar.xz
	radvd.initd
	radvd.confd
	"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/ \
		--with-check \
		--with-pidfile=/run/radvd/radvd.pid
	# work around parallel build issue
	make gram.h && make
}

check() {
	make -C "$builddir" check
}

package() {
	cd "$builddir"
	make -j1 DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/radvd.initd "$pkgdir"/etc/init.d/radvd
	install -Dm644 "$srcdir"/radvd.confd "$pkgdir"/etc/conf.d/radvd
	install -Dm644 radvd.conf.example \
		"$pkgdir"/usr/share/doc/radvd/radvd.conf.example
}

sha512sums="f62aa8acb423320423637c7908abe1d3b8ec4b32f78a81ba67c1a4ecf9bcaaae4e3671fc0c2c5b5776edfe5e6b5d3bf1daf60e55387dd0c0d7370a86d867873c  radvd-2.17.tar.xz
5f96261f3914ff10966828231d1c8df0d7b0e432d5e075eb6405f923a25f1218e647ec8a2c5b7fa995cf44cc521fd226b4bacfe86920d108130852f00623d8c5  radvd.initd
386a6cdee43a0aa157760a590b9daa52e06e2c344a8d191a188c6174281734df95b82121e92d3c01e6c0fe76658dbdf6467dee2b30e2e010fc57dc8e0666b2cc  radvd.confd"
