Merge pull request #22217 from adnelson/lsof_darwin_fix

lsof: replace impure reference to /usr/include files
This commit is contained in:
Michael Raskin 2017-01-29 17:32:55 +00:00 committed by GitHub
commit 71fa504cf9

View File

@ -1,5 +1,7 @@
{ stdenv, fetchurl, ncurses }: { stdenv, fetchurl, ncurses }:
let dialect = with stdenv.lib; last (splitString "-" stdenv.system); in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "lsof-${version}"; name = "lsof-${version}";
version = "4.89"; version = "4.89";
@ -27,17 +29,16 @@ stdenv.mkDerivation rec {
patches = [ ./dfile.patch ]; patches = [ ./dfile.patch ];
configurePhase = '' # Stop build scripts from searching global include paths
# Stop build scripts from searching global include paths LSOF_INCLUDE = "${stdenv.cc.libc}/include";
export LSOF_INCLUDE=${stdenv.cc.libc}/include configurePhase = "./Configure -n ${dialect}";
./Configure -n ${if stdenv.isDarwin then "darwin" else "linux"}
'';
preBuild = '' preBuild = ''
sed -i Makefile -e 's/^CFGF=/& -DHASIPv6=1/;' -e 's/-lcurses/-lncurses/' sed -i Makefile -e 's/^CFGF=/& -DHASIPv6=1/;' -e 's/-lcurses/-lncurses/'
for filepath in $(find dialects/${dialect} -type f); do
sed -i "s,/usr/include,$LSOF_INCLUDE,g" $filepath
done
''; '';
installPhase = '' installPhase = ''
mkdir -p $out/bin $out/man/man8 mkdir -p $out/bin $out/man/man8
cp lsof.8 $out/man/man8/ cp lsof.8 $out/man/man8/
@ -53,6 +54,6 @@ stdenv.mkDerivation rec {
from it). from it).
''; '';
maintainers = [ stdenv.lib.maintainers.mornfall ]; maintainers = [ stdenv.lib.maintainers.mornfall ];
platforms = stdenv.lib.platforms.linux; platforms = stdenv.lib.platforms.unix;
}; };
} }