about summary refs log tree commit diff
path: root/pkgs/development/tools/misc/lsof/default.nix
diff options
context:
space:
mode:
authorAllen Nelson <anelson@narrativescience.com>2017-01-27 15:22:39 -0800
committerAllen Nelson <anelson@narrativescience.com>2017-01-27 15:22:39 -0800
commit06a945f01789a319f8109103c0a90c2aa7ef058b (patch)
tree2d5b2b41286109a2e0170c7196d2eab78aa43bd1 /pkgs/development/tools/misc/lsof/default.nix
parentff89e8189800db204eb251c410f7cd7699b9c36b (diff)
lsof working on darwin
Diffstat (limited to 'pkgs/development/tools/misc/lsof/default.nix')
-rw-r--r--pkgs/development/tools/misc/lsof/default.nix19
1 files changed, 10 insertions, 9 deletions
diff --git a/pkgs/development/tools/misc/lsof/default.nix b/pkgs/development/tools/misc/lsof/default.nix
index 37e5ae6f71057..774734a895c41 100644
--- a/pkgs/development/tools/misc/lsof/default.nix
+++ b/pkgs/development/tools/misc/lsof/default.nix
@@ -1,5 +1,7 @@
 { stdenv, fetchurl, ncurses }:
 
+let dialect = with stdenv.lib; last (splitString "-" stdenv.system); in
+
 stdenv.mkDerivation rec {
   name = "lsof-${version}";
   version = "4.89";
@@ -24,20 +26,19 @@ stdenv.mkDerivation rec {
   };
 
   unpackPhase = "tar xvjf $src; cd lsof_*; tar xvf lsof_*.tar; sourceRoot=$( echo lsof_*/); ";
- 
+
   patches = [ ./dfile.patch ];
 
-  configurePhase = ''
-    # Stop build scripts from searching global include paths
-    export LSOF_INCLUDE=${stdenv.cc.libc}/include
-    ./Configure -n ${if stdenv.isDarwin then "darwin" else "linux"}
-  '';
-  
+  # Stop build scripts from searching global include paths
+  LSOF_INCLUDE = "${stdenv.cc.libc}/include";
+  configurePhase = "./Configure -n ${dialect}";
   preBuild = ''
     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 = ''
     mkdir -p $out/bin $out/man/man8
     cp lsof.8 $out/man/man8/
@@ -53,6 +54,6 @@ stdenv.mkDerivation rec {
       from it).
     '';
     maintainers = [ stdenv.lib.maintainers.mornfall ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }