# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=igmpproxy
pkgver=0.1
pkgrel=5
pkgdesc="A simple dynamic Multicast Routing Daemon using only IGMP signalling"
url="https://sourceforge.net/projects/igmpproxy/"
arch="all"
license="GPL-2.0-or-later"
depends=""
makedepends="linux-headers"
install=""
subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
	0001-Use-standard-unsigned-integer-types.patch"

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

build() {
	cd "$_builddir"
	# our kernel have a patch that changes MAXVIFS
	# note that this is ABI incompatible
	sed -i -e 's:^#define MAX_MC_VIFS.*:#define MAX_MC_VIFS   MAXVIFS:' \
		src/igmpproxy.h

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
}

md5sums="c56f41ec195bc1fe016369bf74efc5a1  igmpproxy-0.1.tar.gz
5e5d698b45e28b77d77eb9243f10a6d1  0001-Use-standard-unsigned-integer-types.patch"
sha256sums="ee18ff3d8c3ae3a29dccb7e5eedf332337330020168bd95a11cece8d7d7ee6ae  igmpproxy-0.1.tar.gz
12b5c5458fe335fd7ec231887240367464fc69330038731425963051385ee6d0  0001-Use-standard-unsigned-integer-types.patch"
sha512sums="1a569814d8984610402313d8c4adb78ff362f82ae28c968a8ba0fb411e12a704d1b51b387111b51517ab8fb2e86952bbd196f27eccd311c11ce288fc6fa25ad4  igmpproxy-0.1.tar.gz
161bcc7f247131f74251b12095361a4883581986d25e84b9dc16f9330846f4be8d2913123cef27a46b790956b258b16fcd77bf8a037a680f79d9bacfa1e037ad  0001-Use-standard-unsigned-integer-types.patch"
