From f02f1a490be0f0d462020ac1517b68a507a9e9e7 Mon Sep 17 00:00:00 2001 From: Ji-Haeng Huh Date: Tue, 4 Oct 2016 15:37:35 +0200 Subject: [PATCH 1/3] Fixing lsof-4.89 for Darwin --- pkgs/development/tools/misc/lsof/default.nix | 11 ++++++++--- pkgs/development/tools/misc/lsof/dfile.patch | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/tools/misc/lsof/dfile.patch diff --git a/pkgs/development/tools/misc/lsof/default.nix b/pkgs/development/tools/misc/lsof/default.nix index da5da2e5ab9..0095f85c3c7 100644 --- a/pkgs/development/tools/misc/lsof/default.nix +++ b/pkgs/development/tools/misc/lsof/default.nix @@ -1,9 +1,12 @@ { stdenv, fetchurl }: - +let pkgs = import {}; +in stdenv.mkDerivation rec { name = "lsof-${version}"; version = "4.89"; + buildInputs = [ pkgs.ncurses ]; + src = fetchurl { urls = ["ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_${version}.tar.bz2"] @@ -22,12 +25,14 @@ stdenv.mkDerivation rec { }; unpackPhase = "tar xvjf $src; cd lsof_*; tar xvf lsof_*.tar; sourceRoot=$( echo lsof_*/); "; + + patches = [ ./dfile.patch ]; - preBuild = "sed -i Makefile -e 's/^CFGF=/& -DHASIPv6=1/;';"; + preBuild = "sed -i Makefile -e 's/^CFGF=/& -DHASIPv6=1/;' -e s/-lcurses/-lncurses/ ;"; configurePhase = '' # Stop build scripts from searching global include paths - export LSOF_INCLUDE=/$(md5sum <(echo $name) | awk '{print $1}') + # export LSOF_INCLUDE=/$(md5sum <(echo $name) | awk '{print $1}') ./Configure -n ${if stdenv.isDarwin then "darwin" else "linux"} ''; diff --git a/pkgs/development/tools/misc/lsof/dfile.patch b/pkgs/development/tools/misc/lsof/dfile.patch new file mode 100644 index 00000000000..47202d5ebea --- /dev/null +++ b/pkgs/development/tools/misc/lsof/dfile.patch @@ -0,0 +1,18 @@ +--- lsof_4.89_src/dialects/darwin/libproc/dfile.c 2014-10-30 12:39:46.000000000 +0100 ++++ lsof_4.89_src/dialects/darwin/libproc/dfile_new.c 2016-10-04 13:44:58.000000000 +0200 +@@ -286,13 +286,13 @@ + + #if defined(PROC_FP_GUARDED) + if (extra > 1) +- putchar(`,'); ++ putchar(','); + if (lf->guardflags) { + struct pff_tab *tp; + long gf; + + (void) printf("guard="); +- tp = Pgf_tab; ++ tp = Pff_tab; + gf = lf->guardflags; + while (gf && !FsvFlagX) { + while (tp->nm) { From b5b907f3fb76bdde0b95a598bbe4ba71187b37ea Mon Sep 17 00:00:00 2001 From: Ji-Haeng Huh Date: Wed, 5 Oct 2016 01:27:47 +0200 Subject: [PATCH 2/3] corretions for PR comments --- pkgs/development/tools/misc/lsof/default.nix | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/development/tools/misc/lsof/default.nix b/pkgs/development/tools/misc/lsof/default.nix index 0095f85c3c7..c1ffece5a79 100644 --- a/pkgs/development/tools/misc/lsof/default.nix +++ b/pkgs/development/tools/misc/lsof/default.nix @@ -1,11 +1,10 @@ -{ stdenv, fetchurl }: -let pkgs = import {}; -in +{ stdenv, fetchurl, ncurses }: + stdenv.mkDerivation rec { name = "lsof-${version}"; version = "4.89"; - buildInputs = [ pkgs.ncurses ]; + buildInputs = [ ncurses ]; src = fetchurl { urls = @@ -25,16 +24,19 @@ stdenv.mkDerivation rec { }; unpackPhase = "tar xvjf $src; cd lsof_*; tar xvf lsof_*.tar; sourceRoot=$( echo lsof_*/); "; - + patches = [ ./dfile.patch ]; - preBuild = "sed -i Makefile -e 's/^CFGF=/& -DHASIPv6=1/;' -e s/-lcurses/-lncurses/ ;"; - configurePhase = '' # Stop build scripts from searching global include paths - # export LSOF_INCLUDE=/$(md5sum <(echo $name) | awk '{print $1}') + export LSOF_INCLUDE=${stdenv.libc}/include ./Configure -n ${if stdenv.isDarwin then "darwin" else "linux"} ''; + + preBuild = '' + sed -i Makefile -e 's/^CFGF=/& -DHASIPv6=1/;' -e 's/-lcurses/-lncurses/' + ''; + installPhase = '' mkdir -p $out/bin $out/man/man8 From 86dc8ad0fd6526fe9d8cab77482dc22e7ac67b70 Mon Sep 17 00:00:00 2001 From: Ji-Haeng Huh Date: Thu, 6 Oct 2016 15:27:29 +0200 Subject: [PATCH 3/3] lsof-4.89 : change 'stdenv.libc' to 'stdenv.cc.libc' --- pkgs/development/tools/misc/lsof/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/tools/misc/lsof/default.nix b/pkgs/development/tools/misc/lsof/default.nix index c1ffece5a79..37e5ae6f710 100644 --- a/pkgs/development/tools/misc/lsof/default.nix +++ b/pkgs/development/tools/misc/lsof/default.nix @@ -29,7 +29,7 @@ stdenv.mkDerivation rec { configurePhase = '' # Stop build scripts from searching global include paths - export LSOF_INCLUDE=${stdenv.libc}/include + export LSOF_INCLUDE=${stdenv.cc.libc}/include ./Configure -n ${if stdenv.isDarwin then "darwin" else "linux"} '';