# Template file for 'liboping'
pkgname=liboping
version=1.10.0
revision=11
build_style=gnu-configure
hostmakedepends="perl"
makedepends="ncurses-devel"
short_desc="C library to generate ICMP echo requests"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.1-only,GPL-2.0-only"
homepage="http://noping.cc/"
distfiles="http://noping.cc/files/liboping-${version}.tar.bz2"
checksum=eb38aa93f93e8ab282d97e2582fbaea88b3f889a08cbc9dbf20059c3779d5cd8

CFLAGS="-Wno-error"

post_configure() {
	(
	cd bindings/perl
	perl Makefile.PL INSTALLDIRS=vendor PREFIX="/usr" TOP_BUILDDIR=".." \
		TARGET_LIBDIR="/usr/lib" CC="$CC" LD="$CC" OPTIMIZE="$CFLAGS"
	sed -i 's/-shared .*/-shared/' Makefile # wrangle LDDLFLAGS
	sed -i 's/-mtune=generic//' Makefile    # fix arm build
	)
}

liboping-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/*.so
		vmove usr/lib/*.a
		vmove usr/lib/pkgconfig
		vmove usr/share/man/man3/liboping.3
		vmove usr/share/man/man3/ping_*.3
	}
}
liboping-perl_package() {
	short_desc+=" - perl bindings"
	shlib_requires="libperl.so.5.36"
	depends="perl"
	pkg_install() {
		vmove usr/share/man/man3/Net::Oping.3p
		vmove usr/lib/perl5
	}
}
