about summary refs log tree commit diff
path: root/pkgs/tools/system/gptfdisk/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/system/gptfdisk/default.nix')
-rw-r--r--pkgs/tools/system/gptfdisk/default.nix32
1 files changed, 23 insertions, 9 deletions
diff --git a/pkgs/tools/system/gptfdisk/default.nix b/pkgs/tools/system/gptfdisk/default.nix
index 6551f27e77217..9306b0e84ccac 100644
--- a/pkgs/tools/system/gptfdisk/default.nix
+++ b/pkgs/tools/system/gptfdisk/default.nix
@@ -1,13 +1,28 @@
 { fetchurl, stdenv, libuuid, popt, icu, ncurses }:
 
+let version = "1.0.1"; in
 stdenv.mkDerivation rec {
-  name = "gptfdisk-1.0.0";
+  name = "gptfdisk-${version}";
 
   src = fetchurl {
+    # http://www.rodsbooks.com/gdisk/${name}.tar.gz also works, but the home
+    # page clearly implies a preference for using SourceForge's bandwidth:
     url = "mirror://sourceforge/gptfdisk/${name}.tar.gz";
-    sha256 = "0v0xl0mzwabdf9yisgsvkhpyi48kbik35c6df42gr6d78dkrarjv";
+    sha256 = "1izazbyv5n2d81qdym77i8mg9m870hiydmq4d0s51npx5vp8lk46";
   };
 
+  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile.mac --replace \
+      "-mmacosx-version-min=10.4" "-mmacosx-version-min=10.6"
+    substituteInPlace Makefile.mac --replace \
+      " -arch i386" ""
+    substituteInPlace Makefile.mac --replace \
+      " -I/opt/local/include -I /usr/local/include -I/opt/local/include" ""
+    substituteInPlace Makefile.mac --replace \
+      "/opt/local/lib/libncurses.a" "${ncurses}/lib/libncurses.dylib"
+  '';
+
+  buildPhase = stdenv.lib.optionalString stdenv.isDarwin "make -f Makefile.mac";
   buildInputs = [ libuuid popt icu ncurses ];
 
   installPhase = ''
@@ -20,13 +35,12 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = {
-    description = "A set of text-mode partitioning tools for Globally Unique Identifier (GUID) Partition Table (GPT) disks";
-
-    license = stdenv.lib.licenses.gpl2;
-
+  meta = with stdenv.lib; {
+    inherit version;
+    description = "Set of text-mode partitioning tools for Globally Unique Identifier (GUID) Partition Table (GPT) disks";
+    license = licenses.gpl2;
     homepage = http://www.rodsbooks.com/gdisk/;
-
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with maintainers; [ nckx ];
+    platforms = platforms.all;
   };
 }