# Template file for 'ndpi'
pkgname=ndpi
version=2.2
revision=3
wrksrc=nDPI-${version}
build_style=gnu-configure
hostmakedepends="libtool automake pkg-config"
makedepends="libpcap-devel json-c-devel"
short_desc="Open Source Deep Packet Inspection Software Toolkit"
maintainer="Toyam Cox <Vaelatern@voidlinux.eu>"
license="LGPL-3"
homepage="http://www.ntop.org/products/ndpi/"
distfiles="https://github.com/ntop/nDPI/archive/${version}.tar.gz"
checksum=25607db12f466ba88a1454ef8b378e0e9eb59adffad6baa4b5610859a102a5dd

pre_configure() {
	# Copied from autogen.sh
	local NDPI_MAJOR=${version%.*}
	local NDPI_MINOR=${version#*.}
	local NDPI_PATCH=0
	local NDPI_VERSION_SHORT=${version}.0
	cat configure.seed | sed "s/@NDPI_MAJOR@/$NDPI_MAJOR/g" | sed "s/@NDPI_MINOR@/$NDPI_MINOR/g" | sed "s/@NDPI_PATCH@/$NDPI_PATCH/g" | sed "s/@NDPI_VERSION_SHORT@/$NDPI_VERSION_SHORT/g" > configure.ac
	autoreconf -fi
}

post_install() {
	vdoc doc/nDPI_QuickStartGuide.pdf
}

ndpi-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.a
		vmove usr/lib/*.so
		vmove usr/lib/pkgconfig
	}
}
