# Contributor: Mika Havela <mika.havela@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libnet
pkgver=1.1.6
pkgrel=2
pkgdesc="A generic networking API that provides access to several protocols."
url="https://sourceforge.net/projects/libnet-dev/"
arch="all"
license="BSD"
depends=
makedepends="autoconf automake libtool linux-headers"
subpackages="$pkgname-dev $pkgname-doc"
source="http://downloads.sourceforge.net/project/libnet-dev/libnet-$pkgver.tar.gz
	fix-includes.patch
	"

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

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

build() {
	cd "$_builddir"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--with-link-layer=linux \
		|| return 1
	make || return 1
}

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

md5sums="710296fe424a49344e5fcc0d09e53317  libnet-1.1.6.tar.gz
b3b08990f91dd27b86e54337b26a03cb  fix-includes.patch"
sha256sums="d392bb5825c4b6b672fc93a0268433c86dc964e1500c279dc6d0711ea6ec467a  libnet-1.1.6.tar.gz
dfa926bf8bfa0f1c2c5e3f1ef36cb0e6f0a3f2b222c6c0d13bedd37da03ef217  fix-includes.patch"
sha512sums="a67e502b0e6957ca590e47cb50b0472dd83d622d84c62818d665d771616df91b5a8fa8fcf1040d13b7860aaabaf338152ef40f66ab97c3fc9502edb08cea0bb6  libnet-1.1.6.tar.gz
6cde8d5c5c3c34f9a02df5ae472f23b823aab293eed2588bbd6c836d228b1c180dc04208916cd6be7b11e02d6e5b2bfffda5e34ec1ceb99e83d1adfafff09231  fix-includes.patch"
