2019-08-28 15:17:25 -07:00
|
|
|
{ stdenv, fetchFromGitHub, buildPackages, ncurses }:
|
2016-10-04 16:27:47 -07:00
|
|
|
|
2018-08-20 12:11:29 -07:00
|
|
|
let dialect = with stdenv.lib; last (splitString "-" stdenv.hostPlatform.system); in
|
2017-01-27 15:22:39 -08:00
|
|
|
|
2015-07-15 12:25:21 -07:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-28 15:17:25 -07:00
|
|
|
pname = "lsof";
|
2020-11-11 06:36:05 -08:00
|
|
|
version = "4.94.0";
|
2007-06-17 15:34:44 -07:00
|
|
|
|
2018-01-14 16:51:53 -08:00
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2016-10-04 16:27:47 -07:00
|
|
|
buildInputs = [ ncurses ];
|
2016-10-04 06:37:35 -07:00
|
|
|
|
2019-08-28 15:17:25 -07:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lsof-org";
|
|
|
|
repo = "lsof";
|
2019-09-08 16:38:31 -07:00
|
|
|
rev = version;
|
2020-11-11 06:36:05 -08:00
|
|
|
sha256 = "0yxv2jg6rnzys49lyrz9yjb4knamah4xvlqj596y6ix3vm4k3chp";
|
2007-06-17 15:34:44 -07:00
|
|
|
};
|
|
|
|
|
2019-08-28 15:17:25 -07:00
|
|
|
patches = [ ./no-build-info.patch ];
|
2018-04-16 15:58:07 -07:00
|
|
|
|
2018-01-13 23:38:17 -08:00
|
|
|
postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
|
|
|
|
substituteInPlace dialects/linux/dlsof.h --replace "defined(__UCLIBC__)" 1
|
2018-04-16 15:58:07 -07:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
sed -i 's|lcurses|lncurses|g' Configure
|
2018-01-13 23:38:17 -08:00
|
|
|
'';
|
|
|
|
|
2017-01-27 15:22:39 -08:00
|
|
|
# Stop build scripts from searching global include paths
|
2018-03-17 18:39:16 -07:00
|
|
|
LSOF_INCLUDE = "${stdenv.lib.getDev stdenv.cc.libc}/include";
|
2018-01-14 16:51:53 -08:00
|
|
|
configurePhase = "LINUX_CONF_CC=$CC_FOR_BUILD LSOF_CC=$CC LSOF_AR=\"$AR cr\" LSOF_RANLIB=$RANLIB ./Configure -n ${dialect}";
|
2016-10-04 16:27:47 -07:00
|
|
|
preBuild = ''
|
2017-01-27 15:22:39 -08:00
|
|
|
for filepath in $(find dialects/${dialect} -type f); do
|
|
|
|
sed -i "s,/usr/include,$LSOF_INCLUDE,g" $filepath
|
|
|
|
done
|
2016-10-04 16:27:47 -07:00
|
|
|
'';
|
|
|
|
|
2008-06-25 06:08:09 -07:00
|
|
|
installPhase = ''
|
2019-09-28 17:19:19 -07:00
|
|
|
# Fix references from man page https://github.com/lsof-org/lsof/issues/66
|
|
|
|
substituteInPlace Lsof.8 \
|
|
|
|
--replace ".so ./00DIALECTS" "" \
|
|
|
|
--replace ".so ./version" ".ds VN ${version}"
|
2012-01-18 12:16:00 -08:00
|
|
|
mkdir -p $out/bin $out/man/man8
|
2019-08-28 15:17:25 -07:00
|
|
|
cp Lsof.8 $out/man/man8/lsof.8
|
2008-06-25 06:08:09 -07:00
|
|
|
cp lsof $out/bin
|
|
|
|
'';
|
2007-06-26 04:49:45 -07:00
|
|
|
|
2018-09-03 12:52:21 -07:00
|
|
|
meta = with stdenv.lib; {
|
2019-08-28 15:17:25 -07:00
|
|
|
homepage = "https://github.com/lsof-org/lsof";
|
2008-06-25 06:08:09 -07: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 12:52:21 -07:00
|
|
|
maintainers = [ maintainers.dezgeg ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.purdueBsd;
|
2007-06-26 04:49:45 -07:00
|
|
|
};
|
2007-06-17 15:34:44 -07:00
|
|
|
}
|