2018-01-15 00:51:53 +00:00
|
|
|
{ stdenv, fetchurl, buildPackages, ncurses }:
|
2016-10-04 23:27:47 +00:00
|
|
|
|
2018-08-20 19:11:29 +00:00
|
|
|
let dialect = with stdenv.lib; last (splitString "-" stdenv.hostPlatform.system); in
|
2017-01-27 23:22:39 +00:00
|
|
|
|
2015-07-15 19:25:21 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "lsof-${version}";
|
2018-04-25 17:49:51 +00:00
|
|
|
version = "4.91";
|
2007-06-17 22:34:44 +00:00
|
|
|
|
2018-01-15 00:51:53 +00:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2016-10-04 23:27:47 +00:00
|
|
|
buildInputs = [ ncurses ];
|
2016-10-04 13:37:35 +00:00
|
|
|
|
2007-06-17 22:44:30 +00:00
|
|
|
src = fetchurl {
|
2018-04-25 17:49:51 +00:00
|
|
|
urls = ["https://fossies.org/linux/misc/lsof_${version}.tar.bz2"] ++ # Mirrors seem to be down...
|
2015-11-21 22:48:41 +00:00
|
|
|
["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 08:16:22 +00: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 ]
|
|
|
|
;
|
2018-04-25 17:49:51 +00:00
|
|
|
sha256 = "18sh4hbl9jw2szkf0gvgan8g13f3g4c6s2q9h3zq5gsza9m99nn9";
|
2007-06-17 22:34:44 +00: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
|
|
|
|
2018-10-08 19:59:26 +00:00
|
|
|
patches = [ ./no-build-info.patch ] ++ stdenv.lib.optional stdenv.isDarwin ./darwin-dfile.patch;
|
2018-04-16 22:58:07 +00:00
|
|
|
|
2018-01-14 07:38:17 +00:00
|
|
|
postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
|
|
|
substituteInPlace dialects/linux/dlsof.h --replace "defined(__UCLIBC__)" 1
|
2018-04-16 22:58:07 +00:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
sed -i 's|lcurses|lncurses|g' Configure
|
2018-01-14 07:38:17 +00:00
|
|
|
'';
|
|
|
|
|
2017-01-27 23:22:39 +00:00
|
|
|
# Stop build scripts from searching global include paths
|
2018-03-18 01:39:16 +00:00
|
|
|
LSOF_INCLUDE = "${stdenv.lib.getDev stdenv.cc.libc}/include";
|
2018-01-15 00:51:53 +00:00
|
|
|
configurePhase = "LINUX_CONF_CC=$CC_FOR_BUILD LSOF_CC=$CC LSOF_AR=\"$AR cr\" LSOF_RANLIB=$RANLIB ./Configure -n ${dialect}";
|
2016-10-04 23:27:47 +00:00
|
|
|
preBuild = ''
|
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-04 23:27:47 +00:00
|
|
|
'';
|
|
|
|
|
2008-06-25 13:08:09 +00:00
|
|
|
installPhase = ''
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin $out/man/man8
|
2008-06-25 13:08:09 +00:00
|
|
|
cp lsof.8 $out/man/man8/
|
|
|
|
cp lsof $out/bin
|
|
|
|
'';
|
2007-06-26 11:49:45 +00:00
|
|
|
|
2018-09-03 19:52:21 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = https://people.freebsd.org/~abe/;
|
2008-06-25 13:08:09 +00:00
|
|
|
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).
|
|
|
|
'';
|
2018-09-03 19:52:21 +00:00
|
|
|
maintainers = [ maintainers.dezgeg ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.purdueBsd;
|
2007-06-26 11:49:45 +00:00
|
|
|
};
|
2007-06-17 22:34:44 +00:00
|
|
|
}
|