2016-10-05 00:27:47 +01:00
|
|
|
{ stdenv, fetchurl, ncurses }:
|
|
|
|
|
2017-01-27 23:22:39 +00:00
|
|
|
let dialect = with stdenv.lib; last (splitString "-" stdenv.system); in
|
|
|
|
|
2015-07-15 20:25:21 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "lsof-${version}";
|
|
|
|
version = "4.89";
|
2007-06-17 23:34:44 +01:00
|
|
|
|
2016-10-05 00:27:47 +01:00
|
|
|
buildInputs = [ ncurses ];
|
2016-10-04 14:37:35 +01:00
|
|
|
|
2007-06-17 23:44:30 +01:00
|
|
|
src = fetchurl {
|
2015-11-21 22:48:41 +00:00
|
|
|
urls =
|
|
|
|
["ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_${version}.tar.bz2"]
|
|
|
|
++ map (
|
|
|
|
# the tarball is moved after new version is released
|
|
|
|
isOld: "ftp://sunsite.ualberta.ca/pub/Mirror/lsof/"
|
|
|
|
+ "${stdenv.lib.optionalString isOld "OLD/"}lsof_${version}.tar.bz2"
|
2016-10-04 09:16:22 +01:00
|
|
|
) [ false true ]
|
|
|
|
++ map (
|
|
|
|
# the tarball is moved after new version is released
|
|
|
|
isOld: "http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/"
|
|
|
|
+ "${stdenv.lib.optionalString isOld "OLD/"}lsof_${version}.tar.bz2"
|
|
|
|
) [ false true ]
|
|
|
|
;
|
2015-07-15 20:25:21 +01:00
|
|
|
sha256 = "061p18v0mhzq517791xkjs8a5dfynq1418a1mwxpji69zp2jzb41";
|
2007-06-17 23:34:44 +01:00
|
|
|
};
|
|
|
|
|
2008-02-22 06:16:53 +00:00
|
|
|
unpackPhase = "tar xvjf $src; cd lsof_*; tar xvf lsof_*.tar; sourceRoot=$( echo lsof_*/); ";
|
2017-01-27 23:22:39 +00:00
|
|
|
|
2016-10-04 14:37:35 +01:00
|
|
|
patches = [ ./dfile.patch ];
|
2016-04-25 17:14:22 +01:00
|
|
|
|
2017-01-27 23:22:39 +00:00
|
|
|
# Stop build scripts from searching global include paths
|
|
|
|
LSOF_INCLUDE = "${stdenv.cc.libc}/include";
|
|
|
|
configurePhase = "./Configure -n ${dialect}";
|
2016-10-05 00:27:47 +01:00
|
|
|
preBuild = ''
|
|
|
|
sed -i Makefile -e 's/^CFGF=/& -DHASIPv6=1/;' -e 's/-lcurses/-lncurses/'
|
2017-01-27 23:22:39 +00:00
|
|
|
for filepath in $(find dialects/${dialect} -type f); do
|
|
|
|
sed -i "s,/usr/include,$LSOF_INCLUDE,g" $filepath
|
|
|
|
done
|
2016-10-05 00:27:47 +01:00
|
|
|
'';
|
|
|
|
|
2008-06-25 14:08:09 +01:00
|
|
|
installPhase = ''
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin $out/man/man8
|
2008-06-25 14:08:09 +01:00
|
|
|
cp lsof.8 $out/man/man8/
|
|
|
|
cp lsof $out/bin
|
|
|
|
'';
|
2007-06-26 12:49:45 +01:00
|
|
|
|
|
|
|
meta = {
|
2008-06-25 14:08:09 +01:00
|
|
|
homepage = ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/;
|
|
|
|
description = "A tool to list open files";
|
|
|
|
longDescription = ''
|
|
|
|
List open files. Can show what process has opened some file,
|
|
|
|
socket (IPv6/IPv4/UNIX local), or partition (by opening a file
|
|
|
|
from it).
|
|
|
|
'';
|
2014-09-13 12:51:39 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.mornfall ];
|
2017-01-27 23:22:39 +00:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
2007-06-26 12:49:45 +01:00
|
|
|
};
|
2007-06-17 23:34:44 +01:00
|
|
|
}
|