# Template file for 'lsof'
pkgname=lsof
version=4.87
revision=2
wrksrc=lsof_${version}
hostmakedepends="which perl"
short_desc="LiSt Open Files"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://people.freebsd.org/~abe/"
license="lsof"
distfiles="ftp://sunsite.ualberta.ca/pub/Mirror/lsof/lsof_${version}.tar.bz2"
checksum=dfdd3709d82bc79ccdf3e404b84aafa9aede5948642a824ecaefd0aac589da2c

post_extract() {
        # We have to do this dance because the real distfile is
	# included in the .tar.bz2 archive.
	tar xf ${wrksrc}/lsof_${version}_src.tar -C ${wrksrc}
}

do_build() {
	cd ${wrksrc}/lsof_${version}_src
	sed "s|/\* #define\tHASSECURITY\t1 \*/|#define\tHASSECURITY\t1|" \
		-i dialects/linux/machine.h
	LSOF_CFGF="$CFLAGS" ./Configure -n linux
	make CC=$CC ${makejobs}
}

do_install() {
	cd ${wrksrc}/lsof_${version}_src
	vinstall lsof 755 usr/sbin
	vinstall lsof.8 644 usr/share/man/man8
	vinstall ${FILESDIR}/license.txt 644 usr/share/licenses/lsof
}
