commit
f1c2f8817b
|
@ -1,34 +1,45 @@
|
||||||
{ stdenv, lib, fetchurl, unzip, curl, hwloc, gmp }:
|
{ stdenv, lib, fetchurl, unzip, curl, hwloc, gmp }:
|
||||||
|
|
||||||
let
|
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}";
|
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
|
||||||
gwnum =
|
|
||||||
if stdenv.hostPlatform.system == "x86_64-linux" then "make64"
|
srcDir = {
|
||||||
else if stdenv.hostPlatform.system == "i686-linux" then "makefile"
|
x86_64-linux = "linux64";
|
||||||
else if stdenv.hostPlatform.system == "x86_64-darwin" then "makemac"
|
i686-linux = "linux";
|
||||||
else throwSystem;
|
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
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "mprime";
|
pname = "mprime";
|
||||||
version = "29.4b7";
|
version = "29.8b7";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "https://www.mersenne.org/ftp_root/gimps/p95v${lib.replaceStrings ["."] [""] version}.source.zip";
|
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 ];
|
nativeBuildInputs = [ unzip ];
|
||||||
|
|
||||||
buildInputs = [ curl hwloc gmp ];
|
buildInputs = [ curl hwloc gmp ];
|
||||||
|
|
||||||
patches = [ ./makefile.patch ];
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
make -C gwnum -f ${gwnum}
|
make -C gwnum -f ${gwnum}
|
||||||
|
@ -36,10 +47,10 @@ stdenv.mkDerivation rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
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";
|
description = "Mersenne prime search / System stability tester";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
MPrime is the Linux command-line interface version of Prime95, to be run
|
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/";
|
homepage = "https://www.mersenne.org/";
|
||||||
# Unfree, because of a license requirement to share prize money if you find
|
# Unfree, because of a license requirement to share prize money if you find
|
||||||
# a suitable prime. http://www.mersenne.org/legal/#EULA
|
# 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.
|
# Untested on linux-32 and osx. Works in theory.
|
||||||
platforms = ["i686-linux" "x86_64-linux" "x86_64-darwin"];
|
platforms = ["i686-linux" "x86_64-linux" "x86_64-darwin"];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
diff -dur src.old/linux/makefile src.new/linux/makefile
|
|
||||||
--- src.old/linux/makefile 2018-01-04 20:49:00.000000000 +0300
|
|
||||||
+++ src.new/linux/makefile 2018-02-15 12:32:02.913011604 +0300
|
|
||||||
@@ -28,8 +28,8 @@
|
|
||||||
CPP = g++
|
|
||||||
CPPFLAGS = -I.. -I../gwnum -O2 -march=i486 -malign-double
|
|
||||||
|
|
||||||
-LFLAGS = -Wl,-M -Wl,-L/usr/local/lib
|
|
||||||
-LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -Wl,-Bstatic -lhwloc -Wl,-Bstatic -lcurl -Wl,-Bdynamic -lrt -lstdc++ -ldl -lgmp
|
|
||||||
+LFLAGS =
|
|
||||||
+LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -lhwloc -lcurl -lrt -lstdc++ -ldl -lgmp
|
|
||||||
|
|
||||||
FACTOROBJ = factor32.o
|
|
||||||
LINUXOBJS = prime.o menu.o
|
|
||||||
diff -dur src.old/linux64/makefile src.new/linux64/makefile
|
|
||||||
--- src.old/linux64/makefile 2018-01-04 20:49:00.000000000 +0300
|
|
||||||
+++ src.new/linux64/makefile 2018-02-15 12:32:28.836286995 +0300
|
|
||||||
@@ -26,9 +26,9 @@
|
|
||||||
CPP = g++
|
|
||||||
CPPFLAGS = -I.. -I../gwnum -DX86_64 -O2
|
|
||||||
|
|
||||||
-LFLAGS = -Wl,-M -Wl,-L/usr/local/lib
|
|
||||||
+LFLAGS =
|
|
||||||
#LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -Wl,-Bstatic -lhwloc -Wl,-Bstatic -lcurl -Wl,-Bdynamic -lrt -lstdc++ -lz -lxml2 -ldl -lgmp
|
|
||||||
-LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -Wl,-Bstatic -lhwloc -Wl,-Bstatic -lcurl -Wl,-Bdynamic -lrt -lstdc++ -ldl -lgmp
|
|
||||||
+LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -lhwloc -lcurl -lrt -lstdc++ -ldl -lgmp
|
|
||||||
|
|
||||||
FACTOROBJ = factor64.o
|
|
||||||
LINUXOBJS = prime.o menu.o
|
|
||||||
diff -dur src.old/macosx64/makefile src.new/macosx64/makefile
|
|
||||||
--- src.old/macosx64/makefile 2018-01-04 20:49:02.000000000 +0300
|
|
||||||
+++ src.new/macosx64/makefile 2018-02-15 12:33:32.401902535 +0300
|
|
||||||
@@ -12,7 +12,7 @@
|
|
||||||
CPP = g++
|
|
||||||
CPPFLAGS = -I.. -I../gwnum -I../linux -O2 -DX86_64 -DCOMMAND_LINE_MPRIME -m64
|
|
||||||
|
|
||||||
-LFLAGS = -m64 -Wl,-no_pie -L/usr/local/lib
|
|
||||||
+LFLAGS = -m64 -Wl,-no_pie
|
|
||||||
LIBS = ../gwnum/amd64/release/gwnum.a -lm -lpthread -lhwloc -lcurl -framework IOKit -framework CoreFoundation -lstdc++ -lgmp
|
|
||||||
|
|
||||||
FACTOROBJ = ../prime95/macosx64/factor64.o
|
|
Loading…
Reference in New Issue