gnu: openblas: Fix building on powerpc64le-linux.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2019, 2020 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014, 2016, 2017 John Darrington <jmd@gnu.org>
5 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Eric Bavier <bavier@posteo.net>
6 ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
7 ;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
8 ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
10 ;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
11 ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
12 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
13 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
14 ;;; Copyright © 2016, 2018, 2020, 2021 Kei Kebreau <kkebreau@posteo.net>
15 ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
16 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
17 ;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
18 ;;; Copyright © 2017, 2018, 2019, 2020 Paul Garlick <pgarlick@tourbillion-technology.com>
19 ;;; Copyright © 2017 Nikita <nikita@n0.is>
20 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
21 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
22 ;;; Copyright © 2017, 2019 Arun Isaac <arunisaac@systemreboot.net>
23 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
24 ;;; Copyright © 2017 Dave Love <me@fx@gnu.org>
25 ;;; Copyright © 2018, 2019, 2020 Jan Nieuwenhuizen <janneke@gnu.org>
26 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
27 ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
28 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
29 ;;; Copyright © 2018, 2020 Marius Bakke <mbakke@fastmail.com>
30 ;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
31 ;;; Copyright © 2018, 2021 Julien Lepiller <julien@lepiller.eu>
32 ;;; Copyright © 2018 Amin Bandali <bandali@gnu.org>
33 ;;; Copyright © 2019, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
34 ;;; Copyright © 2019 Steve Sprang <scs@stevesprang.com>
35 ;;; Copyright © 2019 Robert Smith <robertsmith@posteo.net>
36 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
37 ;;; Copyright © 2020, 2021 Felix Gruber <felgru@posteo.net>
38 ;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
39 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
40 ;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
41 ;;; Copyright © 2020 B. Wilson <elaexuotee@wilsonb.com>
42 ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
43 ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
44 ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
45 ;;; Copyright © 2021 Gerd Heber <gerd.heber@gmail.com>
46 ;;; Copyright © 2021 Franck Pérignon <franck.perignon@univ-grenoble-alpes.fr>
47 ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
48 ;;; Copyright © 2021 Paul A. Patience <paul@apatience.com>
49 ;;;
50 ;;; This file is part of GNU Guix.
51 ;;;
52 ;;; GNU Guix is free software; you can redistribute it and/or modify it
53 ;;; under the terms of the GNU General Public License as published by
54 ;;; the Free Software Foundation; either version 3 of the License, or (at
55 ;;; your option) any later version.
56 ;;;
57 ;;; GNU Guix is distributed in the hope that it will be useful, but
58 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
59 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
60 ;;; GNU General Public License for more details.
61 ;;;
62 ;;; You should have received a copy of the GNU General Public License
63 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
64
65 (define-module (gnu packages maths)
66 #:use-module (ice-9 regex)
67 #:use-module (ice-9 match)
68 #:use-module (gnu packages)
69 #:use-module ((guix licenses) #:prefix license:)
70 #:use-module (guix packages)
71 #:use-module (guix download)
72 #:use-module (guix git-download)
73 #:use-module (guix utils)
74 #:use-module ((guix build utils) #:select (alist-replace))
75 #:use-module (guix build-system cmake)
76 #:use-module (guix build-system glib-or-gtk)
77 #:use-module (guix build-system gnu)
78 #:use-module (guix build-system ocaml)
79 #:use-module (guix build-system python)
80 #:use-module (guix build-system ruby)
81 #:use-module (gnu packages algebra)
82 #:use-module (gnu packages audio)
83 #:use-module (gnu packages autotools)
84 #:use-module (gnu packages base)
85 #:use-module (gnu packages bison)
86 #:use-module (gnu packages boost)
87 #:use-module (gnu packages check)
88 #:use-module (gnu packages cmake)
89 #:use-module (gnu packages compression)
90 #:use-module (gnu packages coq)
91 #:use-module (gnu packages curl)
92 #:use-module (gnu packages cyrus-sasl)
93 #:use-module (gnu packages dbm)
94 #:use-module (gnu packages documentation)
95 #:use-module (gnu packages elf)
96 #:use-module (gnu packages emacs)
97 #:use-module (gnu packages file)
98 #:use-module (gnu packages flex)
99 #:use-module (gnu packages fltk)
100 #:use-module (gnu packages fontutils)
101 #:use-module (gnu packages gettext)
102 #:use-module (gnu packages gcc)
103 #:use-module (gnu packages gd)
104 #:use-module (gnu packages ghostscript)
105 #:use-module (gnu packages glib)
106 #:use-module (gnu packages graphviz)
107 #:use-module (gnu packages gtk)
108 #:use-module (gnu packages icu4c)
109 #:use-module (gnu packages image)
110 #:use-module (gnu packages java)
111 #:use-module (gnu packages less)
112 #:use-module (gnu packages lisp)
113 #:use-module (gnu packages linux)
114 #:use-module (gnu packages llvm)
115 #:use-module (gnu packages logging)
116 #:use-module (gnu packages lua)
117 #:use-module (gnu packages gnome)
118 #:use-module (gnu packages guile)
119 #:use-module (gnu packages xorg)
120 #:use-module (gnu packages gl)
121 #:use-module (gnu packages imagemagick)
122 #:use-module (gnu packages m4)
123 #:use-module (gnu packages mpi)
124 #:use-module (gnu packages multiprecision)
125 #:use-module (gnu packages netpbm)
126 #:use-module (gnu packages ocaml)
127 #:use-module (gnu packages onc-rpc)
128 #:use-module (gnu packages pcre)
129 #:use-module (gnu packages popt)
130 #:use-module (gnu packages perl)
131 #:use-module (gnu packages pkg-config)
132 #:use-module (gnu packages pulseaudio)
133 #:use-module (gnu packages python)
134 #:use-module (gnu packages python-web)
135 #:use-module (gnu packages python-xyz)
136 #:use-module (gnu packages qt)
137 #:use-module (gnu packages readline)
138 #:use-module (gnu packages ruby)
139 #:use-module (gnu packages tbb)
140 #:use-module (gnu packages scheme)
141 #:use-module (gnu packages shells)
142 #:use-module (gnu packages tcl)
143 #:use-module (gnu packages texinfo)
144 #:use-module (gnu packages tex)
145 #:use-module (gnu packages tls)
146 #:use-module (gnu packages version-control)
147 #:use-module (gnu packages wxwidgets)
148 #:use-module (gnu packages xml)
149 #:use-module (srfi srfi-1)
150 #:use-module (srfi srfi-26))
151
152 (define-public aris
153 (package
154 (name "aris")
155 (version "2.2")
156 (source (origin
157 (method url-fetch)
158 (uri (string-append "mirror://gnu/" name "/" name "-" version ".tar.gz"))
159 (sha256 (base32
160 "1q1887ryqdr9sn0522hc7p16kqwlxxyz5dkmma8ar2nxplhgll7q"))))
161 (build-system gnu-build-system)
162 (inputs `(("gtk+" ,gtk+)
163 ("libxml2" ,libxml2)))
164 (native-inputs `(("pkg-config" ,pkg-config)))
165 (synopsis "Natural deduction first-order logic interface")
166 (description "Aris is a program for performing logical proofs. It supports
167 propositional and predicate logic, as well as Boolean algebra and
168 arithmetical logic. In addition to its predefined inference and equivalence
169 rules, Aris also supports references to older proofs. Its use of standard
170 logical symbols and its natural deduction interface make it easy to use for
171 beginners.")
172 (license license:gpl3+)
173 (home-page "https://www.gnu.org/software/aris/")))
174
175 (define-public c-graph
176 (package
177 (name "c-graph")
178 (version "2.0.1")
179 (source (origin
180 (method url-fetch)
181 (uri (string-append "mirror://gnu/c-graph/c-graph-" version
182 ".tar.gz"))
183 (sha256 (base32
184 "092412jzxy6wdvpk96pfj499hpmaww8xllavbvlqspfpr7ips9id"))))
185 (build-system gnu-build-system)
186 (inputs
187 `(("fortran" ,gfortran)))
188 (synopsis "Visualizing and demonstrating convolution")
189 (description
190 "GNU C-Graph is a tool for demonstrating the theory of convolution.
191 Thus, it can serve as an excellent aid to students of signal and systems
192 theory in visualizing the convolution process. Rather than forcing the
193 student to write code, the program offers an intuitive interface with
194 interactive dialogs to guide them.")
195 (license license:gpl3+)
196 (home-page "https://www.gnu.org/software/c-graph/")))
197
198 (define-public coda
199 (package
200 (name "coda")
201 (version "2.19")
202 (source
203 (origin
204 (method url-fetch)
205 (uri (string-append "https://github.com/stcorp/coda/releases/download/"
206 version "/coda-" version ".tar.gz"))
207 (sha256
208 (base32 "1fbxd2afm7dshd92p10yy8dwbr9gc1h1fmnnnmr7d0c5lnw80245"))
209 (patches (search-patches "coda-use-system-libs.patch"))
210 (modules '((guix build utils)))
211 (snippet
212 ;; Make sure we don't use the bundled software.
213 '(begin
214 (for-each (lambda (d)
215 (delete-file-recursively (string-append "libcoda/" d)))
216 '("zlib" "pcre" "expat"))
217 #t))))
218 (native-inputs
219 `(("fortran" ,gfortran)
220 ("python" ,python)
221 ("python-numpy" ,python-numpy)))
222 (inputs
223 `(("zlib" ,zlib)
224 ("pcre" ,pcre)
225 ("expat" ,expat)
226 ("hdf4" ,hdf4-alt)
227 ("hdf5" ,hdf5)))
228 (build-system gnu-build-system)
229 (arguments
230 '(#:configure-flags '("--with-hdf4" "--with-hdf5" "--enable-python"
231 "LIBS= -lz -lpcre -lexpat")))
232 (synopsis "A common interface to various earth observation data formats")
233 (description
234 "The Common Data Access toolbox (CODA) provides a set of interfaces for
235 reading remote sensing data from earth observation data files. It consists of
236 command line applications and interfaces to the C, Fortran, Python, and Java
237 programming languages.")
238 (home-page "https://stcorp.nl/coda")
239 (license license:gpl2+)))
240
241 (define-public qhull
242 (package
243 (name "qhull")
244 (version "2020.2")
245 (source (origin
246 (method url-fetch)
247 (uri (string-append "http://www.qhull.org/download/qhull-"
248 (car (string-split version #\.))
249 "-src-8.0.2.tgz"))
250 (sha256
251 (base32
252 "0zlbhg0lb6j60188c2xhcrvviskr079552icjldqhy1jhgmxghmm"))))
253 (build-system cmake-build-system)
254 (arguments
255 `(#:configure-flags '("-DLINK_APPS_SHARED=ON"
256 "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")))
257 (synopsis "Calculate convex hulls and related structures")
258 (description
259 "@code{Qhull} computes the convex hull, Delaunay triangulation, Voronoi
260 diagram, halfspace intersection about a point, furthest-site Delaunay
261 triangulation, and furthest-site Voronoi diagram. The source code runs in 2-d,
262 3-d, 4-d, and higher dimensions. @code{Qhull} implements the Quickhull
263 algorithm for computing the convex hull. It handles roundoff errors from
264 floating point arithmetic. It computes volumes, surface areas, and
265 approximations to the convex hull.
266
267 @code{Qhull} does not support triangulation of non-convex surfaces, mesh
268 generation of non-convex objects, medium-sized inputs in 9-D and higher, alpha
269 shapes, weighted Voronoi diagrams, Voronoi volumes, or constrained Delaunay
270 triangulations.")
271 (home-page "http://qhull.org")
272 (license (license:non-copyleft "file://COPYING.txt"
273 "See COPYING in the distribution."))))
274
275 (define-public python-cvxopt
276 (package
277 (name "python-cvxopt")
278 (version "1.2.3")
279 (source (origin
280 (method git-fetch)
281 (uri (git-reference
282 (url "https://github.com/cvxopt/cvxopt")
283 (commit version)))
284 (file-name (git-file-name name version))
285 (sha256
286 (base32
287 "1kiy2m62xgs2d5id6dnnwy4vap85cd70p7pgkb9nh23qf9xnak7b"))))
288 (build-system python-build-system)
289 (arguments
290 `(#:phases
291 (modify-phases %standard-phases
292 (add-after 'unpack 'find-libraries
293 (lambda* (#:key inputs #:allow-other-keys)
294 (setenv "CVXOPT_BLAS_LIB" "openblas")
295 (setenv "CVXOPT_BUILD_FFTW" "1")
296 (setenv "CVXOPT_BUILD_GLPK" "1")
297 (setenv "CVXOPT_BUILD_GSL" "1")
298 #t)))))
299 (inputs
300 `(("fftw" ,fftw)
301 ("glpk" ,glpk)
302 ("gsl" ,gsl)
303 ("lapack" ,lapack)
304 ("openblas" ,openblas)
305 ("suitesparse" ,suitesparse)))
306 (home-page "https://www.cvxopt.org")
307 (synopsis "Python library for convex optimization")
308 (description
309 "CVXOPT is a package for convex optimization based on the Python
310 programming language. Its main purpose is to make the development of software
311 for convex optimization applications straightforward by building on Python’s
312 extensive standard library and on the strengths of Python as a high-level
313 programming language.")
314 (license license:gpl3+)))
315
316 (define-public python2-cvxopt
317 (package-with-python2 python-cvxopt))
318
319 (define-public units
320 (package
321 (name "units")
322 (version "2.21")
323 (source (origin
324 (method url-fetch)
325 (uri (string-append "mirror://gnu/units/units-" version
326 ".tar.gz"))
327 (sha256 (base32
328 "1bybhqs4yrly9myb5maz3kdmf8k4fhk2m1d5cbcryn40z6lq0gkc"))))
329 (build-system gnu-build-system)
330 (inputs
331 `(("readline" ,readline)
332 ("python" ,python-wrapper) ;for 'units_cur' script
333 ("python-requests" ,python-requests)))
334 (arguments
335 `(#:phases (modify-phases %standard-phases
336 (add-after 'install 'wrap-units_cur
337 (lambda* (#:key outputs #:allow-other-keys)
338 (let* ((out (assoc-ref outputs "out"))
339 (bin (string-append out "/bin")))
340 (wrap-program (string-append bin "/units_cur")
341 `("PYTHONPATH" ":" prefix
342 ,(search-path-as-string->list (getenv "PYTHONPATH"))))
343 #t))))))
344 (synopsis "Conversion between thousands of scales")
345 (description
346 "GNU Units converts numeric quantities between units of measure. It
347 can handle scale changes through adaptive usage of standard scale
348 prefixes (micro-, kilo-, etc.). It can also handle nonlinear
349 conversions such as Fahrenheit to Celsius. Its interpreter is powerful
350 enough to be used effectively as a scientific calculator.")
351 (license license:gpl3+)
352 (home-page "https://www.gnu.org/software/units/")))
353
354 (define-public double-conversion
355 (package
356 (name "double-conversion")
357 (version "3.1.5")
358 (home-page "https://github.com/google/double-conversion")
359 (source (origin
360 (method git-fetch)
361 (uri (git-reference (url home-page)
362 (commit (string-append "v" version))))
363 (file-name (git-file-name name version))
364 (sha256
365 (base32
366 "0csy4pjw1p8rp6g5qxi2h0ychhhp1fldv7gb761627fs2mclw9gv"))))
367 (build-system cmake-build-system)
368 (arguments
369 '(#:test-target "test"
370 #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
371 "-DBUILD_TESTING=ON")))
372 (synopsis "Conversion routines for IEEE doubles")
373 (description
374 "The double-conversion library provides binary-decimal and decimal-binary
375 routines for IEEE doubles. The library consists of efficient conversion
376 routines that have been extracted from the V8 JavaScript engine.")
377 (license license:bsd-3)))
378
379 (define-public dionysus
380 (package
381 (name "dionysus")
382 (version "1.4.0")
383 (source (origin
384 (method url-fetch)
385 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
386 ".tar.xz"))
387 (sha256
388 (base32
389 "194pzs1mlsj4ww6v37qq3961h5hckm5h805cv0r14xj3g9wfx2sk"))))
390 (build-system gnu-build-system)
391 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
392 (synopsis "Local search for universal constants and scientific values")
393 (description
394 "GNU Dionysus is a convenient system for quickly retrieving the values of
395 mathematical constants used in science and engineering. Values can be
396 searched using a simple command-line tool, choosing from three databases:
397 universal constants, atomic numbers, and constants related to
398 semiconductors.")
399 (license license:gpl3+)
400 (home-page "https://www.gnu.org/software/dionysus/")))
401
402 (define-public dsfmt
403 (package
404 (name "dsfmt")
405 (version "2.2.3")
406 (source
407 (origin
408 (method url-fetch)
409 (uri
410 (string-append
411 "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/"
412 "dSFMT-src-" version ".tar.gz"))
413 (sha256
414 (base32
415 "03kaqbjbi6viz0n33dk5jlf6ayxqlsq4804n7kwkndiga9s4hd42"))
416 (modules '((guix build utils)))
417 ;; Don't distribute html documentation with bundled jquery.
418 (snippet
419 '(begin
420 (delete-file-recursively "html") #t))
421 ;; Add patches borrowed from Julia.
422 (patches
423 (list
424 (origin
425 (method url-fetch)
426 (uri (string-append
427 "https://raw.githubusercontent.com/JuliaLang/julia/"
428 "v1.3.0/deps/patches/dSFMT.c.patch"))
429 (sha256 (base32
430 "09mhv11bms8jsmkmdqvlcgljwhzw3b6n9nncpi2b6dla9798hw2y"))
431 (file-name "dSFMT.c.patch"))
432 (origin
433 (method url-fetch)
434 (uri (string-append
435 "https://raw.githubusercontent.com/JuliaLang/julia/"
436 "v1.3.0/deps/patches/dSFMT.h.patch"))
437 (sha256 (base32
438 "1py5rd0yxic335lzka23f6x2dhncrpizpyrk57gi2f28c0p98y5n"))
439 (file-name "dSFMT.h.patch"))))))
440 (build-system gnu-build-system)
441 (arguments
442 `(#:phases
443 (modify-phases %standard-phases
444 (delete 'configure) ; no configure script
445 (replace 'build
446 ;; Upstream Makefile does not build a shared library. Borrow from Julia
447 ;; https://github.com/JuliaLang/julia/blob/v1.3.0/deps/dsfmt.mk
448 (lambda _
449 (invoke
450 "gcc" "-DNDEBUG" "-DDSFMT_MEXP=19937"
451 "-fPIC" "-DDSFMT_DO_NOT_USE_OLD_NAMES"
452 "-O3" "-finline-functions" "-fomit-frame-pointer"
453 "-fno-strict-aliasing" "--param" "max-inline-insns-single=1800"
454 "-Wmissing-prototypes" "-Wall" "-std=c99" "-shared" "dSFMT.c"
455 "-o" "libdSFMT.so")))
456 (replace 'install ; no "install" target
457 (lambda* (#:key outputs #:allow-other-keys)
458 (let* ((out (assoc-ref outputs "out"))
459 (lib (string-append out "/lib"))
460 (inc (string-append out "/include"))
461 (doc (string-append out "/share/doc/" ,name "-" ,version)))
462 (install-file "libdSFMT.so" lib)
463 (install-file "dSFMT.h" inc)
464 (install-file "LICENSE.txt" doc)
465 #t))))))
466 (synopsis "Double precision SIMD-oriented Fast Mersenne Twister")
467 (description
468 "The dSMFT package speeds up Fast Mersenne Twister generation by avoiding
469 the expensive conversion of integer to double (floating point). dSFMT directly
470 generates double precision floating point pseudorandom numbers which have the
471 IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985)
472 format. dSFMT is only available on the CPUs which use IEEE 754 format double
473 precision floating point numbers.")
474 (home-page "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/")
475 (license license:bsd-3)))
476
477 (define-public gsl
478 (package
479 (name "gsl")
480 (version "2.6")
481 (source (origin
482 (method url-fetch)
483 (uri (string-append "mirror://gnu/gsl/gsl-"
484 version ".tar.gz"))
485 (sha256
486 (base32
487 "1a460zj9xmbgvcymkdhqh313c4l29mn9cffbi5vf33x3qygk70mp"))))
488 (build-system gnu-build-system)
489 (arguments
490 (let ((system (%current-system)))
491 (cond
492 ((or (string-prefix? "aarch64" system)
493 (string-prefix? "powerpc" system))
494 ;; Some sparse matrix tests are failing on AArch64 and PowerPC:
495 ;; https://lists.gnu.org/archive/html/bug-gsl/2020-04/msg00001.html
496 '(#:phases (modify-phases %standard-phases
497 (add-before 'check 'disable-failing-tests
498 (lambda _
499 (substitute* "spmatrix/test.c"
500 ((".*test_complex.*") "\n"))
501 #t)))))
502 ((string-prefix? "i686" system)
503 ;; There are rounding issues with these tests on i686:
504 ;; https://lists.gnu.org/archive/html/bug-gsl/2016-10/msg00000.html
505 ;; https://lists.gnu.org/archive/html/bug-gsl/2020-04/msg00000.html
506 '(#:phases (modify-phases %standard-phases
507 (add-before 'check 'disable-failing-tests
508 (lambda _
509 (substitute* "linalg/test.c"
510 ((".*gsl_test\\(test_LU_decomp.*") "\n")
511 ((".*gsl_test\\(test_LUc_decomp.*") "\n")
512 ((".*gsl_test\\(test_cholesky_decomp.*") "\n")
513 ((".*gsl_test\\(test_COD_lssolve2.*") "\n"))
514 (substitute* "spmatrix/test.c"
515 ((".*test_all.*") "\n")
516 ((".*test_float.*") "\n")
517 ((".*test_complex.*") "\n"))
518 #t)))))
519 (else '()))))
520 (home-page "https://www.gnu.org/software/gsl/")
521 (synopsis "Numerical library for C and C++")
522 (description
523 "The GNU Scientific Library is a library for numerical analysis in C
524 and C++. It includes a wide range of mathematical routines, with over 1000
525 functions in total. Subject areas covered by the library include:
526 differential equations, linear algebra, Fast Fourier Transforms and random
527 numbers.")
528 (license license:gpl3+)))
529
530 (define-public sleef
531 (package
532 (name "sleef")
533 (version "3.5.1")
534 (source
535 (origin
536 (method git-fetch)
537 (uri (git-reference
538 (url "https://github.com/shibatch/sleef")
539 (commit version)))
540 (file-name (git-file-name name version))
541 (sha256
542 (base32 "1jybqrl2dvjxzg30xrhh847s375n2jr1pix644wi6hb5wh5mx3f7"))))
543 (build-system cmake-build-system)
544 (arguments
545 '(#:configure-flags (list "-DCMAKE_BUILD_TYPE=Release"
546 (string-append "-DCMAKE_INSTALL_LIBDIR="
547 (assoc-ref %outputs "out")
548 "/lib")
549 (string-append "-DCMAKE_INSTALL_PREFIX="
550 (assoc-ref %outputs "out")))
551 #:phases
552 (modify-phases %standard-phases
553 ;; SLEEF generates a header library during the build process and writes
554 ;; to it via shell redirection. Make the checkout writable so the
555 ;; build can succeed.
556 (add-after 'unpack 'make-git-checkout-writable
557 (lambda _
558 (for-each make-file-writable (find-files "."))
559 #t)))))
560 (inputs
561 `(("fftw" ,fftw)
562 ("gmp" ,gmp)
563 ("mpfr" ,mpfr)
564 ("openssl" ,openssl)))
565 (home-page "https://sleef.org/")
566 (synopsis "SIMD library for evaluating elementary functions and DFT")
567 (description
568 "SLEEF (SIMD Library for Evaluating Elementary Functions) is a library that
569 implements vectorized versions of all C99 real floating point math functions.
570 It can utilize SIMD instructions that are available on modern processors.")
571 (license (list license:boost1.0 ;sleef
572 license:cc-by4.0)))) ;simplex algorithm
573
574 (define-public glpk
575 (package
576 (name "glpk")
577 (version "5.0")
578 (source
579 (origin
580 (method url-fetch)
581 (uri (string-append "mirror://gnu/glpk/glpk-"
582 version ".tar.gz"))
583 (sha256
584 (base32
585 "05bgxidxj8d9xdp82niy7cy36w181cxq7p8vc3y2ixshpgp1642a"))))
586 (build-system gnu-build-system)
587 (inputs
588 `(("gmp" ,gmp)))
589 (arguments
590 `(#:configure-flags '("--with-gmp"
591 "--disable-static")))
592 (home-page "https://www.gnu.org/software/glpk/")
593 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
594 (description
595 "GLPK is a C library for solving large-scale linear programming (LP),
596 mixed integer programming (MIP), and other related problems. It supports the
597 GNU MathProg modeling language, a subset of the AMPL language, and features a
598 translator for the language. In addition to the C library, a stand-alone
599 LP/MIP solver is included in the package.")
600 (license license:gpl3+)))
601
602 (define-public glpk-4
603 (package
604 (inherit glpk)
605 (name "glpk")
606 (version "4.65")
607 (source
608 (origin
609 (method url-fetch)
610 (uri (string-append "mirror://gnu/glpk/glpk-"
611 version ".tar.gz"))
612 (sha256
613 (base32
614 "040sfaa9jclg2nqdh83w71sv9rc1sznpnfiripjdyr48cady50a2"))))))
615
616 (define-public 4ti2
617 (package
618 (name "4ti2")
619 (version "1.6.9")
620 (source
621 (origin
622 (method url-fetch)
623 (uri (string-append "https://github.com/4ti2/4ti2/releases/download/"
624 "Release_"
625 (string-map (lambda (c) (if (char=? c #\.) #\_ c))
626 version)
627 "/4ti2-" version ".tar.gz"))
628 (sha256
629 (base32 "0rj92x6p9m3la5gasjbj7sa569im527ffmka5y2sv1amgd3fflrh"))))
630 (build-system gnu-build-system)
631 (native-inputs
632 `(("which" ,(@ (gnu packages base) which)))) ; for the tests
633 (inputs
634 `(("glpk" ,glpk)
635 ("gmp" ,gmp)))
636 (home-page "http://www.4ti2.de/")
637 (synopsis "Mathematical tool suite for problems on linear spaces")
638 (description
639 "4ti2 implements algorithms for solving algebraic, geometric and
640 combinatorial problems on linear spaces. Among others, it solves systems
641 of linear equations, computes extreme rays of polyhedral cones, solves
642 integer programming problems and computes Markov bases for statistics.")
643 (license license:gpl2+)))
644
645 (define-public cddlib
646 (package
647 (name "cddlib")
648 (version "0.94i")
649 (source
650 (origin
651 (method url-fetch)
652 (uri (string-append "ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-"
653 (string-delete #\. version) ".tar.gz"))
654 (sha256
655 (base32
656 "00zdgiqb91vx6gd2103h3ijij0llspsxc6zz3iw2bll39fvkl4xq"))))
657 (build-system gnu-build-system)
658 (inputs
659 `(("gmp" ,gmp)))
660 (home-page "https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html")
661 (synopsis "Library for convex hulls and extreme rays of polyhedra")
662 (description
663 "The C-library cddlib implements the Double Description Method of
664 Motzkin et al. for generating all vertices (i.e. extreme points) and extreme
665 rays of a general convex polyhedron given by a system of linear inequalities
666 in arbitrary dimension. It can also be used for the converse operation of
667 computing convex hulls.")
668 (license license:gpl2+)))
669
670 (define-public lrslib
671 (package
672 (name "lrslib")
673 (version "7.1")
674 (source
675 (origin
676 (method url-fetch)
677 (uri (string-append "http://cgm.cs.mcgill.ca/~avis/C/lrslib/archive/"
678 "lrslib-0"
679 (string-delete #\. version) ".tar.gz"))
680 (sha256
681 (base32
682 "05kq3hzam31dlmkccv3v358r478kpvx76mw37ka12c6ypwv5dsnk"))))
683 (build-system gnu-build-system)
684 (inputs
685 `(("gmp" ,gmp)))
686 (arguments
687 `(#:tests? #f ; no check phase
688 #:make-flags `("CC=gcc"
689 ,(string-append "prefix=" (assoc-ref %outputs "out"))
690 "all-shared")
691 #:phases
692 (modify-phases %standard-phases
693 (replace 'configure
694 (lambda _
695 (substitute* "makefile"
696 (("-L \\.") "-L . -Wl,-rpath='$$ORIGIN/../lib'"))
697 #t)))))
698 (home-page "http://cgm.cs.mcgill.ca/~avis/C/lrs.html")
699 (synopsis "Convex hulls of polyhedra with exact arithmetic")
700 (description
701 "The C code of lrslib implements the reverse search algorithm for
702 vertex enumeration and convex hull problems. Its input file format is
703 compatible with cddlib. All computations are done exactly in either
704 multiple precision or fixed integer arithmetic. Output is not stored
705 in memory, so even problems with very large output sizes can sometimes
706 be solved.")
707 (license license:gpl2+)))
708
709 (define-public libcerf
710 (package
711 (name "libcerf")
712 (version "1.14")
713 (source
714 (origin
715 (method git-fetch)
716 (uri (git-reference
717 (url "https://jugit.fz-juelich.de/mlz/libcerf")
718 (commit (string-append "v" version))))
719 (file-name (git-file-name name version))
720 (sha256
721 (base32 "1ic2q7kvxpqmgxlishygvx8d00i4wn51vkq4fyac44ahhf6c3kwd"))))
722 (build-system cmake-build-system)
723 (native-inputs
724 `(("perl" ,perl)))
725 (home-page "https://jugit.fz-juelich.de/mlz/libcerf")
726 (synopsis "Library for complex error functions")
727 (description
728 "@code{libcerf} is a self-contained numeric library that provides an
729 efficient and accurate implementation of complex error functions, along with
730 Dawson, Faddeeva, and Voigt functions.")
731 (license license:expat)))
732
733 (define-public vinci
734 (package
735 (name "vinci")
736 (version "1.0.5")
737 (source
738 (origin
739 (method url-fetch)
740 (uri (string-append "https://www.math.u-bordeaux.fr/~aenge/software/"
741 "vinci/vinci-" version ".tar.gz"))
742 (sha256
743 (base32
744 "1aq0qc1y27iw9grhgnyji3290wwfznsrk3sg6ynqpxwjdda53h4m"))))
745 (build-system gnu-build-system)
746 (inputs
747 `(("lrslib" ,lrslib)))
748 (arguments
749 `(#:tests? #f ; no check phase
750 #:phases
751 (modify-phases %standard-phases
752 (replace 'configure
753 ;; register the lrs location in the config file
754 (lambda* (#:key inputs #:allow-other-keys)
755 (let* ((lrs (assoc-ref inputs "lrslib"))
756 (lrsexec (string-append lrs "/bin/lrs")))
757 (substitute* "vinci.h"
758 (("#define LRS_EXEC \"lrs\"")
759 (string-append "#define LRS_EXEC \"" lrsexec "\""))))
760 #t))
761 (replace 'install
762 (lambda* (#:key outputs #:allow-other-keys)
763 (let* ((out (assoc-ref outputs "out"))
764 (bin (string-append out "/bin")))
765 (install-file "vinci" bin))
766 #t)))))
767 (home-page
768 "https://www.math.u-bordeaux.fr/~aenge/?category=software&page=vinci")
769 (synopsis "Volume computation for polytopes")
770 (description
771 "Vinci implements a number of volume computation algorithms for convex
772 polytopes in arbitrary dimension. The polytopes can be given by their
773 V-representation (as the convex hull of a finite number of vertices), by
774 their H-representation (as the bounded intersection of a finite number of
775 halfspaces) or by their double description with both representations.")
776 (license license:gpl2+)))
777
778 (define-public arpack-ng
779 (package
780 (name "arpack-ng")
781 (version "3.8.0")
782 (home-page "https://github.com/opencollab/arpack-ng")
783 (source (origin
784 (method git-fetch)
785 (uri (git-reference (url home-page) (commit version)))
786 (file-name (git-file-name name version))
787 (sha256
788 (base32
789 "0l7as5z6xvbxly8alam9s4kws70952qq35a6vkljzayi4b9gbklx"))))
790 (build-system gnu-build-system)
791 (native-inputs
792 `(("autoconf" ,autoconf)
793 ("automake" ,automake)
794 ("libtool" ,libtool)
795 ("pkg-config" ,pkg-config)))
796 (inputs
797 `(("eigen" ,eigen)
798 ("lapack" ,lapack)
799 ("fortran" ,gfortran)))
800 (synopsis "Fortran subroutines for solving eigenvalue problems")
801 (description
802 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
803 large scale eigenvalue problems.")
804 (license (license:non-copyleft "file://COPYING"
805 "See COPYING in the distribution."))))
806
807 (define-public arpack-ng-3.3.0
808 (package
809 (inherit arpack-ng)
810 (version "3.3.0")
811 (source
812 (origin
813 (method git-fetch)
814 (uri (git-reference (url (package-home-page arpack-ng))
815 (commit version)))
816 (file-name (git-file-name (package-name arpack-ng) version))
817 (sha256
818 (base32
819 "00h6bjvxjq7bv0b8pwnc0gw33ns6brlqv00xx2rh3w9b5n205918"))))))
820
821 (define-public arpack-ng-openmpi
822 (package (inherit arpack-ng)
823 (name "arpack-ng-openmpi")
824 (inputs
825 `(("mpi" ,openmpi)
826 ,@(package-inputs arpack-ng)))
827 (arguments
828 (substitute-keyword-arguments (package-arguments arpack-ng)
829 ((#:configure-flags _ '())
830 ''("--enable-mpi"))
831 ((#:phases phases '%standard-phases)
832 `(modify-phases ,phases
833 (add-before 'check 'mpi-setup
834 ,%openmpi-setup)))))
835 (synopsis "Fortran subroutines for solving eigenvalue problems with MPI")))
836
837 (define-public lapack
838 (package
839 (name "lapack")
840 (version "3.9.0")
841 (source
842 (origin
843 (method url-fetch)
844 (uri (string-append "http://www.netlib.org/lapack/lapack-"
845 version ".tgz"))
846 (sha256
847 (base32
848 "1155qixp26c12yrxc76z9mlfw2h3xxymxxv5znpgzh5gaykpndgj"))))
849 (build-system cmake-build-system)
850 (home-page "http://www.netlib.org/lapack/")
851 (inputs `(("fortran" ,gfortran)
852 ("python" ,python-wrapper)))
853 (arguments
854 `(#:configure-flags (list
855 "-DBUILD_SHARED_LIBS:BOOL=YES"
856 "-DLAPACKE=ON"
857 ;; Build the 'LAPACKE_clatms' functions.
858 "-DLAPACKE_WITH_TMG=ON"
859 "-DBUILD_TESTING=ON")))
860 (synopsis "Library for numerical linear algebra")
861 (description
862 "LAPACK is a Fortran 90 library for solving the most commonly occurring
863 problems in numerical linear algebra.")
864 (license (license:non-copyleft "file://LICENSE"
865 "See LICENSE in the distribution."))))
866
867 (define-public clapack
868 (package
869 (name "clapack")
870 (version "3.2.1")
871 (source
872 (origin
873 (method url-fetch)
874 (uri (string-append "http://www.netlib.org/clapack/clapack-"
875 version "-CMAKE.tgz"))
876 (sha256
877 (base32
878 "0nnap9q1mv14g57dl3vkvxrdr10k5w7zzyxs6rgxhia8q8mphgqb"))))
879 (build-system cmake-build-system)
880 (arguments
881 `(#:phases
882 (modify-phases %standard-phases
883 ;; These tests use a lot of stack variables and segfault without
884 ;; lifting resource limits.
885 (add-after 'unpack 'disable-broken-tests
886 (lambda _
887 (substitute* "TESTING/CMakeLists.txt"
888 (("add_lapack_test.* xeigtstz\\)") ""))
889 #t))
890 (replace 'install
891 (lambda* (#:key outputs #:allow-other-keys)
892 (let* ((out (assoc-ref outputs "out"))
893 (libdir (string-append out "/lib"))
894 (f2cinc (string-append out "/include/libf2c")))
895 (mkdir-p f2cinc)
896 (display (getcwd))
897 (for-each (lambda (file)
898 (install-file file libdir))
899 '("SRC/liblapack.a"
900 "F2CLIBS/libf2c/libf2c.a"
901 "TESTING/MATGEN/libtmglib.a"
902 "BLAS/SRC/libblas.a"))
903 (for-each (lambda (file)
904 (install-file file f2cinc))
905 (cons "F2CLIBS/libf2c/arith.h"
906 (find-files (string-append "../clapack-"
907 ,version "-CMAKE/F2CLIBS/libf2c")
908 "\\.h$")))
909 (copy-recursively (string-append "../clapack-"
910 ,version "-CMAKE/INCLUDE")
911 (string-append out "/include"))
912 #t))))))
913 (home-page "https://www.netlib.org/clapack/")
914 (synopsis "Numerical linear algebra library for C")
915 (description
916 "The CLAPACK library was built using a Fortran to C conversion utility
917 called f2c. The entire Fortran 77 LAPACK library is run through f2c to obtain
918 C code, and then modified to improve readability. CLAPACK's goal is to
919 provide LAPACK for someone who does not have access to a Fortran compiler.")
920 (license (license:non-copyleft "file://LICENSE"
921 "See LICENSE in the distribution."))))
922
923 (define-public scalapack
924 (package
925 (name "scalapack")
926 (version "2.0.2")
927 (source
928 (origin
929 (method url-fetch)
930 (uri (string-append "http://www.netlib.org/scalapack/scalapack-"
931 version ".tgz"))
932 (sha256
933 (base32
934 "0p1r61ss1fq0bs8ynnx7xq4wwsdvs32ljvwjnx6yxr8gd6pawx0c"))
935 (patches (search-patches "scalapack-blacs-mpi-deprecations.patch"))))
936 (build-system cmake-build-system)
937 (inputs
938 `(("mpi" ,openmpi)
939 ("fortran" ,gfortran)
940 ("lapack" ,lapack))) ;for testing only
941 (arguments
942 `(#:configure-flags `("-DBUILD_SHARED_LIBS:BOOL=YES")
943 #:phases (modify-phases %standard-phases
944 (add-before 'check 'mpi-setup
945 ,%openmpi-setup))))
946 (home-page "http://www.netlib.org/scalapack/")
947 (synopsis "Library for scalable numerical linear algebra")
948 (description
949 "ScaLAPACK is a Fortran 90 library of high-performance linear algebra
950 routines on parallel distributed memory machines. ScaLAPACK solves dense and
951 banded linear systems, least squares problems, eigenvalue problems, and
952 singular value problems.")
953 (license (license:non-copyleft "file://LICENSE"
954 "See LICENSE in the distribution."))))
955
956 (define-public gnuplot
957 (package
958 (name "gnuplot")
959 (version "5.4.2")
960 (source (origin
961 (method url-fetch)
962 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
963 version "/gnuplot-"
964 version ".tar.gz"))
965 (sha256
966 (base32 "1fp7rbhjmz2w63r72kicf8lfszzimz2csfx868fracw167hpaz75"))))
967 (build-system gnu-build-system)
968 (inputs `(("readline" ,readline)
969 ("cairo" ,cairo)
970 ("pango" ,pango)
971 ("gd" ,gd)
972 ("lua" ,lua)))
973 (native-inputs
974 `(("pkg-config" ,pkg-config)
975 ("texlive" ,texlive-tiny)))
976 (arguments `(#:configure-flags (list (string-append
977 "--with-texdir=" %output
978 "/texmf-local/tex/latex/gnuplot"))
979 ;; Plot on a dumb terminal during tests.
980 #:make-flags '("GNUTERM=dumb")))
981 (home-page "http://www.gnuplot.info")
982 (synopsis "Command-line driven graphing utility")
983 (description "Gnuplot is a portable command-line driven graphing
984 utility. It was originally created to allow scientists and students to
985 visualize mathematical functions and data interactively, but has grown to
986 support many non-interactive uses such as web scripting. It is also used as a
987 plotting engine by third-party applications like Octave.")
988 ;; X11 Style with the additional restriction that derived works may only be
989 ;; distributed as patches to the original.
990 (license (license:fsf-free
991 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
992
993 (define-public gctp
994 (package
995 (name "gctp")
996 (version "2.0.0")
997 (source
998 (origin
999 (method git-fetch)
1000 (uri (git-reference
1001 (url "https://github.com/OkoSanto/GCTP")
1002 (commit (string-append "v" version))))
1003 (file-name (git-file-name name version))
1004 (sha256
1005 (base32 "11wqmd443b4nksdbzp1msdws3av948nmwq1xz80w6hka3ss2aigd"))))
1006 (native-inputs
1007 `(("fortran" ,gfortran)))
1008 (build-system gnu-build-system)
1009 (synopsis "General Cartographic Transformation Package (GCTP)")
1010 (description
1011 "The General Cartographic Transformation Package (GCTP) is a system of
1012 software routines designed to permit the transformation of coordinate pairs
1013 from one map projection to another. The GCTP is the standard computer
1014 software used by the National Mapping Division for map projection
1015 computations.")
1016 (home-page "https://github.com/OkoSanto/GCTP")
1017 (license license:public-domain))) ;https://www2.usgs.gov/laws/info_policies.html
1018
1019 (define-public hdf4
1020 (package
1021 (name "hdf4")
1022 (version "4.2.14")
1023 (source
1024 (origin
1025 (method url-fetch)
1026 (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
1027 version "/src/hdf-" version ".tar.bz2"))
1028 (sha256
1029 (base32 "0n29klrrbwan9307np0d9hr128dlpc4nnlf57a140080ll3jmp8l"))
1030 (patches (search-patches "hdf4-architectures.patch"
1031 "hdf4-reproducibility.patch"
1032 "hdf4-shared-fortran.patch"
1033 "hdf4-tirpc.patch"))))
1034 (build-system gnu-build-system)
1035 (native-inputs
1036 `(("gfortran" ,gfortran)
1037 ("bison" ,bison)
1038 ("flex" ,flex)))
1039 (inputs
1040 `(("zlib" ,zlib)
1041 ("libjpeg" ,libjpeg-turbo)
1042 ("libtirpc" ,libtirpc)))
1043 (arguments
1044 `(#:parallel-tests? #f
1045 #:configure-flags (list "--enable-shared"
1046 (string-append "CPPFLAGS=-I"
1047 (assoc-ref %build-inputs "libtirpc")
1048 "/include/tirpc"))
1049 #:phases
1050 (modify-phases %standard-phases
1051 ;; This is inspired by two of Debian's patches.
1052 (add-before 'configure 'add-more-aarch64-support
1053 (lambda _
1054 (substitute* '("mfhdf/ncgen/ncgen.l"
1055 "mfhdf/ncgen/ncgenyy.c"
1056 "mfhdf/libsrc/netcdf.h.in")
1057 (("AIX5L64") "__aarch64__"))
1058 #t))
1059 (add-before 'configure 'patchbuild
1060 (lambda _
1061 (substitute*
1062 '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
1063 (("/bin/rm") "rm")
1064 (("/bin/mkdir") "mkdir"))
1065 (substitute* (find-files "." "^Makefile\\.in$")
1066 (("@HDF_BUILD_XDR_TRUE@XDR_ADD = \
1067 -R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
1068 (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
1069 -R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
1070 -R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
1071 #t))
1072 (add-after 'configure 'patch-settings
1073 (lambda _
1074 ;; libhdf4.settings contains the full path of the
1075 ;; compilers used, and its contents are included in
1076 ;; .so-files. We truncate the hashes to avoid
1077 ;; unnecessary store references to those compilers:
1078 (substitute* "libhdf4.settings"
1079 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
1080 (string-append prefix (string-take hash 10) "...")))
1081 #t))
1082 (add-after 'install 'provide-absolute-libjpeg-reference
1083 (lambda* (#:key inputs outputs #:allow-other-keys)
1084 (let ((out (assoc-ref outputs "out"))
1085 (libjpeg (assoc-ref inputs "libjpeg")))
1086 ;; libjpeg-turbo does not provide a .la file, so libtool is
1087 ;; unable to add an absolute reference for -ljpeg in the .la
1088 ;; files. Fix it manually to avoid having to propagate it.
1089 (substitute* (find-files (string-append out "/lib") "\\.la$")
1090 (("-ljpeg")
1091 (string-append "-L" libjpeg "/lib -ljpeg")))
1092 #t))))))
1093 (home-page "https://www.hdfgroup.org/products/hdf4/")
1094 (synopsis
1095 "Library and multi-object file format for storing and managing data")
1096 (description "HDF4 is a library and multi-object file format for storing
1097 and managing data between machines. HDF4 is an older hierarchical data format,
1098 incompatible with HDF5.")
1099 (license
1100 (license:non-copyleft
1101 "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
1102
1103 (define-public hdf4-alt
1104 (package
1105 (inherit hdf4)
1106 (name "hdf4-alt")
1107 (arguments
1108 (substitute-keyword-arguments (package-arguments hdf4)
1109 ((#:configure-flags flags) `(cons* "--disable-netcdf" ,flags))))
1110 (synopsis
1111 "HDF4 without netCDF API, can be combined with the regular netCDF library")))
1112
1113 (define-public hdf5-1.8
1114 (package
1115 (name "hdf5")
1116 (version "1.8.22")
1117 (source
1118 (origin
1119 (method url-fetch)
1120 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
1121 "hdf5-" (version-major+minor version)
1122 "/hdf5-" version "/src/hdf5-"
1123 version ".tar.bz2")
1124 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
1125 "current"
1126 (match (string-split version #\.)
1127 ((major minor _ ...)
1128 (string-append major minor)))
1129 "/src/hdf5-" version ".tar.bz2")))
1130 (sha256
1131 (base32 "194ki2s5jrgl4czkvy5nc9nwjyapah0fj72l0gb0aysplp38i6v8"))
1132 (patches (search-patches "hdf5-config-date.patch"))))
1133 (build-system gnu-build-system)
1134 (inputs
1135 `(("zlib" ,zlib)))
1136 (native-inputs
1137 `(("gfortran" ,gfortran)
1138 ("perl" ,perl))) ;part of the test machinery needs Perl
1139 (outputs '("out" ; core library
1140 "fortran")) ; fortran interface
1141 (arguments
1142 `(;; Some of the users, notably Flann, need the C++ interface.
1143 #:configure-flags '("--enable-cxx"
1144 "--enable-fortran"
1145 "--enable-fortran2003"
1146
1147 ;; Build a thread-safe library. Unfortunately,
1148 ;; 'configure' invites you to either turn off C++,
1149 ;; Fortran, and the high-level interface (HL), or
1150 ;; to pass '--enable-unsupported'. Debian
1151 ;; packagers chose to pass '--enable-unsupported'
1152 ;; and we follow their lead here.
1153 "--enable-threadsafe"
1154 "--with-pthread"
1155 "--enable-unsupported")
1156 ;; Use -fPIC to allow the R bindings to link with the static libraries
1157 #:make-flags (list "CFLAGS=-fPIC"
1158 "CXXFLAGS=-fPIC")
1159 #:phases
1160 (modify-phases %standard-phases
1161 (add-before 'configure 'patch-configure
1162 (lambda* (#:key outputs #:allow-other-keys)
1163 (substitute* "configure"
1164 (("/bin/mv") "mv"))
1165 (substitute* "fortran/src/Makefile.in"
1166 (("libhdf5_fortran_la_LDFLAGS =")
1167 (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
1168 (assoc-ref outputs "fortran") "/lib")))
1169 (substitute* "hl/fortran/src/Makefile.in"
1170 (("libhdf5hl_fortran_la_LDFLAGS =")
1171 (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
1172 (assoc-ref outputs "fortran") "/lib")))
1173 #t))
1174 (add-after 'configure 'patch-settings
1175 (lambda _
1176 ;; libhdf5.settings contains the full path of the
1177 ;; compilers used, and its contents are included in
1178 ;; libhdf5.so. We truncate the hashes to avoid
1179 ;; unnecessary store references to those compilers:
1180 (substitute* "src/libhdf5.settings"
1181 (("(/gnu/store/)([a-zA-Z0-9]*)" all prefix hash)
1182 (string-append prefix (string-take hash 10) "..."))
1183 ;; Don't record the build-time kernel version to make the
1184 ;; settings file reproducible.
1185 (("Uname information:.*")
1186 "Uname information: Linux\n"))
1187 #t))
1188 (add-after 'install 'patch-references
1189 (lambda* (#:key inputs outputs #:allow-other-keys)
1190 (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
1191 (zlib (assoc-ref inputs "zlib")))
1192 (substitute* (find-files bin "h5p?cc")
1193 (("-lz" lib)
1194 (string-append "-L" zlib "/lib " lib)))
1195 #t)))
1196 (add-after 'install 'split
1197 (lambda* (#:key inputs outputs #:allow-other-keys)
1198 ;; Move all fortran-related files
1199 (let* ((out (assoc-ref outputs "out"))
1200 (bin (string-append out "/bin"))
1201 (lib (string-append out "/lib"))
1202 (inc (string-append out "/include"))
1203 (ex (string-append out "/share/hdf5_examples/fortran"))
1204 (fort (assoc-ref outputs "fortran"))
1205 (fbin (string-append fort "/bin"))
1206 (flib (string-append fort "/lib"))
1207 (finc (string-append fort "/include"))
1208 (fex (string-append fort "/share/hdf5_examples/fortran")))
1209 (mkdir-p fbin)
1210 (mkdir-p flib)
1211 (mkdir-p finc)
1212 (mkdir-p fex)
1213 ;; Note: When built with --enable-parallel, the 'h5fc' file
1214 ;; doesn't exist, hence this condition.
1215 (when (file-exists? (string-append bin "/h5fc"))
1216 (rename-file (string-append bin "/h5fc")
1217 (string-append fbin "/h5fc")))
1218 (for-each (lambda (file)
1219 (rename-file file
1220 (string-append flib "/" (basename file))))
1221 (find-files lib ".*fortran.*"))
1222 (for-each (lambda (file)
1223 (rename-file file
1224 (string-append finc "/" (basename file))))
1225 (find-files inc ".*mod"))
1226 (for-each (lambda (file)
1227 (rename-file file
1228 (string-append fex "/" (basename file))))
1229 (find-files ex ".*"))
1230 (delete-file-recursively ex))
1231 #t)))))
1232 (home-page "https://www.hdfgroup.org")
1233 (synopsis "Management suite for extremely large and complex data")
1234 (description "HDF5 is a suite that makes possible the management of
1235 extremely large and complex data collections.")
1236 (license (license:x11-style
1237 "https://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
1238
1239 (define-public hdf5-1.10
1240 (package
1241 (inherit hdf5-1.8)
1242 (version "1.10.7")
1243 (source
1244 (origin
1245 (method url-fetch)
1246 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
1247 "hdf5-" (version-major+minor version)
1248 "/hdf5-" version "/src/hdf5-"
1249 version ".tar.bz2")
1250 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
1251 "current"
1252 (apply string-append
1253 (take (string-split version #\.) 2))
1254 "/src/hdf5-" version ".tar.bz2")))
1255 (sha256
1256 (base32 "0pm5xxry55i0h7wmvc7svzdaa90rnk7h78rrjmnlkz2ygsn8y082"))
1257 (patches (search-patches "hdf5-config-date.patch"))))))
1258
1259 (define-public hdf5-1.12
1260 (package
1261 (inherit hdf5-1.8)
1262 (version "1.12.0")
1263 (source
1264 (origin
1265 (method url-fetch)
1266 (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
1267 "hdf5-" (version-major+minor version)
1268 "/hdf5-" version "/src/hdf5-"
1269 version ".tar.bz2")
1270 (string-append "https://support.hdfgroup.org/ftp/HDF5/"
1271 "current"
1272 (apply string-append
1273 (take (string-split version #\.) 2))
1274 "/src/hdf5-" version ".tar.bz2")))
1275 (sha256
1276 (base32 "0qazfslkqbmzg495jafpvqp0khws3jkxa0z7rph9qvhacil6544p"))
1277 (patches (search-patches "hdf5-config-date.patch"))))))
1278
1279 (define-public hdf5
1280 ;; Default version of HDF5.
1281 hdf5-1.10)
1282
1283 (define-public hdf-java
1284 (package
1285 (name "hdf-java")
1286 (version "3.3.2")
1287 (source
1288 (origin
1289 (method url-fetch)
1290 (uri (string-append
1291 "https://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfjni-"
1292 version "/src/CMake-hdfjava-" version ".tar.gz"))
1293 (sha256
1294 (base32 "0m1gp2aspcblqzmpqbdpfp6giskws85ds6p5gz8sx7asyp7wznpr"))
1295 (modules '((guix build utils)))
1296 (snippet ; Make sure we don't use the bundled sources and binaries.
1297 `(begin
1298 (for-each delete-file
1299 (list "SZip.tar.gz" "ZLib.tar.gz" "JPEG8d.tar.gz"
1300 "HDF4.tar.gz" "HDF5.tar.gz"))
1301 (delete-file-recursively ,(string-append "hdfjava-" version "/lib"))
1302 #t))))
1303 (build-system gnu-build-system)
1304 (native-inputs
1305 `(("jdk" ,icedtea "jdk")
1306 ("automake" ,automake) ; For up to date 'config.guess' and 'config.sub'.
1307 ;; For tests:
1308 ("hamcrest-core" ,java-hamcrest-core)
1309 ("junit" ,java-junit)
1310 ("slf4j-simple" ,java-slf4j-simple)))
1311 (inputs
1312 `(("hdf4" ,hdf4)
1313 ("hdf5" ,hdf5-1.8)
1314 ("zlib" ,zlib)
1315 ("libjpeg" ,libjpeg-turbo)
1316 ("slf4j-api" ,java-slf4j-api)))
1317 (arguments
1318 `(#:configure-flags
1319 (list (string-append "--target=" ,(or (%current-target-system) (%current-system)))
1320 (string-append "--with-jdk=" (assoc-ref %build-inputs "jdk") "/include,"
1321 (assoc-ref %build-inputs "jdk") "/lib" )
1322 (string-append "--with-hdf4=" (assoc-ref %build-inputs "hdf4") "/lib")
1323 (string-append "--with-hdf5=" (assoc-ref %build-inputs "hdf5") "/lib"))
1324
1325 #:make-flags
1326 (list (string-append "HDFLIB=" (assoc-ref %build-inputs "hdf4") "/lib")
1327 (string-append "HDF5LIB=" (assoc-ref %build-inputs "hdf5") "/lib")
1328 (string-append "ZLIB=" (assoc-ref %build-inputs "zlib") "/lib/libz.so")
1329 (string-append "JPEGLIB="
1330 (assoc-ref %build-inputs "libjpeg") "/lib/libjpeg.so")
1331 "LLEXT=so")
1332
1333 #:phases
1334 (modify-phases %standard-phases
1335 (add-before 'configure 'chdir-to-source
1336 (lambda _ (chdir ,(string-append "hdfjava-" version)) #t))
1337 (add-before 'configure 'patch-build
1338 (lambda* (#:key inputs outputs #:allow-other-keys)
1339 (substitute* "configure"
1340 (("COPT=\"") "COPT=\"-O2 ") ; CFLAGS is ignored in Makefiles
1341 (("/bin/cat") (which "cat")))
1342 ;; Set classpath for compilation
1343 (substitute* '("hdf/hdf5lib/Makefile.in"
1344 "hdf/hdf5lib/exceptions/Makefile.in"
1345 "hdf/hdflib/Makefile.in")
1346 (("\\$\\(TOP\\)/lib/slf4j-api-1\\.7\\.5\\.jar")
1347 (string-append (assoc-ref inputs "slf4j-api")
1348 "/share/java/slf4j-api.jar")))
1349 ;; Replace outdated config.sub and config.guess:
1350 (with-directory-excursion "config"
1351 (for-each (lambda (file)
1352 (install-file
1353 (string-append (assoc-ref inputs "automake")
1354 "/share/automake-"
1355 ,(version-major+minor (package-version automake))
1356 "/" file) "."))
1357 '("config.sub" "config.guess")))
1358
1359 ;; Fix embedded version number
1360 (let ((hdf5version (list ,@(string-split (package-version hdf5) #\.))))
1361 (substitute* "hdf/hdf5lib/H5.java"
1362 (("1, 8, 19")
1363 (string-join hdf5version ", "))))
1364
1365 (mkdir-p (string-append (assoc-ref outputs "out")))
1366 ;; Set classpath for tests
1367 (let* ((build-dir (getcwd))
1368 (lib (string-append build-dir "/lib"))
1369 (jhdf (string-append lib "/jhdf.jar"))
1370 (jhdf5 (string-append lib "/jhdf5.jar"))
1371 (testjars
1372 (append
1373 (map (lambda (i)
1374 (string-append (assoc-ref inputs i)
1375 "/share/java/" i ".jar"))
1376 '("slf4j-api" "slf4j-simple"))
1377 (list
1378 (car (find-files (assoc-ref inputs "junit") "jar$"))
1379 (car (find-files (assoc-ref inputs "hamcrest-core")
1380 "jar$")))))
1381 (class-path
1382 (string-join `("." ,build-dir ,jhdf ,jhdf5 ,@testjars) ":")))
1383
1384 (substitute* '("test/hdf5lib/Makefile.in"
1385 "test/hdf5lib/junit.sh.in"
1386 "examples/runExample.sh.in")
1387 (("/usr/bin/test")
1388 (string-append (assoc-ref inputs "coreutils")
1389 "/bin/test"))
1390 (("/usr/bin/uname")
1391 (string-append (assoc-ref inputs "coreutils")
1392 "/bin/uname"))
1393 (("CLASSPATH=[^\n]*")
1394 (string-append "CLASSPATH=" class-path)))
1395 (setenv "CLASSPATH" class-path))
1396 #t))
1397 (add-before 'check 'build-examples
1398 (lambda _
1399 (apply invoke `("javac"
1400 ,@(find-files "examples" ".*\\.java"))))))
1401
1402 #:parallel-build? #f
1403
1404 #:parallel-tests? #f ))
1405 (home-page "https://support.hdfgroup.org/products/java")
1406 (synopsis "Java interface for the HDF4 and HDF5 libraries")
1407 (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
1408 the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
1409 implemented in C.")
1410
1411 ;; BSD-style license:
1412 (license (license:x11-style
1413 "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
1414 /current/src/unpacked/COPYING"))))
1415
1416 (define-public hdf-eos2
1417 (package
1418 (name "hdf-eos2")
1419 (version "19.1.0")
1420 (source
1421 (origin
1422 (method url-fetch)
1423 (uri "ftp://edhs1.gsfc.nasa.gov\
1424 /edhs/hdfeos/latest_release/HDF-EOS2.19v1.00.tar.Z")
1425 (sha256
1426 (base32 "0c9fcz25s292ldap12wxmlrvnyz99z24p63d8fwx51bf8s0s1zrz"))
1427 (patches (search-patches "hdf-eos2-remove-gctp.patch"
1428 "hdf-eos2-build-shared.patch"
1429 "hdf-eos2-fortrantests.patch"))))
1430 (build-system gnu-build-system)
1431 (native-inputs
1432 `(("gfortran" ,gfortran)))
1433 (inputs
1434 `(("hdf4" ,hdf4-alt) ; assume most HDF-EOS2 users won't use the HDF4 netCDF API
1435 ;; XXX: These inputs are really dependencies of hdf4.
1436 ("zlib" ,zlib)
1437 ("libjpeg" ,libjpeg-turbo)
1438 ("libtirpc" ,libtirpc)
1439
1440 ("gctp" ,gctp)))
1441 (arguments
1442 `( #:configure-flags '("--enable-install-include" "--enable-shared"
1443 "CC=h4cc -Df2cFortran" "LIBS=-lgctp")
1444 #:parallel-tests? #f))
1445 (home-page "https://hdfeos.org/software/library.php#HDF-EOS2")
1446 (synopsis "HDF4-based data format for NASA's Earth Observing System")
1447 (description "HDF-EOS2 is a software library built on HDF4 which supports
1448 the construction of data structures used in NASA's Earth Observing
1449 System (Grid, Point and Swath).")
1450
1451 ;; Source files carry a permissive license header.
1452 (license (license:non-copyleft home-page))))
1453
1454 (define-public hdf-eos5
1455 (package
1456 (name "hdf-eos5")
1457 (version "1.15")
1458 (source (origin
1459 (method url-fetch)
1460 (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
1461 /edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
1462 (sha256
1463 (base32
1464 "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
1465 (patches (search-patches "hdf-eos5-build-shared.patch"
1466 "hdf-eos5-remove-gctp.patch"
1467 "hdf-eos5-fix-szip.patch"
1468 "hdf-eos5-fortrantests.patch"))))
1469 (native-inputs
1470 `(("gfortran" ,gfortran)))
1471 (build-system gnu-build-system)
1472 (inputs
1473 `(("hdf5" ,hdf5-1.8)
1474 ("zlib" ,zlib)
1475 ("gctp" ,gctp)))
1476 (arguments
1477 `(#:configure-flags '("--enable-install-include" "--enable-shared"
1478 "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
1479 #:parallel-tests? #f))
1480 (synopsis "HDF5-based data format for NASA's Earth Observing System")
1481 (description
1482 "HDF-EOS5 is a software library built on HDF5 to support the construction
1483 of data structures used in NASA's Earth Observing System (Grid, Point and
1484 Swath).")
1485 (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
1486
1487 ;; Source files carry a permissive license header.
1488 (license (license:non-copyleft home-page))))
1489
1490 (define-public hdf5-parallel-openmpi
1491 (package/inherit hdf5-1.10 ;use the latest
1492 (name "hdf5-parallel-openmpi")
1493 (inputs
1494 `(("mpi" ,openmpi)
1495 ,@(package-inputs hdf5)))
1496 (arguments
1497 (substitute-keyword-arguments (package-arguments hdf5)
1498 ((#:configure-flags flags)
1499 ``("--enable-parallel"
1500 ,@(delete "--enable-cxx"
1501 (delete "--enable-threadsafe" ,flags))))
1502 ((#:phases phases)
1503 `(modify-phases ,phases
1504 (add-after 'build 'mpi-setup
1505 ,%openmpi-setup)
1506 (add-before 'check 'patch-tests
1507 (lambda _
1508 ;; OpenMPI's mpirun will exit with non-zero status if it
1509 ;; detects an "abnormal termination", i.e. any process not
1510 ;; calling MPI_Finalize(). Since the test is explicitly
1511 ;; avoiding MPI_Finalize so as not to have at_exit and thus
1512 ;; H5C_flush_cache from being called, mpirun will always
1513 ;; complain, so turn this test off.
1514 (substitute* "testpar/Makefile"
1515 (("(^TEST_PROG_PARA.*)t_pflush1(.*)" front back)
1516 (string-append front back "\n")))
1517 (substitute* "tools/test/h5diff/testph5diff.sh"
1518 (("/bin/sh") (which "sh")))
1519 #t))))))
1520 (synopsis "Management suite for data with parallel IO support")))
1521
1522 (define-public hdf5-blosc
1523 (package
1524 (name "hdf5-blosc")
1525 (version "1.0.0")
1526 (source
1527 (origin
1528 (method git-fetch)
1529 (uri (git-reference
1530 (url "https://github.com/Blosc/hdf5-blosc")
1531 (commit (string-append "v" version))))
1532 (file-name (git-file-name name version))
1533 (sha256
1534 (base32 "1nj2bm1v6ymm3fmyvhbn6ih5fgdiapavlfghh1pvbmhw71cysyqs"))))
1535 (build-system cmake-build-system)
1536 (arguments
1537 `(#:configure-flags
1538 (list (string-append "-DBLOSC_INSTALL_DIR="
1539 (assoc-ref %build-inputs "c-blosc"))
1540 (string-append "-DPLUGIN_INSTALL_PATH="
1541 (assoc-ref %outputs "out")
1542 "/hdf5/lib/plugin"))
1543 #:phases
1544 (modify-phases %standard-phases
1545 (add-after 'unpack 'do-not-build-blosc
1546 (lambda _
1547 (substitute* "CMakeLists.txt"
1548 (("set\\(BLOSC_INSTALL_DIR.*") "")
1549 (("ExternalProject_Add\\(project_blosc") "message("))
1550 #t)))))
1551 (inputs
1552 `(("c-blosc" ,c-blosc)
1553 ("hdf5" ,hdf5-1.10)))
1554 (home-page "https://github.com/Blosc/hdf5-blosc")
1555 (synopsis "Filter for HDF5 using the Blosc compressor")
1556 (description "This is a filter for HDF5 that uses the Blosc compressor; by
1557 installing this filter, you can read and write HDF5 files with
1558 Blosc-compressed datasets.")
1559 (license license:expat)))
1560
1561 (define-public h5check
1562 (package
1563 (name "h5check")
1564 (version "2.0.1")
1565 (source
1566 (origin
1567 (method url-fetch)
1568 (uri (string-append "https://www.hdfgroup.org/ftp/HDF5/tools/"
1569 "h5check/src/h5check-" version ".tar.gz"))
1570 (sha256
1571 (base32
1572 "1gm76jbwhz9adbxgn14zx8cj33dmjdr2g5xcy0m9c2gakp8w59kj"))))
1573 (build-system gnu-build-system)
1574 (inputs `(("hdf5" ,hdf5-1.8))) ;h5cc for tests
1575 (home-page "https://www.hdfgroup.org/products/hdf5_tools/h5check.html")
1576 (synopsis "HDF5 format checker")
1577 (description "@code{h5check} is a validation tool for verifying that an
1578 HDF5 file is encoded according to the HDF File Format Specification.")
1579 (license (license:x11-style "file://COPYING"))))
1580
1581 (define-public itpp
1582 (package
1583 (name "itpp")
1584 (version "4.3.1")
1585 (source (origin
1586 (method url-fetch)
1587 (uri (string-append "mirror://sourceforge/itpp/itpp/"
1588 version "/itpp-"
1589 version ".tar.gz"))
1590 (sha256
1591 (base32
1592 "14ddy2xnb6sgp4hiax9v5sv4pr4l4dd4ps76nfha3nrpr1ikhcqm"))))
1593 (build-system cmake-build-system)
1594 (arguments `(#:tests? #f)) ; Tests require googletest *sources*
1595 (inputs `(("lapack" ,lapack)
1596 ("fftw" ,fftw)))
1597 ;; FIXME: Even though the fonts are available dvips complains:
1598 ;; "Font cmmi10 not found; characters will be left blank."
1599 (native-inputs
1600 `(("texlive" ,texlive-tiny)
1601 ("ghostscript" ,ghostscript)
1602 ("doxygen" ,doxygen)))
1603 (home-page "http://itpp.sourceforge.net")
1604 (synopsis "C++ library of maths, signal processing and communication classes")
1605 (description "IT++ is a C++ library of mathematical, signal processing and
1606 communication classes and functions. Its main use is in simulation of
1607 communication systems and for performing research in the area of
1608 communications. The kernel of the library consists of generic vector and
1609 matrix classes, and a set of accompanying routines. Such a kernel makes IT++
1610 similar to MATLAB, GNU Octave or SciPy.")
1611 (license license:gpl3+)))
1612
1613 (define-public netcdf
1614 (package
1615 (name "netcdf")
1616 (version "4.7.4")
1617 (source
1618 (origin
1619 (method url-fetch)
1620 (uri (string-append
1621 "https://www.unidata.ucar.edu/downloads/netcdf/ftp/"
1622 "netcdf-c-" version ".tar.gz"))
1623 (sha256
1624 (base32
1625 "1a2fpp15a2rl1m50gcvvzd9y6bavl6vjf9zzf63sz5gdmq06yiqf"))
1626 (patches (search-patches "netcdf-date-time.patch"))))
1627 (build-system gnu-build-system)
1628 (native-inputs
1629 `(("m4" ,m4)
1630 ("doxygen" ,doxygen)
1631 ("graphviz" ,graphviz)))
1632 (inputs
1633 `(("hdf4" ,hdf4-alt)
1634 ("hdf5" ,hdf5)
1635 ("curl" ,curl)
1636 ("zlib" ,zlib)
1637 ("libjpeg" ,libjpeg-turbo)))
1638 (arguments
1639 `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
1640
1641 #:phases (modify-phases %standard-phases
1642 (add-before 'configure 'fix-source-date
1643 (lambda _
1644 ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
1645 ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
1646 ;; to '1st hour of the current day', and therefore makes the
1647 ;; package not reproducible.
1648 (substitute* "./configure"
1649 (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
1650 "date --date='@0'"))
1651 #t))
1652 (add-after 'configure 'patch-settings
1653 (lambda _
1654 ;; libnetcdf.settings contains the full filename of the compilers
1655 ;; used to build the library. We truncate the hashes of those
1656 ;; filenames to avoid unnecessary references to the corresponding
1657 ;; store items.
1658 (substitute* "libnetcdf.settings"
1659 (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
1660 (string-append prefix (string-take hash 10) "...")))
1661 #t)))
1662
1663 #:parallel-tests? #f)) ;various race conditions
1664 (home-page "https://www.unidata.ucar.edu/software/netcdf/")
1665 (synopsis "Library for scientific data")
1666 (description "NetCDF is an interface for scientific data access and a
1667 software library that provides an implementation of the interface. The netCDF
1668 library defines a machine-independent format for representing scientific data.
1669 Together, the interface, library, and format support the creation, access, and
1670 sharing of scientific data.")
1671 (license (license:x11-style "file://COPYRIGHT"))))
1672
1673 (define-public netcdf-parallel-openmpi
1674 (package (inherit netcdf)
1675 (name "netcdf-parallel-openmpi")
1676 (inputs
1677 `(("mpi" ,openmpi)
1678 ,@(alist-replace "hdf5" (list hdf5-parallel-openmpi)
1679 (package-inputs netcdf))))
1680 ;; TODO: Replace pkg-config references in nc-config with absolute references
1681 (arguments
1682 (substitute-keyword-arguments (package-arguments netcdf)
1683 ((#:configure-flags flags)
1684 `(cons* "CC=mpicc" "CXX=mpicxx"
1685 "--enable-parallel-tests"
1686 ;; Shared libraries not supported with parallel IO.
1687 "--disable-shared" "--with-pic"
1688 ,flags))
1689 ((#:phases phases '%standard-phases)
1690 `(modify-phases ,phases
1691 (add-after 'build 'mpi-setup
1692 ,%openmpi-setup)))))))
1693
1694 (define-public netcdf-fortran
1695 (package
1696 (name "netcdf-fortran")
1697 (version "4.5.3")
1698 (source (origin
1699 (method url-fetch)
1700 (uri (string-append
1701 "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
1702 version ".tar.gz"))
1703 (sha256
1704 (base32
1705 "0x4acvfhbsx1q79dkkwrwbgfhm0w5ngnp4zj5kk92s1khihmqfhj"))))
1706 (build-system gnu-build-system)
1707 (arguments
1708 `(#:parallel-tests? #f))
1709 (inputs
1710 `(("netcdf" ,netcdf)))
1711 (native-inputs
1712 `(("gfortran" ,gfortran)))
1713 (synopsis "Fortran interface for the netCDF library")
1714 (description (package-description netcdf))
1715 (home-page (package-home-page netcdf))
1716 (license (package-license netcdf))))
1717
1718 (define-public nlopt
1719 (package
1720 (name "nlopt")
1721 (version "2.4.2")
1722 (source (origin
1723 (method url-fetch)
1724 (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
1725 version ".tar.gz"))
1726 (sha256
1727 (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
1728 (build-system gnu-build-system)
1729 (arguments
1730 `(;; Shared libraries are not built by default. They are required to
1731 ;; build the Guile, Octave, and Python bindings.
1732 #:configure-flags '("--enable-shared")
1733
1734 #:phases
1735 (modify-phases %standard-phases
1736 (add-before 'configure 'set-libnlopt-file-name
1737 (lambda* (#:key outputs #:allow-other-keys)
1738 ;; Make sure the Scheme module refers to the library by its
1739 ;; absolute file name (we cannot do that from a snippet
1740 ;; because the expansion of @libdir@ contains
1741 ;; ${exec_prefix}.)
1742 (let ((out (assoc-ref outputs "out")))
1743 (substitute* "swig/nlopt.scm.in"
1744 (("libnlopt")
1745 (string-append out "/lib/libnlopt")))
1746 #t))))))
1747 (inputs `(("guile" ,guile-2.0)))
1748 (native-inputs `(("pkg-config" ,pkg-config)))
1749 (home-page "http://ab-initio.mit.edu/wiki/")
1750 (synopsis "Library for nonlinear optimization")
1751 (description "NLopt is a library for nonlinear optimization, providing a
1752 common interface for a number of different free optimization routines available
1753 online as well as original implementations of various other algorithms.")
1754 (license license:lgpl2.1+)))
1755
1756 (define-public ipopt
1757 (package
1758 (name "ipopt")
1759 (version "3.13.4")
1760 (source (origin
1761 (method git-fetch)
1762 (uri (git-reference
1763 (url "https://github.com/coin-or/Ipopt")
1764 (commit (string-append "releases/" version))))
1765 (file-name (git-file-name name version))
1766 (sha256
1767 (base32
1768 "08gznhwhqv1x4baksz350ih8q16r5rd0k8vals6078m3h94khr4b"))))
1769 (build-system gnu-build-system)
1770 (arguments
1771 '(#:phases (modify-phases %standard-phases
1772 (add-after 'install 'add--L-flags-in-ipopt.pc
1773 (lambda* (#:key inputs outputs #:allow-other-keys)
1774 ;; The '.pc' file lists '-llapack -lblas' in "Libs";
1775 ;; move it to "Libs.private" where it belongs, and add a
1776 ;; '-L' flag for LAPACK.
1777 (let ((out (assoc-ref outputs "out"))
1778 (lapack (assoc-ref inputs "lapack")))
1779 (substitute* (string-append out "/lib/pkgconfig/"
1780 "ipopt.pc")
1781 (("Libs: (.*)-llapack -lblas(.*)$" _ before after)
1782 (string-append "Libs: " before " " after "\n"
1783 "Libs.private: " before
1784 "-L" lapack "/lib -llapack -lblas "
1785 after "\n")))
1786 #t))))))
1787 (native-inputs
1788 `(("gfortran" ,gfortran)
1789 ("pkg-config" ,pkg-config)))
1790 (inputs
1791 ;; TODO: Maybe add dependency on COIN-MUMPS, ASL, and HSL.
1792 `(("lapack" ,lapack))) ;for both libblas and liblapack
1793 (home-page "https://www.coin-or.org")
1794 (synopsis "Large-scale nonlinear optimizer")
1795 (description
1796 "The Interior Point Optimizer (IPOPT) is a software package for
1797 large-scale nonlinear optimization. It provides C++, C, and Fortran
1798 interfaces.")
1799 (license license:epl2.0)))
1800
1801 (define-public cbc
1802 (package
1803 (name "cbc")
1804 (version "2.10.5")
1805 (source (origin
1806 (method url-fetch)
1807 (uri (string-append "https://www.coin-or.org/download/source/"
1808 "Cbc/Cbc-" version ".tgz"))
1809 (sha256
1810 (base32
1811 "0wk9vr6zc62gw71v7gnra5wxqlcljcgbhm5lasx236v791b986ns"))
1812 (modules '((guix build utils)))
1813 (snippet
1814 ;; Make sure we don't use the bundled software.
1815 '(delete-file-recursively "ThirdParty"))))
1816 (build-system gnu-build-system)
1817 (native-inputs
1818 `(("gfortran" ,gfortran)
1819 ("pkg-config" ,pkg-config)))
1820 (inputs
1821 `(("openblas" ,openblas)))
1822 (home-page "https://www.coin-or.org")
1823 (synopsis "Branch-and-cut solver")
1824 (description
1825 "Cbc (Coin-or branch and cut) is a mixed integer linear programming
1826 solver written in C++. It can be used as a library or as a standalone
1827 executable.")
1828 (license license:epl1.0)))
1829
1830 (define-public clp
1831 (package
1832 (name "clp")
1833 (version "1.17.6")
1834 (source (origin
1835 (method url-fetch)
1836 (uri (string-append "https://www.coin-or.org/download/source/"
1837 "Clp/Clp-" version ".tgz"))
1838 (sha256
1839 (base32
1840 "0ap1f0lxppa6pnbc4bg7ih7a96avwaki482nig8w5fr3vg9wvkzr"))
1841 (modules '((guix build utils)))
1842 (snippet
1843 ;; Make sure we don't use the bundled software.
1844 '(begin
1845 (delete-file-recursively "ThirdParty")
1846 #t))))
1847 (build-system gnu-build-system)
1848 (native-inputs
1849 `(("gfortran" ,gfortran)
1850 ("pkg-config" ,pkg-config)))
1851 (inputs
1852 `(("openblas" ,openblas)))
1853 (home-page "https://www.coin-or.org")
1854 (synopsis "Linear programming solver")
1855 (description
1856 "CLP is a high quality linear programming solver. Its main strengths are
1857 its dual and primal Simplex algorithms. It also has a barrier algorithm for
1858 linear and quadratic objectives. There are limited facilities for nonlinear
1859 and quadratic objectives using the Simplex algorithm.")
1860 (license license:epl1.0)))
1861
1862 (define-public libflame
1863 (package
1864 (name "libflame")
1865 (version "5.2.0")
1866 (outputs '("out" "static"))
1867 (source
1868 (origin
1869 (method git-fetch)
1870 (uri (git-reference
1871 (url "https://github.com/flame/libflame")
1872 (commit version)))
1873 (file-name (git-file-name name version))
1874 (sha256
1875 (base32
1876 "1n6lf0wvpp77lxqlr721h2jbfbzigphdp19wq8ajiccilcksh7ay"))))
1877 (build-system gnu-build-system)
1878 (arguments
1879 `(#:configure-flags
1880 ;; Sensible defaults: https://github.com/flame/libflame/issues/28
1881 (list "--enable-dynamic-build"
1882 "--enable-max-arg-list-hack"
1883 "--enable-lapack2flame"
1884 "--enable-verbose-make-output"
1885 "--enable-multithreading=pthreads" ; Openblas isn't built with openmp.
1886 ,@(if (any (cute string-prefix? <> (or (%current-target-system)
1887 (%current-system)))
1888 '("x86_64" "i686"))
1889 '("--enable-vector-intrinsics=sse")
1890 '())
1891 "--enable-supermatrix"
1892 "--enable-memory-alignment=16"
1893 "--enable-ldim-alignment")
1894 #:phases
1895 (modify-phases %standard-phases
1896 (add-after 'unpack 'patch-/usr/bin/env-bash
1897 (lambda _
1898 (substitute* "build/config.mk.in"
1899 (("/usr/bin/env bash") (which "bash")))
1900 #t))
1901 (replace 'check
1902 (lambda* (#:key tests? #:allow-other-keys)
1903 (substitute* "test/Makefile"
1904 (("LIBBLAS .*") "LIBBLAS = -lblas\n")
1905 (("LIBLAPACK .*") "LIBLAPACK = -llapack\n"))
1906 (if tests?
1907 (with-directory-excursion "test"
1908 (mkdir "obj")
1909 (invoke "make")
1910 (invoke "./test_libflame.x"))
1911 #t)))
1912 (add-after 'install 'install-static
1913 (lambda* (#:key outputs #:allow-other-keys)
1914 (let ((out (assoc-ref outputs "out"))
1915 (static (assoc-ref outputs "static")))
1916 (mkdir-p (string-append static "/lib"))
1917 (rename-file (string-append out "/lib/libflame.a")
1918 (string-append static "/lib/libflame.a"))
1919 (install-file (string-append out "/include/FLAME.h")
1920 (string-append static "/include"))
1921 #t))))))
1922 (inputs
1923 `(("gfortran" ,gfortran)))
1924 (native-inputs
1925 `(("lapack" ,lapack)
1926 ("openblas" ,openblas)
1927 ("perl" ,perl)
1928 ("python" ,python-wrapper)))
1929 (home-page "https://github.com/flame/libflame")
1930 (synopsis "High-performance object-based library for DLA computations")
1931 (description "@code{libflame} is a portable library for dense matrix
1932 computations, providing much of the functionality present in LAPACK, developed
1933 by current and former members of the @acronym{SHPC, Science of High-Performance
1934 Computing} group in the @url{https://www.ices.utexas.edu/, Institute for
1935 Computational Engineering and Sciences} at The University of Texas at Austin.
1936 @code{libflame} includes a compatibility layer, @code{lapack2flame}, which
1937 includes a complete LAPACK implementation.")
1938 (license license:bsd-3)))
1939
1940 (define-public ceres
1941 (package
1942 (name "ceres-solver")
1943 (version "1.14.0")
1944 (home-page "http://ceres-solver.org/")
1945 (source (origin
1946 (method url-fetch)
1947 (uri (string-append home-page "ceres-solver-"
1948 version ".tar.gz"))
1949 (sha256
1950 (base32
1951 "13lfxy8x58w8vprr0nkbzziaijlh0vvqshgahvcgw0mrqdgh0i27"))))
1952 (build-system cmake-build-system)
1953 (arguments
1954 ;; TODO: Build HTML user documentation and install separately.
1955 '(#:configure-flags '("-DBUILD_EXAMPLES=OFF"
1956 "-DBUILD_SHARED_LIBS=ON")
1957
1958 #:phases (modify-phases %standard-phases
1959 (add-before 'configure 'set-library-directory
1960 (lambda _
1961 ;; Install libraries to lib/, not lib64/.
1962 (substitute* "internal/ceres/CMakeLists.txt"
1963 (("set\\(LIB_SUFFIX \"64\"\\)")
1964 "set(LIB_SUFFIX \"\")"))
1965 #t)))))
1966 (native-inputs
1967 `(("pkg-config" ,pkg-config)))
1968 (propagated-inputs
1969 `(("glog" ,glog))) ;for #include <glog/glog.h>
1970 (inputs
1971 `(("eigen" ,eigen)
1972 ("blas" ,openblas)
1973 ("lapack" ,lapack)
1974 ("suitesparse" ,suitesparse)
1975 ("gflags" ,gflags)))
1976 (synopsis "C++ library for solving large optimization problems")
1977 (description
1978 "Ceres Solver is a C++ library for modeling and solving large,
1979 complicated optimization problems. It is a feature rich, mature and
1980 performant library which has been used in production since 2010. Ceres Solver
1981 can solve two kinds of problems:
1982 @enumerate
1983 @item non-linear least squares problems with bounds constraints;
1984 @item general unconstrained optimization problems.
1985 @end enumerate\n")
1986 (license license:bsd-3)))
1987
1988 ;; For a fully featured Octave, users are strongly recommended also to install
1989 ;; the following packages: less, ghostscript, gnuplot.
1990 (define-public octave-cli
1991 (package
1992 (name "octave-cli")
1993 (version "6.2.0")
1994 (source
1995 (origin
1996 (method url-fetch)
1997 (uri (string-append "mirror://gnu/octave/octave-"
1998 version ".tar.xz"))
1999 (sha256
2000 (base32
2001 "06id09zspya24gshcwgp039cp35c06150mdlxysawgnbrhj16wkv"))))
2002 (build-system gnu-build-system)
2003 (inputs
2004 `(("alsa-lib" ,alsa-lib)
2005 ("arpack" ,arpack-ng)
2006 ("bdb" ,bdb)
2007 ("curl" ,curl)
2008 ("fftw" ,fftw)
2009 ("fftwf" ,fftwf)
2010 ("fltk" ,fltk)
2011 ("fontconfig" ,fontconfig)
2012 ("freetype" ,freetype)
2013 ("gl2ps" ,gl2ps)
2014 ("glpk" ,glpk)
2015 ("glu" ,glu)
2016 ("graphicsmagick" ,graphicsmagick)
2017
2018 ;; TODO: libjpeg-turbo is indirectly required through libtiff. In
2019 ;; the next rebuild cycle, add an absolute reference for -ljpeg in
2020 ;; libtiff.la instead of having to provide it here.
2021 ("libjpeg" ,libjpeg-turbo)
2022
2023 ("hdf5" ,hdf5)
2024 ("lapack" ,lapack)
2025 ("libsndfile" ,libsndfile)
2026 ("libxft" ,libxft)
2027 ("mesa" ,mesa)
2028 ("pcre" ,pcre)
2029 ("portaudio" ,portaudio)
2030 ("qhull" ,qhull)
2031 ("readline" ,readline)
2032 ("suitesparse" ,suitesparse)
2033 ("texinfo" ,texinfo)
2034 ("zlib" ,zlib)))
2035 (native-inputs
2036 `(("gfortran" ,gfortran)
2037 ("pkg-config" ,pkg-config)
2038 ("perl" ,perl)
2039 ;; The following inputs are not actually used in the build process.
2040 ;; However, the ./configure gratuitously tests for their existence and
2041 ;; assumes that programs not present at build time are also not, and
2042 ;; can never be, available at run time! If these inputs are therefore
2043 ;; not present, support for them will be built out. However, Octave
2044 ;; will still run without them, albeit without the features they
2045 ;; provide.
2046 ("less" ,less)
2047 ("ghostscript" ,ghostscript)
2048 ("gnuplot" ,gnuplot)))
2049 ;; Octave code uses this variable to detect directories holding multiple CA
2050 ;; certificates to verify peers with. This is required for the networking
2051 ;; functions that require encryption to work properly.
2052 (native-search-paths
2053 (list (search-path-specification
2054 (variable "CURLOPT_CAPATH")
2055 (files '("etc/ssl/certs")))))
2056 (arguments
2057 `(#:configure-flags
2058 (list (string-append "--with-shell="
2059 (assoc-ref %build-inputs "bash")
2060 "/bin/sh")
2061
2062 ;; XXX: Without this flag, linking octave-cli fails with
2063 ;; undefined references to 'logf@GLIBCXX_3.4' et.al. due to
2064 ;; not pulling in liboctinterp.la for -lstdc++.
2065 "--enable-link-all-dependencies")
2066 #:phases
2067 (modify-phases %standard-phases
2068 (add-after 'configure 'configure-makeinfo
2069 (lambda* (#:key inputs #:allow-other-keys)
2070 (substitute* "libinterp/corefcn/help.h"
2071 (("\"makeinfo\"")
2072 (string-append
2073 "\"" (assoc-ref inputs "texinfo") "/bin/makeinfo\"")))
2074 #t)))))
2075 (home-page "https://www.gnu.org/software/octave/")
2076 (synopsis "High-level language for numerical computation (no GUI)")
2077 (description "GNU Octave is a high-level interpreted language that is
2078 specialized for numerical computations. It can be used for both linear and
2079 non-linear applications and it provides great support for visualizing results.
2080 Work may be performed both at the interactive command-line as well as via
2081 script files.")
2082 (license license:gpl3+)))
2083
2084 (define-public octave
2085 (package (inherit octave-cli)
2086 (name "octave")
2087 (inputs
2088 `(("qscintilla" ,qscintilla)
2089 ("qt" ,qtbase-5)
2090 ,@(package-inputs octave-cli)))
2091 (native-inputs
2092 `(("qttools" , qttools) ;for lrelease
2093 ("texlive" ,(texlive-union (list texlive-epsf))) ; for texi2dvi
2094 ,@(package-native-inputs octave-cli)))
2095 (arguments
2096 (substitute-keyword-arguments (package-arguments octave-cli)
2097 ((#:phases phases)
2098 `(modify-phases ,phases
2099 (add-before 'configure 'patch-qscintilla-library-name
2100 (lambda* (#:key inputs #:allow-other-keys)
2101 ;; The QScintilla library that the Octave configure script tries
2102 ;; to link with should be named libqscintilla-qt5.so, but the
2103 ;; QScintilla input provides the shared library as
2104 ;; libqscintilla2_qt5.so.
2105 (substitute* "configure"
2106 (("qscintilla2-qt5")
2107 "qscintilla2_qt5"))
2108 #t))))))
2109 (synopsis "High-level language for numerical computation (with GUI)")))
2110
2111 (define-public opencascade-oce
2112 (package
2113 (name "opencascade-oce")
2114 (version "0.17.2")
2115 (source
2116 (origin
2117 (method git-fetch)
2118 (uri (git-reference
2119 (url "https://github.com/tpaviot/oce")
2120 (commit (string-append "OCE-" version))))
2121 (file-name (git-file-name name version))
2122 (patches (search-patches "opencascade-oce-glibc-2.26.patch"))
2123 (sha256
2124 (base32 "0rg5wzkvfmzfl6v2amyryb8dnjad0nn9kyr607wy2gch6rciah69"))))
2125 (build-system cmake-build-system)
2126 (arguments
2127 '(#:configure-flags
2128 (list "-DOCE_TESTING:BOOL=ON"
2129 "-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=ON"
2130 "-DOCE_DRAW:BOOL=ON"
2131 (string-append "-DOCE_INSTALL_PREFIX:PATH="
2132 (assoc-ref %outputs "out"))
2133 "-UCMAKE_INSTALL_RPATH")))
2134 (inputs
2135 `(("freetype" ,freetype)
2136 ("glu" ,glu)
2137 ("libxmu" ,libxmu)
2138 ("mesa" ,mesa)
2139 ("tcl" ,tcl)
2140 ("tk" ,tk)))
2141 (native-inputs
2142 `(("python" ,python-wrapper)))
2143 (home-page "https://github.com/tpaviot/oce")
2144 (synopsis "Libraries for 3D modeling and numerical simulation")
2145 (description
2146 "Open CASCADE is a set of libraries for the development of applications
2147 dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
2148 C++ class libraries providing services for 3D surface and solid modeling, CAD
2149 data exchange, and visualization. It is used for development of specialized
2150 software dealing with 3D models in design (CAD), manufacturing (CAM),
2151 numerical simulation (CAE), measurement equipment (CMM), and quality
2152 control (CAQ) domains.
2153
2154 This is the ``Community Edition'' (OCE) of Open CASCADE, which gathers
2155 patches, improvements, and experiments contributed by users over the official
2156 Open CASCADE library.")
2157 (license (list license:lgpl2.1; OCE libraries, with an exception for the
2158 ; use of header files; see
2159 ; OCCT_LGPL_EXCEPTION.txt
2160 license:public-domain; files
2161 ; src/Standard/Standard_StdAllocator.hxx and
2162 ; src/NCollection/NCollection_StdAllocator.hxx
2163 license:expat; file src/OpenGl/OpenGl_glext.h
2164 license:bsd-3)))); test framework gtest
2165
2166 (define-public opencascade-occt
2167 (package
2168 (name "opencascade-occt")
2169 (version "7.3.0p3")
2170 (source
2171 (origin
2172 (method git-fetch)
2173 (uri (git-reference
2174 (url "https://git.dev.opencascade.org/repos/occt.git")
2175 (commit
2176 (string-append "V"
2177 (string-map (lambda (x) (if (eq? x #\.) #\_ x))
2178 version)))))
2179 (file-name (git-file-name name version))
2180 (sha256
2181 (base32 "0bdywwxb6mk0ykbiajlvsb37295akqjp0a60y672qjfa67k0ljv4"))
2182 (modules '((guix build utils)))
2183 (snippet
2184 '(begin
2185 ;; Remove files specific to non-free operating systems.
2186 (delete-file-recursively "samples/ios")
2187 (delete-file-recursively "samples/mfc")
2188 (delete-file-recursively "samples/qt/FuncDemo")
2189 (delete-file "genconf.bat")
2190 (delete-file "gendoc.bat")
2191 (delete-file "genproj.bat")
2192 (delete-file "upgrade.bat")
2193 ;; Remove references to deleted files.
2194 (substitute* "dox/FILES_HTML.txt"
2195 ((".*standard.*") "" )
2196 ((".*UIKitSample.*") ""))
2197 #t))))
2198 (build-system cmake-build-system)
2199 (arguments
2200 '(;; There is no test target for make. OCCT provides an
2201 ;; 'Automated Testing System', which may be accessed after
2202 ;; installation via the draw.sh script. draw.sh is located in
2203 ;; the bin directory. For details see:
2204 ;; https://www.opencascade.com/doc/occt-7.3.0/overview/html/\
2205 ;; occt_dev_guides__tests.html
2206 #:tests? #f
2207 ;; Configure without freeimage: attempting to link against the
2208 ;; freeimage version 3.17 library leads to 'undefined
2209 ;; reference' errors.
2210 #:configure-flags
2211 (list "-DUSE_FREEIMAGE:BOOL=OFF"
2212 "-DUSE_TBB:BOOL=ON"
2213 "-DUSE_VTK:BOOL=OFF"
2214 "-DBUILD_DOC_Overview:BOOL=OFF"
2215 "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
2216 "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
2217 "-UCMAKE_INSTALL_LIBDIR")))
2218 (inputs
2219 `(("doxygen" ,doxygen)
2220 ;("freeimage" ,freeimage)
2221 ("freetype" ,freetype)
2222 ("glu" ,glu)
2223 ("libxext" ,libxext)
2224 ("libxi" ,libxi)
2225 ("libxmu" ,libxmu)
2226 ("mesa" ,mesa)
2227 ("tbb" ,tbb)
2228 ("tcl" ,tcl)
2229 ("tk" ,tk)))
2230 ;; TODO: build Overview documentation and add 'doc' output.
2231 (home-page "https://www.opencascade.com")
2232 (synopsis "Libraries for 3D modeling and numerical simulation")
2233 (description
2234 "Open CASCADE is a set of libraries for the development of applications
2235 dealing with 3D CAD data or requiring industrial 3D capabilities. It includes
2236 C++ class libraries providing services for 3D surface and solid modeling, CAD
2237 data exchange, and visualization. It is used for development of specialized
2238 software dealing with 3D models in design (CAD), manufacturing (CAM),
2239 numerical simulation (CAE), measurement equipment (CMM), and quality
2240 control (CAQ) domains.
2241
2242 This is the certified version of the Open Cascade Technology (OCCT) library.")
2243 (license (list ;; OCCT library:
2244 license:lgpl2.1; with an exception for the use of header
2245 ; files, see OCCT_LGPL_EXCEPTION.txt.
2246 ;; Files src/OpenGl/glext.h, adm/cmake/cotire.cmake and
2247 ;; src/OpenGl/OpenGl_HaltonSampler.hxx:
2248 license:expat
2249 ;; Files src/ExprIntrp/ExprIntrp.tab.* and
2250 ;; src/StepFile/step.tab.*:
2251 license:gpl3+ ; with Bison 2.2 exception.
2252 ;; File src/NCollection/NCollection_UtfIterator.lxx:
2253 (license:non-copyleft
2254 "https://www.unicode.org/license.html")
2255 ;; File src/NCollection/NCollection_StdAllocator.hxx:
2256 license:public-domain))))
2257
2258 (define-public gmsh
2259 (package
2260 (name "gmsh")
2261 (version "4.6.0")
2262 (source
2263 (origin
2264 (method git-fetch)
2265 (uri (git-reference
2266 (url "https://gitlab.onelab.info/gmsh/gmsh.git")
2267 (commit
2268 (string-append "gmsh_"
2269 (string-map (lambda (x) (if (eq? x #\.) #\_ x))
2270 version)))))
2271 (file-name (git-file-name name version))
2272 (sha256
2273 (base32 "0m0pjxcy1bnr7a20i11lh0ih159pphq9wsvfjr3sfx4y3lginz5y"))
2274 (modules '((guix build utils)))
2275 (snippet
2276 '(begin
2277 (delete-file-recursively "contrib/metis")
2278 #t))))
2279 (build-system cmake-build-system)
2280 (propagated-inputs
2281 `(("fltk" ,fltk)
2282 ("gfortran" ,gfortran)
2283 ("gmp" ,gmp)
2284 ("hdf5" ,hdf5)
2285 ("lapack" ,lapack)
2286 ("mesa" ,mesa)
2287 ("glu" ,glu)
2288 ("metis" ,metis)
2289 ("opencascade-occt" ,opencascade-occt)
2290 ("libx11" ,libx11)
2291 ("libxext" ,libxext)))
2292 (inputs
2293 `(("fontconfig" ,fontconfig)
2294 ("libxft" ,libxft)))
2295 (arguments
2296 `(#:configure-flags `("-DENABLE_SYSTEM_CONTRIB:BOOL=ON"
2297 "-DENABLE_BUILD_SHARED:BOOL=ON"
2298 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
2299 (home-page "http://gmsh.info/")
2300 (synopsis "3D finite element grid generator")
2301 (description "Gmsh is a 3D finite element grid generator with a built-in
2302 CAD engine and post-processor. Its design goal is to provide a fast, light
2303 and user-friendly meshing tool with parametric input and advanced
2304 visualization capabilities. Gmsh is built around four modules: geometry,
2305 mesh, solver and post-processing. The specification of any input to these
2306 modules is done either interactively using the graphical user interface or in
2307 ASCII text files using Gmsh's own scripting language.")
2308 (license license:gpl2+)))
2309
2310 (define-public veusz
2311 (package
2312 (name "veusz")
2313 (version "3.3.1")
2314 (source
2315 (origin
2316 (method url-fetch)
2317 (uri (pypi-uri "veusz" version))
2318 (sha256
2319 (base32 "1q7hi1qwwg4pgiz62isvv1pia85m13bspdpp1q3mrnwl11in0ag0"))))
2320 (build-system python-build-system)
2321 (arguments
2322 `(;; Tests will fail because they depend on optional packages like
2323 ;; python-astropy, which is not packaged.
2324 #:tests? #f
2325 #:phases
2326 (modify-phases %standard-phases
2327 ;; Veusz will append 'PyQt5' to sip_dir by default. That is not how
2328 ;; the path is defined in Guix, therefore we have to change it.
2329 (add-after 'unpack 'fix-sip-dir
2330 (lambda _
2331 (substitute* "pyqtdistutils.py"
2332 (("os.path.join\\(sip_dir, 'PyQt5'\\)") "sip_dir"))
2333 #t))
2334 ;; Now we have to pass the correct sip_dir to setup.py.
2335 (replace 'build
2336 (lambda* (#:key inputs #:allow-other-keys)
2337 ;; We need to tell setup.py where to locate QtCoremod.sip
2338 ((@@ (guix build python-build-system) call-setuppy)
2339 "build_ext"
2340 (list (string-append "--sip-dir="
2341 (assoc-ref inputs "python-pyqt")
2342 "/share/sip"))
2343 #t)))
2344 ;; Ensure that icons are found at runtime.
2345 (add-after 'install 'wrap-executable
2346 (lambda* (#:key inputs outputs #:allow-other-keys)
2347 (let ((out (assoc-ref outputs "out")))
2348 (wrap-program (string-append out "/bin/veusz")
2349 `("QT_PLUGIN_PATH" prefix
2350 ,(list (string-append (assoc-ref inputs "qtsvg")
2351 "/lib/qt5/plugins/"))))))))))
2352 (native-inputs
2353 `(("pkg-config" ,pkg-config)
2354 ;;("python-astropy" ,python-astropy) ;; FIXME: Package this.
2355 ("qttools" ,qttools)
2356 ("python-sip" ,python-sip-4)))
2357 (inputs
2358 `(("ghostscript" ,ghostscript) ;optional, for EPS/PS output
2359 ("python-dbus" ,python-dbus)
2360 ("python-h5py" ,python-h5py) ;optional, for HDF5 data
2361 ("python-pyqt" ,python-pyqt)
2362 ("qtbase" ,qtbase-5)
2363 ("qtsvg" ,qtsvg)))
2364 (propagated-inputs
2365 `(("python-numpy" ,python-numpy)))
2366 (home-page "https://veusz.github.io/")
2367 (synopsis "Scientific plotting package")
2368 (description
2369 "Veusz is a scientific plotting and graphing program with a graphical
2370 user interface, designed to produce publication-ready 2D and 3D plots. In
2371 addition it can be used as a module in Python for plotting. It supports
2372 vector and bitmap output, including PDF, Postscript, SVG and EMF.")
2373 (license license:gpl2+)))
2374
2375 (define-public maxflow
2376 (package
2377 (name "maxflow")
2378 ;; Versioning is ambiguous: the git tag matching this commit is ‘3.0.5’,
2379 ;; which matches CMakeLists.txt, but README.md and CHANGES say ‘3.04’.
2380 (version "3.0.5")
2381 (source (origin
2382 (method git-fetch)
2383 (uri (git-reference
2384 (url "https://github.com/gerddie/maxflow")
2385 (commit version)))
2386 (file-name (git-file-name name version))
2387 (sha256
2388 (base32
2389 "0rll38whw55h0vcjrrwdnh9ascvxby0ph7n1l0d12z17cg215kkb"))))
2390 (build-system cmake-build-system)
2391 (home-page "https://pub.ist.ac.at/~vnk/software.html")
2392 (synopsis "Library implementing Maxflow algorithm")
2393 (description "An implementation of the maxflow algorithm described in
2394 @cite{An Experimental Comparison of Min-Cut/Max-Flow Algorithms for
2395 Energy Minimization in Computer Vision.\n
2396 Yuri Boykov and Vladimir Kolmogorov.\n
2397 In IEEE Transactions on Pattern Analysis and Machine Intelligence,\n
2398 September 2004}")
2399 (license license:gpl3+)))
2400
2401 (define-public petsc
2402 (package
2403 (name "petsc")
2404 (version "3.11.2")
2405 (source
2406 (origin
2407 (method url-fetch)
2408 ;; The *-lite-* tarball does not contain the *large* documentation
2409 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
2410 "petsc-lite-" version ".tar.gz"))
2411 (sha256
2412 (base32 "1645nwwcp9bcnfnxikk480mhbbacdvhsay2c401818hk97dqj5nx"))))
2413 (outputs '("out" ; libraries and headers
2414 "examples")) ; ~30MiB of examples
2415 (build-system gnu-build-system)
2416 (native-inputs
2417 `(("python" ,python-2)))
2418 (inputs
2419 `(("gfortran" ,gfortran)
2420 ("openblas" ,openblas)
2421 ("superlu" ,superlu)
2422 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
2423 ;; leaving out opengl, as configuration seems to only be for mac
2424 ))
2425 (arguments
2426 `(#:test-target "test"
2427 #:parallel-build? #f ; build is parallel by default
2428 #:configure-flags
2429 `("--with-mpi=0"
2430 "--with-openmp=1"
2431 "--with-openblas=1"
2432 "--with-superlu=1")
2433 #:make-flags
2434 ;; Honor (parallel-job-count) for build. Do not use --with-make-np,
2435 ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
2436 (list (format #f "MAKE_NP=~a" (parallel-job-count)))
2437 #:phases
2438 (modify-phases %standard-phases
2439 (replace 'configure
2440 ;; PETSc's configure script is actually a python script, so we can't
2441 ;; run it with bash.
2442 (lambda* (#:key outputs (configure-flags '())
2443 #:allow-other-keys)
2444 (let* ((prefix (assoc-ref outputs "out"))
2445 (flags `(,(string-append "--prefix=" prefix)
2446 ,@configure-flags)))
2447 (format #t "build directory: ~s~%" (getcwd))
2448 (format #t "configure flags: ~s~%" flags)
2449 (apply invoke "./configure" flags))))
2450 (add-after 'configure 'clean-local-references
2451 (lambda* (#:key outputs #:allow-other-keys)
2452 (let ((out (assoc-ref outputs "out")))
2453 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
2454 ;; Prevent build directory from leaking into compiled code
2455 (((getcwd)) out)
2456 ;; Scrub timestamp for reproducibility
2457 ((".*Libraries compiled on.*") ""))
2458 (substitute* (find-files "." "petscvariables")
2459 ;; Do not expose build machine characteristics, set to defaults.
2460 (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
2461 (("NPMAX = [:digit:]+") "NPMAX = 2"))
2462 #t)))
2463 (add-after 'install 'clean-install
2464 ;; Try to keep installed files from leaking build directory names.
2465 (lambda* (#:key inputs outputs #:allow-other-keys)
2466 (let ((out (assoc-ref outputs "out")))
2467 (substitute* (map (lambda (file)
2468 (string-append out "/lib/petsc/conf/" file))
2469 '("petscvariables"))
2470 (((getcwd)) out))
2471 ;; Make compiler references point to the store
2472 (substitute* (string-append out "/lib/petsc/conf/petscvariables")
2473 (("= (gcc|g\\+\\+|gfortran)" _ compiler)
2474 (string-append "= " (which compiler))))
2475 ;; PETSc installs some build logs, which aren't necessary.
2476 (for-each (lambda (file)
2477 (let ((f (string-append out "/lib/petsc/conf/" file)))
2478 (when (file-exists? f)
2479 (delete-file f))))
2480 '("configure.log" "make.log" "gmake.log"
2481 "test.log" "error.log" "RDict.db"
2482 "PETScBuildInternal.cmake"
2483 ;; Once installed, should uninstall with Guix
2484 "uninstall.py"))
2485 #t)))
2486 (add-after 'install 'move-examples
2487 (lambda* (#:key outputs #:allow-other-keys)
2488 (let* ((out (assoc-ref outputs "out"))
2489 (examples (assoc-ref outputs "examples"))
2490 (exdir (string-append out "/share/petsc/examples"))
2491 (exdir' (string-append examples "/share/petsc/examples")))
2492 (copy-recursively exdir exdir')
2493 (delete-file-recursively exdir)
2494 #t))))))
2495 (home-page "https://www.mcs.anl.gov/petsc")
2496 (synopsis "Library to solve PDEs")
2497 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
2498 data structures and routines for the scalable (parallel) solution of
2499 scientific applications modeled by partial differential equations.")
2500 (license (license:non-copyleft
2501 "https://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
2502
2503 (define-public petsc-complex
2504 (package (inherit petsc)
2505 (name "petsc-complex")
2506 (arguments
2507 (substitute-keyword-arguments (package-arguments petsc)
2508 ((#:configure-flags cf)
2509 `(cons "--with-scalar-type=complex" ,cf))))
2510 (synopsis "Library to solve PDEs (with complex scalars)")))
2511
2512 (define-public petsc-openmpi
2513 (package (inherit petsc)
2514 (name "petsc-openmpi")
2515 (inputs
2516 `(("hdf5" ,hdf5-parallel-openmpi)
2517 ("hypre" ,hypre-openmpi)
2518 ("metis" ,metis)
2519 ("mumps" ,mumps-openmpi)
2520 ("openmpi" ,openmpi)
2521 ("scalapack" ,scalapack)
2522 ("scotch" ,pt-scotch32)
2523 ,@(package-inputs petsc)))
2524 (arguments
2525 (substitute-keyword-arguments (package-arguments petsc)
2526 ((#:configure-flags cf)
2527 ``("--with-hypre=1"
2528 "--with-mpiexec=mpirun"
2529 "--with-metis=1"
2530 "--with-mumps=1"
2531 "--with-scalapack=1"
2532 "--with-ptscotch=1"
2533 ,(string-append "--with-mpi-dir="
2534 (assoc-ref %build-inputs "openmpi"))
2535 ,(string-append "--with-hdf5-include="
2536 (assoc-ref %build-inputs "hdf5") "/include")
2537 ,(string-append "--with-hdf5-lib="
2538 (assoc-ref %build-inputs "hdf5") "/lib/libhdf5.a")
2539 ,@(delete "--with-mpi=0" ,cf)))
2540 ((#:phases phases)
2541 `(modify-phases ,phases
2542 (add-before 'configure 'mpi-setup
2543 ,%openmpi-setup)))))
2544 (synopsis "Library to solve PDEs (with MUMPS and MPI support)")))
2545
2546 (define-public petsc-complex-openmpi
2547 (package (inherit petsc-complex)
2548 (name "petsc-complex-openmpi")
2549 (inputs
2550 `(("openmpi" ,openmpi)
2551 ,@(package-inputs petsc-complex)))
2552 (arguments
2553 (substitute-keyword-arguments (package-arguments petsc-complex)
2554 ((#:configure-flags cf)
2555 ``("--with-mpiexec=mpirun"
2556 ,(string-append "--with-mpi-dir="
2557 (assoc-ref %build-inputs "openmpi"))
2558 ,@(delete "--with-mpi=0" ,cf)))
2559 ((#:phases phases)
2560 `(modify-phases ,phases
2561 (add-before 'configure 'mpi-setup
2562 ,%openmpi-setup)))))
2563 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
2564
2565 (define-public python-petsc4py
2566 (package
2567 (name "python-petsc4py")
2568 (version "3.11.0")
2569 (source
2570 (origin
2571 (method url-fetch)
2572 (uri (pypi-uri "petsc4py" version))
2573 (sha256
2574 (base32
2575 "1rm1qj5wlkhxl39by9n78lh3gbmii31wsnb8j1rr5hvfr5xgbx2q"))
2576 (modules '((guix build utils)))
2577 (snippet
2578 '(begin
2579 ;; Ensure source file is regenerated in the build phase.
2580 (delete-file "src/petsc4py.PETSc.c")
2581 ;; Remove legacy GC code. See
2582 ;; https://bitbucket.org/petsc/petsc4py/issues/125.
2583 (substitute* "src/PETSc/cyclicgc.pxi"
2584 ((".*gc_refs.*") "" )
2585 ((".*PyGC_Head.*") ""))
2586 #t))))
2587 (build-system python-build-system)
2588 (arguments
2589 `(#:phases
2590 (modify-phases %standard-phases
2591 (add-before 'build 'pre-build
2592 (lambda _
2593 ;; Define path to PETSc installation.
2594 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
2595 #t))
2596 (add-before 'check 'mpi-setup
2597 ,%openmpi-setup))))
2598 (native-inputs
2599 `(("python-cython" ,python-cython)))
2600 (inputs
2601 `(("petsc" ,petsc-openmpi)
2602 ("python-numpy" ,python-numpy)))
2603 (home-page "https://bitbucket.org/petsc/petsc4py/")
2604 (synopsis "Python bindings for PETSc")
2605 (description "PETSc, the Portable, Extensible Toolkit for
2606 Scientific Computation, is a suite of data structures and routines for
2607 the scalable (parallel) solution of scientific applications modeled by
2608 partial differential equations. It employs the MPI standard for all
2609 message-passing communication. @code{petsc4py} provides Python
2610 bindings to almost all functions of PETSc.")
2611 (license license:bsd-3)))
2612
2613 (define-public python-kiwisolver
2614 (package
2615 (name "python-kiwisolver")
2616 (version "1.0.1")
2617 (source (origin
2618 (method url-fetch)
2619 (uri (pypi-uri "kiwisolver" version))
2620 (sha256
2621 (base32
2622 "0y22ci86znwwwfhbmvbgdfnbi6lv5gv2xkdlxvjw7lml43ayafyf"))))
2623 (build-system python-build-system)
2624 (home-page "https://github.com/nucleic/kiwi")
2625 (synopsis "Fast implementation of the Cassowary constraint solver")
2626 (description
2627 "Kiwi is an efficient C++ implementation of the Cassowary constraint
2628 solving algorithm. Kiwi has been designed from the ground up to be
2629 lightweight and fast. Kiwi ranges from 10x to 500x faster than the original
2630 Cassowary solver with typical use cases gaining a 40x improvement. Memory
2631 savings are consistently > 5x.")
2632 (license license:bsd-3)))
2633
2634 (define-public python2-kiwisolver
2635 (package-with-python2 python-kiwisolver))
2636
2637 (define-public slepc
2638 (package
2639 (name "slepc")
2640 (version "3.11.1")
2641 (source
2642 (origin
2643 (method url-fetch)
2644 (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
2645 version ".tar.gz"))
2646 (sha256
2647 (base32
2648 "1yq84q9wannc8xwapxpay4ypdd675picwi395hhsdvng9q6hf5j8"))))
2649 (build-system gnu-build-system)
2650 (native-inputs
2651 `(("python" ,python-2)
2652 ("petsc:examples" ,petsc "examples"))) ;for gmakegen.py script
2653 (inputs
2654 `(("arpack" ,arpack-ng)
2655 ("gfortran" ,gfortran)))
2656 (propagated-inputs
2657 `(("petsc" ,petsc)))
2658 (arguments
2659 `(#:parallel-build? #f ;build is parallel by default
2660 #:configure-flags
2661 `(,(string-append "--with-arpack-dir="
2662 (assoc-ref %build-inputs "arpack") "/lib"))
2663 #:make-flags ;honor (parallel-job-count)
2664 `(,(format #f "MAKE_NP=~a" (parallel-job-count))
2665 ,(string-append "PETSCCONFIGDIR="
2666 (assoc-ref %build-inputs "petsc:examples")
2667 "/share/petsc/examples/config"))
2668 #:phases
2669 (modify-phases %standard-phases
2670 (replace 'configure
2671 ;; configure is a python script, so we can't run it with bash.
2672 (lambda* (#:key inputs outputs (configure-flags '())
2673 #:allow-other-keys)
2674 (let* ((prefix (assoc-ref outputs "out"))
2675 (flags `(,(string-append "--prefix=" prefix)
2676 ,@configure-flags)))
2677 (format #t "build directory: ~s~%" (getcwd))
2678 (format #t "configure flags: ~s~%" flags)
2679 (setenv "SLEPC_DIR" (getcwd))
2680 (setenv "PETSC_DIR" (assoc-ref inputs "petsc"))
2681 (apply invoke "./configure" flags))))
2682 (add-after 'install 'delete-doc
2683 ;; TODO: SLEPc installs HTML documentation alongside headers in
2684 ;; $out/include. We'd like to move them to share/doc, but delete
2685 ;; them for now, as they are incomplete and installing the complete
2686 ;; documentation is difficult.
2687 (lambda* (#:key outputs #:allow-other-keys)
2688 (let* ((out (assoc-ref outputs "out")))
2689 (for-each delete-file (find-files out "\\.html$"))
2690 #t)))
2691 (add-after 'install 'clean-install
2692 ;; Clean up unnecessary build logs from installation.
2693 (lambda* (#:key outputs #:allow-other-keys)
2694 (let ((out (assoc-ref outputs "out")))
2695 (for-each (lambda (file)
2696 (let ((f (string-append out "/lib/slepc/conf/" file)))
2697 (when (file-exists? f)
2698 (delete-file f))))
2699 '("configure.log" "make.log" "gmake.log"
2700 "test.log" "error.log" "RDict.db"
2701 "uninstall.py"))
2702 #t))))))
2703 (home-page "https://slepc.upv.es")
2704 (synopsis "Scalable library for eigenproblems")
2705 (description "SLEPc is a software library for the solution of large sparse
2706 eigenproblems on parallel computers. It can be used for the solution of
2707 linear eigenvalue problems formulated in either standard or generalized form,
2708 as well as other related problems such as the singular value decomposition.
2709 The emphasis of the software is on methods and techniques appropriate for
2710 problems in which the associated matrices are sparse, for example, those
2711 arising after the discretization of partial differential equations.")
2712 (license license:bsd-2)))
2713
2714 (define-public slepc-complex
2715 (package (inherit slepc)
2716 (name "slepc-complex")
2717 (propagated-inputs
2718 `(("petsc" ,petsc-complex)
2719 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
2720 (synopsis "Scalable library for eigenproblems (with complex scalars)")))
2721
2722 (define-public slepc-openmpi
2723 (package (inherit slepc)
2724 (name "slepc-openmpi")
2725 (arguments
2726 (substitute-keyword-arguments (package-arguments slepc)
2727 ((#:phases phases '%standard-phases)
2728 `(modify-phases ,phases
2729 (add-before 'check 'mpi-setup
2730 ,%openmpi-setup)))))
2731 (inputs
2732 `(("mpi" ,openmpi)
2733 ("arpack" ,arpack-ng-openmpi)
2734 ,@(alist-delete "arpack" (package-inputs slepc))))
2735 (propagated-inputs
2736 `(("petsc" ,petsc-openmpi)
2737 ,@(alist-delete "petsc" (package-propagated-inputs slepc))))
2738 (synopsis "Scalable library for eigenproblems (with MPI support)")))
2739
2740 (define-public slepc-complex-openmpi
2741 (package (inherit slepc-openmpi)
2742 (name "slepc-complex-openmpi")
2743 (propagated-inputs
2744 `(("petsc" ,petsc-complex-openmpi)
2745 ,@(alist-delete "petsc" (package-propagated-inputs slepc-openmpi))))
2746 (synopsis "Scalable library for eigenproblems (with complex scalars and MPI support)")))
2747
2748 (define-public python-slepc4py
2749 (package
2750 (name "python-slepc4py")
2751 (version "3.11.0")
2752 (source
2753 (origin
2754 (method url-fetch)
2755 (uri (pypi-uri "slepc4py" version))
2756 (sha256
2757 (base32
2758 "1ksp08kxf4wg408b9nn39z3qfhy643j22d4rfbl30vzxk2rxh4lq"))))
2759 (build-system python-build-system)
2760 (arguments
2761 `(#:phases
2762 (modify-phases %standard-phases
2763 (add-before 'build 'pre-build
2764 (lambda _
2765 ;; Define path to PETSc installation.
2766 (setenv "PETSC_DIR" (assoc-ref %build-inputs "petsc"))
2767 ;; Define path to SLEPc installation.
2768 (setenv "SLEPC_DIR" (assoc-ref %build-inputs "slepc"))
2769 #t))
2770 (add-before 'check 'mpi-setup
2771 ,%openmpi-setup))))
2772 (inputs
2773 `(("python-numpy" ,python-numpy)
2774 ("python-petsc4py" ,python-petsc4py)
2775 ("slepc" ,slepc-openmpi)))
2776 (home-page "https://bitbucket.org/slepc/slepc4py/")
2777 (synopsis "Python bindings for SLEPc")
2778 (description "SLEPc, the Scalable Library for Eigenvalue Problem
2779 Computations, is based on PETSc, the Portable, Extensible Toolkit for
2780 Scientific Computation. It employs the MPI standard for all
2781 message-passing communication. @code{slepc4py} provides Python
2782 bindings to almost all functions of SLEPc.")
2783 (license license:bsd-3)))
2784
2785 (define-public metamath
2786 (package
2787 (name "metamath")
2788 (version "0.193")
2789 (source
2790 (origin
2791 (method git-fetch)
2792 (uri (git-reference
2793 (url "https://github.com/metamath/metamath-exe")
2794 (commit (string-append "v" version))))
2795 (file-name (git-file-name name version))
2796 (sha256
2797 (base32 "1s9hyknfvhj86g3giayyf3dxzg23iij0rs7bdvj075v9qbyhqn9b"))))
2798 (build-system gnu-build-system)
2799 (native-inputs
2800 `(("autoconf" ,autoconf)
2801 ("automake" ,automake)))
2802 (home-page "http://us.metamath.org/")
2803 (synopsis "Proof verifier based on a minimalistic formalism")
2804 (description
2805 "Metamath is a tiny formal language and that can express theorems in
2806 abstract mathematics, with an accompyaning @command{metamath} executable that
2807 verifies databases of these proofs. There is a public database,
2808 @url{https://github.com/metamath/set.mm, set.mm}, implementing first-order
2809 logic and Zermelo-Frenkel set theory with Choice, along with a large swath of
2810 associated, high-level theorems, e.g.@: the fundamental theorem of arithmetic,
2811 the Cauchy-Schwarz inequality, Stirling's formula, etc. See the Metamath
2812 book.")
2813 (license license:gpl2+)))
2814
2815 (define-public mumps
2816 (package
2817 (name "mumps")
2818 (version "5.2.1")
2819 (source
2820 (origin
2821 (method url-fetch)
2822 (uri (string-append "http://mumps.enseeiht.fr/MUMPS_"
2823 version ".tar.gz"))
2824 (sha256
2825 (base32
2826 "0jklh54x4y3ik1zkw6db7766kakjm5910diyaghfxxf8vwsgr26r"))
2827 (patches (search-patches "mumps-build-parallelism.patch"
2828 "mumps-shared-libseq.patch"
2829 "mumps-shared-mumps.patch"
2830 "mumps-shared-pord.patch"))))
2831 (build-system gnu-build-system)
2832 (inputs
2833 `(("fortran" ,gfortran)
2834 ;; These are required for linking against mumps, but we let the user
2835 ;; declare the dependency.
2836 ("blas" ,openblas)
2837 ("metis" ,metis)
2838 ("scotch" ,scotch)))
2839 (arguments
2840 `(#:modules ((ice-9 match)
2841 (ice-9 popen)
2842 (srfi srfi-1)
2843 ,@%gnu-build-system-modules)
2844 #:phases
2845 (modify-phases %standard-phases
2846 (replace 'configure
2847 (lambda* (#:key inputs #:allow-other-keys)
2848 (call-with-output-file "Makefile.inc"
2849 (lambda (port)
2850 (format port "
2851 PLAT =
2852 LIBEXT = .a
2853 OUTC = -o
2854 OUTF = -o
2855 RM = rm -f~:[
2856 CC = gcc
2857 FC = gfortran
2858 FL = gfortran
2859 INCSEQ = -I$(topdir)/libseq
2860 LIBSEQ = $(topdir)/libseq/libmpiseq.a
2861 LIBSEQNEEDED = libseqneeded~;
2862 CC = mpicc
2863 FC = mpifort
2864 FL = mpifort~]
2865 AR = ar vr # rules require trailing space, ugh...
2866 RANLIB = ranlib
2867 BLASDIR = ~a
2868 LIBBLAS = -Wl,-rpath=$(BLASDIR) -Wl,-rpath='$$ORIGIN' -L$(BLASDIR) -lopenblas~@[
2869 SCALAPDIR = ~a
2870 SCALAP = -Wl,-rpath=$(SCALAPDIR) -Wl,-rpath='$$ORIGIN' -L$(SCALAPDIR) -lscalapack~]
2871 LIBOTHERS = -pthread
2872 CDEFS = -DAdd_
2873 PIC = -fPIC
2874 OPTF = -O2 -DALLOW_NON_INIT $(PIC)
2875 OPTL = -O2 $(PIC)
2876 OPTC = -O2 $(PIC)
2877 INCS = $(INCSEQ)
2878 LIBS = $(SCALAP) $(LIBSEQ)
2879 LPORDDIR = $(topdir)/PORD/lib
2880 IPORD = -I$(topdir)/PORD/include
2881 LPORD = $(LPORDDIR)/libpord.a
2882 ORDERINGSF = -Dpord~@[
2883 METISDIR = ~a
2884 IMETIS = -I$(METISDIR)/include
2885 LMETIS = -Wl,-rpath $(METISDIR)/lib -L$(METISDIR)/lib -lmetis
2886 ORDERINGSF += -Dmetis~]~@[~:{
2887 SCOTCHDIR = ~a
2888 ISCOTCH = -I$(SCOTCHDIR)/include
2889 LSCOTCH = -Wl,-rpath $(SCOTCHDIR)/lib -L$(SCOTCHDIR)/lib ~a-lesmumps -lscotch -lscotcherr
2890 ORDERINGSF += ~a~}~]
2891 ORDERINGSC = $(ORDERINGSF)
2892 LORDERINGS = $(LPORD) $(LMETIS) $(LSCOTCH) $(LIBSEQ)
2893 IORDERINGSF = $(ISCOTCH)
2894 IORDERINGSC = $(IPORD) $(IMETIS) $(ISCOTCH)"
2895 (assoc-ref inputs "mpi")
2896 (assoc-ref inputs "blas")
2897 (assoc-ref inputs "scalapack")
2898 (assoc-ref inputs "metis")
2899 (match (list (assoc-ref inputs "pt-scotch")
2900 (assoc-ref inputs "scotch"))
2901 ((#f #f)
2902 #f)
2903 ((#f scotch)
2904 `((,scotch "" "-Dscotch")))
2905 ((ptscotch _)
2906 `((,ptscotch
2907 "-lptesmumps -lptscotch -lptscotcherr "
2908 "-Dptscotch")))))))))
2909 (replace 'build
2910 ;; By default only the d-precision library is built. Make with "all"
2911 ;; target so that all precision libraries and examples are built.
2912 (lambda _
2913 (invoke "make" "all"
2914 (format #f "-j~a" (parallel-job-count)))))
2915 (replace 'check
2916 ;; Run the simple test drivers, which read test input from stdin:
2917 ;; from the "real" input for the single- and double-precision
2918 ;; testers, and from the "cmplx" input for complex-precision
2919 ;; testers. The EXEC-PREFIX key is used by the mumps-openmpi
2920 ;; package to prefix execution with "mpirun".
2921 (lambda* (#:key (exec-prefix '()) #:allow-other-keys)
2922 (with-directory-excursion "examples"
2923 (every
2924 (lambda (prec type)
2925 (let ((tester (apply open-pipe*
2926 `(,OPEN_WRITE
2927 ,@exec-prefix
2928 ,(string-append "./" prec
2929 "simpletest"))))
2930 (input (open-input-file
2931 (string-append "input_simpletest_" type))))
2932 (begin
2933 (dump-port input tester)
2934 (close-port input)
2935 (zero? (close-pipe tester)))))
2936 '("s" "d" "c" "z")
2937 '("real" "real" "cmplx" "cmplx")))))
2938 (replace 'install
2939 (lambda* (#:key outputs #:allow-other-keys)
2940 (let* ((out (assoc-ref outputs "out"))
2941 (libdir (string-append out "/lib")))
2942 (copy-recursively "lib" libdir)
2943 (copy-recursively "include" (string-append out "/include"))
2944 (when (file-exists? "libseq/libmpiseq.a")
2945 (install-file "libseq/libmpiseq.a" libdir))
2946 (when (file-exists? "libseq/libmpiseq.so")
2947 (install-file "libseq/libmpiseq.so" libdir))
2948 #t))))))
2949 (home-page "http://mumps.enseeiht.fr")
2950 (synopsis "Multifrontal sparse direct solver")
2951 (description
2952 "MUMPS (MUltifrontal Massively Parallel sparse direct Solver) solves a
2953 sparse system of linear equations A x = b using Gaussian elimination.")
2954 (license license:cecill-c)))
2955
2956 (define-public mumps-metis
2957 (package (inherit mumps)
2958 (name "mumps-metis")
2959 (inputs
2960 (alist-delete "scotch" (package-inputs mumps)))))
2961
2962 (define-public mumps-openmpi
2963 (package (inherit mumps)
2964 (name "mumps-openmpi")
2965 (inputs
2966 `(("mpi" ,openmpi)
2967 ("scalapack" ,scalapack)
2968 ("pt-scotch" ,pt-scotch)
2969 ,@(alist-delete "scotch" (package-inputs mumps))))
2970 (arguments
2971 (substitute-keyword-arguments (package-arguments mumps)
2972 ((#:phases phases)
2973 `(modify-phases ,phases
2974 (add-before 'check 'mpi-setup
2975 ,%openmpi-setup)
2976 (replace 'check
2977 (lambda _
2978 ((assoc-ref ,phases 'check)
2979 #:exec-prefix '("mpirun" "-n" "2"))))))))
2980 (synopsis "Multifrontal sparse direct solver (with MPI)")))
2981
2982 (define-public mumps-metis-openmpi
2983 (package (inherit mumps-openmpi)
2984 (name "mumps-metis-openmpi")
2985 (inputs
2986 (alist-delete "pt-scotch" (package-inputs mumps-openmpi)))))
2987
2988 (define-public ruby-asciimath
2989 (package
2990 (name "ruby-asciimath")
2991 (version "2.0.1")
2992 (source
2993 (origin
2994 (method url-fetch)
2995 (uri (rubygems-uri "asciimath" version))
2996 (sha256
2997 (base32
2998 "1aapydwwkydbwgz07n7ma3a5jy9n3v0shy6q6j8mi4wr3crhx45a"))))
2999 (build-system ruby-build-system)
3000 (native-inputs
3001 `(("ruby-nokogiri" ,ruby-nokogiri)
3002 ("ruby-rspec" ,ruby-rspec)))
3003 (synopsis "AsciiMath parsing and conversion library")
3004 (description
3005 "A pure Ruby AsciiMath parsing and conversion library. AsciiMath is an
3006 easy-to-write markup language for mathematics.")
3007 (home-page "https://github.com/asciidoctor/asciimath")
3008 (license license:expat)))
3009
3010 (define-public superlu
3011 (package
3012 (name "superlu")
3013 (version "5.2.2")
3014 (source
3015 (origin
3016 (method url-fetch)
3017 (uri (string-append "https://portal.nersc.gov/project/sparse/superlu/"
3018 "superlu_" version ".tar.gz"))
3019 (sha256
3020 (base32 "13520vk6fqspyl22cq4ak2jh3rlmhja4czq56j75fdx65fkk80s7"))
3021 (modules '((guix build utils)))
3022 (snippet
3023 ;; Replace the non-free implementation of MC64 with a stub adapted
3024 ;; from Debian
3025 '(begin
3026 (use-modules (ice-9 regex)
3027 (ice-9 rdelim))
3028 (call-with-output-file "SRC/mc64ad.c"
3029 (lambda (port)
3030 (display "
3031 #include <stdio.h>
3032 #include <stdlib.h>
3033 void mc64id_(int *a) {
3034 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
3035 abort ();
3036 }
3037 void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
3038 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
3039 fprintf (stderr, \"SuperLU: non-free MC64 not available. Aborting.\\n\");
3040 abort ();
3041 }\n" port)))
3042 ;; Remove the corresponding license verbiage. MC64 license follows
3043 ;; a "------" line separator.
3044 (with-atomic-file-replacement "License.txt"
3045 (let ((rx (make-regexp "-{8}")))
3046 (lambda (in out)
3047 (let loop ()
3048 (let ((line (read-line in 'concat)))
3049 (unless (regexp-exec rx line)
3050 (display line out)
3051 (loop))))
3052 #t)))))))
3053 (build-system cmake-build-system)
3054 (native-inputs
3055 `(("tcsh" ,tcsh)))
3056 (inputs
3057 `(("blas" ,openblas)
3058 ("gfortran" ,gfortran)))
3059 (arguments
3060 `(#:configure-flags '("-Denable_blaslib:BOOL=NO" ;do not use internal cblas
3061 "-DTPL_BLAS_LIBRARIES=openblas"
3062 "-DBUILD_SHARED_LIBS:BOOL=YES")))
3063 (home-page "https://portal.nersc.gov/project/sparse/superlu/")
3064 (synopsis "Supernodal direct solver for sparse linear systems")
3065 (description
3066 "SuperLU is a general purpose library for the direct solution of large,
3067 sparse, nonsymmetric systems of linear equations on high performance machines.
3068 The library is written in C and is callable from either C or Fortran. The
3069 library routines perform an LU decomposition with partial pivoting and
3070 triangular system solves through forward and back substitution. The library
3071 also provides threshold-based ILU factorization preconditioners.")
3072 (license (list license:bsd-3
3073 license:gpl2+ ;EXAMPLE/*fgmr.c
3074 (license:fsf-free "file://SRC/colamd.h")))))
3075
3076 (define-public superlu-dist
3077 (package
3078 (name "superlu-dist")
3079 (version "6.4.0")
3080 (source
3081 (origin
3082 (method git-fetch)
3083 (uri (git-reference
3084 (url "https://github.com/xiaoyeli/superlu_dist")
3085 (commit (string-append "v" version))))
3086 (file-name (git-file-name name version))
3087 (sha256
3088 (base32 "0fa29yr72p4yq5ln4rgfsawmi5935n4qcr5niz6864bjladz4lql"))
3089 (modules '((guix build utils)))
3090 (snippet
3091 ;; Replace the non-free implementation of MC64 with a stub
3092 '(begin
3093 (make-file-writable "SRC/mc64ad_dist.c")
3094 (call-with-output-file "SRC/mc64ad_dist.c"
3095 (lambda (port)
3096 (display "
3097 #include <stdio.h>
3098 #include <stdlib.h>
3099 void mc64id_dist(int *a) {
3100 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
3101 abort ();
3102 }
3103 void mc64ad_dist (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
3104 int *h, int *i, int *j, int *k, double *l, int *m, int *n) {
3105 fprintf (stderr, \"SuperLU_DIST: non-free MC64 not available. Aborting.\\n\");
3106 abort ();
3107 }\n" port)))
3108 (substitute* "SRC/util.c" ;adjust default algorithm
3109 (("RowPerm[[:blank:]]*=[[:blank:]]*LargeDiag_MC64;")
3110 ;; TODO: set to "LargeDiag_AWPM" once combinatorial-blas has
3111 ;; general (i.e. non-square) processor-grid support.
3112 "RowPerm = NOROWPERM;"))
3113 #t))
3114 (patches (search-patches "superlu-dist-scotchmetis.patch"
3115 "superlu-dist-awpm-grid.patch"))))
3116 (build-system cmake-build-system)
3117 (native-inputs
3118 `(("tcsh" ,tcsh)))
3119 (inputs
3120 `(("gfortran" ,gfortran)
3121 ("blas" ,openblas)
3122 ("lapack" ,lapack)
3123 ("combblas" ,combinatorial-blas)))
3124 (propagated-inputs
3125 `(("mpi" ,openmpi) ;headers include MPI heades
3126 ("parmetis" ,pt-scotch32 "metis")
3127 ("pt-scotch" ,pt-scotch32)))
3128 (arguments
3129 `(#:parallel-tests? #f ;tests use MPI and OpenMP
3130 #:configure-flags (list "-DBUILD_SHARED_LIBS:BOOL=YES"
3131 "-DTPL_ENABLE_COMBBLASLIB=YES"
3132 "-DTPL_BLAS_LIBRARIES=-lopenblas"
3133 "-DTPL_LAPACK_LIBRARIES=-llapack"
3134 (string-append "-DTPL_PARMETIS_LIBRARIES="
3135 (string-join
3136 '("ptscotchparmetis" "ptscotch" "ptscotcherr"
3137 "scotchmetis" "scotch" "scotcherr")
3138 ";"))
3139 (string-append "-DTPL_PARMETIS_INCLUDE_DIRS="
3140 (assoc-ref %build-inputs "parmetis")
3141 "/include")
3142 "-DTPL_ENABLE_COMBBLASLIB=ON"
3143 (string-append "-DTPL_COMBBLAS_INCLUDE_DIRS="
3144 (assoc-ref %build-inputs "combblas")
3145 "/include/CombBLAS;"
3146 (assoc-ref %build-inputs "combblas")
3147 "/include/BipartiteMatchings")
3148 "-DTPL_COMBBLAS_LIBRARIES=CombBLAS")
3149 #:phases
3150 (modify-phases %standard-phases
3151 (add-before 'configure 'set-c++-standard
3152 (lambda _
3153 (substitute* "CMakeLists.txt"
3154 ;; AWPM headers require C++14
3155 (("CMAKE_CXX_STANDARD 11") "CMAKE_CXX_STANDARD 14"))))
3156 (add-before 'check 'mpi-setup
3157 ,%openmpi-setup)
3158 (add-before 'check 'omp-setup
3159 (lambda _ (setenv "OMP_NUM_THREADS" "1") #t)))))
3160 (home-page (package-home-page superlu))
3161 (synopsis "Parallel supernodal direct solver")
3162 (description
3163 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
3164 It is targeted for distributed memory parallel machines. SuperLU_DIST is
3165 implemented in ANSI C, and MPI for communications.")
3166 (license license:bsd-3)))
3167
3168 (define-public scotch
3169 (package
3170 (name "scotch")
3171 (version "6.1.1")
3172 (source
3173 (origin
3174 (method url-fetch)
3175 (uri (string-append "https://gforge.inria.fr/frs/download.php/"
3176 "latestfile/298/scotch_" version ".tar.gz"))
3177 (sha256
3178 (base32 "04dkz24a2g20wq703fnyi4440ac4mwycy9gwrrllljj7zxcjy19r"))
3179 (patches (search-patches "scotch-build-parallelism.patch"
3180 "scotch-integer-declarations.patch"))))
3181 (build-system gnu-build-system)
3182 (inputs
3183 `(("zlib" ,zlib)))
3184 (native-inputs
3185 `(("flex" ,flex)
3186 ("bison" ,bison)
3187 ("gfortran" ,gfortran)))
3188 (outputs '("out" "metis"))
3189 (arguments
3190 `(#:make-flags (list (string-append "prefix=" %output))
3191 #:phases
3192 (modify-phases %standard-phases
3193 (add-after
3194 'unpack 'chdir-to-src
3195 (lambda _ (chdir "src") #t))
3196 (replace
3197 'configure
3198 (lambda _
3199 (call-with-output-file "Makefile.inc"
3200 (lambda (port)
3201 (format port "
3202 EXE =
3203 LIB = .a
3204 OBJ = .o
3205 MAKE = make
3206 AR = ar
3207 ARFLAGS = -ruv
3208 CAT = cat
3209 CCS = gcc
3210 CCP = mpicc
3211 CCD = gcc
3212 FC = gfortran
3213 CPPFLAGS =~{ -D~a~}
3214 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
3215 LDFLAGS = -lz -lm -lrt -lpthread
3216 CP = cp
3217 LEX = flex -Pscotchyy -olex.yy.c
3218 LN = ln
3219 MKDIR = mkdir
3220 MV = mv
3221 RANLIB = ranlib
3222 YACC = bison -pscotchyy -y -b y
3223 "
3224 '("COMMON_FILE_COMPRESS_GZ"
3225 "COMMON_PTHREAD"
3226 "COMMON_RANDOM_FIXED_SEED"
3227 "INTSIZE64" ;use 'int64_t'
3228 ;; Prevents symbol clashes with libesmumps
3229 "SCOTCH_RENAME"
3230 ;; XXX: Causes invalid frees in superlu-dist tests
3231 ;; "SCOTCH_PTHREAD"
3232 ;; "SCOTCH_PTHREAD_NUMBER=2"
3233 "restrict=__restrict"))))
3234 #t))
3235 (add-after 'build 'build-esmumps
3236 (lambda _
3237 (invoke "make"
3238 (format #f "-j~a" (parallel-job-count))
3239 "esmumps")))
3240 (add-before 'install 'make-install-dirs
3241 (lambda* (#:key outputs #:allow-other-keys)
3242 (mkdir (assoc-ref outputs "out"))))
3243 (add-after 'install 'install-metis
3244 (lambda* (#:key outputs #:allow-other-keys)
3245 (let ((out (assoc-ref outputs "metis")))
3246 (mkdir out)
3247 ;; metis files are not installed with 'make install'
3248 (for-each (lambda (f)
3249 (install-file f (string-append out "/include")))
3250 (find-files "../include/" ".*metis\\.h"))
3251 (for-each (lambda (f)
3252 (install-file f (string-append out "/lib")))
3253 (find-files "../lib/" ".*metis\\..*"))
3254 #t))))))
3255 (home-page "https://www.labri.fr/perso/pelegrin/scotch/")
3256 (properties
3257 `((release-monitoring-url . "https://gforge.inria.fr/frs/?group_id=248")))
3258 (synopsis "Programs and libraries for graph algorithms")
3259 (description "SCOTCH is a set of programs and libraries which implement
3260 the static mapping and sparse matrix reordering algorithms developed within
3261 the SCOTCH project. Its purpose is to apply graph theory, with a divide and
3262 conquer approach, to scientific computing problems such as graph and mesh
3263 partitioning, static mapping, and sparse matrix ordering, in application
3264 domains ranging from structural mechanics to operating systems or
3265 bio-chemistry.")
3266 ;; See LICENSE_en.txt
3267 (license license:cecill-c)))
3268
3269 (define-public scotch32
3270 ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
3271 ;; some applications.
3272 (package (inherit scotch)
3273 (name "scotch32")
3274 (arguments
3275 (substitute-keyword-arguments (package-arguments scotch)
3276 ((#:phases scotch-phases)
3277 `(modify-phases ,scotch-phases
3278 (replace
3279 'configure
3280 (lambda _
3281 (call-with-output-file "Makefile.inc"
3282 (lambda (port)
3283 (format port "
3284 EXE =
3285 LIB = .a
3286 OBJ = .o
3287 MAKE = make
3288 AR = ar
3289 ARFLAGS = -ruv
3290 CAT = cat
3291 CCS = gcc
3292 CCP = mpicc
3293 CCD = gcc
3294 FC = gfortran
3295 CPPFLAGS =~{ -D~a~}
3296 CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
3297 LDFLAGS = -lz -lm -lrt -lpthread
3298 CP = cp
3299 LEX = flex -Pscotchyy -olex.yy.c
3300 LN = ln
3301 MKDIR = mkdir
3302 MV = mv
3303 RANLIB = ranlib
3304 YACC = bison -pscotchyy -y -b y
3305 "
3306 '("COMMON_FILE_COMPRESS_GZ"
3307 "COMMON_PTHREAD"
3308 "COMMON_RANDOM_FIXED_SEED"
3309 "INTSIZE32" ;use 32-bit integers. See INSTALL.txt
3310 ;; Prevents symbolc clashes with libesmumps
3311 "SCOTCH_RENAME"
3312 ;; XXX: Causes invalid frees in superlu-dist tests
3313 ;; "SCOTCH_PTHREAD"
3314 ;; "SCOTCH_PTHREAD_NUMBER=2"
3315 "restrict=__restrict"))))))))))
3316 (synopsis
3317 "Programs and libraries for graph algorithms (32-bit integers)")))
3318
3319 (define-public scotch-shared
3320 (package (inherit scotch)
3321 (name "scotch-shared")
3322 (native-inputs
3323 `(("gcc" ,gcc)
3324 ("flex" ,flex)
3325 ("bison" ,bison)))
3326 (arguments
3327 (substitute-keyword-arguments (package-arguments scotch)
3328 ((#:phases scotch-shared-phases)
3329 `(modify-phases ,scotch-shared-phases
3330 (replace
3331 'configure
3332 (lambda _
3333 ;; Otherwise, the RUNPATH will lack the final path component.
3334 (setenv "RPATHFLAGS" (string-append "-Wl,-rpath="
3335 (assoc-ref %outputs "out") "/lib"))
3336 (call-with-output-file "Makefile.inc"
3337 (lambda (port)
3338 (format port "
3339 EXE =
3340 LIB = .so
3341 OBJ = .o
3342 MAKE = make
3343 AR = gcc
3344 ARFLAGS = -shared -o
3345 CAT = cat
3346 CCS = gcc
3347 CCP = mpicc
3348 CCD = gcc
3349 FC = gfortran
3350 CPPFLAGS =~{ -D~a~}
3351 CFLAGS = -O2 -g -fPIC $(CPPFLAGS) $(RPATHFLAGS)
3352 CLIBFLAGS = -shared -fPIC
3353 LDFLAGS = -lz -lm -lrt -lpthread -Xlinker --no-as-needed
3354 CP = cp
3355 LEX = flex -Pscotchyy -olex.yy.c
3356 LN = ln
3357 MKDIR = mkdir
3358 MV = mv
3359 RANLIB = echo
3360 YACC = bison -pscotchyy -y -b y
3361 "
3362 '("COMMON_FILE_COMPRESS_GZ"
3363 "COMMON_PTHREAD"
3364 "COMMON_RANDOM_FIXED_SEED"
3365 "INTSIZE64" ;use 'int64_t'
3366 ;; Prevents symbolc clashes with libesmumps
3367 "SCOTCH_RENAME"
3368 ;; XXX: Causes invalid frees in superlu-dist tests
3369 ;; "SCOTCH_PTHREAD"
3370 ;; "SCOTCH_PTHREAD_NUMBER=2"
3371 "restrict=__restrict"
3372 ))))#t))
3373 (delete 'check)))))
3374 (synopsis
3375 "Programs and libraries for graph algorithms (shared libraries version)")))
3376
3377 (define-public pt-scotch
3378 (package (inherit scotch)
3379 (name "pt-scotch")
3380 (propagated-inputs
3381 `(("openmpi" ,openmpi))) ;Headers include MPI headers
3382 (arguments
3383 (substitute-keyword-arguments (package-arguments scotch)
3384 ((#:phases scotch-phases)
3385 `(modify-phases ,scotch-phases
3386 (replace
3387 'build
3388 (lambda _
3389 (invoke "make" (format #f "-j~a" (parallel-job-count))
3390 "ptscotch" "ptesmumps")
3391
3392 ;; Install the serial metis compatibility library
3393 (invoke "make" "-C" "libscotchmetis" "install")))
3394 (add-before 'check 'mpi-setup
3395 ,%openmpi-setup)
3396 (replace 'check
3397 (lambda _
3398 (invoke "make" "ptcheck")))))))
3399 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
3400
3401 (define-public pt-scotch32
3402 (package (inherit scotch32)
3403 (name "pt-scotch32")
3404 (propagated-inputs
3405 `(("openmpi" ,openmpi))) ;headers include MPI headers
3406 (arguments
3407 (substitute-keyword-arguments (package-arguments scotch32)
3408 ((#:phases scotch32-phases)
3409 `(modify-phases ,scotch32-phases
3410 (replace 'build
3411 (lambda _
3412 (invoke "make" (format #f "-j~a" (parallel-job-count))
3413 "ptscotch" "ptesmumps")
3414 ;; Install the serial metis compatibility library
3415 (invoke "make" "-C" "libscotchmetis" "install")))
3416 (add-before 'check 'mpi-setup
3417 ,%openmpi-setup)
3418 (replace 'check
3419 (lambda _
3420 (invoke "make" "ptcheck")))))))
3421 (synopsis
3422 "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
3423
3424 (define-public pt-scotch-shared
3425 (package (inherit scotch-shared)
3426 (name "pt-scotch-shared")
3427 (propagated-inputs
3428 `(("openmpi" ,openmpi))) ;Headers include MPI headers
3429 (arguments
3430 (substitute-keyword-arguments (package-arguments scotch-shared)
3431 ((#:phases scotch-shared-phases)
3432 `(modify-phases ,scotch-shared-phases
3433 (replace
3434 'build
3435 (lambda _
3436 (invoke "make" (format #f "-j~a" (parallel-job-count))
3437 "ptscotch" "ptesmumps")
3438
3439 ;; Install the serial metis compatibility library
3440 (invoke "make" "-C" "libscotchmetis" "install")))
3441 (add-before 'check 'mpi-setup
3442 ,%openmpi-setup)))))
3443 (synopsis "Graph algorithms (shared libraries version, with MPI)")))
3444
3445
3446 (define-public metis
3447 (package
3448 (name "metis")
3449 (version "5.1.0")
3450 (source
3451 (origin
3452 (method url-fetch)
3453 (uri (string-append "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/"
3454 "metis-" version ".tar.gz"))
3455 (sha256
3456 (base32
3457 "1cjxgh41r8k6j029yxs8msp3z6lcnpm16g5pvckk35kc7zhfpykn"))))
3458 (properties
3459 `((release-monitoring-url
3460 . "http://glaros.dtc.umn.edu/gkhome/metis/metis/download")))
3461 (build-system cmake-build-system)
3462 (inputs
3463 `(("blas" ,openblas)))
3464 (arguments
3465 `(#:tests? #f ;no tests
3466 #:configure-flags `("-DSHARED=ON"
3467 ,(string-append "-DGKLIB_PATH=" (getcwd)
3468 "/metis-" ,version "/GKlib"))))
3469 (home-page "http://glaros.dtc.umn.edu/gkhome/metis/metis/overview")
3470 (synopsis "Graph partitioning and fill-reducing matrix ordering library")
3471 (description
3472 "METIS is a set of serial programs for partitioning graphs, partitioning
3473 finite element meshes, and producing fill-reducing orderings for sparse
3474 matrices. The algorithms implemented in METIS are based on the multilevel
3475 recursive-bisection, multilevel k-way, and multi-constraint partitioning
3476 schemes.")
3477 (license license:asl2.0))) ;As of version 5.0.3
3478
3479 (define-public p4est
3480 (package
3481 (name "p4est")
3482 (version "2.0")
3483 (source
3484 (origin
3485 (method url-fetch)
3486 (uri (string-append "http://p4est.github.io/release/p4est-"
3487 version ".tar.gz"))
3488 (sha256
3489 (base32
3490 "16h267z256kxcxfjs390qqzv19hr58vrj4x8lndb7alnk2vca8n5"))))
3491 (build-system gnu-build-system)
3492 (inputs
3493 `(("fortran" ,gfortran)
3494 ("blas" ,openblas)
3495 ("lapack" ,lapack)
3496 ("zlib" ,zlib)))
3497 (arguments
3498 `(#:configure-flags `(,(string-append "BLAS_LIBS=-L"
3499 (assoc-ref %build-inputs "blas")
3500 " -lopenblas")
3501 ,(string-append "LAPACK_LIBS=-L"
3502 (assoc-ref %build-inputs "lapack")
3503 " -llapack"))
3504 #:phases (modify-phases %standard-phases
3505 (add-before 'check 'mpi-setup
3506 ,%openmpi-setup))))
3507 (home-page "http://www.p4est.org")
3508 (synopsis "Adaptive mesh refinement on forests of octrees")
3509 (description
3510 "The p4est software library enables the dynamic management of a
3511 collection of adaptive octrees, conveniently called a forest of octrees.
3512 p4est is designed to work in parallel and scales to hundreds of thousands of
3513 processor cores.")
3514 (license license:gpl2+)))
3515
3516 (define-public p4est-openmpi
3517 (package (inherit p4est)
3518 (name "p4est-openmpi")
3519 (inputs
3520 `(("mpi" ,openmpi)
3521 ,@(package-inputs p4est)))
3522 (arguments
3523 (substitute-keyword-arguments (package-arguments p4est)
3524 ((#:configure-flags cf)
3525 ``("--enable-mpi" ,@,cf))))
3526 (synopsis "Parallel adaptive mesh refinement on forests of octrees")))
3527
3528 (define-public gsegrafix
3529 (package
3530 (name "gsegrafix")
3531 (version "1.0.6")
3532 (source
3533 (origin
3534 (method url-fetch)
3535 (uri (string-append "mirror://gnu/" name "/" name "-"
3536 version ".tar.gz"))
3537 (sha256
3538 (base32
3539 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
3540 (build-system gnu-build-system)
3541 (arguments
3542 `(#:configure-flags '("LDFLAGS=-lm")))
3543 (inputs
3544 `(("libgnomecanvas" ,libgnomecanvas)
3545 ("libbonoboui" ,libbonoboui)
3546 ("libgnomeui" ,libgnomeui)
3547 ("libgnomeprintui" ,libgnomeprintui)
3548 ("popt" ,popt)))
3549 (native-inputs
3550 `(("pkg-config" ,pkg-config)))
3551 (home-page "https://www.gnu.org/software/gsegrafix/")
3552 (synopsis "GNOME application to create scientific and engineering plots")
3553 (description "GSEGrafix is an application which produces high-quality graphical
3554 plots for science and engineering. Plots are specified via simple ASCII
3555 parameter files and data files and are presented in an anti-aliased GNOME
3556 canvas. The program supports rectangular two-dimensional plots, histograms,
3557 polar-axis plots and three-dimensional plots. Plots can be printed or saved
3558 to BMP, JPEG or PNG image formats.")
3559 (license license:gpl3+)))
3560
3561 (define-public maxima
3562 (package
3563 (name "maxima")
3564 (version "5.45.1")
3565 (source
3566 (origin
3567 (method url-fetch)
3568 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
3569 version "-source/" name "-" version ".tar.gz"))
3570 (sha256
3571 (base32
3572 "1p77nk5sz1qfkn5zr97szpbi8ib4b22k8i52l4ag5gkhd4kid47y"))
3573 (patches (search-patches "maxima-defsystem-mkdir.patch"))))
3574 (build-system gnu-build-system)
3575 (inputs
3576 `(("gcl" ,gcl)
3577 ("gnuplot" ,gnuplot) ;for plots
3578 ("sed" ,sed)
3579 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
3580 (native-inputs
3581 `(("texinfo" ,texinfo)
3582 ("perl" ,perl)
3583 ("python" ,python)))
3584 (arguments
3585 `(#:configure-flags
3586 (list "--enable-gcl"
3587 (string-append "--with-posix-shell="
3588 (assoc-ref %build-inputs "bash")
3589 "/bin/sh")
3590 (string-append "--with-wish="
3591 (assoc-ref %build-inputs "tk")
3592 "/bin/wish"
3593 (let ((v ,(package-version tk)))
3594 (string-take v (string-index-right v #\.)))))
3595 ;; By default Maxima attempts to write temporary files to
3596 ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
3597 ;; Work around that.
3598 #:make-flags (list "TMPDIR=/tmp")
3599 #:phases
3600 (modify-phases %standard-phases
3601 (add-after 'unpack 'patch-paths
3602 (lambda* (#:key inputs #:allow-other-keys)
3603 (let* ((sed (string-append (assoc-ref inputs "sed") "/bin/sed"))
3604 (coreutils (assoc-ref inputs "coreutils"))
3605 (dirname (string-append coreutils "/bin/dirname"))
3606 (head (string-append coreutils "/bin/head"))
3607 (perl (string-append (assoc-ref inputs "perl") "/bin/perl"))
3608 (python (string-append (assoc-ref inputs "python")
3609 "/bin/python3")))
3610 (substitute* "src/maxima.in"
3611 (("sed ") (string-append sed " "))
3612 (("dirname") dirname)
3613 (("head") head))
3614 (substitute* "doc/info/Makefile.in"
3615 (("/usr/bin/env perl") perl))
3616 (substitute* "doc/info/build_html.sh.in"
3617 (("python") python))
3618 #t)))
3619 (add-before 'check 'pre-check
3620 (lambda _
3621 (chmod "src/maxima" #o555)
3622 #t))
3623 (replace 'check
3624 (lambda _
3625 ;; This is derived from the testing code in the "debian/rules" file
3626 ;; of Debian's Maxima package.
3627 ;; If Maxima can successfully run this, the binary to be installed
3628 ;; should be fine.
3629 (invoke "sh" "-c"
3630 (string-append
3631 "./maxima-local "
3632 "--lisp=gcl "
3633 "--batch-string=\"run_testsuite();\" "
3634 "| grep -q \"No unexpected errors found\""))))
3635 ;; Make sure the doc and emacs files are found in the
3636 ;; standard location. Also configure maxima to find gnuplot
3637 ;; without having it on the PATH.
3638 (add-after 'install 'post-install
3639 (lambda* (#:key outputs inputs #:allow-other-keys)
3640 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
3641 (out (assoc-ref outputs "out"))
3642 (datadir (string-append out "/share/maxima/" ,version))
3643 (binutils (string-append (assoc-ref inputs "binutils")
3644 "/bin")))
3645 (with-directory-excursion out
3646 (mkdir-p "share/emacs")
3647 (mkdir-p "share/doc")
3648 (symlink
3649 (string-append datadir "/doc/")
3650 (string-append out "/share/doc/maxima"))
3651 (with-atomic-file-replacement
3652 (string-append datadir "/share/maxima-init.lisp")
3653 (lambda (in out)
3654 (format out "~a ~s~a~%"
3655 "(setf $gnuplot_command "
3656 (string-append gnuplot "/bin/gnuplot") ")")
3657 (dump-port in out))))
3658 ;; Ensure that Maxima will have access to the GNU binutils
3659 ;; components at runtime.
3660 (wrap-program (string-append out "/bin/maxima")
3661 `("PATH" prefix (,binutils))))
3662 #t)))))
3663 (home-page "https://maxima.sourceforge.io")
3664 (synopsis "Numeric and symbolic expression manipulation")
3665 (description "Maxima is a system for the manipulation of symbolic and
3666 numerical expressions. It yields high precision numeric results by using
3667 exact fractions, arbitrary precision integers, and variable precision floating
3668 point numbers.")
3669 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
3670 ;; Others simply say "GNU General Public License" without stating a
3671 ;; version (which implicitly means gpl1+).
3672 ;; At least one file (src/maxima.asd) says "version 2."
3673 ;; GPLv2 only is therefore the smallest subset.
3674 (license license:gpl2)))
3675
3676 (define-public wxmaxima
3677 (package
3678 (name "wxmaxima")
3679 (version "21.05.2")
3680 (source
3681 (origin
3682 (method git-fetch)
3683 (uri (git-reference
3684 (url "https://github.com/wxMaxima-developers/wxmaxima")
3685 (commit (string-append "Version-" version))))
3686 (file-name (git-file-name name version))
3687 (sha256
3688 (base32 "0h7ryykh2dapcyvpp4f1j1b3vrrz80x9k8nkci2yxifgdb29vyhw"))))
3689 (build-system cmake-build-system)
3690 (native-inputs
3691 `(("gettext" ,gettext-minimal)))
3692 (inputs
3693 `(("wxwidgets" ,wxwidgets)
3694 ("maxima" ,maxima)
3695 ;; Runtime support.
3696 ("adwaita-icon-theme" ,adwaita-icon-theme)
3697 ("gtk+" ,gtk+)
3698 ("shared-mime-info" ,shared-mime-info)))
3699 (arguments
3700 `(#:tests? #f ; tests fail non-deterministically
3701 #:phases
3702 (modify-phases %standard-phases
3703 (add-after 'unpack 'patch-doc-path
3704 (lambda _
3705 ;; Don't look in share/doc/wxmaxima-xx.xx.x for the
3706 ;; documentation. Only licensing information is placed there by
3707 ;; Guix.
3708 (substitute* "src/Dirstructure.cpp"
3709 (("/doc/wxmaxima-\\%s") "/doc/wxmaxima"))
3710 #t))
3711 (add-after 'install 'wrap-program
3712 (lambda* (#:key inputs outputs #:allow-other-keys)
3713 (wrap-program (string-append (assoc-ref outputs "out")
3714 "/bin/wxmaxima")
3715 `("PATH" ":" prefix
3716 (,(string-append (assoc-ref inputs "maxima")
3717 "/bin")))
3718 ;; For GtkFileChooserDialog.
3719 `("GSETTINGS_SCHEMA_DIR" =
3720 (,(string-append (assoc-ref inputs "gtk+")
3721 "/share/glib-2.0/schemas")))
3722 `("XDG_DATA_DIRS" ":" prefix
3723 (;; Needed by gdk-pixbuf to know supported icon formats.
3724 ,(string-append
3725 (assoc-ref inputs "shared-mime-info") "/share")
3726 ;; The default icon theme of GTK+.
3727 ,(string-append
3728 (assoc-ref inputs "adwaita-icon-theme") "/share"))))
3729 #t)))))
3730 (home-page "https://wxmaxima-developers.github.io/wxmaxima/")
3731 (synopsis "Graphical user interface for the Maxima computer algebra system")
3732 (description
3733 "wxMaxima is a graphical user interface for the Maxima computer algebra
3734 system. It eases the use of Maxima by making most of its commands available
3735 through a menu system and by providing input dialogs for commands that require
3736 more than one argument. It also implements its own display engine that
3737 outputs mathematical symbols directly instead of depicting them with ASCII
3738 characters.
3739
3740 wxMaxima also features 2D and 3D inline plots, simple animations, mixing of
3741 text and mathematical calculations to create documents, exporting of input and
3742 output to TeX, and a browser for Maxima's manual including command index and
3743 full text searching.")
3744 (license license:gpl2+)))
3745
3746 (define-public armadillo
3747 (package
3748 (name "armadillo")
3749 (version "9.100.5")
3750 (source (origin
3751 (method url-fetch)
3752 (uri (string-append "mirror://sourceforge/arma/armadillo-"
3753 version ".tar.xz"))
3754 (sha256
3755 (base32
3756 "1ka1vd9fcmvp12qkcm4888dkfqwnalvv00x04wy29f3nx3qwczby"))))
3757 (build-system cmake-build-system)
3758 (arguments `(#:tests? #f)) ; no test target
3759 (inputs
3760 `(("openblas" ,openblas)
3761 ("lapack" ,lapack)
3762 ("arpack" ,arpack-ng)))
3763 (home-page "http://arma.sourceforge.net/")
3764 (synopsis "C++ linear algebra library")
3765 (description
3766 "Armadillo is a C++ linear algebra library, aiming towards a good balance
3767 between speed and ease of use. It is useful for algorithm development
3768 directly in C++, or quick conversion of research code into production
3769 environments. It can be used for machine learning, pattern recognition,
3770 signal processing, bioinformatics, statistics, econometrics, etc. The library
3771 provides efficient classes for vectors, matrices and cubes, as well as 150+
3772 associated functions (e.g., contiguous and non-contiguous submatrix views).")
3773 (license license:asl2.0)))
3774
3775 (define-public muparser
3776 ;; When switching download sites, muparser re-issued a 2.2.5 release with a
3777 ;; different hash. In order to make `guix package --upgrade` work correctly,
3778 ;; we set a Guix packaging revision.
3779 ;; When the next version of muparser is released, we can remove
3780 ;; UPSTREAM-VERSION and REVISION and use the plain VERSION.
3781 (let ((upstream-version "2.2.5")
3782 (revision "2"))
3783 (package
3784 (name "muparser")
3785 (version (string-append upstream-version "-" revision))
3786 (source
3787 (origin
3788 (method git-fetch)
3789 (uri (git-reference
3790 (url "https://github.com/beltoforion/muparser")
3791 (commit (string-append "v" upstream-version))))
3792 (file-name (git-file-name name version))
3793 (sha256
3794 (base32 "0f0g4995xngf1pp3zr4p6ai2f8v6f8bxwa0k8ayjjiv1l8h44m24"))))
3795 (build-system gnu-build-system)
3796 (arguments
3797 `(#:configure-flags '("--enable-samples=no")
3798 #:tests? #f)) ;no "check" target
3799 (home-page "http://muparser.beltoforion.de/")
3800 (synopsis "Fast parser library for mathematical expressions")
3801 (description
3802 "muParser is an extensible high performance math parser library. It is
3803 based on transforming an expression into a bytecode and precalculating constant
3804 parts of it.")
3805 (license license:expat))))
3806
3807 (define-public openblas
3808 (package
3809 (name "openblas")
3810 (version "0.3.9")
3811 (source
3812 (origin
3813 (method url-fetch)
3814 (uri (string-append "mirror://sourceforge/openblas/v" version "/OpenBLAS%20"
3815 version "%20version.tar.gz"))
3816 (file-name (string-append name "-" version ".tar.gz"))
3817 (sha256
3818 (base32
3819 "14iz9xnrb9xiwgj84j94mc74gg0zn2vsy9fmsijxxma1n7dck4w3"))))
3820 (build-system gnu-build-system)
3821 (arguments
3822 `(#:test-target "test"
3823 ;; DYNAMIC_ARCH is only supported on x86. When it is disabled and no
3824 ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
3825 ;; we need to disable substitutions.
3826 #:substitutable?
3827 ,(let ((system (or (%current-target-system) (%current-system))))
3828 (or (string-prefix? "x86_64" system)
3829 (string-prefix? "i686" system)
3830 (string-prefix? "mips" system)
3831 (string-prefix? "aarch64" system)))
3832 #:make-flags
3833 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
3834 "SHELL=bash"
3835 "MAKE_NB_JOBS=0" ;use jobserver for submakes
3836
3837 ;; This is the maximum number of threads OpenBLAS will ever use (that
3838 ;; is, if $OPENBLAS_NUM_THREADS is greater than that, then NUM_THREADS
3839 ;; is used.) If we don't set it, the makefile sets it to the number
3840 ;; of cores of the build machine, which is obviously wrong.
3841 "NUM_THREADS=128"
3842
3843 ;; Build the library for all supported CPUs. This allows
3844 ;; switching CPU targets at runtime with the environment variable
3845 ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
3846 ;; Unfortunately, this is not supported on all architectures,
3847 ;; where it leads to failed builds.
3848 ,@(let ((system (or (%current-target-system) (%current-system))))
3849 (cond
3850 ((or (string-prefix? "x86_64" system)
3851 (string-prefix? "i686" system))
3852 '("DYNAMIC_ARCH=1"))
3853 ;; On some of these architectures the CPU can't be detected.
3854 ((string-prefix? "powerpc64le" system)
3855 '("DYNAMIC_ARCH=1"
3856 "TARGET=GENERIC"))
3857 ;; On MIPS we force the "SICORTEX" TARGET, as for the other
3858 ;; two available MIPS targets special extended instructions
3859 ;; for Loongson cores are used.
3860 ((string-prefix? "mips" system)
3861 '("TARGET=SICORTEX"))
3862 ;; On aarch64 force the generic 'armv8-a' target
3863 ((string-prefix? "aarch64" system)
3864 '("TARGET=ARMV8"))
3865 ;; Failed to detect CPU.
3866 ((string-prefix? "armhf" system)
3867 '("TARGET=ARMV7"))
3868 (else '()))))
3869 ;; no configure script
3870 #:phases
3871 (modify-phases %standard-phases
3872 (delete 'configure)
3873 (add-before 'build 'set-extralib
3874 (lambda* (#:key inputs #:allow-other-keys)
3875 ;; Get libgfortran found when building in utest.
3876 (setenv "FEXTRALIB"
3877 (string-append "-L" (assoc-ref inputs "fortran-lib")
3878 "/lib"))
3879 #t)))))
3880 (inputs
3881 `(("fortran-lib" ,gfortran "lib")))
3882 (native-inputs
3883 `(("cunit" ,cunit)
3884 ("fortran" ,gfortran)
3885 ("perl" ,perl)))
3886 (home-page "https://www.openblas.net/")
3887 (synopsis "Optimized BLAS library based on GotoBLAS")
3888 (description
3889 "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
3890 (license license:bsd-3)))
3891
3892 (define-public openblas-ilp64
3893 (package/inherit openblas
3894 (name "openblas-ilp64")
3895 (supported-systems '("x86_64-linux" "aarch64-linux" "mips64el-linux"))
3896 (arguments
3897 (substitute-keyword-arguments (package-arguments openblas)
3898 ((#:make-flags flags '())
3899 `(append (list "INTERFACE64=1" "LIBNAMESUFFIX=ilp64")
3900 ,flags))))
3901 (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
3902 (license license:bsd-3)))
3903
3904 (define-public blis
3905 (package
3906 (name "blis")
3907 (version "0.8.1")
3908 (home-page "https://github.com/flame/blis")
3909 (source (origin
3910 (method git-fetch)
3911 (uri (git-reference (url home-page) (commit version)))
3912 (sha256
3913 (base32
3914 "05ifil6jj9424sr8kmircl8k4bmxnl3y12a79vwj1kxxva5gz50g"))
3915 (file-name (git-file-name "blis" version))))
3916 (native-inputs
3917 `(("python" ,python)
3918 ("perl" ,perl)))
3919 (build-system gnu-build-system)
3920 (arguments
3921 `(#:modules
3922 ((guix build gnu-build-system)
3923 (guix build utils)
3924 (srfi srfi-1))
3925 #:test-target "test"
3926 #:phases
3927 (modify-phases %standard-phases
3928 (replace 'configure
3929 (lambda* (#:key outputs
3930 target
3931 system
3932 (configure-flags '())
3933 #:allow-other-keys)
3934 ;; This is a home-made 'configure' script.
3935 (let* ((out (assoc-ref outputs "out"))
3936 ;; Guix-specific support for choosing the configuration
3937 ;; via #:configure-flags: see below for details.
3938 (config-flag-prefix "--blis-config=")
3939 (maybe-config-flag (find
3940 (lambda (s)
3941 (string-prefix? config-flag-prefix s))
3942 configure-flags))
3943 (configure-flags (if maybe-config-flag
3944 (delete maybe-config-flag
3945 configure-flags)
3946 configure-flags))
3947 ;; Select the "configuration" to build.
3948 ;; The "generic" configuration is non-optimized but
3949 ;; portable (no assembly).
3950 ;; The "x86_64" configuration family includes
3951 ;; sub-configurations for all supported
3952 ;; x86_64 microarchitectures.
3953 ;; BLIS currently lacks runtime hardware detection
3954 ;; for other architectures: see
3955 ;; <https://github.com/flame/blis/commit/c534da6>.
3956 ;; Conservatively, we stick to "generic" on armhf,
3957 ;; aarch64, and ppc64le for now. (But perhaps
3958 ;; "power9", "cortexa9", and "cortexa57" might be
3959 ;; general enough to use?)
3960 ;; Another approach would be to use the "auto"
3961 ;; configuration and make this package
3962 ;; non-substitutable.
3963 ;; The build is fairly intensive, though.
3964 (blis-config
3965 (cond
3966 (maybe-config-flag
3967 (substring maybe-config-flag
3968 (string-length config-flag-prefix)))
3969 ((string-prefix? "x86_64" (or target system))
3970 "x86_64")
3971 (else
3972 "generic")))
3973 (configure-args
3974 `("-p" ,out
3975 "-d" "opt"
3976 "--disable-static"
3977 "--enable-shared"
3978 "--enable-threading=openmp"
3979 "--enable-verbose-make"
3980 ,@configure-flags
3981 ,blis-config)))
3982 (format #t "configure args: ~s~%" configure-args)
3983 (apply invoke
3984 "./configure"
3985 configure-args)
3986 #t)))
3987 (add-before 'check 'show-test-output
3988 (lambda _
3989 ;; By default "make check" is silent. Make it verbose.
3990 (system "tail -F output.testsuite &")
3991 #t)))))
3992 (synopsis "High-performance basic linear algebra (BLAS) routines")
3993 (description
3994 "BLIS is a portable software framework for instantiating high-performance
3995 BLAS-like dense linear algebra libraries. The framework was designed to
3996 isolate essential kernels of computation that, when optimized, immediately
3997 enable optimized implementations of most of its commonly used and
3998 computationally intensive operations. While BLIS exports a new BLAS-like API,
3999 it also includes a BLAS compatibility layer which gives application developers
4000 access to BLIS implementations via traditional BLAS routine calls.")
4001 (license license:bsd-3)))
4002
4003 (define-public blis-sandybridge (deprecated-package "blis-sandybridge" blis))
4004 (define-public blis-haswell (deprecated-package "blis-haswell" blis))
4005 (define-public blis-knl (deprecated-package "blis-knl" blis))
4006
4007 (define ignorance blis)
4008
4009 (define-public openlibm
4010 (package
4011 (name "openlibm")
4012 (version "0.6.0")
4013 (source
4014 (origin
4015 (method git-fetch)
4016 (uri (git-reference
4017 (url "https://github.com/JuliaLang/openlibm")
4018 (commit (string-append "v" version))))
4019 (file-name (git-file-name name version))
4020 (sha256
4021 (base32 "08wfchmmr5200fvmn1kwq9byc1fhsq46hn0y5k8scdl74771c7gh"))))
4022 (build-system gnu-build-system)
4023 (arguments
4024 `(#:make-flags
4025 (list (string-append "prefix=" (assoc-ref %outputs "out")))
4026 #:phases
4027 ;; no configure script
4028 (modify-phases %standard-phases (delete 'configure))
4029 #:tests? #f)) ;the tests are part of the default target
4030 (home-page "https://openlibm.org/")
4031 (synopsis "Portable C mathematical library (libm)")
4032 (description
4033 "OpenLibm is an effort to have a high quality, portable, standalone C
4034 mathematical library (libm). It can be used standalone in applications and
4035 programming language implementations. The project was born out of a need to
4036 have a good libm for the Julia programming language that worked consistently
4037 across compilers and operating systems, and in 32-bit and 64-bit
4038 environments.")
4039 ;; Each architecture has its own make target, and there is none for mips.
4040 (supported-systems (delete "mips64el-linux" %supported-systems))
4041 ;; See LICENSE.md for details.
4042 (license (list license:expat
4043 license:isc
4044 license:bsd-2
4045 license:public-domain
4046 license:lgpl2.1+))))
4047
4048 (define-public openspecfun
4049 (package
4050 (name "openspecfun")
4051 (version "0.5.3")
4052 (source
4053 (origin
4054 (method git-fetch)
4055 (uri (git-reference
4056 (url "https://github.com/JuliaLang/openspecfun")
4057 (commit (string-append "v" version))))
4058 (file-name (git-file-name name version))
4059 (sha256
4060 (base32 "0pfw6l3ch7isz403llx7inxlvavqh01jh1hb9dpidi86sjjx9kfh"))))
4061 (build-system gnu-build-system)
4062 (arguments
4063 '(#:tests? #f ; no "check" target
4064 #:make-flags
4065 (list (string-append "prefix=" (assoc-ref %outputs "out")))
4066 #:phases
4067 (modify-phases %standard-phases
4068 (delete 'configure)))) ; no configure script
4069 (inputs
4070 `(("fortran" ,gfortran)))
4071 (home-page "https://github.com/JuliaLang/openspecfun")
4072 (synopsis "Collection of special mathematical functions")
4073 (description
4074 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
4075 portable package for Bessel Functions of a Complex Argument and Nonnegative
4076 Order; it contains subroutines for computing Bessel functions and Airy
4077 functions. Faddeeva allows computing the various error functions of arbitrary
4078 complex arguments (Faddeeva function, error function, complementary error
4079 function, scaled complementary error function, imaginary error function, and
4080 Dawson function); given these, one can also easily compute Voigt functions,
4081 Fresnel integrals, and similar related functions as well.")
4082 ;; Faddeeva is released under the Expat license; AMOS is included as
4083 ;; public domain software.
4084 (license (list license:expat license:public-domain))))
4085
4086 (define-public suitesparse
4087 (package
4088 (name "suitesparse")
4089 (version "5.10.1")
4090 (source
4091 (origin
4092 (method git-fetch)
4093 (uri (git-reference
4094 (url "https://github.com/DrTimothyAldenDavis/SuiteSparse")
4095 (commit (string-append "v" version))))
4096 (file-name (git-file-name name version))
4097 (sha256
4098 (base32
4099 "19gx5wlgqnqpgz6mvam9lalyzpbfwgqhppps8z3np9sh0mgaiyw9"))
4100 (patches (search-patches "suitesparse-mongoose-cmake.patch"))
4101 (modules '((guix build utils)))
4102 (snippet
4103 ;; Remove bundled metis source
4104 '(begin
4105 (delete-file-recursively "metis-5.1.0")
4106 #t))))
4107 (build-system gnu-build-system)
4108 (arguments
4109 `(#:tests? #f ;no "check" target
4110 #:make-flags
4111 (list (string-append "CC=" ,(cc-for-target))
4112 "TBB=-ltbb"
4113 "MY_METIS_LIB=-lmetis"
4114
4115 ;; The default is to link against netlib lapack. Use OpenBLAS
4116 ;; instead.
4117 "BLAS=-lopenblas" "LAPACK=-lopenblas"
4118
4119 ;; Flags for cmake (required to build GraphBLAS and Mongoose)
4120 (string-append "CMAKE_OPTIONS=-DCMAKE_INSTALL_PREFIX="
4121 (assoc-ref %outputs "out")
4122 " -DCMAKE_VERBOSE_MAKEFILE=ON"
4123 " -DCMAKE_C_FLAGS_RELEASE=\"$(CFLAGS) $(CPPFLAGS)\""
4124 " -DCMAKE_CXX_FLAGS_RELEASE=\"$(CXXFLAGS) $(CPPFLAGS)\""
4125 " -DCMAKE_SKIP_RPATH=TRUE"
4126 " -DCMAKE_BUILD_TYPE=Release"
4127 " -DCMAKE_INSTALL_LIBDIR=lib")
4128 (string-append "INSTALL_LIB="
4129 (assoc-ref %outputs "out") "/lib")
4130 (string-append "INSTALL_INCLUDE="
4131 (assoc-ref %outputs "out") "/include")
4132 "library")
4133 #:phases
4134 (modify-phases %standard-phases
4135 (delete 'configure)))) ;no configure script
4136 (inputs
4137 `(("tbb" ,tbb)
4138 ("openblas" ,openblas)
4139 ("gmp" ,gmp)
4140 ("mpfr" ,mpfr)
4141 ("metis" ,metis)))
4142 (native-inputs
4143 `(("cmake" ,cmake-minimal)
4144 ("m4" ,m4)))
4145 (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
4146 (synopsis "Suite of sparse matrix software")
4147 (description
4148 "SuiteSparse is a suite of sparse matrix algorithms, including: UMFPACK,
4149 multifrontal LU factorization; CHOLMOD, supernodal Cholesky; SPQR,
4150 multifrontal QR; KLU and BTF, sparse LU factorization, well-suited for circuit
4151 simulation; ordering methods (AMD, CAMD, COLAMD, and CCOLAMD); CSparse and
4152 CXSparse, a concise sparse Cholesky factorization package; and many other
4153 packages.")
4154 ;; LGPLv2.1+:
4155 ;; AMD, CAMD, BTF, COLAMD, CCOLAMD, CSparse, CXSparse, KLU, LDL
4156 ;; GPLv2+:
4157 ;; GPUQREngine, RBio, SuiteSparse_GPURuntime, SuiteSparseQR, UMFPACK
4158 (license (list license:gpl2+ license:lgpl2.1+))))
4159
4160 (define-public atlas
4161 (package
4162 (name "atlas")
4163 (version "3.10.3")
4164 (source (origin
4165 (method url-fetch)
4166 (uri (string-append "mirror://sourceforge/math-atlas/Stable/"
4167 version "/atlas" version ".tar.bz2"))
4168 (sha256
4169 (base32
4170 "1dyjlq3fiparvm8ypwk6rsmjzmnwk81l88gkishphpvc79ryp216"))))
4171 (build-system gnu-build-system)
4172 (home-page "http://math-atlas.sourceforge.net/")
4173 (inputs `(("gfortran" ,gfortran)
4174 ("lapack-tar" ,(package-source lapack))))
4175 (outputs '("out" "doc"))
4176 ;; For the moment we drop support for MIPS at it fails to compile. See
4177 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
4178 (supported-systems (delete "mips64el-linux" %supported-systems))
4179 (arguments
4180 `(#:parallel-build? #f
4181 #:parallel-tests? #f
4182
4183 ;; ATLAS tunes itself for the machine it is built on, as explained at
4184 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
4185 ;; For this reason, we want users to build it locally instead of using
4186 ;; substitutes.
4187 #:substitutable? #f
4188
4189 #:modules ((srfi srfi-26)
4190 (guix build gnu-build-system)
4191 (guix build utils))
4192 #:configure-flags
4193 `(;; Generate position independent code suitable for dynamic libraries
4194 ;; and use WALL timer to get more accurate timing.
4195 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
4196 ;; Set word width.
4197 "-b"
4198 ,,(if (string-match "64" (%current-system))
4199 "64"
4200 "32")
4201 ;; Disable parallel build as it gives errors: atlas_pthread.h is
4202 ;; needed to compile C files before it is generated.
4203 "-Ss" "pmake" "make -j 1"
4204 ;; Probe is failing for MIPS. We therefore define the system
4205 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
4206 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
4207 ,,@(if (string-prefix? "mips" (%current-system))
4208 (list "-A" "49" "-V" "1")
4209 (list))
4210 ;; Generate shared libraries.
4211 "--shared"
4212 ;; Build a full LAPACK library.
4213 ,(string-append "--with-netlib-lapack-tarfile="
4214 (assoc-ref %build-inputs "lapack-tar")))
4215 #:phases
4216 (modify-phases %standard-phases
4217 (add-after 'install 'install-doc
4218 (lambda* (#:key outputs inputs #:allow-other-keys)
4219 (let ((doc (string-append (assoc-ref outputs "doc")
4220 "/share/doc/atlas")))
4221 (mkdir-p doc)
4222 (for-each (cut install-file <> doc)
4223 (find-files "../ATLAS/doc" ".*"))
4224 #t)))
4225 (add-after 'check 'check-pt
4226 (lambda _ (invoke "make" "ptcheck")))
4227 ;; Fix files required to run configure.
4228 (add-before 'configure 'fix-/bin/sh
4229 (lambda _
4230 ;; Use `sh', not `/bin/sh'.
4231 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
4232 (("/bin/sh")
4233 "sh"))
4234 #t))
4235 ;; Fix /bin/sh in generated make files.
4236 (add-after 'configure 'fix-/bin/sh-in-generated-files
4237 (lambda _
4238 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
4239 (("/bin/sh")
4240 "sh"))
4241 #t))
4242 ;; ATLAS configure program does not accepts the default flags
4243 ;; passed by the 'gnu-build-system'.
4244 (replace 'configure
4245 (lambda* (#:key native-inputs inputs outputs
4246 (configure-flags '())
4247 #:allow-other-keys #:rest args)
4248 (let* ((prefix (assoc-ref outputs "out"))
4249 (bash (or (and=> (assoc-ref
4250 (or native-inputs inputs) "bash")
4251 (cut string-append <> "/bin/bash"))
4252 "/bin/sh"))
4253 (flags `(,(string-append "--prefix=" prefix)
4254 ,@configure-flags))
4255 (abs-srcdir (getcwd))
4256 (srcdir (string-append "../" (basename abs-srcdir))))
4257 (format #t "source directory: ~s (relative from build: ~s)~%"
4258 abs-srcdir srcdir)
4259 (mkdir "../build")
4260 (chdir "../build")
4261 (format #t "build directory: ~s~%" (getcwd))
4262 (format #t "configure flags: ~s~%" flags)
4263 (apply invoke bash
4264 (string-append srcdir "/configure")
4265 flags)))))))
4266 (synopsis "Automatically Tuned Linear Algebra Software")
4267 (description
4268 "ATLAS is an automatically tuned linear algebra software library
4269 providing C and Fortran77 interfaces to a portably efficient BLAS
4270 implementation, as well as a few routines from LAPACK.
4271
4272 Optimization occurs at build time. For this reason, the library is built on
4273 the machine where it is installed, without resorting to pre-built substitutes.
4274
4275 Before building the library, CPU throttling should be disabled. This can be
4276 done in the BIOS, or, on GNU/Linux, with the following command:
4277
4278 @example
4279 # cpupower --governor performance
4280 @end example
4281
4282 Failure to do so will result in a library with poor performance.")
4283 ;; The test suite is notoriously lengthy and routinely exceeds the default
4284 ;; timeout of 21600 seconds on the not unbeefy berlin build nodes.
4285 (properties '((timeout . 86400))) ; 1 day
4286 (license license:bsd-3)))
4287
4288 (define-public cglm
4289 (package
4290 (name "cglm")
4291 (version "0.8.2")
4292 (source
4293 (origin
4294 (method git-fetch)
4295 (uri (git-reference
4296 (url "https://github.com/recp/cglm")
4297 (commit (string-append "v" version))))
4298 (file-name (git-file-name name version))
4299 (sha256
4300 (base32 "1lcfl9ph4bnl3hckpx4hzwh8r4llnw94ik75igc5qy38wk468gmk"))))
4301 (build-system cmake-build-system)
4302 (arguments
4303 `(#:configure-flags
4304 (list "-DCGLM_USE_TEST=ON")))
4305 (home-page "https://github.com/recp/cglm")
4306 (synopsis "Mathematics C library for graphics programming")
4307 (description
4308 "@acronym{CGLM, C OpenGL Mathematics} is an optimised 3D maths library
4309 for graphics software based on the @acronym{GLSL, OpenGL Shading Language}
4310 specifications.
4311
4312 It's similar to the original C++ GLM library but written in C99 and compatible
4313 with C89.")
4314 (license license:expat)))
4315
4316 (define-public glm
4317 (package
4318 (name "glm")
4319 (version "0.9.9.8")
4320 (source
4321 (origin
4322 (method url-fetch)
4323 (uri (string-append "https://github.com/g-truc/glm/releases/download/"
4324 version "/glm-" version ".zip"))
4325 (sha256
4326 (base32 "0k6yk9v46h690rshdx49x98y5qspkzibld1wb51jwcm35vba7qip"))))
4327 (build-system cmake-build-system)
4328 (arguments
4329 `(#:phases (modify-phases %standard-phases
4330 (replace 'install
4331 (lambda* (#:key outputs #:allow-other-keys)
4332 ;; Since version 0.9.9.6, 'make install' is not supported
4333 ;; and we have to do it "manually". Upstream discussion:
4334 ;; <https://github.com/g-truc/glm/pull/968>.
4335 (let* ((source (string-append "../glm"))
4336 (out (assoc-ref outputs "out"))
4337 (inc (string-append out "/include"))
4338 (lib (string-append out "/lib"))
4339 (pkgconfig (string-append lib "/pkgconfig")))
4340 (with-directory-excursion source
4341 (mkdir-p inc)
4342 (mkdir-p pkgconfig)
4343 (copy-recursively "glm" (string-append inc "/glm"))
4344 (copy-recursively "cmake" (string-append lib "/cmake"))
4345 (call-with-output-file (string-append pkgconfig "/glm.pc")
4346 (lambda (port)
4347 (format port
4348 "prefix=~a
4349 includedir=${prefix}/include
4350
4351 Name: GLM
4352 Description: OpenGL Mathematics
4353 Version: ~a
4354 Cflags: -I${includedir}~%" out ,(version-prefix version 3)))))
4355 #t))))))
4356 (native-inputs
4357 `(("unzip" ,unzip)))
4358 (home-page "https://glm.g-truc.net/")
4359 (synopsis "OpenGL Mathematics library")
4360 (description "OpenGL Mathematics (GLM) is a header-only C++ mathematics
4361 library for graphics software based on the OpenGL Shading Language (GLSL)
4362 specifications.")
4363 (license license:expat)))
4364
4365 (define-public lpsolve
4366 (package
4367 (name "lpsolve")
4368 (version "5.5.2.5")
4369 (source
4370 (origin
4371 (method url-fetch)
4372 (uri (string-append "mirror://sourceforge/lpsolve/lpsolve/" version
4373 "/lp_solve_" version "_source.tar.gz"))
4374 (sha256
4375 (base32
4376 "12pj1idjz31r7c2mb5w03vy1cmvycvbkx9z29s40qdmkp1i7q6i0"))
4377 (modules '((guix build utils)))
4378 (snippet
4379 '(begin
4380 (substitute* (list "lp_solve/ccc" "lpsolve55/ccc")
4381 (("^c=cc") "c=gcc")
4382 ;; Pretend to be on a 64 bit platform to obtain a common directory
4383 ;; name for the build results on all architectures; nothing else
4384 ;; seems to depend on it.
4385 (("^PLATFORM=.*$") "PLATFORM=ux64\n")
4386
4387 ;; The check for 'isnan' as it is written fails with
4388 ;; "non-floating-point argument in call to function
4389 ;; ‘__builtin_isnan’", which leads to the 'NOISNAN' cpp macro
4390 ;; definition, which in turn leads to bad things. Fix the feature
4391 ;; test.
4392 (("isnan\\(0\\)") "isnan(0.)"))
4393 #t))))
4394 (build-system gnu-build-system)
4395 (arguments
4396 `(#:tests? #f ; no check target
4397 #:phases
4398 (modify-phases %standard-phases
4399 (delete 'configure) ; no configure script
4400 (replace 'build
4401 (lambda _
4402 (with-directory-excursion "lpsolve55"
4403 (invoke "bash" "ccc"))
4404 (with-directory-excursion "lp_solve"
4405 (invoke "bash" "ccc"))
4406 #t))
4407 (replace 'install
4408 (lambda* (#:key outputs #:allow-other-keys)
4409 (let* ((out (assoc-ref outputs "out"))
4410 (bin (string-append out "/bin"))
4411 (lib (string-append out "/lib"))
4412 ;; This is where LibreOffice expects to find the header
4413 ;; files, and where they are installed by Debian.
4414 (include (string-append out "/include/lpsolve")))
4415 (install-file "lpsolve55/bin/ux64/liblpsolve55.a" lib)
4416 (install-file "lpsolve55/bin/ux64/liblpsolve55.so" lib)
4417 (install-file "lp_solve/bin/ux64/lp_solve" bin)
4418
4419 ;; Install a subset of the header files as on Debian
4420 ;; (plus lp_bit.h, which matches the regular expression).
4421 (for-each (lambda (name)
4422 (install-file name include))
4423 (find-files "." "lp_[HMSa-z].*\\.h$"))
4424 (with-directory-excursion "shared"
4425 (for-each (lambda (name)
4426 (install-file name include))
4427 (find-files "." "\\.h$")))
4428 #t))))))
4429 (home-page "http://lpsolve.sourceforge.net/")
4430 (synopsis "Mixed integer linear programming (MILP) solver")
4431 (description
4432 "lp_solve is a mixed integer linear programming solver based on the
4433 revised simplex and the branch-and-bound methods.")
4434 (license license:lgpl2.1+)))
4435
4436 (define-public dealii
4437 (package
4438 (name "dealii")
4439 (version "9.2.0")
4440 (source
4441 (origin
4442 (method url-fetch)
4443 (uri (string-append "https://github.com/dealii/dealii/releases/"
4444 "download/v" version "/dealii-" version ".tar.gz"))
4445 (sha256
4446 (base32
4447 "0fm4xzrnb7dfn4415j24d8v3jkh0lssi86250x2f5wgi83xq4nnh"))
4448 (modules '((guix build utils)))
4449 (snippet
4450 ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
4451 '(begin
4452 (delete-file-recursively "bundled")
4453 #t))))
4454 (build-system cmake-build-system)
4455 (inputs
4456 `(("tbb" ,tbb)
4457 ("zlib" ,zlib)
4458 ("boost" ,boost)
4459 ("p4est" ,p4est)
4460 ("blas" ,openblas)
4461 ("lapack" ,lapack)
4462 ("arpack" ,arpack-ng)
4463 ("muparser" ,muparser)
4464 ("gfortran" ,gfortran)
4465 ("suitesparse" ,suitesparse))) ;for UMFPACK
4466 (arguments
4467 `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
4468 #:configure-flags
4469 ;; Work around a bug in libsuitesparseconfig linking
4470 ;; see https://github.com/dealii/dealii/issues/4745
4471 '("-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON")))
4472 (home-page "https://www.dealii.org")
4473 (synopsis "Finite element library")
4474 (description
4475 "Deal.II is a C++ program library targeted at the computational solution
4476 of partial differential equations using adaptive finite elements. The main
4477 aim of deal.II is to enable rapid development of modern finite element codes,
4478 using among other aspects adaptive meshes and a wide array of tools often used
4479 in finite element programs.")
4480 (license license:lgpl2.1+)))
4481
4482 (define-public dealii-openmpi
4483 (package (inherit dealii)
4484 (name "dealii-openmpi")
4485 (inputs
4486 `(("mpi" ,openmpi)
4487 ;;Supported only with MPI:
4488 ("hdf5" ,hdf5-parallel-openmpi) ;TODO: have petsc-openmpi propagate?
4489 ("p4est" ,p4est-openmpi)
4490 ("petsc" ,petsc-openmpi)
4491 ("slepc" ,slepc-openmpi)
4492 ("metis" ,metis) ;for MUMPS
4493 ("scalapack" ,scalapack) ;for MUMPS
4494 ("mumps" ,mumps-metis-openmpi) ;configure supports only metis orderings
4495 ("arpack" ,arpack-ng-openmpi)
4496 ,@(fold alist-delete (package-inputs dealii)
4497 '("p4est" "arpack"))))
4498 (arguments
4499 (substitute-keyword-arguments (package-arguments dealii)
4500 ((#:configure-flags cf)
4501 `(cons "-DDEAL_II_WITH_MPI:BOOL=ON"
4502 ,cf))
4503 ((#:phases phases '%standard-phases)
4504 `(modify-phases ,phases
4505 (add-before 'check 'mpi-setup
4506 ,%openmpi-setup)))))
4507 (synopsis "Finite element library (with MPI support)")))
4508
4509 (define-public flann
4510 (package
4511 (name "flann")
4512 (version "1.9.1")
4513 (home-page "https://github.com/mariusmuja/flann/")
4514 (source
4515 (origin
4516 (method git-fetch)
4517 (uri (git-reference (url home-page) (commit version)))
4518 (file-name (git-file-name name version))
4519 (sha256
4520 (base32
4521 "0p56fl2yx1r86ds1mgjq40926jdcgq3hka7p3l1hv2acv9jxp15x"))
4522 (patches (search-patches "flann-cmake-3.11.patch"))))
4523 (build-system cmake-build-system)
4524 (outputs '("out"))
4525 (native-inputs
4526 `(("unzip" ,unzip)))
4527 (inputs
4528 `(("hdf5" ,hdf5)
4529 ;; FIXME: 'mkoctfile' fails with a linker error:
4530 ;; ld: cannot find -loctinterp
4531 ;; ld: cannot find -loctave
4532 ;; Disable it for now.
4533 ;;("octave" ,octave-cli)
4534 ("python" ,python-2) ; print syntax
4535 ;; ("python2-numpy" ,python2-numpy) ; only required for the tests
4536 ("zlib" ,zlib)))
4537 (arguments
4538 `(;; The 'share/flann/octave' contains a .mex file, which is an ELF file
4539 ;; taken 46 MiB unstripped, and 6 MiB stripped.
4540 #:strip-directories '("lib" "lib64" "libexec"
4541 "bin" "sbin" "share/flann/octave")
4542
4543 ;; Save 12 MiB by not installing .a files. Passing
4544 ;; '-DBUILD_STATIC_LIBS=OFF' has no effect.
4545 #:phases (modify-phases %standard-phases
4546 (add-after 'install 'remove-static-libraries
4547 (lambda* (#:key outputs #:allow-other-keys)
4548 (let* ((out (assoc-ref outputs "out"))
4549 (lib (string-append out "/lib")))
4550 (for-each delete-file
4551 (find-files lib "\\.a$"))
4552 #t))))
4553
4554 #:tests? #f)) ; The test data are downloaded from the Internet.
4555 (synopsis "Library for approximate nearest neighbors computation")
4556 (description "FLANN is a library for performing fast approximate
4557 nearest neighbor searches in high dimensional spaces. It implements a
4558 collection of algorithms and a system for automatically choosing the best
4559 algorithm and optimum parameters depending on the dataset.
4560
4561 FLANN is written in C++ and contains bindings for C, Octave and Python.")
4562 (license (license:non-copyleft "file://COPYING"
4563 "See COPYING in the distribution."))))
4564
4565 (define-public wcalc
4566 (package
4567 (name "wcalc")
4568 (version "2.5")
4569 (source
4570 (origin
4571 (method url-fetch)
4572 (uri (string-append "mirror://sourceforge/w-calc/Wcalc/" version "/"
4573 "wcalc-" version ".tar.bz2"))
4574 (sha256
4575 (base32
4576 "1vi8dl6rccqiq1apmpwawyg2ywx6a1ic1d3cvkf2hlwk1z11fb0f"))))
4577 (build-system gnu-build-system)
4578 (inputs
4579 `(("mpfr" ,mpfr)
4580 ("readline" ,readline)))
4581 (home-page "http://w-calc.sourceforge.net/index.php")
4582 (synopsis "Flexible command-line scientific calculator")
4583 (description "Wcalc is a very capable calculator. It has standard functions
4584 (sin, asin, and sinh for example, in either radians or degrees), many
4585 pre-defined constants (pi, e, c, etc.), support for using variables, \"active\"
4586 variables, a command history, hex/octal/binary input and output, unit
4587 conversions, embedded comments, and an expandable expression entry field. It
4588 evaluates expressions using the standard order of operations.")
4589 (license license:gpl2+)))
4590
4591 (define-public xaos
4592 (package
4593 (name "xaos")
4594 (version "4.2.1")
4595 (source (origin
4596 (method git-fetch)
4597 (uri (git-reference
4598 (url "https://github.com/xaos-project/XaoS")
4599 (commit (string-append "release-" version))))
4600 (file-name (git-file-name name version))
4601 (sha256
4602 (base32
4603 "0maw5am6rrkyjrprfg113zjq37mqj0iaznkg4h2927ff7wrprc94"))))
4604 (build-system gnu-build-system)
4605 (native-inputs `(("gettext" ,gettext-minimal)
4606 ("qtbase" ,qtbase-5)
4607 ("qttools" ,qttools)))
4608 (inputs `(("libx11" ,libx11)
4609 ("zlib" ,zlib)
4610 ("libpng" ,libpng)
4611 ("gsl" ,gsl)))
4612 ;; The upstream project file ("XaoS.pro") and the Makefile it generates are
4613 ;; not enough for this package to install properly. These phases fix that.
4614 (arguments
4615 `(#:tests? #f ;no "check" target
4616 #:phases
4617 (modify-phases %standard-phases
4618 (add-before 'configure 'make-qt-deterministic
4619 (lambda _
4620 ;; Make Qt deterministic.
4621 (setenv "QT_RCC_SOURCE_DATE_OVERRIDE" "1")
4622 #t))
4623 (replace 'configure
4624 (lambda* (#:key outputs #:allow-other-keys)
4625 (let ((out (assoc-ref outputs "out")))
4626 (substitute* "XaoS.pro"
4627 ;; The DESTDIR is originally set to install the xaos binary to
4628 ;; the "bin" folder inside the build directory. Setting make
4629 ;; flags doesn't seem to change this.
4630 (("DESTDIR.*$")
4631 (string-append "DESTDIR=" out "/bin"))
4632 ;; Set the correct path to the lrelease binary.
4633 (("lrelease-qt5") "lrelease"))
4634 (substitute* "src/include/config.h"
4635 (("/usr/share/XaoS")
4636 (string-append out "/share/XaoS")))
4637 (invoke "qmake"))))
4638 (add-after 'install 'install-data
4639 (lambda* (#:key outputs #:allow-other-keys)
4640 (let* ((out (assoc-ref outputs "out"))
4641 (share (string-append out "/share")))
4642 (mkdir-p share)
4643 (for-each
4644 (lambda (folder)
4645 (copy-recursively folder
4646 (string-append share "/XaoS/" folder)))
4647 '("catalogs" "examples" "tutorial"))
4648 (install-file "xdg/xaos.png"
4649 (string-append share "/pixmaps"))
4650 (install-file "xdg/xaos.desktop"
4651 (string-append share "/applications")))
4652 #t)))))
4653 (synopsis "Real-time fractal zoomer")
4654 (description "GNU XaoS is a graphical program that generates fractal
4655 patterns and allows you to zoom in and out of them infinitely in a fluid,
4656 continuous manner. It also includes tutorials that help to explain how fractals
4657 are built. It can generate many different fractal types such as the Mandelbrot
4658 set.")
4659 (home-page "https://xaos-project.github.io/")
4660 (license license:gpl2+)))
4661
4662 (define-public hypre
4663 (package
4664 (name "hypre")
4665 (version "2.15.1")
4666 (source
4667 (origin
4668 (method git-fetch)
4669 (uri (git-reference
4670 (url "https://github.com/hypre-space/hypre")
4671 (commit (string-append "v" version))))
4672 (file-name (git-file-name name version))
4673 (sha256
4674 (base32 "1lvh4ybqkriyqfg2zmic6mrg1981qv1i9vry1fdgsabn81hb71g4"))
4675 (modules '((guix build utils)))
4676 (snippet
4677 '(begin
4678 ;; Remove use of __DATE__ and __TIME__ for reproducibility;
4679 ;; substitute the release date.
4680 (substitute* "src/utilities/HYPRE_utilities.h"
4681 (("Date Compiled: .*$")
4682 "Date Compiled: Oct 19 2018 15:23:00 +0000\"\n"))
4683 #t))))
4684 (build-system gnu-build-system)
4685 (outputs '("out" ; 6.1 MiB of headers and libraries
4686 "doc")) ; 4.8 MiB of documentation
4687 (native-inputs
4688 `(("doc++" ,doc++)
4689 ("netpbm" ,netpbm)
4690 ("perl" ,perl) ; needed to run 'ppmquant' during tests
4691 ("texlive" ,(texlive-union (list texlive-xypic
4692 texlive-cm
4693 texlive-latex-hyperref
4694 texlive-bibtex)))
4695 ("ghostscript" ,ghostscript)))
4696 (inputs
4697 `(("blas" ,openblas)
4698 ("lapack" ,lapack)))
4699 (arguments
4700 `(#:modules ((srfi srfi-1)
4701 ,@%gnu-build-system-modules)
4702 #:configure-flags '("--enable-shared"
4703 "--disable-fortran"
4704 "--without-MPI"
4705 "--with-openmp"
4706 "--with-fei"
4707 "--with-lapack"
4708 "--with-blas")
4709 #:phases
4710 (modify-phases %standard-phases
4711 (add-before 'build 'set-HOME
4712 (lambda _
4713 ;; FIXME: texlive-union does not find the built
4714 ;; metafonts, so it tries to generate them in HOME.
4715 (setenv "HOME" "/tmp")
4716 #t))
4717 (add-before 'configure 'chdir-src
4718 (lambda _ (chdir "src")))
4719 (replace 'configure
4720 (lambda* (#:key build target configure-flags
4721 #:allow-other-keys #:rest args)
4722 (let* ((configure (assoc-ref %standard-phases 'configure)))
4723 (apply configure
4724 (append args
4725 (list #:configure-flags
4726 (cons (string-append
4727 "--host=" (or target build))
4728 configure-flags)))))))
4729 (add-after 'build 'build-docs
4730 (lambda _
4731 (invoke "make" "-Cdocs" "pdf" "html")))
4732 (replace 'check
4733 (lambda _
4734 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/hypre/lib"))
4735 (setenv "PATH" (string-append "." ":" (getenv "PATH")))
4736 (invoke "make" "check" "CHECKRUN=")
4737 (for-each (lambda (filename)
4738 (let ((size (stat:size (stat filename))))
4739 (when (positive? size)
4740 (error (format #f "~a size ~d; error indication~%"
4741 filename size)))))
4742 (find-files "test" ".*\\.err$"))
4743 #t))
4744 (add-after 'install 'install-docs
4745 (lambda* (#:key outputs #:allow-other-keys)
4746 ;; Custom install because docs/Makefile doesn't honor ${docdir}.
4747 (let* ((doc (assoc-ref outputs "doc"))
4748 (docdir (string-append doc "/share/doc/hypre-" ,version)))
4749 (with-directory-excursion "docs"
4750 (for-each (lambda (base)
4751 (install-file (string-append base ".pdf") docdir)
4752 (copy-recursively base docdir)) ; html docs
4753 '("HYPRE_usr_manual"
4754 "HYPRE_ref_manual")))
4755 #t))))))
4756 (home-page "https://computing.llnl.gov/projects\
4757 /hypre-scalable-linear-solvers-multigrid-methods")
4758 (synopsis "Library of solvers and preconditioners for linear equations")
4759 (description
4760 "HYPRE is a software library of high performance preconditioners and
4761 solvers for the solution of large, sparse linear systems of equations. It
4762 features multigrid solvers for both structured and unstructured grid
4763 problems.")
4764 (license license:lgpl2.1)))
4765
4766 (define-public hypre-openmpi
4767 (package (inherit hypre)
4768 (name "hypre-openmpi")
4769 (inputs
4770 `(("mpi" ,openmpi)
4771 ,@(package-inputs hypre)))
4772 (arguments
4773 (substitute-keyword-arguments (package-arguments hypre)
4774 ((#:configure-flags flags)
4775 ``("--with-MPI"
4776 ,@(delete "--without-MPI" ,flags)))
4777 ((#:phases phases)
4778 `(modify-phases ,phases
4779 (add-before 'check 'mpi-setup
4780 ,%openmpi-setup)))))
4781 (synopsis "Parallel solvers and preconditioners for linear equations")
4782 (description
4783 "HYPRE is a software library of high performance preconditioners and
4784 solvers for the solution of large, sparse linear systems of equations on
4785 parallel computers. It features parallel multigrid solvers for both
4786 structured and unstructured grid problems.")))
4787
4788 (define-public matio
4789 (package
4790 (name "matio")
4791 (version "1.5.19")
4792 (source
4793 (origin
4794 (method url-fetch)
4795 (uri (string-append "mirror://sourceforge/matio/matio/" version "/"
4796 "matio-" version ".tar.gz"))
4797 (sha256
4798 (base32
4799 "0vr8c1mz1k6mz0sgh6n3scl5c3a71iqmy5fnydrgq504icj4vym4"))))
4800 (build-system gnu-build-system)
4801 (inputs
4802 `(("zlib" ,zlib)
4803 ("hdf5" ,hdf5-1.8)))
4804 (home-page "http://matio.sourceforge.net/")
4805 (synopsis "Library for reading and writing MAT files")
4806 (description "Matio is a library for reading and writing MAT files. It
4807 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
4808 (license license:bsd-2)))
4809
4810 (define-public vc
4811 (package
4812 (name "vc")
4813 (version "1.4.1")
4814 (source
4815 (origin (method url-fetch)
4816 (uri (string-append "https://github.com/VcDevel/Vc/releases/"
4817 "download/" version "/Vc-" version ".tar.gz"))
4818 (sha256
4819 (base32
4820 "17qili8bf8r78cng65yf4qmgna8kiqjqbgcqbric6v9j6nkhkrk8"))))
4821 (build-system cmake-build-system)
4822 (arguments
4823 '(#:configure-flags
4824 '("-DBUILD_TESTING=ON"
4825 ;; By default, Vc will optimize for the CPU of the build machine.
4826 ;; Setting this to "none" makes it create portable binaries. See
4827 ;; "cmake/OptimizeForArchitecture.cmake".
4828 "-DTARGET_ARCHITECTURE=none")
4829 #:phases (modify-phases %standard-phases
4830 (add-after 'unpack 'copy-testdata
4831 (lambda* (#:key inputs native-inputs #:allow-other-keys)
4832 (let ((testdata (assoc-ref (or native-inputs inputs)
4833 "testdata")))
4834 (copy-recursively testdata "tests/testdata")
4835 #t))))))
4836 (native-inputs
4837 `(("virtest" ,virtest)
4838
4839 ;; This is a submodule in the git project, but not part of the
4840 ;; released sources. See the git branch for the commit to take.
4841 ("testdata" ,(let ((commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3"))
4842 (origin
4843 (method git-fetch)
4844 (uri (git-reference
4845 (url "https://github.com/VcDevel/vc-testdata")
4846 (commit "9ada1f34d6a41f1b5553d6223f277eae72c039d3")))
4847 (file-name (git-file-name "vc-testdata"
4848 (string-take commit 7)))
4849 (sha256
4850 (base32
4851 "1hkhqib03qlcq412ym2dciynfxcdr2ygqhnplz4l1vissr1wnqn2")))))))
4852 (synopsis "SIMD vector classes for C++")
4853 (description "Vc provides portable, zero-overhead C++ types for explicitly
4854 data-parallel programming. It is a library designed to ease explicit
4855 vectorization of C++ code. Its types enable explicitly stating data-parallel
4856 operations on multiple values. The parallelism is therefore added via the type
4857 system. Vc has an intuitive API and provides portability between different
4858 compilers and compiler versions as well as portability between different vector
4859 instruction sets. Thus, an application written with Vc can be compiled for:
4860 @enumerate
4861 @item AVX and AVX2
4862 @item SSE2 up to SSE4.2 or SSE4a
4863 @item Scalar
4864 @item MIC
4865 @item NEON (in development)
4866 @item NVIDIA GPUs / CUDA (in development)
4867 @end enumerate\n")
4868 (home-page "https://github.com/VcDevel/Vc")
4869 ;; "No support_???.cpp file exists for this architecture."
4870 (supported-systems '("x86_64-linux" "i686-linux"))
4871 (license license:bsd-3)))
4872
4873 (define-public reducelcs
4874 ;; This is the last commit which is available upstream, no
4875 ;; release happened since 2010.
4876 (let ((commit "474f88deb968061abe8cf11c959e02319b8ae5c0")
4877 (revision "1"))
4878 (package
4879 (name "reducelcs")
4880 (version (string-append "1.0-" revision "." (string-take commit 7)))
4881 (source
4882 (origin
4883 (method git-fetch)
4884 (uri (git-reference
4885 (url "https://github.com/gdv/Reduce-Expand-for-LCS")
4886 (commit commit)))
4887 (file-name (string-append name "-" version "-checkout"))
4888 (sha256
4889 (base32
4890 "1rllzcfwc042c336mhq262a8ha90x6afq30kvk60r7i4761j4yjm"))))
4891 (build-system gnu-build-system)
4892 (inputs
4893 `(("openlibm" ,openlibm)))
4894 (arguments
4895 `(#:tests? #f ; no tests
4896 #:phases
4897 (modify-phases %standard-phases
4898 (delete 'configure) ; No configure script exists.
4899 (replace 'install ; No install phase exists.
4900 (lambda* (#:key outputs #:allow-other-keys)
4901 (let* ((out (assoc-ref outputs "out"))
4902 (bin (string-append out "/bin")))
4903 (install-file "Approximation" bin)
4904 (install-file "CollectResults" bin)
4905 (install-file "GenerateInstances" bin)
4906 #t))))))
4907 (synopsis "Approximate Longest Commons Subsequence computation tool")
4908 (description
4909 "@code{reduceLCS} is an implementation of the Reduce-Expand
4910 algorithm for LCS. It is a fast program to compute the approximate
4911 Longest Commons Subsequence of a set of strings.")
4912 (home-page "https://github.com/gdv/Reduce-Expand-for-LCS")
4913 (license license:gpl3+))))
4914
4915 (define-public jacal
4916 (package
4917 (name "jacal")
4918 (version "1c4")
4919 (source (origin
4920 (method url-fetch)
4921 (uri (string-append
4922 "http://groups.csail.mit.edu/mac/ftpdir/scm/jacal-"
4923 version ".zip"))
4924 (sha256 (base32
4925 "055zrn12a1dmy0dqkwrkq3fklbhg3yir6vn0lacp4mvbg8573a3q"))
4926 (patches (search-patches "jacal-fix-texinfo.patch"))))
4927 (build-system gnu-build-system)
4928 (arguments
4929 `(#:phases
4930 (modify-phases %standard-phases
4931 (add-before 'build 'pre-build
4932 ;; Don't use upstream's script - it really doesn't fit into
4933 ;; Guix's functional paradigm.
4934 (lambda* (#:key inputs outputs #:allow-other-keys)
4935 (substitute* "Makefile"
4936 (("^install: install-script") "install: "))))
4937 (add-after 'install 'post-install
4938 ;; Instead, we provide our own simplified script.
4939 (lambda* (#:key inputs outputs #:allow-other-keys)
4940 (let ((wrapper (string-append (assoc-ref outputs "out")
4941 "/bin/jacal")))
4942 (format (open wrapper (logior O_WRONLY O_CREAT))
4943 (string-append "#!~a\nexec ~a/bin/scm -ip1 "
4944 "-e '(slib:load \"~a/lib/jacal/math\") "
4945 "(math)' \"$@\"\n")
4946 (which "bash")
4947 (assoc-ref inputs "scm")
4948 (assoc-ref outputs "out"))
4949 (chmod wrapper #o555))))
4950 (replace 'configure
4951 (lambda* (#:key outputs #:allow-other-keys)
4952 (invoke "./configure"
4953 (string-append "--prefix="
4954 (assoc-ref outputs "out"))))))))
4955 (inputs `(("scm" ,scm)))
4956 (native-inputs `(("unzip" ,unzip)
4957 ("texinfo" ,texinfo)))
4958 (synopsis "Symbolic mathematics system")
4959 (description "GNU JACAL is an interactive symbolic mathematics program based on
4960 Scheme. It manipulate and simplify a range of mathematical expressions such
4961 as equations, scalars, vectors, and matrices.")
4962 (home-page "https://www.gnu.org/software/jacal/")
4963 (license license:gpl3+)))
4964
4965 (define-public z3
4966 (package
4967 (name "z3")
4968 (version "4.8.9")
4969 (home-page "https://github.com/Z3Prover/z3")
4970 (source (origin
4971 (method git-fetch)
4972 (uri (git-reference (url home-page)
4973 (commit (string-append "z3-" version))))
4974 (file-name (git-file-name name version))
4975 (sha256
4976 (base32
4977 "1hnbzq10d23drd7ksm3c1n2611c3kd0q0yxgz8y78zaafwczvwxx"))))
4978 (build-system gnu-build-system)
4979 (arguments
4980 `(#:imported-modules ((guix build python-build-system)
4981 ,@%gnu-build-system-modules)
4982 #:modules (((guix build python-build-system) #:select (site-packages))
4983 (guix build gnu-build-system)
4984 (guix build utils))
4985 #:phases
4986 (modify-phases %standard-phases
4987 (add-after 'unpack 'enable-bytecode-determinism
4988 (lambda _
4989 (setenv "PYTHONHASHSEED" "0")
4990 #t))
4991 (add-after 'unpack 'fix-compatability
4992 ;; Versions after 4.8.3 have immintrin.h IFDEFed for Windows only.
4993 (lambda _
4994 (substitute* "src/util/mpz.cpp"
4995 (("#include <immintrin.h>") ""))
4996 #t))
4997 (add-before 'configure 'bootstrap
4998 (lambda _
4999 (invoke "python" "scripts/mk_make.py")))
5000 ;; work around gnu-build-system's setting --enable-fast-install
5001 ;; (z3's `configure' is a wrapper around the above python file,
5002 ;; which fails when passed --enable-fast-install)
5003 (replace 'configure
5004 (lambda* (#:key inputs outputs #:allow-other-keys)
5005 (invoke "./configure"
5006 "--python"
5007 (string-append "--prefix=" (assoc-ref outputs "out"))
5008 (string-append "--pypkgdir=" (site-packages inputs outputs)))))
5009 (add-after 'configure 'change-directory
5010 (lambda _
5011 (chdir "build")
5012 #t))
5013 (add-before 'check 'make-test-z3
5014 (lambda _
5015 ;; Build the test suite executable.
5016 (invoke "make" "test-z3" "-j"
5017 (number->string (parallel-job-count)))))
5018 (replace 'check
5019 (lambda _
5020 ;; Run all the tests that don't require arguments.
5021 (invoke "./test-z3" "/a"))))))
5022 (native-inputs
5023 `(("which" ,which)
5024 ("python" ,python-wrapper)))
5025 (synopsis "Theorem prover")
5026 (description "Z3 is a theorem prover and @dfn{satisfiability modulo
5027 theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.")
5028 (license license:expat)))
5029
5030 (define-public elpa
5031 (package
5032 (name "elpa")
5033 (version "2018.11.001")
5034 (source (origin
5035 (method url-fetch)
5036 (uri (string-append "http://elpa.mpcdf.mpg.de/html/Releases/"
5037 version "/elpa-" version ".tar.gz"))
5038 (sha256
5039 (base32
5040 "05hv3v5i6xmziaizw350ff72y1c3k662r85fm3xfdrkclj5zw9yc"))))
5041 (build-system gnu-build-system)
5042 (native-inputs
5043 `(("fortran" ,gfortran)
5044 ("perl" ,perl))) ;for configure and deps
5045 (inputs
5046 `(("blas" ,openblas)))
5047 (arguments
5048 `(#:configure-flags
5049 `("--enable-openmp"
5050 "--with-mpi=no"
5051 ;; ELPA unfortunately does not support runtime dispatch, so we can
5052 ;; only enable the "generic" kernels. See the "Cross compilation"
5053 ;; section of INSTALL.md.
5054 "--enable-generic"
5055 "--disable-sse" "--disable-sse-assembly" ;Require SSE3
5056 "--disable-avx" "--disable-avx2" "--disable-avx512"
5057 ,(string-append "CFLAGS=-O3 "
5058 "-funsafe-loop-optimizations -funsafe-math-optimizations "
5059 "-ftree-vect-loop-version -ftree-vectorize "
5060 ,(let ((system (or (%current-target-system)
5061 (%current-system))))
5062 (cond
5063 ((or (string-prefix? "x86_64" system)
5064 (string-prefix? "i686" system))
5065 "-msse2")
5066 (else "")))))
5067 #:parallel-tests? #f ;tests are multi-threaded, via BLAS
5068 #:phases
5069 (modify-phases %standard-phases
5070 (add-before 'configure 'patch-header-generation
5071 (lambda _
5072 (substitute* "configure"
5073 (("^ *make.*top_srcdir=\"\\$srcdir\"" &)
5074 (string-append & " CPP=\"$CPP\"")))
5075 #t))
5076 (add-before 'check 'setup-tests
5077 (lambda _
5078 ;; Decrease test time and RAM use by computing fewer eigenvalues.
5079 ;; The flags are (MATRIX-SIZE, EIGENVALUES, BLOCK-SIZE), where
5080 ;; the default is (500, 250, 16) for C tests and (5000, 150, 16)
5081 ;; for Fortran. This also causes several tests to pass that
5082 ;; otherwise would otherwise fail with matrix size 5000; possibly
5083 ;; due to floating point tolerances that are too tight.
5084 (setenv "TEST_FLAGS" "1500 50 16") ;from elpa.spec
5085 (setenv "OMP_NUM_THREADS" (number->string (parallel-job-count)))
5086 (substitute* "Makefile"
5087 ;; Test scripts are generated, patch the shebang
5088 (("#!/bin/bash") (string-append "#!" (which "sh"))))
5089 #t)))))
5090 (home-page "https://elpa.mpcdf.mpg.de")
5091 (synopsis "Eigenvalue solvers for symmetric matrices")
5092 (description
5093 "The ELPA library provides efficient and scalable direct eigensolvers for
5094 symmetric matrices.")
5095 (license license:lgpl3)))
5096
5097 (define-public elpa-openmpi
5098 (package (inherit elpa)
5099 (name "elpa-openmpi")
5100 (inputs
5101 `(("mpi" ,openmpi)
5102 ("scalapack" ,scalapack)
5103 ,@(package-inputs elpa)))
5104 (arguments
5105 (substitute-keyword-arguments (package-arguments elpa)
5106 ((#:configure-flags cf '())
5107 `(cons "--with-mpi=yes" (delete "--with-mpi=no" ,cf)))
5108 ((#:phases phases '%standard-phases)
5109 `(modify-phases ,phases
5110 (add-before 'check 'mpi-setup
5111 (lambda _
5112 ;; Tests use 2 mpi tasks by default, use our remaining build
5113 ;; cores as OpenMP threads.
5114 (setenv "OMP_NUM_THREADS" (number->string
5115 (max (quotient (parallel-job-count) 2)
5116 1)))
5117 (,%openmpi-setup)))))))
5118 (synopsis "Eigenvalue solvers for symmetric matrices (with MPI support)")))
5119
5120 (define-public elemental
5121 (package
5122 (name "elemental")
5123 (version "0.87.7")
5124 (source (origin
5125 (method git-fetch)
5126 (uri (git-reference
5127 (url "https://github.com/elemental/Elemental")
5128 (commit (string-append "v" version))))
5129 (file-name (git-file-name name version))
5130 (sha256
5131 (base32
5132 "1687xpjjzig27y2pnqv7hv09smpijyfdpz7qjgmcxf4shfajlfkc"))))
5133 (build-system cmake-build-system)
5134 (home-page "https://github.com/elemental/Elemental")
5135 (native-inputs
5136 `(("gfortran" ,gfortran)))
5137 (inputs
5138 `(("blas" ,openblas)
5139 ("gfortran:lib" ,gfortran "lib")
5140 ("gmp" ,gmp)
5141 ("lapack" ,lapack)
5142 ("metis" ,metis)
5143 ("mpc" ,mpc)
5144 ("mpfr" ,mpfr)
5145 ("mpi" ,openmpi)
5146 ("qd" ,qd)))
5147 (arguments
5148 `(#:build-type "Release" ;default RelWithDebInfo not supported
5149 #:configure-flags `("-DEL_DISABLE_PARMETIS:BOOL=YES"
5150 "-DEL_AVOID_COMPLEX_MPI:BOOL=NO"
5151 "-DEL_CACHE_WARNINGS:BOOL=YES"
5152 "-DEL_TESTS:BOOL=YES"
5153 "-DCMAKE_INSTALL_LIBDIR=lib"
5154 "-DGFORTRAN_LIB=gfortran")
5155 #:phases (modify-phases %standard-phases
5156 (add-before 'check 'mpi-setup
5157 ,%openmpi-setup)
5158 (add-before 'check 'setup-tests
5159 (lambda _
5160 ;; Parallelism is done at the MPI layer.
5161 (setenv "OMP_NUM_THREADS" "1")
5162 #t))
5163 (add-after 'install 'remove-tests
5164 (lambda* (#:key outputs #:allow-other-keys)
5165 ;; Tests are installed, with no easy configuration
5166 ;; switch to prevent this, so delete them.
5167 (delete-file-recursively
5168 (string-append (assoc-ref outputs "out") "/bin"))
5169 #t)))))
5170 (synopsis "Dense and sparse-direct linear algebra and optimization")
5171 (description "Elemental is a modern C++ library for distributed-memory
5172 dense and sparse-direct linear algebra, conic optimization, and lattice
5173 reduction.")
5174 (license license:bsd-2)))
5175
5176 (define-public mcrl2
5177 (package
5178 (name "mcrl2")
5179 (version "202006.0")
5180 (source (origin
5181 (method url-fetch)
5182 (uri (string-append
5183 "https://www.mcrl2.org/download/release/mcrl2-"
5184 version ".tar.gz"))
5185 (sha256
5186 (base32
5187 "167ryrzk1a2j53c2j198jlxa98amcaym070gkcj730619gymv5zl"))))
5188 (inputs
5189 `(("boost" ,boost)
5190 ("glu" ,glu)
5191 ("mesa" ,mesa)
5192 ("qtbase" ,qtbase-5)))
5193 (build-system cmake-build-system)
5194 (synopsis "Toolset for the mCRL2 formal specification language")
5195 (description
5196 "@dfn{mCRL2} (micro Common Representation Language 2) is a formal
5197 specification language for describing concurrent discrete event systems. Its
5198 toolset supports analysis and automatic verification, linearisation, simulation,
5199 state-space exploration and generation, and tools to optimise and analyse
5200 specifications. Also, state spaces can be manipulated, visualised and
5201 analysed.")
5202 (home-page "https://mcrl2.org")
5203 (license license:boost1.0)))
5204
5205 (define-public mcrl2-minimal
5206 (package
5207 (inherit mcrl2)
5208 (name "mcrl2-minimal")
5209 (inputs
5210 `(("boost" ,boost)))
5211 (arguments
5212 '(#:configure-flags '("-DMCRL2_ENABLE_GUI_TOOLS=OFF")))))
5213
5214 (define-public tcalc
5215 (package
5216 (name "tcalc")
5217 (version "2.0")
5218 (source
5219 (origin
5220 (method url-fetch)
5221 (uri (string-append "https://sites.google.com/site/mohammedisam2000/tcalc/tcalc-"
5222 version ".tar.gz"))
5223 (sha256
5224 (base32
5225 "0jq806m4dqfia85nppfm75mml9w57g0cgv4cdw9bp3zymda83s0m"))))
5226 (build-system gnu-build-system)
5227 (synopsis "The terminal calculator")
5228 (description
5229 "The terminal calculator is a small program to help users of the GNU/Linux
5230 terminal do calculations simply and quickly. The formula to be calculated can
5231 be fed to @command{tcalc} through the command line.")
5232 (home-page "https://sites.google.com/site/mohammedisam2000/tcalc")
5233 (license license:gpl3+)))
5234
5235 (define-public tiny-bignum
5236 (let ((commit "1d7a1f9b8e77316187a6b3eae8e68d60a6f9a4d4"))
5237 (package
5238 (name "tiny-bignum")
5239 (version (git-version "0" "0" commit))
5240 (source
5241 (origin
5242 (method git-fetch)
5243 (uri (git-reference
5244 (url "https://github.com/kokke/tiny-bignum-c")
5245 (commit commit)))
5246 (file-name (git-file-name "tiny-bignum" commit))
5247 (sha256
5248 (base32 "0vj71qlhlaa7d92bfar1kwqv6582dqrby8x3kdw0yzh82k2023g6"))))
5249 (build-system gnu-build-system)
5250 (arguments
5251 `(#:phases
5252 (modify-phases %standard-phases
5253 (delete 'configure)
5254 (add-after 'unpack 'patch-tests
5255 (lambda _
5256 (substitute* "scripts/test_rand.py"
5257 (("\t") " ")
5258 (("\" % (\\w+)" _ symbol) (string-append "\" % int(" symbol ")")))
5259 #t))
5260 (replace 'check
5261 (lambda* (#:key tests? #:allow-other-keys)
5262 (when tests?
5263 (invoke "make" "test"))
5264 #t))
5265 (replace 'install
5266 (lambda* (#:key outputs #:allow-other-keys)
5267 (let ((share (string-append (assoc-ref outputs "out") "/share"))
5268 (doc (string-append (assoc-ref outputs "out") "/doc")))
5269 (mkdir-p share)
5270 (install-file "bn.c" share)
5271 (install-file "bn.h" share)
5272 (mkdir-p doc)
5273 (install-file "LICENSE" doc)
5274 (install-file "README.md" doc))
5275 #t)))))
5276 (native-inputs
5277 `(("python" ,python-wrapper)))
5278 (home-page "https://github.com/kokke/tiny-bignum-c")
5279 (synopsis "Small portable multiple-precision unsigned integer arithmetic in C")
5280 (description
5281 "This library provides portable Arbitrary-precision unsigned integer
5282 arithmetic in C, for calculating with large numbers. Basic arithmetic (+, -,
5283 *, /, %) and bitwise operations (&, |, ^. <<, >>) plus increments, decrements
5284 and comparisons are supported.")
5285 (license license:unlicense))))
5286
5287 (define-public sundials
5288 (package
5289 (name "sundials")
5290 (version "3.1.1")
5291 (source
5292 (origin
5293 (method url-fetch)
5294 (uri (string-append "https://computation.llnl.gov/projects/sundials/download/"
5295 "sundials-" version ".tar.gz"))
5296 (sha256
5297 (base32
5298 "090s8ymhd0g1s1d44fa73r5yi32hb4biwahhbfi327zd64yn8kd2"))))
5299 (build-system cmake-build-system)
5300 (native-inputs
5301 `(("python" ,python-2))) ;for tests; syntax incompatible with python 3
5302 (inputs
5303 `(("fortran" ,gfortran) ;for fcmix
5304 ("blas" ,openblas)
5305 ("suitesparse" ,suitesparse))) ;TODO: Add hypre
5306 (arguments
5307 `(#:configure-flags `("-DEXAMPLES_ENABLE_C:BOOL=ON"
5308 "-DEXAMPLES_ENABLE_CXX:BOOL=ON"
5309 "-DEXAMPLES_ENABLE_F77:BOOL=ON"
5310 "-DEXAMPLES_ENABLE_F90:BOOL=ON"
5311 "-DEXAMPLES_INSTALL:BOOL=OFF"
5312
5313 "-DFCMIX_ENABLE:BOOL=ON"
5314
5315 "-DKLU_ENABLE:BOOL=ON"
5316 ,(string-append "-DKLU_INCLUDE_DIR="
5317 (assoc-ref %build-inputs "suitesparse")
5318 "/include")
5319 ,(string-append "-DKLU_LIBRARY_DIR="
5320 (assoc-ref %build-inputs "suitesparse")
5321 "/lib"))))
5322 (home-page "https://computation.llnl.gov/projects/sundials")
5323 (synopsis "Suite of nonlinear and differential/algebraic equation solvers")
5324 (description "SUNDIALS is a family of software packages implemented with
5325 the goal of providing robust time integrators and nonlinear solvers that can
5326 easily be incorporated into existing simulation codes.")
5327 (license license:bsd-3)))
5328
5329 (define-public sundials-openmpi
5330 (package (inherit sundials)
5331 (name "sundials-openmpi")
5332 (inputs
5333 `(("mpi" ,openmpi)
5334 ("petsc" ,petsc-openmpi) ;support in SUNDIALS requires MPI
5335 ,@(package-inputs sundials)))
5336 (arguments
5337 (substitute-keyword-arguments (package-arguments sundials)
5338 ((#:configure-flags flags '())
5339 `(cons* "-DMPI_ENABLE:BOOL=ON"
5340 "-DPETSC_ENABLE:BOOL=ON"
5341 (string-append "-DPETSC_INCLUDE_DIR="
5342 (assoc-ref %build-inputs "petsc")
5343 "/include")
5344 (string-append "-DPETSC_LIBRARY_DIR="
5345 (assoc-ref %build-inputs "petsc")
5346 "/lib")
5347 ,flags))
5348 ((#:phases phases '%standard-phases)
5349 `(modify-phases ,phases
5350 (add-before 'check 'mpi-setup
5351 ,%openmpi-setup)))))
5352 (synopsis "SUNDIALS with OpenMPI support")))
5353
5354 (define-public combinatorial-blas
5355 (package
5356 (name "combinatorial-blas")
5357 (version "1.6.2")
5358 (source
5359 (origin
5360 (method url-fetch)
5361 (uri (string-append "http://eecs.berkeley.edu/~aydin/CombBLAS_FILES/"
5362 "CombBLAS_beta_"
5363 (match (string-split version #\.)
5364 ((major minor patch)
5365 (string-append major minor "_" patch))) ;e.g. "16_2"
5366 ".tgz"))
5367 (sha256
5368 (base32
5369 "1a9wbgdqyy1whhfc0yl0yqkax3amnqa6iihhq48d063gc0jwfd9a"))
5370 (patches (search-patches "combinatorial-blas-awpm.patch"
5371 "combinatorial-blas-io-fix.patch"))))
5372 (build-system cmake-build-system)
5373 (inputs
5374 `(("mpi" ,openmpi)
5375 ("test-data" ,(origin
5376 (method url-fetch)
5377 (uri (string-append "https://people.eecs.berkeley.edu/~aydin/"
5378 "CombBLAS_FILES/testdata_combblas1.6.1.tgz"))
5379 (sha256
5380 (base32
5381 "01y2781cy3fww7znmidrp85mf8zx0c905w5vzvk1mgrmhhynim87"))))))
5382 (arguments
5383 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
5384 "-DCMAKE_CXX_FLAGS=-DUSE_FUNNEL")
5385 #:parallel-tests? #f ;tests use 'mpiexec -n4'
5386 #:phases
5387 (modify-phases %standard-phases
5388 (add-before 'check 'mpi-setup
5389 ,%openmpi-setup)
5390 (add-before 'check 'test-setup
5391 (lambda* (#:key inputs #:allow-other-keys)
5392 (setenv "OMP_NUM_THREADS" "2")
5393 (invoke "tar" "xf" (assoc-ref inputs "test-data")))))))
5394 (home-page "https://people.eecs.berkeley.edu/~aydin/CombBLAS/html/")
5395 (synopsis "Linear algebra primitives for graph analytics")
5396 (description "The Combinatorial BLAS (CombBLAS) is an extensible
5397 distributed-memory parallel graph library offering a small but powerful set of
5398 linear algebra primitives specifically targeting graph analytics.")
5399 (license (list
5400 license:gpl2+ ;include/psort/(funnel|sort)*.h
5401 license:x11 ;usort and psort
5402 license:bsd-3)))) ;CombBLAS and MersenneTwister.h
5403
5404 (define-public dune-common
5405 (package
5406 (name "dune-common")
5407 (version "2.7.0")
5408 (source
5409 (origin
5410 (method url-fetch)
5411 (uri (string-append "https://dune-project.org/download/"
5412 version "/dune-common-" version ".tar.gz"))
5413 (sha256
5414 (base32
5415 "140q1zh44cr5yrjwg4b5ga803rkqv55vk30l2cqm29aklj1wb0rw"))))
5416 (build-system cmake-build-system)
5417 (arguments
5418 `(#:phases
5419 (modify-phases %standard-phases
5420 (add-after 'build 'build-tests
5421 (lambda* (#:key make-flags #:allow-other-keys)
5422 (apply invoke "make" "build_tests" make-flags))))))
5423 (inputs
5424 `(("gmp" ,gmp)
5425 ("metis" ,metis)
5426 ("openblas" ,openblas)
5427 ("python" ,python)
5428 ("superlu" ,superlu)))
5429 (native-inputs
5430 `(("gfortran" ,gfortran)
5431 ("pkg-config" ,pkg-config)))
5432 (home-page "https://dune-project.org/")
5433 (synopsis "Distributed and Unified Numerics Environment")
5434 (description "DUNE, the Distributed and Unified Numerics Environment is a
5435 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
5436 grid-based methods. It supports the easy implementation of methods like
5437 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
5438 Differences} (FD).")
5439 ;; GPL version 2 with "runtime exception" to make it behave like LGPLv2.
5440 (license license:gpl2)))
5441
5442 (define-public dune-geometry
5443 (package
5444 (name "dune-geometry")
5445 (version "2.7.0")
5446 (source
5447 (origin
5448 (method url-fetch)
5449 (uri (string-append "https://dune-project.org/download/"
5450 version "/dune-geometry-" version ".tar.gz"))
5451 (sha256
5452 (base32
5453 "1cicvlwbyyw76npicnblxckyvhbfn3ip8isydiv3hlrlz8zcg5nr"))))
5454 (build-system cmake-build-system)
5455 (arguments
5456 `(#:phases
5457 (modify-phases %standard-phases
5458 (add-after 'build 'build-tests
5459 (lambda* (#:key make-flags #:allow-other-keys)
5460 (apply invoke "make" "build_tests" make-flags))))))
5461 (inputs
5462 `(("dune-common" ,dune-common)
5463 ;; Optional
5464 ("openblas" ,openblas)
5465 ("gmp" ,gmp)
5466 ("python" ,python)))
5467 (native-inputs
5468 `(("gfortran" ,gfortran)
5469 ("pkg-config" ,pkg-config)))
5470 (home-page "https://dune-project.org/")
5471 (synopsis "Distributed and Unified Numerics Environment")
5472 (description "DUNE, the Distributed and Unified Numerics Environment is a
5473 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
5474 grid-based methods. It supports the easy implementation of methods like
5475 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
5476 Differences} (FD).
5477
5478 This package contains the basic DUNE geometry classes.")
5479 ;; GPL version 2 with "runtime exception"
5480 (license license:gpl2)))
5481
5482 (define-public dune-uggrid
5483 (package
5484 (name "dune-uggrid")
5485 (version "2.7.0")
5486 (source
5487 (origin
5488 (method git-fetch)
5489 (uri (git-reference
5490 (url "https://gitlab.dune-project.org/staging/dune-uggrid.git")
5491 (commit (string-append "v" version))))
5492 (file-name (git-file-name name version))
5493 (sha256
5494 (base32
5495 "192miqgmfj6jwk969gydzpbv9ki7jg5nky3ydnrwa2nq29b5xkh0"))))
5496 (build-system cmake-build-system)
5497 (arguments
5498 `(#:phases
5499 (modify-phases %standard-phases
5500 (add-after 'build 'build-tests
5501 (lambda* (#:key make-flags #:allow-other-keys)
5502 (apply invoke "make" "build_tests" make-flags))))))
5503 (inputs
5504 `(("dune-common" ,dune-common)))
5505 (native-inputs
5506 `(("gfortran" ,gfortran)
5507 ("pkg-config" ,pkg-config)))
5508 (home-page "https://dune-project.org/")
5509 (synopsis "Distributed and Unified Numerics Environment")
5510 (description "DUNE, the Distributed and Unified Numerics Environment is a
5511 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
5512 grid-based methods. It supports the easy implementation of methods like
5513 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
5514 Differences} (FD).
5515
5516 This package contains the DUNE UG grid classes.")
5517 (license license:lgpl2.1)))
5518
5519 (define-public dune-grid
5520 (package
5521 (name "dune-grid")
5522 (version "2.7.0")
5523 (source
5524 (origin
5525 (method url-fetch)
5526 (uri (string-append "https://dune-project.org/download/"
5527 version "/dune-grid-" version ".tar.gz"))
5528 (sha256
5529 (base32
5530 "17fjz30qazjgl11sryyxnw9klai4yz1ji4bs68013xcxc5hdv27s"))))
5531 (build-system cmake-build-system)
5532 (arguments
5533 `(#:phases
5534 (modify-phases %standard-phases
5535 (add-after 'build 'build-tests
5536 (lambda* (#:key make-flags #:allow-other-keys)
5537 (apply invoke "make" "build_tests" make-flags))))))
5538 (inputs
5539 `(("dune-common" ,dune-common)
5540 ("dune-geometry" ,dune-geometry)
5541 ("gmp" ,gmp)
5542 ("metis" ,metis)
5543 ("openblas" ,openblas)
5544 ("python" ,python)))
5545 (propagated-inputs
5546 `(("dune-uggrid" ,dune-uggrid)))
5547 (native-inputs
5548 `(("gfortran" ,gfortran)
5549 ("pkg-config" ,pkg-config)))
5550 (home-page "https://dune-project.org/")
5551 (synopsis "Distributed and Unified Numerics Environment")
5552 (description "DUNE, the Distributed and Unified Numerics Environment is a
5553 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
5554 grid-based methods. It supports the easy implementation of methods like
5555 @dfn{Finite Elements} (FE), @dfn{Finite Volumes} (FV), and also @dfn{Finite
5556 Differences} (FD).
5557
5558 This package contains the basic DUNE grid classes.")
5559 ;; GPL version 2 with "runtime exception"
5560 (license license:gpl2)))
5561
5562 (define-public dune-istl
5563 (package
5564 (name "dune-istl")
5565 (version "2.7.0")
5566 (source
5567 (origin
5568 (method url-fetch)
5569 (uri (string-append "https://dune-project.org/download/"
5570 version "/dune-istl-" version ".tar.gz"))
5571 (sha256
5572 (base32
5573 "0gl3wgz5rs6sb4m83440ny45sbx7z7lnbi3gx6r9nm3rvy5j33f9"))
5574 (patches (search-patches "dune-istl-2.7-fix-non-mpi-tests.patch"))))
5575 (build-system cmake-build-system)
5576 (arguments
5577 `(#:phases
5578 (modify-phases %standard-phases
5579 ;; XXX: istl/test/matrixtest.cc includes <fenv.h> and fails to find
5580 ;; the stdlib types when the gfortran header is used. Remove gfortran
5581 ;; from CPLUS_INCLUDE_PATH as a workaround.
5582 (add-after 'set-paths 'hide-gfortran
5583 (lambda* (#:key inputs #:allow-other-keys)
5584 (let ((gfortran (assoc-ref inputs "gfortran")))
5585 (setenv "CPLUS_INCLUDE_PATH"
5586 (string-join
5587 (delete (string-append gfortran "/include/c++")
5588 (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
5589 ":"))
5590 #t)))
5591 (add-after 'build 'build-tests
5592 (lambda* (#:key make-flags #:allow-other-keys)
5593 (apply invoke "make" "build_tests" make-flags))))))
5594 (inputs
5595 `(("dune-common" ,dune-common)
5596 ;; Optional
5597 ("metis" ,metis)
5598 ("suitesparse" ,suitesparse)
5599 ("superlu" ,superlu)
5600 ("openblas" ,openblas)
5601 ("gmp" ,gmp)
5602 ("python" ,python)))
5603 (native-inputs
5604 `(("gfortran" ,gfortran)
5605 ("pkg-config" ,pkg-config)))
5606 (home-page "https://dune-project.org/")
5607 (synopsis "Distributed and Unified Numerics Environment")
5608 (description "DUNE, the Distributed and Unified Numerics Environment is a
5609 modular toolbox for solving @dfn{partial differential equations} (PDEs) with
5610 grid-based methods.
5611
5612 This is the iterative solver template library which provides generic sparse
5613 matrix/vector classes and a variety of solvers based on these classes. A
5614 special feature is the use of templates to exploit the recursive block
5615 structure of finite element matrices at compile time. Available solvers
5616 include Krylov methods, (block-) incomplete decompositions and
5617 aggregation-based algebraic multigrid.")
5618 ;; GPL version 2 with "runtime exception"
5619 (license license:gpl2)))
5620
5621 (define-public dune-localfunctions
5622 (package
5623 (name "dune-localfunctions")
5624 (version "2.7.0")
5625 (source
5626 (origin
5627 (method url-fetch)
5628 (uri (string-append "https://dune-project.org/download/"
5629 version "/dune-localfunctions-" version ".tar.gz"))
5630 (sha256
5631 (base32
5632 "1yih59h6vngii696bx1c2vil02lriij4kz0nc583mjn9kiaqxfqd"))))
5633 (build-system cmake-build-system)
5634 (arguments
5635 `(#:phases
5636 (modify-phases %standard-phases
5637 ;; XXX: localfunctions/test/lagrangeshapefunctiontest.cc includes <fenv.h>
5638 ;; and fails to find the stdlib types when the gfortran header is used.
5639 ;; Hide gfortran from CPLUS_INCLUDE_PATH to ensure we get the GCC header.
5640 (add-after 'set-paths 'hide-gfortran
5641 (lambda* (#:key inputs #:allow-other-keys)
5642 (let ((gfortran (assoc-ref inputs "gfortran")))
5643 (setenv "CPLUS_INCLUDE_PATH"
5644 (string-join
5645 (delete (string-append gfortran "/include/c++")
5646 (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
5647 ":"))
5648 #t)))
5649 (add-after 'build 'build-tests
5650 (lambda* (#:key make-flags #:allow-other-keys)
5651 (apply invoke "make" "build_tests" make-flags))))))
5652 (inputs
5653 `(("dune-common" ,dune-common)
5654 ("dune-geometry" ,dune-geometry)
5655 ;; Optional
5656 ("metis" ,metis)
5657 ("superlu" ,superlu)
5658 ("gmp" ,gmp)))
5659 (native-inputs
5660 `(("gfortran" ,gfortran)
5661 ("pkg-config" ,pkg-config)))
5662 (home-page "https://dune-project.org/")
5663 (synopsis "Distributed and Unified Numerics Environment") ; TODO
5664 (description "This DUNE module provides interface and implementation for
5665 shape functions defined on the DUNE reference elements. In addition to the
5666 shape function, interpolation operators and special keys are provided which
5667 can be used to assemble global function spaces on finite-element grids.
5668
5669 This package provides an interface and implementation for shape functions
5670 defined on the DUNE reference elements. In addition to the shape function,
5671 interpolation operators and special keys are provided which can be used to
5672 assemble global function spaces on finite-element grids.")
5673 ;; GPL version 2 with "runtime exception"
5674 (license license:gpl2)))
5675
5676 (define-public dune-alugrid
5677 (package
5678 (name "dune-alugrid")
5679 (version "2.7.0-git-81d35682")
5680 (source
5681 (origin
5682 (method git-fetch)
5683 (uri (git-reference
5684 (url "https://gitlab.dune-project.org/extensions/dune-alugrid.git")
5685 (commit "81d356827c84454b971937db02c02b90bbcd7fe5")))
5686 (file-name (git-file-name name version))
5687 (sha256
5688 (base32
5689 "0z54lwfp53prcrs94k8gwh047l9z642jll3l56xlyfr69z0b2zz1"))))
5690 (build-system cmake-build-system)
5691 (arguments
5692 `(#:phases
5693 (modify-phases %standard-phases
5694 (add-after 'unpack 'patch-include
5695 (lambda _
5696 (substitute* "dune/alugrid/test/test-alugrid.cc"
5697 (("doc/grids/gridfactory/testgrids")
5698 "doc/dune-grid/grids/gridfactory/testgrids"))
5699 #t))
5700 (add-after 'build 'build-tests
5701 (lambda* (#:key inputs make-flags #:allow-other-keys)
5702 (setenv "CPLUS_INCLUDE_PATH"
5703 (string-append (assoc-ref inputs "dune-grid") "/share"))
5704 (apply invoke "make" "build_tests" make-flags))))))
5705 (inputs
5706 `(("dune-common" ,dune-common)
5707 ("dune-geometry" ,dune-geometry)
5708 ("dune-grid" ,dune-grid)
5709 ;; Optional
5710 ("metis" ,metis)
5711 ("openblas" ,openblas)
5712 ("python" ,python)
5713 ("superlu" ,superlu)
5714 ("gmp" ,gmp)
5715 ("zlib" ,zlib)))
5716 (native-inputs
5717 `(("gfortran" ,gfortran)
5718 ("pkg-config" ,pkg-config)))
5719 (home-page "https://dune-project.org/")
5720 (synopsis "Distributed and Unified Numerics Environment")
5721 (description "ALUGrid is an adaptive, loadbalancing, unstructured
5722 implementation of the DUNE grid interface supporting either simplices or
5723 cubes.")
5724 (license license:gpl2+)))
5725
5726 (define-public dune-subgrid
5727 (package
5728 (name "dune-subgrid")
5729 (version "2.7.0-git-2103a363")
5730 (source
5731 (origin
5732 (method git-fetch)
5733 (uri (git-reference
5734 (url "https://git.imp.fu-berlin.de/agnumpde/dune-subgrid")
5735 (commit "2103a363f32e8d7b60e66eee7ddecf969f6cf762")))
5736 (file-name (git-file-name name version))
5737 (sha256
5738 (base32
5739 "1wsjlypd3835c3arqjkw836cxx5q67zy447wa65q634lf6f6v9ia"))))
5740 (build-system cmake-build-system)
5741 (arguments
5742 `(#:phases
5743 (modify-phases %standard-phases
5744 (add-after 'build 'build-tests
5745 (lambda* (#:key make-flags #:allow-other-keys)
5746 (apply invoke "make" "build_tests" make-flags))))))
5747 (inputs
5748 `(("dune-common" ,dune-common)
5749 ("dune-geometry" ,dune-geometry)
5750 ("dune-grid" ,dune-grid)
5751 ;; Optional
5752 ("metis" ,metis)
5753 ("openblas" ,openblas)
5754 ("gmp" ,gmp)))
5755 (native-inputs
5756 `(("gfortran" ,gfortran)
5757 ("pkg-config" ,pkg-config)))
5758 (home-page "http://numerik.mi.fu-berlin.de/dune-subgrid/index.php")
5759 (synopsis "Distributed and Unified Numerics Environment")
5760 (description "The dune-subgrid module marks elements of
5761 another hierarchical dune grid. The set of marked elements can then be
5762 accessed as a hierarchical dune grid in its own right. Dune-Subgrid
5763 provides the full grid interface including adaptive mesh refinement.")
5764 (license license:gpl2+)))
5765
5766 (define-public dune-typetree
5767 (package
5768 (name "dune-typetree")
5769 (version "2.7.0")
5770 (source
5771 (origin
5772 (method git-fetch)
5773 (uri (git-reference
5774 (url "https://gitlab.dune-project.org/staging/dune-typetree.git")
5775 (commit (string-append "v" version))))
5776 (file-name (git-file-name name version))
5777 (sha256
5778 (base32
5779 "1rhv25yg0q1hw50c8wlfqhgwrjl4mh62zq9v14ilwgzbfgxmpiy7"))))
5780 (build-system cmake-build-system)
5781 (arguments
5782 `(#:phases
5783 (modify-phases %standard-phases
5784 (add-after 'build 'build-tests
5785 (lambda* (#:key make-flags #:allow-other-keys)
5786 (apply invoke "make" "build_tests" make-flags))))))
5787 (inputs
5788 `(("dune-common" ,dune-common)
5789 ;; Optional
5790 ("openblas" ,openblas)
5791 ("python" ,python)
5792 ("metis" ,metis)
5793 ("superlu" ,superlu)
5794 ("gmp" ,gmp)))
5795 (native-inputs
5796 `(("gfortran" ,gfortran)
5797 ("pkg-config" ,pkg-config)))
5798 (home-page "https://dune-project.org/")
5799 (synopsis "Distributed and Unified Numerics Environment")
5800 (description "TypeTree is a template library for constructing and
5801 operating on statically typed trees of objects.")
5802 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5803 (license (list license:lgpl3+ license:gpl2))))
5804
5805 (define-public dune-functions
5806 (package
5807 (name "dune-functions")
5808 (version "2.7.0")
5809 (source
5810 (origin
5811 (method git-fetch)
5812 (uri (git-reference
5813 (url "https://gitlab.dune-project.org/staging/dune-functions.git")
5814 (commit (string-append "v" version))))
5815 (file-name (git-file-name name version))
5816 (sha256
5817 (base32
5818 "1na4gcih0kin37ksj2xj07ds04v7zx53pjdhm1hzy55jjfqdjk8h"))))
5819 (build-system cmake-build-system)
5820 (arguments
5821 `(#:phases
5822 (modify-phases %standard-phases
5823 (add-after 'unpack 'disable-failing-tests
5824 (lambda _
5825 (setenv "ARGS"
5826 ;; unable to load GMSH file in this test
5827 "--exclude-regex gridviewfunctionspacebasistest")
5828 #t))
5829 (add-after 'build 'build-tests
5830 (lambda* (#:key make-flags #:allow-other-keys)
5831 (apply invoke "make" "build_tests" make-flags))))))
5832 (inputs
5833 `(("dune-common" ,dune-common)
5834 ("dune-istl" ,dune-istl)
5835 ("dune-localfunctions" ,dune-localfunctions)
5836 ("dune-grid" ,dune-grid)
5837 ("dune-geometry" ,dune-geometry)
5838 ("dune-typetree" ,dune-typetree)
5839 ("openblas" ,openblas)
5840 ("metis" ,metis)
5841 ("python" ,python)
5842 ("superlu" ,superlu)
5843 ("gmp" ,gmp)))
5844 (native-inputs
5845 `(("gfortran" ,gfortran)
5846 ("pkg-config" ,pkg-config)))
5847 (home-page "https://dune-project.org/")
5848 (synopsis "Distributed and Unified Numerics Environment")
5849 (description "The dune-functions module provides an abstraction layer for
5850 global finite element functions. Its two main concepts are functions
5851 implemented as callable objects, and bases of finite element spaces.")
5852 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5853 (license (list license:lgpl3+ license:gpl2))))
5854
5855 (define-public dune-pdelab
5856 (package
5857 (name "dune-pdelab")
5858 (version "2.7.0-git-476fe437")
5859 (source
5860 (origin
5861 (method git-fetch)
5862 (uri (git-reference
5863 (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
5864 (commit "476fe43763fa6f459c5e4658e2a2b4b5582db834")))
5865 (file-name (git-file-name name version))
5866 (sha256
5867 (base32
5868 "0cs36piqzn6rq0j2ih3ab3q3q9yg199wk72k5qi86pkzh7i7fdn1"))))
5869 (build-system cmake-build-system)
5870 (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
5871 (inputs
5872 `(("dune-common" ,dune-common)
5873 ("dune-istl" ,dune-istl)
5874 ("dune-localfunctions" ,dune-localfunctions)
5875 ("dune-geometry" ,dune-geometry)
5876 ("dune-grid" ,dune-grid)
5877 ("dune-typetree" ,dune-typetree)
5878 ("dune-functions" ,dune-functions)
5879 ;; Optional
5880 ("openblas" ,openblas)
5881 ("eigen" ,eigen)
5882 ("metis" ,metis)
5883 ("python" ,python)
5884 ("superlu" ,superlu)
5885 ("gmp" ,gmp)))
5886 (native-inputs
5887 `(("gfortran" ,gfortran)
5888 ("pkg-config" ,pkg-config)))
5889 (home-page "https://dune-project.org/")
5890 (synopsis "Differential equations solver toolbox")
5891 (description "PDELab is a partial differential equations solver toolbox
5892 built on top of DUNE, the Distributed and Unified Numerics Environment.")
5893 ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
5894 (license (list license:lgpl3+ license:gpl2))))
5895
5896 (define add-openmpi-to-dune-package
5897 (let ((dune-package?
5898 (lambda (p) (string-prefix? "dune-" (package-name p)))))
5899 (package-mapping
5900 (lambda (p)
5901 (if (dune-package? p)
5902 (package (inherit p)
5903 (name (string-append (package-name p) "-openmpi"))
5904 (inputs `(,@(package-inputs p)
5905 ("openmpi" ,openmpi)))
5906 (arguments
5907 (substitute-keyword-arguments (package-arguments p)
5908 ((#:phases phases '%standard-phases)
5909 `(modify-phases ,phases
5910 (add-before 'check 'mpi-setup
5911 ,%openmpi-setup)))))
5912 (synopsis (string-append (package-synopsis p) " (with MPI support)")))
5913 p))
5914 (negate dune-package?))))
5915
5916 (define-public dune-common-openmpi
5917 (add-openmpi-to-dune-package dune-common))
5918
5919 (define-public dune-geometry-openmpi
5920 (add-openmpi-to-dune-package dune-geometry))
5921
5922 (define-public dune-istl-openmpi
5923 (add-openmpi-to-dune-package dune-istl))
5924
5925 (define-public dune-typetree-openmpi
5926 (add-openmpi-to-dune-package dune-typetree))
5927
5928 (define-public dune-uggrid-openmpi
5929 (add-openmpi-to-dune-package dune-uggrid))
5930
5931 (define-public dune-grid-openmpi
5932 (add-openmpi-to-dune-package dune-grid))
5933
5934 (define-public dune-alugrid-openmpi
5935 (add-openmpi-to-dune-package dune-alugrid))
5936
5937 (define-public dune-subgrid-openmpi
5938 (add-openmpi-to-dune-package dune-subgrid))
5939
5940 (define-public dune-localfunctions-openmpi
5941 (add-openmpi-to-dune-package dune-localfunctions))
5942
5943 (define-public dune-functions-openmpi
5944 (add-openmpi-to-dune-package dune-functions))
5945
5946 (define-public dune-pdelab-openmpi
5947 (add-openmpi-to-dune-package dune-pdelab))
5948
5949 (define-public mlucas
5950 (package
5951 (name "mlucas")
5952 (version "18")
5953 (source
5954 (origin
5955 (method url-fetch)
5956 (uri (string-append
5957 "https://mersenneforum.org/mayer/src/C/mlucas_v" version ".txz"))
5958 (sha256
5959 (base32 "0h4xj6pyyac79ka5ibqjilfa3s9j3yxnzgpwc57b54kfh2bj3447"))))
5960 (build-system gnu-build-system)
5961 (inputs
5962 `(("python2" ,python-2)))
5963 (arguments
5964 `(#:tests? #f ; no tests
5965 #:phases
5966 (modify-phases %standard-phases
5967 (replace 'configure
5968 (lambda _
5969 (chdir "src")
5970 (call-with-output-file "Makefile"
5971 (lambda (port)
5972 (format port "CC = gcc
5973 CFLAGS = -O3 ~a -DUSE_THREADS
5974 LDLIBS = -lm -lpthread -lrt
5975 Mlucas: $(addsuffix .o,$(basename $(wildcard *.c)))
5976 "
5977 ,(let ((system (or (%current-target-system)
5978 (%current-system))))
5979 (cond
5980 ((string-prefix? "x86_64" system) "-DUSE_SSE2")
5981 (else ""))))))
5982 #t))
5983 (replace 'install
5984 (lambda* (#:key outputs #:allow-other-keys)
5985 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
5986 (install-file "Mlucas" bin)
5987 (install-file "primenet.py" bin))
5988 #t)))))
5989 (home-page "https://www.mersenne.org")
5990 (synopsis "Great Internet Mersenne Prime Search (GIMPS) distributed computing client")
5991 (description "Mlucas performs Lucas-Lehmer primality testing of Mersenne
5992 numbers in search of a world-record prime. You may use it to test any
5993 suitable number as you wish, but it is preferable that you do so in a
5994 coordinated fashion, as part of the Great Internet Mersenne Prime
5995 Search (GIMPS). Mlucas also includes a simple Python script for assignment
5996 management via the GIMPS project's Primenet server.")
5997 (license license:gpl2+)))
5998
5999 (define-public nauty
6000 (package
6001 (name "nauty")
6002 (version "2.7r1")
6003 (source
6004 (origin
6005 (method url-fetch)
6006 (uri (string-append
6007 "https://pallini.di.uniroma1.it/"
6008 "nauty" (string-join (string-split version #\.) "") ".tar.gz"))
6009 (sha256
6010 (base32 "0xsfqfcknbd6g6wzpa5l7crmmk3bf3zjh37rhylq6b20dqcmvjkn"))))
6011 (build-system gnu-build-system)
6012 (outputs '("out" "lib"))
6013 (arguments
6014 `(#:test-target "checks"
6015 #:configure-flags '("--enable-generic") ;prevent -march-native
6016 #:phases
6017 (modify-phases %standard-phases
6018 ;; Default make target does not build all available
6019 ;; executables. Create them now.
6020 (add-after 'build 'build-extra-programs
6021 (lambda _
6022 (for-each (lambda (target) (invoke "make" target))
6023 '("blisstog" "bliss2dre" "checks6" "sumlines"))
6024 #t))
6025 ;; Upstream does not provide any install target.
6026 (replace 'install
6027 (lambda* (#:key outputs #:allow-other-keys)
6028 (let* ((out (assoc-ref outputs "out"))
6029 (lib-output (assoc-ref outputs "lib"))
6030 (bin (string-append out "/bin"))
6031 (doc (string-append out "/share/doc/nauty/"))
6032 (include (string-append lib-output "/include/nauty"))
6033 (lib (string-append lib-output "/lib/nauty")))
6034 (for-each (lambda (f) (install-file f bin))
6035 '("addedgeg" "amtog" "assembleg" "biplabg" "blisstog"
6036 "bliss2dre" "catg" "checks6" "complg" "converseg"
6037 "copyg" "countg" "cubhamg" "deledgeg" "delptg"
6038 "directg" "dreadnaut" "dretodot" "dretog" "genbg"
6039 "genbgL" "geng" "genquarticg" "genrang" "genspecialg"
6040 "gentourng" "gentreeg" "hamheuristic" "labelg"
6041 "linegraphg" "listg" "multig" "newedgeg" "pickg"
6042 "planarg" "ranlabg" "shortg" "showg" "subdivideg"
6043 "sumlines" "twohamg" "underlyingg" "vcolg"
6044 "watercluster2" "NRswitchg"))
6045 (for-each (lambda (f) (install-file f include))
6046 (find-files "." "\\.h$"))
6047 (for-each (lambda (f) (install-file f lib))
6048 (find-files "." "\\.a$"))
6049 (for-each (lambda (f) (install-file f doc))
6050 (append '("formats.txt" "README" "schreier.txt")
6051 (find-files "." "\\.pdf$")))))))))
6052 (inputs
6053 `(("gmp" ,gmp))) ;for sumlines
6054 (home-page "https://pallini.di.uniroma1.it/")
6055 (synopsis "Library for graph automorphisms")
6056 (description "@code{nauty} (No AUTomorphisms, Yes?) is a set of
6057 procedures for computing automorphism groups of graphs and digraphs.
6058
6059 @code{nauty} computes graph information in the form of a set of
6060 generators, the size of the group, and the orbits of the group; it can
6061 also produce a canonical label. The @code{nauty} suite is written in
6062 C and comes with a command-line interface, a collection of
6063 command-line tools, and an Application Programming Interface (API).
6064
6065 This package provides the static libraries required to run programs
6066 compiled against the nauty library.")
6067 (license license:asl2.0)))
6068
6069 (define-public ppl
6070 (package
6071 (name "ppl")
6072 (version "1.2")
6073 (source
6074 (origin
6075 (method url-fetch)
6076 (uri (string-append "https://www.bugseng.com/products/ppl/download/"
6077 "ftp/releases/" version
6078 "/ppl-" version ".tar.gz"))
6079 (sha256
6080 (base32
6081 "1j5aji1g2vmdvc0gqz45n2ll2l2f6czca04wiyfl5g3sm3a6vhvb"))))
6082 (build-system gnu-build-system)
6083 (native-inputs
6084 `(("m4" ,m4)))
6085 (inputs
6086 `(("glpk" ,glpk)
6087 ("gmp" ,gmp)))
6088 (home-page "https://www.bugseng.com/parma-polyhedra-library")
6089 (synopsis
6090 "Parma Polyhedra Library for computations with polyhedra")
6091 (description
6092 "The Parma Polyhedra Library (PPL) provides numerical abstractions
6093 especially targeted at applications in the field of analysis and
6094 verification of complex systems. These abstractions include convex
6095 polyhedra, defined as the intersection of a finite number of (open or
6096 closed) halfspaces, each described by a linear inequality (strict or
6097 non-strict) with rational coefficients; some special classes of polyhedra
6098 shapes that offer interesting complexity/precision tradeoffs; and grids
6099 which represent regularly spaced points that satisfy a set of linear
6100 congruence relations. The library also supports finite powersets and
6101 products of (any kind of) polyhedra and grids, a mixed integer linear
6102 programming problem solver using an exact-arithmetic version of the simplex
6103 algorithm, a parametric integer programming solver, and primitives for
6104 termination analysis via the automatic synthesis of linear ranking
6105 functions.")
6106 (license license:gpl3+)))
6107
6108 (define-public speedcrunch
6109 (package
6110 (name "speedcrunch")
6111 (version "0.12.0")
6112 (source
6113 (origin
6114 (method git-fetch)
6115 (uri (git-reference
6116 (url "https://bitbucket.org/heldercorreia/speedcrunch.git")
6117 (commit (string-append "release-" version))))
6118 (file-name (git-file-name name version))
6119 (sha256
6120 (base32
6121 "0vh7cd1915bjqzkdp3sk25ngy8cq624mkh8c53c5bnzk357kb0fk"))))
6122 (build-system cmake-build-system)
6123 (inputs `(("qtbase" ,qtbase-5)))
6124 (native-inputs `(("qttools" ,qttools)))
6125 (arguments
6126 `(#:phases
6127 (modify-phases %standard-phases
6128 (add-after 'unpack 'chdir-to-src
6129 (lambda _ (chdir "src") #t)))))
6130 (synopsis "High-precision scientific calculator")
6131 (description
6132 "SpeedCrunch is a high-precision scientific calculator. It features a
6133 syntax-highlighted scrollable display and is designed to be fully used via
6134 keyboard. Some distinctive features are auto-completion of functions and
6135 variables, a formula book, and quick insertion of constants from various
6136 fields of knowledge.")
6137 (home-page "https://speedcrunch.org/")
6138 (license license:gpl2+)))
6139
6140 (define-public minisat
6141 ;; This is the last commit which is available upstream, no
6142 ;; release happened since 2010.
6143 (let ((commit "37dc6c67e2af26379d88ce349eb9c4c6160e8543")
6144 (revision "1"))
6145 (package
6146 (name "minisat")
6147 (version (string-append "2.2.0-" revision "." (string-take commit 7)))
6148 (source
6149 (origin
6150 (method git-fetch)
6151 (uri (git-reference
6152 (url "https://github.com/niklasso/minisat")
6153 (commit commit)))
6154 (file-name (string-append name "-" version "-checkout"))
6155 (sha256
6156 (base32
6157 "091hf3qkm197s5r7xcr3m07xsdwyz2rqk1hc9kj0hn13imz09irq"))
6158 (patches
6159 (search-patches "minisat-friend-declaration.patch"
6160 "minisat-install.patch"))))
6161 (build-system gnu-build-system)
6162 (arguments
6163 '(#:make-flags (list (string-append "prefix=" %output))
6164 #:tests? #f ;no check target
6165 #:phases
6166 (modify-phases %standard-phases
6167 (delete 'configure))))
6168 (inputs
6169 `(("zlib:static" ,zlib "static")
6170 ("zlib" ,zlib)))
6171 (synopsis
6172 "Small, yet efficient, SAT solver")
6173 (description
6174 "MiniSat is a minimalistic, open-source SAT solver, developed to help
6175 researchers and developers alike to get started on SAT.")
6176 (home-page
6177 "http://minisat.se/MiniSat.html")
6178 (license license:expat))))
6179
6180 (define-public libqalculate
6181 (package
6182 (name "libqalculate")
6183 (version "3.19.0")
6184 (source
6185 (origin
6186 (method git-fetch)
6187 (uri (git-reference
6188 (url "https://github.com/Qalculate/libqalculate/")
6189 (commit (string-append "v" version))))
6190 (file-name (git-file-name name version))
6191 (sha256
6192 (base32 "1w44407wb552q21dz4m2nwwdi8b9hzjb2w1l3ffsikzqckc7wbyj"))
6193 (patches
6194 (search-patches "libqalculate-3.8.0-libcurl-ssl-fix.patch"))))
6195 (build-system gnu-build-system)
6196 (native-inputs
6197 `(("pkg-config" ,pkg-config)
6198 ("gettext" ,gettext-minimal)
6199 ("intltool" ,intltool)
6200 ("automake" ,automake)
6201 ("autoconf" ,autoconf)
6202 ("libtool" ,libtool)
6203 ("doxygen" ,doxygen)
6204 ("file" ,file)))
6205 (inputs
6206 `(("gmp" ,gmp)
6207 ("mpfr" ,mpfr)
6208 ("libxml2" ,libxml2)
6209 ("curl" ,curl)
6210 ("icu4c" ,icu4c)
6211 ("gnuplot" ,gnuplot)
6212 ("readline" ,readline)
6213 ("libiconv" ,libiconv)))
6214 (arguments
6215 `(#:phases
6216 (modify-phases %standard-phases
6217 (add-before 'bootstrap 'setenv
6218 ;; Prevent the autogen.sh script to carry out the configure
6219 ;; script, which has not yet been patched to replace /bin/sh.
6220 (lambda _
6221 (setenv "NOCONFIGURE" "TRUE")
6222 #t)))))
6223 (home-page "https://qalculate.github.io/")
6224 (synopsis "Multi-purpose cli desktop calculator and library")
6225 (description
6226 "Libqalculate is a multi-purpose cli desktop calculator and library.
6227 It provides basic and advanced functionality. Features include customizable
6228 functions, unit calculations, and conversions, physical constants, symbolic
6229 calculations (including integrals and equations), arbitrary precision,
6230 uncertainty propagation, interval arithmetic, plotting and a user-friendly
6231 cli.")
6232 (license license:gpl2+)))
6233
6234 (define-public qalculate-gtk
6235 (package
6236 (name "qalculate-gtk")
6237 (version "3.19.0")
6238 (source
6239 (origin
6240 (method git-fetch)
6241 (uri (git-reference
6242 (url "https://github.com/Qalculate/qalculate-gtk/")
6243 (commit (string-append "v" version))))
6244 (file-name (git-file-name name version))
6245 (sha256
6246 (base32 "1nrx7gp6f1yalbdda1gb97azhbr4xclq2xf08vvbvsk8jfd6fd2v"))))
6247 (build-system glib-or-gtk-build-system)
6248 (native-inputs
6249 `(("pkg-config" ,pkg-config)
6250 ("intltool" ,intltool)
6251 ("automake" ,automake)
6252 ("autoconf" ,autoconf)
6253 ("libtool" ,libtool)
6254 ("file" ,file)))
6255 (inputs
6256 `(("gmp" ,gmp)
6257 ("mpfr" ,mpfr)
6258 ("libqalculate" ,libqalculate)
6259 ("libxml2" ,libxml2)
6260 ("glib" ,glib)
6261 ("gtk+" ,gtk+)))
6262 (arguments
6263 `(#:phases
6264 (modify-phases %standard-phases
6265 (add-before 'bootstrap 'setenv
6266 ;; Prevent the autogen.sh script to carry out the configure
6267 ;; script, which has not yet been patched to replace /bin/sh.
6268 (lambda _
6269 (setenv "NOCONFIGURE" "TRUE")
6270 #t)))))
6271 (home-page "https://qalculate.github.io/")
6272 (synopsis "Multi-purpose graphical desktop calculator")
6273 (description
6274 "Qalculate-gtk is the GTK frontend for libqalculate. It is a
6275 multi-purpose GUI desktop calculator. It provides basic and advanced
6276 functionality. Features include customizable functions, unit calculations,
6277 and conversions, physical constants, symbolic calculations (including
6278 integrals and equations), arbitrary precision, uncertainty propagation,
6279 interval arithmetic, plotting.")
6280 (license license:gpl2+)))
6281
6282 (define-public numdiff
6283 (package
6284 (name "numdiff")
6285 (version "5.9.0")
6286 (source
6287 (origin
6288 (method url-fetch)
6289 (uri (string-append "mirror://savannah/numdiff/numdiff-"
6290 version ".tar.gz"))
6291 (sha256
6292 (base32
6293 "1vzmjh8mhwwysn4x4m2vif7q2k8i19x8azq7pzmkwwj4g48lla47"))))
6294 (build-system gnu-build-system)
6295 (arguments
6296 '(#:tests? #f ; There are no tests.
6297 #:phases
6298 (modify-phases %standard-phases
6299 (add-before 'compress-documentation 'delete-precompressed-info-file
6300 (lambda _
6301 (delete-file (string-append (assoc-ref %outputs "out")
6302 "/share/info/numdiff.info.gz"))
6303 #t)))))
6304 (home-page "https://nongnu.org/numdiff/")
6305 (synopsis "Compare files with numeric fields")
6306 (description
6307 "Numdiff compares files line by line and field by field, ignoring small
6308 numeric differences and differences in numeric formats.")
6309 (license license:gpl3+)))
6310
6311 (define-public why3
6312 (package
6313 (name "why3")
6314 (version "1.3.3")
6315 (source (origin
6316 (method url-fetch)
6317 (uri (string-append "https://gforge.inria.fr/frs/download.php/file"
6318 "/38367/why3-" version ".tar.gz"))
6319 (sha256
6320 (base32
6321 "1n0a2nn1gnk0zg339lh698g4wpk7m8m1vyi2yvifd5adqvk4milw"))))
6322 (build-system ocaml-build-system)
6323 (native-inputs
6324 `(("coq" ,coq)
6325 ("ocaml" ,ocaml)
6326 ("which" ,which)))
6327 (propagated-inputs
6328 `(("camlzip" ,camlzip)
6329 ("ocaml-graph" ,ocaml-graph)
6330 ("ocaml-menhir" ,ocaml-menhir)
6331 ("ocaml-num" ,ocaml-num)
6332 ("ocaml-zarith" ,ocaml-zarith)))
6333 (inputs
6334 `(("coq-flocq" ,coq-flocq)
6335 ("emacs-minimal" ,emacs-minimal)
6336 ("zlib" ,zlib)))
6337 (arguments
6338 `(#:phases
6339 (modify-phases %standard-phases
6340 (add-before 'configure 'fix-configure
6341 (lambda _
6342 (setenv "CONFIG_SHELL" (which "sh"))
6343 (substitute* "configure"
6344 ;; find ocaml-num in the correct directory
6345 (("\\$DIR/nums.cma") "$DIR/num.cma")
6346 (("\\$DIR/num.cmi") "$DIR/core/num.cmi"))
6347 #t))
6348 (add-after 'configure 'fix-makefile
6349 (lambda _
6350 (substitute* "Makefile"
6351 ;; find ocaml-num in the correct directory
6352 (("site-lib/num") "site-lib"))
6353 #t))
6354 (add-after 'install 'install-lib
6355 (lambda _
6356 (invoke "make" "byte")
6357 (invoke "make" "install-lib")
6358 #t)))))
6359 (home-page "http://why3.lri.fr")
6360 (synopsis "Deductive program verification")
6361 (description "Why3 provides a language for specification and programming,
6362 called WhyML, and relies on external theorem provers, both automated and
6363 interactive, to discharge verification conditions. Why3 comes with a standard
6364 library of logical theories (integer and real arithmetic, Boolean operations,
6365 sets and maps, etc.) and basic programming data structures (arrays, queues,
6366 hash tables, etc.). A user can write WhyML programs directly and get
6367 correct-by-construction OCaml programs through an automated extraction
6368 mechanism. WhyML is also used as an intermediate language for the verification
6369 of C, Java, or Ada programs.")
6370 (license license:lgpl2.1)))
6371
6372 (define-public frama-c
6373 (package
6374 (name "frama-c")
6375 (version "22.0")
6376 (source (origin
6377 (method url-fetch)
6378 (uri (string-append "http://frama-c.com/download/frama-c-"
6379 version "-Titanium.tar.gz"))
6380 (sha256
6381 (base32
6382 "1mq1fijka95ydrla486yr4w6wdl9l7vmp512s1q00b0p6lmfwmkh"))))
6383 (build-system ocaml-build-system)
6384 (arguments
6385 `(#:tests? #f; no test target in Makefile
6386 #:phases
6387 (modify-phases %standard-phases
6388 (add-before 'configure 'export-shell
6389 (lambda* (#:key inputs #:allow-other-keys)
6390 (setenv "CONFIG_SHELL" (string-append (assoc-ref inputs "bash")
6391 "/bin/sh"))
6392 #t)))))
6393 (inputs
6394 `(("gmp" ,gmp)))
6395 (propagated-inputs
6396 `(("ocaml-biniou" ,ocaml-biniou)
6397 ("ocaml-easy-format" ,ocaml-easy-format)
6398 ("ocaml-graph" ,ocaml-graph)
6399 ("ocaml-yojson" ,ocaml-yojson)
6400 ("ocaml-zarith" ,ocaml-zarith)
6401 ("why3" ,why3)))
6402 (native-search-paths
6403 (list (search-path-specification
6404 (variable "FRAMAC_SHARE")
6405 (files '("share/frama-c"))
6406 (separator #f))
6407 (search-path-specification
6408 (variable "FRAMAC_LIB")
6409 (files '("lib/frama-c"))
6410 (separator #f))))
6411 (home-page "http://frama-c.com")
6412 (synopsis "C source code analysis platform")
6413 (description "Frama-C is an extensible and collaborative platform dedicated
6414 to source-code analysis of C software. The Frama-C analyzers assist you in
6415 various source-code-related activities, from the navigation through unfamiliar
6416 projects up to the certification of critical software.")
6417 (license license:lgpl2.1+)))