+56
pkgs/tools/misc/mprime/default.nix
+56
pkgs/tools/misc/mprime/default.nix
···
1
+
{ stdenv, fetchurl, unzip, pkgconfig, curl }:
2
+
3
+
let
4
+
srcDir =
5
+
if stdenv.system == "x86_64-linux" then "linux64"
6
+
else if stdenv.system == "i686-linux" then "linux"
7
+
else if stdenv.system == "x86_64-darwin" then "macosx64"
8
+
else abort "Unsupported platform";
9
+
gwnum =
10
+
if stdenv.system == "x86_64-linux" then "make64"
11
+
else if stdenv.system == "i686-linux" then "makefile"
12
+
else if stdenv.system == "x86_64-darwin" then "makemac"
13
+
else abort "Unsupported platform";
14
+
in
15
+
16
+
stdenv.mkDerivation {
17
+
name = "mprime-28.7";
18
+
19
+
src = fetchurl {
20
+
url = http://www.mersenne.org/ftp_root/gimps/p95v287.source.zip;
21
+
sha256 = "1k3gxhs3g8hfghzpmidhcwpwyayj8r83v8zjai1z4xgsql4jwby1";
22
+
};
23
+
24
+
unpackCmd = "unzip -d src -q $curSrc";
25
+
26
+
buildInputs = [ unzip pkgconfig curl ];
27
+
28
+
patches = [ ./makefile.patch ];
29
+
30
+
buildPhase = ''
31
+
make -C gwnum -f ${gwnum}
32
+
echo 'override CFLAGS := $(CFLAGS)' $(pkg-config --cflags libcurl) >> ${srcDir}/makefile
33
+
echo 'override LIBS := $(LIBS)' $(pkg-config --libs libcurl) >> ${srcDir}/makefile
34
+
make -C ${srcDir}
35
+
'';
36
+
37
+
installPhase = ''
38
+
install -D ${srcDir}/mprime $out/bin/mprime
39
+
'';
40
+
41
+
meta = {
42
+
description = "Mersenne prime search / System stability tester";
43
+
longDescription = ''
44
+
MPrime is the Linux command-line interface version of Prime95, to be run
45
+
in a text terminal or in a terminal emulator window as a remote shell
46
+
client. It is identical to Prime95 in functionality, except it lacks a
47
+
graphical user interface.
48
+
'';
49
+
homepage = http://www.mersenne.org/;
50
+
# Unfree, because of a license requirement to share prize money if you find
51
+
# a suitable prime. http://www.mersenne.org/legal/#EULA
52
+
license = stdenv.lib.licenses.unfree;
53
+
# Untested on linux-32 and osx. Works in theory.
54
+
platforms = ["i686-linux" "x86_64-linux" "x86_64-darwin"];
55
+
};
56
+
}
+46
pkgs/tools/misc/mprime/makefile.patch
+46
pkgs/tools/misc/mprime/makefile.patch
···
1
+
diff -ru orig/linux/makefile patched/linux/makefile
2
+
--- orig/linux/makefile 2015-08-09 21:06:18.000000000 +0100
3
+
+++ patched/linux/makefile 2016-02-16 16:25:45.988662423 +0000
4
+
@@ -25,8 +25,8 @@
5
+
CPP = g++
6
+
CPPFLAGS = -I.. -I../gwnum -O2 -march=i486 -malign-double
7
+
8
+
-LFLAGS = -Wl,-M -Wl,-L/usr/local/lib
9
+
-LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -Wl,-Bstatic -lcurl -Wl,-Bdynamic -lrt -lstdc++ -ldl
10
+
+LFLAGS =
11
+
+LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -lrt -lstdc++ -ldl
12
+
13
+
FACTOROBJ = factor32.o
14
+
LINUXOBJS = prime.o menu.o
15
+
diff -ru orig/linux64/makefile patched/linux64/makefile
16
+
--- orig/linux64/makefile 2015-08-09 21:06:20.000000000 +0100
17
+
+++ patched/linux64/makefile 2016-02-16 16:25:57.076531585 +0000
18
+
@@ -13,13 +13,13 @@
19
+
# LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -Wl,-Bstatic $(shell pkg-config --static --libs libcurl) -lstdc++ -Wl,-Bdynamic -ldl
20
+
21
+
CC = gcc
22
+
-CFLAGS = -I.. -I../gwnum -I/usr/local/include -DX86_64 -O2
23
+
+CFLAGS = -I.. -I../gwnum -I/usr/local/include -DX86_64 -O2
24
+
25
+
CPP = g++
26
+
CPPFLAGS = -I.. -I../gwnum -DX86_64 -O2
27
+
28
+
-LFLAGS = -Wl,-M -Wl,-L/usr/local/lib
29
+
-LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -Wl,-Bstatic -lcurl -Wl,-Bdynamic -lrt -lstdc++ -ldl
30
+
+LFLAGS =
31
+
+LIBS = ../gwnum/gwnum.a ../gwnum/gwnum.ld -lm -lpthread -lrt -lstdc++ -ldl
32
+
33
+
FACTOROBJ = factor64.o
34
+
LINUXOBJS = prime.o menu.o
35
+
diff -ru orig/macosx64/makefile patched/macosx64/makefile
36
+
--- orig/macosx64/makefile 2015-08-09 21:06:22.000000000 +0100
37
+
+++ patched/macosx64/makefile 2016-02-16 16:19:03.988415925 +0000
38
+
@@ -10,7 +10,7 @@
39
+
CPPFLAGS = -I.. -I../gwnum -I../linux -O2 -DX86_64 -DCOMMAND_LINE_MPRIME -m64
40
+
41
+
LFLAGS = -m64 -Wl,-no_pie
42
+
-LIBS = ../gwnum/amd64/release/gwnum.a -lm -lpthread -lcurl -framework IOKit -framework CoreFoundation -lstdc++
43
+
+LIBS = ../gwnum/amd64/release/gwnum.a -lm -lpthread -framework IOKit -framework CoreFoundation -lstdc++
44
+
45
+
FACTOROBJ = ../prime95/macosx64/factor64.o
46
+
OBJS = prime.o menu.o
+2
pkgs/top-level/all-packages.nix
+2
pkgs/top-level/all-packages.nix