# Template file for 'lsof'
pkgname=lsof
version=4.99.0
revision=1
build_style=gnu-configure
configure_args="--enable-security"
hostmakedepends="automake groff"
checkdepends="util-linux procps-ng"
short_desc="LiSt Open Files"
maintainer="Subhaditya Nath <sn03.general@gmail.com>"
license="lsof"
homepage="https://github.com/lsof-org/lsof"
changelog="https://raw.githubusercontent.com/lsof-org/lsof/master/00DIST"
distfiles="https://github.com/lsof-org/lsof/releases/download/${version}/lsof-${version}.tar.gz"
checksum=180e6284aff184d94d273e34f7264edc2af849c07b1c5d6a4183d4d402734245

post_extract() {
	# Ensure tests always run
	ln -sf /bin/true tests/CkTestDB

	# Skip tests/LTsock on GitHub CI
	# hostname/IP resolution fails in CI container
	if [ "$XBPS_BUILD_ENVIRONMENT" = void-packages-ci ]; then
		vsed -i Makefile.am -e '/^TESTS +=/s:tests/LTsock::g'
	fi

	# liblsof is still in alpha. Don't include it in the package.
	vsed -i Makefile.am -e '/^lib_LTLIBRARIES/s/^lib_/noinst_/; /^include_HEADERS/d'
}

post_install() {
	vlicense COPYING
}
