about summary refs log tree commit diff
path: root/pkgs/development/tools/misc/lsof
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-04-16 18:58:07 -0400
committerShea Levy <shea@shealevy.com>2018-04-16 18:58:07 -0400
commit85422c0f51e322c75b14fbf1cb9e3851eaad7123 (patch)
tree393c86b981cb5a0c5b55587ad27115b927f2abeb /pkgs/development/tools/misc/lsof
parent9330ef4df8edc974512f0bf0a730c8362fa56043 (diff)
lsof: Fix build on darwin.
Diffstat (limited to 'pkgs/development/tools/misc/lsof')
-rw-r--r--pkgs/development/tools/misc/lsof/darwin-dfile.patch12
-rw-r--r--pkgs/development/tools/misc/lsof/default.nix4
2 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/development/tools/misc/lsof/darwin-dfile.patch b/pkgs/development/tools/misc/lsof/darwin-dfile.patch
new file mode 100644
index 0000000000000..9952228e613a2
--- /dev/null
+++ b/pkgs/development/tools/misc/lsof/darwin-dfile.patch
@@ -0,0 +1,12 @@
+diff -Naur a/dialects/darwin/libproc/dfile.c b/dialects/darwin/libproc/dfile.c
+--- a/dialects/darwin/libproc/dfile.c	2018-02-14 09:28:06.000000000 -0500
++++ b/dialects/darwin/libproc/dfile.c	2018-04-16 18:52:40.828715293 -0400
+@@ -43,7 +43,7 @@
+ #include "lsof.h"
+ 
+ #if	defined(PROC_FP_GUARDED)
+-#extern	struct pff_tab	Pgf_tab[];
++extern	struct pff_tab	Pgf_tab[];
+ #endif	/* defined(PROC_FP_GUARDED) */
+ 
+ 
diff --git a/pkgs/development/tools/misc/lsof/default.nix b/pkgs/development/tools/misc/lsof/default.nix
index 53b960a7c0311..ae62c8c7aaef6 100644
--- a/pkgs/development/tools/misc/lsof/default.nix
+++ b/pkgs/development/tools/misc/lsof/default.nix
@@ -28,8 +28,12 @@ stdenv.mkDerivation rec {
 
   unpackPhase = "tar xvjf $src; cd lsof_*; tar xvf lsof_*.tar; sourceRoot=$( echo lsof_*/); ";
 
+  patches = stdenv.lib.optional stdenv.isDarwin ./darwin-dfile.patch;
+
   postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
     substituteInPlace dialects/linux/dlsof.h --replace "defined(__UCLIBC__)" 1
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's|lcurses|lncurses|g' Configure
   '';
 
   # Stop build scripts from searching global include paths