# Template file for 'libpcap'
pkgname=libpcap
version=1.5.2
revision=1
build_style=gnu-configure
configure_args="--enable-ipv6 --with-libnl --with-pcap=linux"
hostmakedepends="pkg-config flex libnl3-devel"
makedepends="libfl-devel libnl3-devel"
short_desc="System-independent interface for user-level packet capture"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.tcpdump.org/"
license="BSD"
distfiles="http://www.tcpdump.org/release/$pkgname-$version.tar.gz"
checksum=806d4ba23b126476d39a458ad1468f73dfe63c92f9586208f7e4e18c13e52ddd

post_install() {
	vinstall LICENSE 644 usr/share/licenses/$pkgname
}

# Package build options
build_options="bluetooth dbus usb"
build_options_default="usb"

desc_option_bluetooth="Enable support for bluetooth sniffing"
desc_option_dbus="Enable support for dbus"
desc_option_usb="Enable support for USB sniffing"

if [ "$build_option_bluetooth" ]; then
	configure_args+=" --enable-bluetooth"
	makedepends+=" libbluetooth-devel"
else
	configure_args+=" --disable-bluetooth"
fi

if [ "$build_option_dbus" ]; then
	configure_args+=" --enable-dbus"
	makedepends+=" dbus-devel"
else
	configure_args+=" --disable-dbus"
fi

if [ "$build_option_usb" ]; then
	configure_args+=" --enable-canusb"
	makedepends+=" libusb-devel"
else
	configure_args+=" --disable-canusb"
fi

libpcap-devel_package() {
	depends="libnl3-devel libpcap>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/bin
		vmove usr/share/man
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
	}
}