# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=opennhrp
pkgver=0.14.1
pkgrel=6
pkgdesc="NBMA Next Hop Resolution Protocol daemon"
url="https://sourceforge.net/projects/opennhrp"
arch="all"
license="GPL-2.0"
depends=
makedepends="c-ares-dev linux-headers"
subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
	0001-peer-reset-interface-nat-cie-when-server-does-not-de.patch
	0002-all-fix-includes-and-types-to-honor-standards.patch
	0003-netlink-honor-configured-route-table-for-shortcut-de.patch
	0004-netlink-additional-fixes-to-route-table-matching-fix.patch
	0005-do-not-establish-shortcut-entry-if-cie-code-indicate.patch
	0006-modify-packet-destination-only-for-registration-requ.patch
	0007-fix-race-condition-to-stop-processing-dns-requests.patch

	opennhrp-0.9.3-peer-up-bgp.patch
	$pkgname.initd
	$pkgname.confd
	"

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

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch)
			msg "Applying $i"
			patch -p1 < "$srcdir"/$i || return 1
			;;
		esac
	done
	sed -i -e 's/-Werror//' Make.rules
}

build() {
	cd "$_builddir"
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/opennhrp.initd "$pkgdir"/etc/init.d/opennhrp
	install -Dm644 "$srcdir"/opennhrp.confd "$pkgdir"/etc/conf.d/opennhrp
}
md5sums="eb42ddb13e07ceb415b9ebb8eaca28ee  opennhrp-0.14.1.tar.bz2
26c9bb43830a667ff6e5a6729eb3c6b7  0001-peer-reset-interface-nat-cie-when-server-does-not-de.patch
b2527e4e9d255b0b6f0c1dce2f5317e1  0002-all-fix-includes-and-types-to-honor-standards.patch
b1bd8599b606243d9c0777b069054f85  0003-netlink-honor-configured-route-table-for-shortcut-de.patch
c08a55fd6bcf5a746b4cf5fb1d924558  0004-netlink-additional-fixes-to-route-table-matching-fix.patch
b88d25303480b43f1fe5103b9cb71f71  0005-do-not-establish-shortcut-entry-if-cie-code-indicate.patch
594952bb2c3d459db213497e67907363  0006-modify-packet-destination-only-for-registration-requ.patch
2cca39a96d94e9fc784efaa96b2436ad  0007-fix-race-condition-to-stop-processing-dns-requests.patch
f81539fc92800bb79668dda119a97d1d  opennhrp-0.9.3-peer-up-bgp.patch
e923550bcb296eeb74f003f98e4d97cd  opennhrp.initd
8eee86233728dc0d156bbfee6d98f338  opennhrp.confd"
sha256sums="1517d53d688ffc165a1da20c344d96b4c53e60f34bd73c64e60cb67cfca4e9ab  opennhrp-0.14.1.tar.bz2
1e22e02cbf8fdc96f7baf8832242820f463b9d55f7b75f8d73ef07a03016d4fa  0001-peer-reset-interface-nat-cie-when-server-does-not-de.patch
851b45722d61485608390089e34e965cc138e9bf306c0114ae5188974e7c1d85  0002-all-fix-includes-and-types-to-honor-standards.patch
201ff69b3053df260406d97debe7dc2124b9334121e8d6fb4ef3d48068e6f2ef  0003-netlink-honor-configured-route-table-for-shortcut-de.patch
62b5d5c0c989d5491408e6e874d42239c34831e9600df1fe1ea88127439094e6  0004-netlink-additional-fixes-to-route-table-matching-fix.patch
2374bc91bc4babf7b0669faf40fa7a822f9eb0e6971e4af0660635d4dd66d06c  0005-do-not-establish-shortcut-entry-if-cie-code-indicate.patch
8dbea0b390d6c77f92d6caf422e70014807178258c71627c069cd009f268ef35  0006-modify-packet-destination-only-for-registration-requ.patch
0c85facd3b66f5e08dc362c3cb61922f77637a4368cc4e989564c3d8e71458ca  0007-fix-race-condition-to-stop-processing-dns-requests.patch
d348cc75694761124a7e05406d9e21e59251be185356bd3d3bec8dcc9dbbac73  opennhrp-0.9.3-peer-up-bgp.patch
22cd14faf54886525e719acf803b5cd07ec209a6694f950642a723d5b5d02428  opennhrp.initd
83a7ad5e94546dbdfaabf0dd12c0d2e611b89cab06c600499e9453777e28928f  opennhrp.confd"
sha512sums="dd0d5debf86d195256995406909c7406d4b60dcdd3a47fca95fd7053b1691e1863b430ff9d65e8633c2d49c747abb4fdc10b45bdef0d0bfa733e94e33c476785  opennhrp-0.14.1.tar.bz2
7d6d73dfc7c078d6af6f5df7b4e06703f40675a9746c9191c227b85cc857537502ab501c7e01085e36eafe39dc1a2468ebf139a92ac67522606968abe53e74cd  0001-peer-reset-interface-nat-cie-when-server-does-not-de.patch
19a5822e9d6f5be06084213c11e2bb09a4283d2fe6a010cd04b9a3724208581b624c9edb323b6f84e06b1a9d67c2129341c171eeb9eedacc37ff43099c94ac30  0002-all-fix-includes-and-types-to-honor-standards.patch
3eb2cd6f485e194bb8db8e3560e6ad18056a41129b49c77fb035d1a6f0a25671619d78a39fe4df626aac86a7b2ca5d964e660809dff1c3f3514892bf0c324080  0003-netlink-honor-configured-route-table-for-shortcut-de.patch
0573502d0e43e0f63c39f54e41e57d58bc975dcc656682dc9128c0a67d24dc91b4db07ea7dfa2f8297e5bc0a0dfdc9975d155038107c4b7e6fbe45a8e7ab75a5  0004-netlink-additional-fixes-to-route-table-matching-fix.patch
46dc3a8bb2e919092388b20691adcf59f32f5d49b0b952c5187ada40f0ce9fa552e0f4334645a73002ef1970c18e1131c881af231a5956a5875cdc1111bdb259  0005-do-not-establish-shortcut-entry-if-cie-code-indicate.patch
a9c523c6c73c3376c3939bf04b873f1eba0d1f5855e2a979c6788a8ddabd2c9712539f8c8509174dc76b861036873384aef387fe08cfd22dcecece7098acc49d  0006-modify-packet-destination-only-for-registration-requ.patch
4c2e103bdf8c97fdfdbcea5b796dd72b2db3522b0e9eb3543a00fcb6a8b7dc38c8e0cd59baa9a0a474b1d5827c321e2733e5b5b6bd34e03903cfbdcd0ad76963  0007-fix-race-condition-to-stop-processing-dns-requests.patch
6ce107a2ad59331ab130108b49e80de5902d96002480f0465f7ad15b5146637a67982d2edaa392117a3f1820381b6b4a8985bef2a49364ce269c0bbc632d1739  opennhrp-0.9.3-peer-up-bgp.patch
97046d2ee2d9b5c2e91e6358807f797454d6daa129244d81a2e1e4afac739567d09425751e7d4a83922ce509a56d5d2f059117c408111fe8d7a2ef2543cba3f8  opennhrp.initd
c998a0ba198e187c72d09ed3ba2e12fbd30c5d998ed06da01394058741c28a534f1c7e9d692f931ff00dac76c7d4e19e911f7d2ad48deb94f0cef8bd706c4315  opennhrp.confd"
