-
Notifications
You must be signed in to change notification settings - Fork 0
/
sagelib.nix
193 lines (176 loc) · 3.16 KB
/
sagelib.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
{pkgs, sage-src, fetchurl, stdenv, perl, gfortran6, autoreconfHook, gettext, hevea
, buildPythonPackage
, fetchFromGitHub
, arb
, openblasCompat
, openblas-blas-pc
, openblas-cblas-pc
, openblas-lapack-pc
, brial
, cliquer
, cypari2
, cysignals
, cython
, ecl
, eclib
, ecm
, flint
, gd
, givaro
, glpk
, gsl
, iml
, jinja2
, jupyter_core
, lcalc
, lrcalc
, libgap
, libpng
, linbox
, m4ri
, m4rie
, libmpc
, mpfi
, mpfr
, mpir
, ntl
, numpy
, pari
, pkgconfig
, planarity
, ppl
, pynac
, python2
, python3
, ratpoints
, readline
, rankwidth
, six
, symmetrica
, zn_poly
, zlib
, fflas-ffpack
, markupsafe
, gmp
, boost
, boehmgc
, singular
, pip
}:
# TODO autoreconf -vi
# TODO configure --prefix=...
# TODO --optimize
buildPythonPackage rec {
format = "other";
version = "8.1"; # TODO
name = "sagelib-${version}";
src = sage-src;
# This has a cyclic dependency with sage. I don't include sage in the
# buildInputs and let python figure it out at runtime. Because of this,
# I don't include the package in the main nipxkgs tree. It wouldn't be useful
# outside of sage anyways (as you could just directly depend on sage and use
# it).
pybrial = buildPythonPackage rec {
pname = "pyBRiAl";
version = "1.2.3";
# included with BRiAl source
src = fetchFromGitHub {
owner = "BRiAl";
repo = "BRiAl";
rev = "${version}";
sha256 = "0qy4cwy7qrk4zg151cmws5cglaa866z461cnj9wdnalabs7v7qbg";
};
preConfigure = "cd sage-brial";
meta = with stdenv.lib; {
description = "python implementation of BRiAl";
license = licenses.gpl2;
maintainers = with maintainers; [ timokau ];
};
};
pythonRuntimeDeps = [
pybrial
cypari2
cysignals
cython
jinja2
jupyter_core
numpy
pkgconfig
six
markupsafe
boost
];
otherDeps = [ # not needed for build
pynac
perl
gfortran6
autoreconfHook
gettext
hevea
arb
openblasCompat
openblas-blas-pc
openblas-cblas-pc
openblas-lapack-pc
brial
cliquer
ecl
eclib
ecm
flint
gd
givaro
glpk
gsl
iml
lcalc
lrcalc
libgap
libpng
linbox
m4ri
m4rie
libmpc
mpfi
mpfr
mpir
ntl
pari
planarity
ppl
ratpoints
readline
rankwidth
symmetrica
zn_poly
zlib
fflas-ffpack
gmp
boehmgc
singular
pip
];
propagatedBuildInputs = pythonRuntimeDeps ++ otherDeps; # FIXME
# environment variables for the build
SAGE_ROOT = src;
SAGE_LOCAL = placeholder "out"; # TODO build somewhere else
SAGE_SHARE = SAGE_LOCAL + "/share";
JUPYTER_PATH = SAGE_LOCAL + "/jupyter";
MAKE = "make";
buildPhase = ''
export PATH="$PWD/build/bin":"$PWD/src/bin":"$PATH"
cd src
export SAGE_NUM_THREADS="$NIX_BUILD_CORES"
mkdir -p $out/{share,bin,include,lib}
mkdir -p $out/var/lib/sage/installed
source bin/sage-dist-helpers
sage-python23 -u setup.py --no-user-cfg build
'';
installPhase = ''
sage-python23 -u setup.py --no-user-cfg install --prefix=$out
cp bin/sage "$out"/bin
'';
postInstall = ''
rm -f "$SAGE_LOCAL"/lib/*.la
'';
}