about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/mprime/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-10 07:13:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-12 14:07:16 +0000
commite2698550456abba83c6dcd5d5e5a9990a0b96f8a (patch)
tree79a56f0df3fa55e470d84b4dff6059fbf487ec18 /nixpkgs/pkgs/tools/misc/mprime/default.nix
parent1cdc42df888dc98c347e03bd942ed9825a55bcb3 (diff)
parent84d74ae9c9cbed73274b8e4e00be14688ffc93fe (diff)
downloadnixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.gz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.bz2
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.lz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.xz
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.tar.zst
nixlib-e2698550456abba83c6dcd5d5e5a9990a0b96f8a.zip
Merge commit '84d74ae9c9cbed73274b8e4e00be14688ffc93fe'
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/mprime/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/misc/mprime/default.nix47
1 files changed, 29 insertions, 18 deletions
diff --git a/nixpkgs/pkgs/tools/misc/mprime/default.nix b/nixpkgs/pkgs/tools/misc/mprime/default.nix
index 363e90ab5f23..3189e41de8d4 100644
--- a/nixpkgs/pkgs/tools/misc/mprime/default.nix
+++ b/nixpkgs/pkgs/tools/misc/mprime/default.nix
@@ -1,34 +1,45 @@
 { stdenv, lib, fetchurl, unzip, curl, hwloc, gmp }:
 
 let
-  srcDir =
-    if stdenv.hostPlatform.system == "x86_64-linux" then "linux64"
-    else if stdenv.hostPlatform.system == "i686-linux" then "linux"
-    else if stdenv.hostPlatform.system == "x86_64-darwin" then "macosx64"
-    else throwSystem;
   throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
-  gwnum =
-    if stdenv.hostPlatform.system == "x86_64-linux" then "make64"
-    else if stdenv.hostPlatform.system == "i686-linux" then "makefile"
-    else if stdenv.hostPlatform.system == "x86_64-darwin" then "makemac"
-    else throwSystem;
+
+  srcDir = {
+    x86_64-linux = "linux64";
+    i686-linux = "linux";
+    x86_64-darwin = "macosx64";
+  }."${stdenv.hostPlatform.system}" or throwSystem;
+
+  gwnum = {
+    x86_64-linux = "make64";
+    i686-linux = "makefile";
+    x86_64-darwin = "makemac";
+  }."${stdenv.hostPlatform.system}" or throwSystem;
 in
 
 stdenv.mkDerivation rec {
   pname = "mprime";
-  version = "29.4b7";
+  version = "29.8b7";
 
   src = fetchurl {
     url = "https://www.mersenne.org/ftp_root/gimps/p95v${lib.replaceStrings ["."] [""] version}.source.zip";
-    sha256 = "0idaqm46m4yis7vl014scx57lpccvjbnyy79gmj8caxghyajws0m";
+    sha256 = "0x5dk2dcppfnq17n79297lmn6p56rd66cbwrh1ds4l8r4hmwsjaj";
   };
 
-  unpackCmd = "unzip -d src -q $curSrc || true";
+  postPatch = ''
+    sed -i ${srcDir}/makefile \
+      -e 's/^LFLAGS =.*//'
+    substituteInPlace ${srcDir}/makefile \
+      --replace '-Wl,-Bstatic'  "" \
+      --replace '-Wl,-Bdynamic' ""
+  '';
+
+  sourceRoot = ".";
 
   nativeBuildInputs = [ unzip ];
+
   buildInputs = [ curl hwloc gmp ];
 
-  patches = [ ./makefile.patch ];
+  enableParallelBuilding = true;
 
   buildPhase = ''
     make -C gwnum -f ${gwnum}
@@ -36,10 +47,10 @@ stdenv.mkDerivation rec {
   '';
 
   installPhase = ''
-    install -D ${srcDir}/mprime $out/bin/mprime
+    install -Dm555 -t $out/bin ${srcDir}/mprime
   '';
-  
-  meta = {
+
+  meta = with lib; {
     description = "Mersenne prime search / System stability tester";
     longDescription = ''
       MPrime is the Linux command-line interface version of Prime95, to be run
@@ -50,7 +61,7 @@ stdenv.mkDerivation rec {
     homepage = "https://www.mersenne.org/";
     # Unfree, because of a license requirement to share prize money if you find
     # a suitable prime. http://www.mersenne.org/legal/#EULA
-    license = stdenv.lib.licenses.unfree;
+    license = licenses.unfree;
     # Untested on linux-32 and osx. Works in theory.
     platforms = ["i686-linux" "x86_64-linux" "x86_64-darwin"];
   };