nixpkgs/pkgs/tools/misc/mprime/default.nix

69 lines
1.9 KiB
Nix
Raw Normal View History

2018-02-15 09:39:57 +00:00
{ stdenv, lib, fetchurl, unzip, curl, hwloc, gmp }:
2016-02-16 16:37:45 +00:00
let
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
2020-07-27 09:21:16 +00:00
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;
2016-02-16 16:37:45 +00:00
in
2018-02-15 09:39:57 +00:00
stdenv.mkDerivation rec {
pname = "mprime";
2020-07-27 09:21:16 +00:00
version = "29.8b7";
2016-02-16 16:37:45 +00:00
src = fetchurl {
url = "https://www.mersenne.org/ftp_root/gimps/p95v${lib.replaceStrings ["."] [""] version}.source.zip";
2020-07-27 09:21:16 +00:00
sha256 = "0x5dk2dcppfnq17n79297lmn6p56rd66cbwrh1ds4l8r4hmwsjaj";
2016-02-16 16:37:45 +00:00
};
2020-07-27 09:21:16 +00:00
postPatch = ''
sed -i ${srcDir}/makefile \
-e 's/^LFLAGS =.*//'
substituteInPlace ${srcDir}/makefile \
--replace '-Wl,-Bstatic' "" \
--replace '-Wl,-Bdynamic' ""
'';
sourceRoot = ".";
2016-02-16 16:37:45 +00:00
2018-02-15 09:39:57 +00:00
nativeBuildInputs = [ unzip ];
2020-07-27 09:21:16 +00:00
2018-02-15 09:39:57 +00:00
buildInputs = [ curl hwloc gmp ];
2016-02-16 16:37:45 +00:00
2020-07-27 09:21:16 +00:00
enableParallelBuilding = true;
2016-02-16 16:37:45 +00:00
buildPhase = ''
make -C gwnum -f ${gwnum}
make -C ${srcDir}
'';
installPhase = ''
2020-07-27 09:21:16 +00:00
install -Dm555 -t $out/bin ${srcDir}/mprime
2016-02-16 16:37:45 +00:00
'';
2020-07-27 09:21:16 +00:00
meta = with lib; {
2016-02-16 16:37:45 +00:00
description = "Mersenne prime search / System stability tester";
longDescription = ''
MPrime is the Linux command-line interface version of Prime95, to be run
in a text terminal or in a terminal emulator window as a remote shell
client. It is identical to Prime95 in functionality, except it lacks a
graphical user interface.
'';
homepage = "https://www.mersenne.org/";
2016-02-16 16:37:45 +00:00
# Unfree, because of a license requirement to share prize money if you find
# a suitable prime. http://www.mersenne.org/legal/#EULA
2020-07-27 09:21:16 +00:00
license = licenses.unfree;
2016-02-16 16:37:45 +00:00
# Untested on linux-32 and osx. Works in theory.
platforms = ["i686-linux" "x86_64-linux" "x86_64-darwin"];
};
}