# Contributor: Francesco Zanini <francesco@zanini.me>
# Contributor: Katie Holly <holly@fuslvz.ws>
# Contributor: Mike Crute <mike@crute.us>
# Maintainer: Mike Crute <mike@crute.us>
pkgname=bird
pkgver=2.15.1
pkgrel=0
pkgdesc="BIRD Internet Routing Daemon"
url="https://bird.network.cz/"
arch="all"
license="GPL-2.0-or-later"
makedepends="bison flex ncurses-dev readline-dev linux-headers libssh-dev"
install="$pkgname.pre-install $pkgname.pre-upgrade"
subpackages="$pkgname-dbg $pkgname-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://bird.network.cz/download/bird-$pkgver.tar.gz
	bird.initd
	bird.confd
	"

# flawed test on big-endian
case "$CARCH" in
	s390x) options="!check";;
esac

prepare() {
	default_prepare
	update_config_guess
}

build() {
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--runstatedir=/run \
		--enable-libssh
	make
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/bird.initd "$pkgdir"/etc/init.d/bird
	install -Dm644 "$srcdir"/bird.confd "$pkgdir"/etc/conf.d/bird
}

sha512sums="
75828ae7c3e574097ba6d7e38dd275ada3b078e215454478f2ed9898f7f8447b149e9ba4f47de05a2b8f4e4959b5ee8d46bee0ef58c79b9cb908a44e12df2842  bird-2.15.1.tar.gz
1e7cf8497469b26bbfe5a1f2b3ea2327362a90dfd2684ad150d2594f1c2e9d3ddf88b281087ff925a69e186d9d0f60aea98abc6408641b6bcea49ba5aa559842  bird.initd
0724e9414c276b4162e8d829f67500e41d0fd4732b9ac7f65f9d282214c8c110f22091be90d750990eafc03e2a5b66939537753d751502decc1d592602003116  bird.confd
"
