# Template file for 'libknet1'
# only libraries and development files now, if interested in kronosnetd update!
pkgname=libknet1
version=1.24
revision=3
build_style=gnu-configure
configure_args="--disable-dependency-tracking --disable-libknet-sctp
 --disable-static $(vopt_enable man)"
hostmakedepends="automake doxygen libtool libxml2-devel pkg-config libqb-devel"
makedepends="bzip2-devel liblz4-devel liblzma-devel libnl3-devel libqb-devel
 openssl-devel libxml2-devel libzstd-devel lzo-devel nss-devel zlib-devel"
short_desc="Kronosnet core switching implementation (libraries)"
maintainer="Jiří Bělka <jirib79@gmail.com>"
license="GPL-2.0-or-later, LGPL-2.1-only"
homepage="https://www.kronosnet.org"
distfiles="https://kronosnet.org/releases/kronosnet-${version}.tar.bz2"
checksum=89d6bf9df3efe5fa6ff54fd27f45038b5f67e073938a4fc67ce21ed6dcfd7ed0

CFLAGS="-Wno-format-truncation"

build_options="man"
build_options_default=""

if [ -z "$CROSS_BUILD" ]; then
	build_options_default+=" man"
fi

pre_configure() {
	autoreconf -fi
}

post_install() {
	rm -rf ${DESTDIR}/usr/share/doc/kronosnet
	vdoc README
}

libknet1-devel_package() {
	depends="libknet1>=${version}_${revision}"
	short_desc="Kronosnet core switching implementation (development files)"
	pkg_install() {
		vmove usr/include/libknet.h
		vmove usr/lib/libknet.so
		vmove usr/lib/pkgconfig/libknet.pc
		if [ "$build_option_man" ]; then
			vmove "usr/share/man/man3/knet*"
		fi
	}
}

libnozzle1_package() {
	short_desc="Userland wrapper around kernel tap devices"
	pkg_install() {
		vmove "usr/lib/libnozzle.so.*"
	}
}

libnozzle1-devel_package() {
	depends="libnozzle1>=${version}_${revision}"
	short_desc="Userland wrapper around kernel tap devices (development files)"
	pkg_install() {
		vmove usr/include/libnozzle.h
		vmove usr/lib/libnozzle.so
		vmove usr/lib/pkgconfig/libnozzle.pc
		if [ "$build_option_man" ]; then
			vmove "usr/share/man/man3/nozzle*"
		fi
	}
}
