nixpkgs/pkgs/development/tools/misc/lsof/default.nix

55 lines
1.6 KiB
Nix
Raw Normal View History

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