# $Id: PKGBUILD 94246 2010-10-05 21:44:43Z dgriffiths $
# Contributor: Aaron Griffin <aaron@archlinux.org>
# Contributor: Jochem Kossen <j.kossen@home.nl>
# Maintainer: Daniel J Griffiths <ghost1227@archlinux.us>

pkgname=lsof
pkgver=4.84
pkgrel=1
pkgdesc="Lists open files for running Unix processes"
arch=('i686' 'x86_64')
url="http://people.freebsd.org/~abe/"
license=('custom')
depends=('glibc')
source=(ftp://sunsite.ualberta.ca/pub/Mirror/lsof/${pkgname}_${pkgver}.tar.bz2 license.txt)
md5sums=('a09326df500ef7e4550af546868338d6'
         '1b63c76bd10437cabf890508c8e58d36')

build() {
	cd ${srcdir}/${pkgname}_${pkgver}
	tar xf ${pkgname}_${pkgver}_src.tar
	cd ${pkgname}_${pkgver}_src
	sed -i 's|/\* #define\tHASSECURITY\t1 \*/|#define\tHASSECURITY\t1|' dialects/linux/machine.h

	./Configure -n linux
	make || return 1
}

package() {
	cd ${srcdir}/${pkgname}_${pkgver}/${pkgname}_${pkgver}_src

	install -Dm0755 -o root -g root lsof ${pkgdir}/usr/sbin/lsof || return 1
	install -Dm0644 -o root -g root lsof.8 ${pkgdir}/usr/share/man/man8/lsof.8 || return 1
   
	install -D -m0644 -o root -g root ${srcdir}/license.txt \
	     ${pkgdir}/usr/share/licenses/lsof/LICENSE || return 1
}