gnu: hdf5: Combine all outputs into one.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
CommitLineData
8f8b2451 1;;; GNU Guix --- Functional package management for GNU
06ed5982 2;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
da95c817 3;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
668c06ac 4;;; Copyright © 2014 John Darrington <jmd@gnu.org>
f5d5a346 5;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
df354a77 6;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
182d6311 7;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
865a69dd 8;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
32158110 9;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
8f8b2451
AE
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages maths)
ec322be2 27 #:use-module (ice-9 regex)
8f8b2451 28 #:use-module (gnu packages)
b5b73a82 29 #:use-module ((guix licenses) #:prefix license:)
8f8b2451
AE
30 #:use-module (guix packages)
31 #:use-module (guix download)
279663ef 32 #:use-module (guix svn-download)
0e2672ae 33 #:use-module (guix utils)
da95c817 34 #:use-module (guix build-system cmake)
c9dfa3c7 35 #:use-module (guix build-system gnu)
3de01d3f
EB
36 #:use-module (gnu packages algebra)
37 #:use-module (gnu packages bison)
38 #:use-module (gnu packages cmake)
c9dfa3c7 39 #:use-module (gnu packages compression)
668c06ac 40 #:use-module (gnu packages curl)
57e544e8 41 #:use-module (gnu packages elf)
3de01d3f 42 #:use-module (gnu packages flex)
668c06ac 43 #:use-module (gnu packages fltk)
f3929800 44 #:use-module (gnu packages fontutils)
1dba6407 45 #:use-module (gnu packages gettext)
da95c817 46 #:use-module (gnu packages gcc)
73fed4f8 47 #:use-module (gnu packages gd)
668c06ac 48 #:use-module (gnu packages ghostscript)
221ed17a 49 #:use-module (gnu packages glib)
f3929800 50 #:use-module (gnu packages gtk)
668c06ac 51 #:use-module (gnu packages less)
8731e527 52 #:use-module (gnu packages lisp)
5698b8b8 53 #:use-module (gnu packages gnome)
668c06ac
JD
54 #:use-module (gnu packages xorg)
55 #:use-module (gnu packages gl)
8731e527 56 #:use-module (gnu packages m4)
d8c7eeb9 57 #:use-module (gnu packages mpi)
b92eee75 58 #:use-module (gnu packages multiprecision)
668c06ac 59 #:use-module (gnu packages pcre)
5698b8b8 60 #:use-module (gnu packages popt)
c9dfa3c7
AE
61 #:use-module (gnu packages perl)
62 #:use-module (gnu packages pkg-config)
da95c817 63 #:use-module (gnu packages python)
c9dfa3c7 64 #:use-module (gnu packages readline)
183e44ae 65 #:use-module (gnu packages tcsh)
df354a77 66 #:use-module (gnu packages tcl)
668c06ac 67 #:use-module (gnu packages texinfo)
73fed4f8 68 #:use-module (gnu packages texlive)
c9dfa3c7 69 #:use-module (gnu packages xml))
8f8b2451
AE
70
71(define-public units
72 (package
73 (name "units")
983815c8 74 (version "2.11")
8f8b2451
AE
75 (source (origin
76 (method url-fetch)
77 (uri (string-append "mirror://gnu/units/units-" version
78 ".tar.gz"))
79 (sha256 (base32
983815c8 80 "1gjs3wc212aaiq4r76hx9nl1h3fa39n0ljwl9420d6ixl3rdmdjk"))))
8f8b2451
AE
81 (build-system gnu-build-system)
82 (synopsis "Conversion between thousands of scales")
83 (description
574e86f9
LC
84 "GNU Units converts numeric quantities between units of measure. It
85can handle scale changes through adaptive usage of standard scale prefixes
86(micro-, kilo-, etc.). It can also handle nonlinear conversions such as
87Fahrenheit to Celsius. Its interpreter is powerful enough to be used
88effectively as a scientific calculator.")
8f8b2451
AE
89 (license license:gpl3+)
90 (home-page "http://www.gnu.org/software/units/")))
c9dfa3c7 91
182d6311
ML
92(define-public dionysus
93 (package
94 (name "dionysus")
95 (version "1.3.0")
96 (source (origin
97 (method url-fetch)
98 (uri (string-append "mirror://gnu/dionysus/dionysus-" version
99 ".tar.gz"))
100 (sha256
101 (base32
102 "1aqnvw6z33bzqgd1ga571pnx6vq2zrkckm1cz91grv45h4jr9vgs"))))
103 (build-system gnu-build-system)
104 (inputs `(("tcl" ,tcl))) ;for 'tclsh'
105 (synopsis "Local search for universal constants and scientific values")
106 (description
107 "GNU Dionysus is a convenient system for quickly retrieving the values of
108mathematical constants used in science and engineering. Values can be
109searched using a simple command-line tool, choosing from three databases:
110universal constants, atomic numbers, and constants related to
111semiconductors.")
112 (license license:gpl3+)
113 (home-page "http://www.gnu.org/software/dionysus/")))
114
88bd1804
AE
115(define-public gsl
116 (package
117 (name "gsl")
487da565 118 (version "1.16")
88bd1804
AE
119 (source
120 (origin
121 (method url-fetch)
122 (uri (string-append "mirror://gnu/gsl/gsl-"
123 version ".tar.gz"))
124 (sha256
125 (base32
487da565 126 "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k"))))
88bd1804 127 (build-system gnu-build-system)
71e0f288 128 (arguments
487da565
AE
129 `(#:parallel-tests? #f
130 #:phases
71e0f288
AE
131 (alist-replace
132 'configure
133 (lambda* (#:key target system outputs #:allow-other-keys #:rest args)
134 (let ((configure (assoc-ref %standard-phases 'configure)))
135 ;; disable numerically unstable test on i686, see thread at
136 ;; http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
137 (if (string=? (or target system) "i686-linux")
138 (substitute* "ode-initval2/Makefile.in"
139 (("TESTS = \\$\\(check_PROGRAMS\\)") "TESTS =")))
140 (apply configure args)))
141 %standard-phases)))
88bd1804
AE
142 (home-page "http://www.gnu.org/software/gsl/")
143 (synopsis "Numerical library for C and C++")
144 (description
a22dc0c4
LC
145 "The GNU Scientific Library is a library for numerical analysis in C
146and C++. It includes a wide range of mathematical routines, with over 1000
147functions in total. Subject areas covered by the library include:
148differential equations, linear algebra, Fast Fourier Transforms and random
149numbers.")
88bd1804
AE
150 (license license:gpl3+)))
151
b92eee75
AE
152(define-public glpk
153 (package
154 (name "glpk")
66fdf545 155 (version "4.55")
b92eee75
AE
156 (source
157 (origin
158 (method url-fetch)
159 (uri (string-append "mirror://gnu/glpk/glpk-"
160 version ".tar.gz"))
161 (sha256
162 (base32
66fdf545 163 "1rqx5fzj1mhkifilip5mkxybpj2wkniq5qcn8h1w2vkr2rzhs29p"))))
b92eee75
AE
164 (build-system gnu-build-system)
165 (inputs
166 `(("gmp" ,gmp)))
167 (arguments
168 `(#:configure-flags '("--with-gmp")))
169 (home-page "http://www.gnu.org/software/glpk/")
79c311b8 170 (synopsis "GNU Linear Programming Kit, supporting the MathProg language")
b92eee75
AE
171 (description
172 "GLPK is a C library for solving large-scale linear programming (LP),
173mixed integer programming (MIP), and other related problems. It supports the
174GNU MathProg modeling language, a subset of the AMPL language, and features a
175translator for the language. In addition to the C library, a stand-alone
176LP/MIP solver is included in the package.")
177 (license license:gpl3+)))
178
c9dfa3c7
AE
179(define-public pspp
180 (package
181 (name "pspp")
3dcd7810 182 (version "0.8.4")
c9dfa3c7
AE
183 (source
184 (origin
185 (method url-fetch)
186 (uri (string-append "mirror://gnu/pspp/pspp-"
187 version ".tar.gz"))
188 (sha256
189 (base32
3dcd7810 190 "0b65q45x05ps95pph6glbg7ymdr638nfb0rk9x5x9qm5k073pk5z"))))
c9dfa3c7
AE
191 (build-system gnu-build-system)
192 (inputs
f3929800
AE
193 `(("cairo" ,cairo)
194 ("fontconfig" ,fontconfig)
1dba6407 195 ("gettext" ,gnu-gettext)
c9dfa3c7
AE
196 ("gsl" ,gsl)
197 ("libxml2" ,libxml2)
f3929800 198 ("pango" ,pango)
c9dfa3c7 199 ("readline" ,readline)
e6a5ce8e
JD
200 ("gtk" ,gtk+-2)
201 ("gtksourceview" ,gtksourceview)
c9dfa3c7
AE
202 ("zlib" ,zlib)))
203 (native-inputs
221ed17a
EB
204 `(("glib" ,glib "bin") ;for glib-genmarshal
205 ("perl" ,perl)
c9dfa3c7 206 ("pkg-config" ,pkg-config)))
c9dfa3c7
AE
207 (home-page "http://www.gnu.org/software/pspp/")
208 (synopsis "Statistical analysis")
209 (description
79c311b8 210 "GNU PSPP is a statistical analysis program. It can perform
c5779c93
LC
211descriptive statistics, T-tests, linear regression and non-parametric tests.
212It features both a graphical interface as well as command-line input. PSPP
213is designed to interoperate with Gnumeric, LibreOffice and OpenOffice. Data
214can be imported from spreadsheets, text files and database sources and it can
215be output in text, PostScript, PDF or HTML.")
c9dfa3c7 216 (license license:gpl3+)))
da95c817 217
865a69dd
RW
218(define-public arpack-ng
219 (package
220 (name "arpack-ng")
221 (version "3.2.0")
222 (source
223 (origin
224 (method url-fetch)
225 (uri (string-append "https://github.com/opencollab/arpack-ng/archive/"
226 version ".tar.gz"))
f586c877 227 (file-name (string-append name "-" version ".tar.gz"))
865a69dd
RW
228 (sha256
229 (base32
230 "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"))))
231 (build-system gnu-build-system)
232 (home-page "https://github.com/opencollab/arpack-ng")
233 (inputs
234 `(("lapack" ,lapack)
235 ("fortran" ,gfortran-4.8)))
236 (synopsis "Fortran subroutines for solving eigenvalue problems")
237 (description
238 "ARPACK-NG is a collection of Fortran77 subroutines designed to solve
239large scale eigenvalue problems.")
240 (license (license:bsd-style "file://COPYING"
241 "See COPYING in the distribution."))))
242
da95c817
NK
243(define-public lapack
244 (package
245 (name "lapack")
566146ab 246 (version "3.5.0")
da95c817
NK
247 (source
248 (origin
249 (method url-fetch)
250 (uri (string-append "http://www.netlib.org/lapack/lapack-"
251 version ".tgz"))
252 (sha256
253 (base32
566146ab 254 "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
da95c817
NK
255 (build-system cmake-build-system)
256 (home-page "http://www.netlib.org/lapack/")
57e544e8 257 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
da95c817
NK
258 (inputs `(("fortran" ,gfortran-4.8)
259 ("python" ,python-2)))
260 (arguments
06ed5982 261 `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
da95c817 262 #:phases (alist-cons-before
6a995754
LC
263 'check 'patch-python
264 (lambda* (#:key inputs #:allow-other-keys)
265 (let ((python (assoc-ref inputs "python")))
266 (substitute* "lapack_testing.py"
267 (("/usr/bin/env python") python))))
06ed5982 268 %standard-phases)))
da95c817
NK
269 (synopsis "Library for numerical linear algebra")
270 (description
271 "LAPACK is a Fortran 90 library for solving the most commonly occurring
272problems in numerical linear algebra.")
273 (license (license:bsd-style "file://LICENSE"
274 "See LICENSE in the distribution."))))
73fed4f8
JD
275
276(define-public gnuplot
277 (package
278 (name "gnuplot")
279 (version "4.6.3")
280 (source
281 (origin
282 (method url-fetch)
283 (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
284 version "/gnuplot-" version ".tar.gz"))
285 (sha256
286 (base32
287 "1xd7gqdhlk7k1p9yyqf9vkk811nadc7m4si0q3nb6cpv4pxglpyz"))))
288 (build-system gnu-build-system)
289 (inputs `(("readline" ,readline)
290 ("cairo" ,cairo)
291 ("pango" ,pango)
292 ("gd" ,gd)))
293 (native-inputs `(("texlive" ,texlive)
294 ("pkg-config" ,pkg-config)))
295 (home-page "http://www.gnuplot.info")
296 (synopsis "Command-line driven graphing utility")
297 (description "Gnuplot is a portable command-line driven graphing
35b9e423 298utility. It was originally created to allow scientists and students to
73fed4f8 299visualize mathematical functions and data interactively, but has grown to
35b9e423 300support many non-interactive uses such as web scripting. It is also used as a
73fed4f8
JD
301plotting engine by third-party applications like Octave.")
302 ;; X11 Style with the additional restriction that derived works may only be
303 ;; distributed as patches to the original.
304 (license (license:fsf-free
668c06ac
JD
305 "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))
306
7ee3f1a2
JD
307(define-public hdf5
308 (package
309 (name "hdf5")
310 (version "1.8.12")
311 (source
312 (origin
313 (method url-fetch)
93c3de92
AE
314 (uri (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-"
315 version "/src/hdf5-"
7ee3f1a2
JD
316 version ".tar.bz2"))
317 (sha256
318 (base32 "0f9n0v3p3lwc7564791a39c6cn1d3dbrn7d1j3ikqsi27a8hy23d"))))
319 (build-system gnu-build-system)
320 (arguments
321 `(#:phases
d4bf49b1
EB
322 (alist-cons-before
323 'configure 'patch-configure
324 (lambda _
325 (substitute* "configure"
326 (("/bin/mv") "mv")))
7ee3f1a2 327 %standard-phases)))
7ee3f1a2 328 (home-page "http://www.hdfgroup.org")
516e93f8 329 (synopsis "Management suite for extremely large and complex data")
7ee3f1a2
JD
330 (description "HDF5 is a suite that makes possible the management of
331extremely large and complex data collections.")
d4bf49b1
EB
332 (license (license:x11-style
333 "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
7ee3f1a2
JD
334
335
668c06ac
JD
336;; For a fully featured Octave, users are strongly recommended also to install
337;; the following packages: texinfo, less, ghostscript, gnuplot.
338(define-public octave
339 (package
340 (name "octave")
32158110 341 (version "3.8.2")
668c06ac
JD
342 (source
343 (origin
344 (method url-fetch)
345 (uri (string-append "mirror://gnu/octave/octave-"
346 version ".tar.gz"))
347 (sha256
348 (base32
32158110 349 "05slz8yx8k91fqlnfr1f0vni95iq9qmchz41c7nf4isn3b2fjn7j"))))
668c06ac
JD
350 (build-system gnu-build-system)
351 (inputs
352 `(("lapack" ,lapack)
353 ("readline" ,readline)
354 ("glpk" ,glpk)
355 ("curl" ,curl)
356 ("pcre" ,pcre)
357 ("fltk" ,fltk)
358 ("fontconfig" ,fontconfig)
359 ("freetype" ,freetype)
40029cbe 360 ("hdf5" ,hdf5)
668c06ac
JD
361 ("libxft" ,libxft)
362 ("mesa" ,mesa)
363 ("zlib" ,zlib)))
364 (native-inputs
365 `(("gfortran" ,gfortran-4.8)
366 ("pkg-config" ,pkg-config)
367 ("perl" ,perl)
368 ;; The following inputs are not actually used in the build process. However, the
369 ;; ./configure gratuitously tests for their existence and assumes that programs not
370 ;; present at build time are also not, and can never be, available at run time!
371 ;; If these inputs are therefore not present, support for them will be built out.
372 ;; However, Octave will still run without them, albeit without the features they
373 ;; provide.
374 ("less" ,less)
375 ("texinfo" ,texinfo)
376 ("ghostscript" ,ghostscript)
377 ("gnuplot" ,gnuplot)))
378 (arguments
379 `(#:configure-flags (list (string-append "--with-shell="
380 (assoc-ref %build-inputs "bash")
381 "/bin/sh"))))
382 (home-page "http://www.gnu.org/software/octave/")
383 (synopsis "High-level language for numerical computation")
384 (description "GNU Octave is a high-level interpreted language that is specialized
385for numerical computations. It can be used for both linear and non-linear
386applications and it provides great support for visualizing results. Work may
387be performed both at the interactive command-line as well as via script
388files.")
389 (license license:gpl3+)))
3de01d3f
EB
390
391(define-public gmsh
392 (package
393 (name "gmsh")
394 (version "2.8.4")
395 (source
396 (origin
397 (method url-fetch)
398 (uri (string-append "http://www.geuz.org/gmsh/src/gmsh-"
399 version "-source.tgz"))
400 (sha256
401 (base32 "0jv2yvk28w86rx5mvjkb0w12ff2jxih7axnpvznpd295lg5jg7hr"))
402 (modules '((guix build utils)))
403 (snippet
404 ;; Remove non-free METIS code
405 '(delete-file-recursively "contrib/Metis"))))
406 (build-system cmake-build-system)
407 (native-inputs `(("patchelf" ,patchelf))) ;for augment-rpath
408 (propagated-inputs
409 `(("fltk" ,fltk)
410 ("gfortran" ,gfortran-4.8)
411 ("gmp" ,gmp)
40029cbe 412 ("hdf5" ,hdf5)
3de01d3f
EB
413 ("lapack" ,lapack)
414 ("mesa" ,mesa)
85f41902 415 ("glu" ,glu)
3de01d3f
EB
416 ("libx11" ,libx11)
417 ("libxext" ,libxext)))
418 (arguments
419 `(#:configure-flags `("-DENABLE_METIS:BOOL=OFF"
420 "-DENABLE_BUILD_SHARED:BOOL=ON"
421 "-DENABLE_BUILD_DYNAMIC:BOOL=ON")))
422 (home-page "http://www.geuz.org/gmsh/")
423 (synopsis "3D finite element grid generator")
edf684ef
EB
424 (description "Gmsh is a 3D finite element grid generator with a built-in
425CAD engine and post-processor. Its design goal is to provide a fast, light
426and user-friendly meshing tool with parametric input and advanced
427visualization capabilities. Gmsh is built around four modules: geometry,
428mesh, solver and post-processing. The specification of any input to these
429modules is done either interactively using the graphical user interface or in
430ASCII text files using Gmsh's own scripting language.")
3de01d3f 431 (license license:gpl2+)))
b9100e2f
EB
432
433(define-public petsc
434 (package
435 (name "petsc")
436 (version "3.4.4")
437 (source
438 (origin
439 (method url-fetch)
440 ;; The *-lite-* tarball does not contain the *large* documentation
441 (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
442 "petsc-lite-" version ".tar.gz"))
443 (sha256
444 (base32 "0v5dg6dhdjpi5ianvd4mm6hsvxzv1bsxwnh9f9myag0a0d9xk9iv"))
445 (patches
446 (list (search-patch "petsc-fix-threadcomm.patch")))))
447 (build-system gnu-build-system)
448 (native-inputs
449 `(("python" ,python-2)
450 ("perl" ,perl)))
451 (inputs
452 `(("gfortran" ,gfortran-4.8)
453 ("lapack" ,lapack)
f258212d 454 ("superlu" ,superlu)
b9100e2f
EB
455 ;; leaving out hdf5 and fftw, as petsc expects them to be built with mpi
456 ;; leaving out opengl, as configuration seems to only be for mac
457 ))
458 (arguments
459 `(#:test-target "test"
460 #:parallel-build? #f
461 #:configure-flags
462 `("--with-mpi=0"
f258212d
EB
463 "--with-openmp=1"
464 "--with-superlu=1"
465 ,(string-append "--with-superlu-include="
466 (assoc-ref %build-inputs "superlu") "/include")
467 ,(string-append "--with-superlu-lib="
468 (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
b9100e2f
EB
469 #:phases
470 (alist-replace
471 'configure
472 ;; PETSc's configure script is actually a python script, so we can't
473 ;; run it with bash.
474 (lambda* (#:key outputs (configure-flags '())
475 #:allow-other-keys)
476 (let* ((prefix (assoc-ref outputs "out"))
477 (flags `(,(string-append "--prefix=" prefix)
478 ,@configure-flags)))
479 (format #t "build directory: ~s~%" (getcwd))
480 (format #t "configure flags: ~s~%" flags)
481 (zero? (apply system* "./configure" flags))))
482 (alist-cons-after
10b11968
EB
483 'configure 'clean-local-references
484 ;; Try to keep build directory names from leaking into compiled code
b9100e2f 485 (lambda* (#:key inputs outputs #:allow-other-keys)
10b11968
EB
486 (let ((out (assoc-ref outputs "out")))
487 (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
488 (((getcwd)) out))))
489 (alist-cons-after
490 'install 'clean-install
491 ;; Try to keep installed files from leaking build directory names.
492 (lambda* (#:key inputs outputs #:allow-other-keys)
493 (let ((out (assoc-ref outputs "out"))
494 (fortran (assoc-ref inputs "gfortran")))
495 (substitute* (map (lambda (file)
496 (string-append out "/" file))
497 '("conf/petscvariables"
498 "conf/PETScConfig.cmake"))
499 (((getcwd)) out))
500 ;; Make compiler references point to the store
501 (substitute* (string-append out "/conf/petscvariables")
502 (("= g(cc|\\+\\+|fortran)" _ suffix)
503 (string-append "= " fortran "/bin/g" suffix)))
504 ;; PETSc installs some build logs, which aren't necessary.
505 (for-each (lambda (file)
506 (let ((f (string-append out "/" file)))
507 (when (file-exists? f)
508 (delete-file f))))
509 '("conf/configure.log"
510 "conf/make.log"
511 "conf/test.log"
512 "conf/error.log"
513 "conf/RDict.db"
514 ;; Once installed, should uninstall with Guix
515 "conf/uninstall.py"))))
516 %standard-phases)))))
b9100e2f 517 (home-page "http://www.mcs.anl.gov/petsc")
16ecf3ff 518 (synopsis "Library to solve PDEs")
b9100e2f
EB
519 (description "PETSc, pronounced PET-see (the S is silent), is a suite of
520data structures and routines for the scalable (parallel) solution of
521scientific applications modeled by partial differential equations.")
522 (license (license:bsd-style
523 "http://www.mcs.anl.gov/petsc/documentation/copyright.html"))))
524
525(define-public petsc-complex
526 (package (inherit petsc)
9e771e3b 527 (location (source-properties->location (current-source-location)))
b9100e2f
EB
528 (name "petsc-complex")
529 (arguments
530 (substitute-keyword-arguments (package-arguments petsc)
531 ((#:configure-flags cf)
532 `(cons "--with-scalar-type=complex" ,cf))))
16ecf3ff 533 (synopsis "Library to solve PDEs (with complex scalars)")))
183e44ae 534
d8c7eeb9
EB
535(define-public petsc-openmpi
536 (package (inherit petsc)
537 (name "petsc-openmpi")
538 (inputs
539 `(("openmpi" ,openmpi)
540 ,@(package-inputs petsc)))
541 (arguments
542 (substitute-keyword-arguments (package-arguments petsc)
543 ((#:configure-flags cf)
544 ``("--with-mpiexec=mpirun"
545 ,(string-append "--with-mpi-dir="
546 (assoc-ref %build-inputs "openmpi"))
547 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 548 (synopsis "Library to solve PDEs (with MPI support)")))
d8c7eeb9
EB
549
550(define-public petsc-complex-openmpi
551 (package (inherit petsc-complex)
552 (name "petsc-complex-openmpi")
553 (inputs
554 `(("openmpi" ,openmpi)
555 ,@(package-inputs petsc-complex)))
556 (arguments
557 (substitute-keyword-arguments (package-arguments petsc-complex)
558 ((#:configure-flags cf)
559 ``("--with-mpiexec=mpirun"
560 ,(string-append "--with-mpi-dir="
561 (assoc-ref %build-inputs "openmpi"))
562 ,@(delete "--with-mpi=0" ,cf)))))
16ecf3ff 563 (synopsis "Library to solve PDEs (with complex scalars and MPI support)")))
d8c7eeb9 564
183e44ae
EB
565(define-public superlu
566 (package
567 (name "superlu")
568 (version "4.3")
569 (source
570 (origin
571 (method url-fetch)
572 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
573 "superlu_" version ".tar.gz"))
574 (sha256
575 (base32 "10b785s9s4x0m9q7ihap09275pq4km3k2hk76jiwdfdr5qr2168n"))))
576 (build-system gnu-build-system)
577 (native-inputs
578 `(("tcsh" ,tcsh)))
579 (inputs
580 `(("lapack" ,lapack)
581 ("gfortran" ,gfortran-4.8)))
582 (arguments
583 `(#:parallel-build? #f
584 #:tests? #f ;tests are run as part of `make all`
585 #:phases
586 (alist-replace
587 'configure
588 (lambda* (#:key inputs outputs #:allow-other-keys)
589 (call-with-output-file "make.inc"
590 (lambda (port)
591 (format port "
592PLAT =
593SuperLUroot = ~a
594SUPERLULIB = ~a/lib/libsuperlu.a
595TMGLIB = libtmglib.a
596BLASDEF = -DUSE_VENDOR_BLAS
597BLASLIB = -L~a/lib -lblas
598LIBS = $(SUPERLULIB) $(BLASLIB)
599ARCH = ar
600ARCHFLAGS = cr
601RANLIB = ranlib
602CC = gcc
603PIC = -fPIC
604CFLAGS = -O3 -DPRNTlevel=0 $(PIC)
605NOOPTS = -O0 $(PIC)
606FORTRAN = gfortran
607FFLAGS = -O2 $(PIC)
608LOADER = $(CC)
609CDEFS = -DAdd_"
610 (getcwd)
611 (assoc-ref outputs "out")
612 (assoc-ref inputs "lapack")))))
613 (alist-cons-before
614 'build 'create-install-directories
615 (lambda* (#:key outputs #:allow-other-keys)
616 (for-each
617 (lambda (dir)
618 (mkdir-p (string-append (assoc-ref outputs "out")
619 "/" dir)))
620 '("lib" "include")))
621 (alist-replace
622 'install
623 (lambda* (#:key outputs #:allow-other-keys)
624 ;; Library is placed in lib during the build phase. Copy over
625 ;; headers to include.
626 (let* ((out (assoc-ref outputs "out"))
627 (incdir (string-append out "/include")))
628 (for-each (lambda (file)
629 (let ((base (basename file)))
630 (format #t "installing `~a' to `~a'~%"
631 base incdir)
632 (copy-file file
633 (string-append incdir "/" base))))
634 (find-files "SRC" ".*\\.h$"))))
635 %standard-phases)))))
636 (home-page "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/")
637 (synopsis "Supernodal direct solver for sparse linear systems")
638 (description
639 "SuperLU is a general purpose library for the direct solution of large,
640sparse, nonsymmetric systems of linear equations on high performance machines.
641The library is written in C and is callable from either C or Fortran. The
642library routines perform an LU decomposition with partial pivoting and
643triangular system solves through forward and back substitution. The library
644also provides threshold-based ILU factorization preconditioners.")
645 (license license:bsd-3)))
f8ed036a 646
a54aefea
EB
647(define-public superlu-dist
648 (package
649 (name "superlu-dist")
650 (version "3.3")
651 (source
652 (origin
653 (method url-fetch)
654 (uri (string-append "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/"
655 "superlu_dist_" version ".tar.gz"))
656 (sha256
657 (base32 "1hnak09yxxp026blq8zhrl7685yip16svwngh1wysqxf8z48vzfj"))
658 (patches (list (search-patch "superlu-dist-scotchmetis.patch")))))
659 (build-system gnu-build-system)
660 (native-inputs
661 `(("tcsh" ,tcsh)))
662 (inputs
663 `(("gfortran" ,gfortran-4.8)))
664 (propagated-inputs
665 `(("openmpi" ,openmpi) ;headers include MPI heades
666 ("lapack" ,lapack) ;required to link with output library
667 ("pt-scotch" ,pt-scotch))) ;same
668 (arguments
669 `(#:parallel-build? #f ;race conditions using ar
670 #:phases
671 (alist-replace
672 'configure
673 (lambda* (#:key inputs outputs #:allow-other-keys)
674 (call-with-output-file "make.inc"
675 (lambda (port)
676 (format port "
677PLAT =
678DSuperLUroot = ~a
679DSUPERLULIB = ~a/lib/libsuperlu_dist.a
680BLASDEF = -DUSE_VENDOR_BLAS
681BLASLIB = -L~a/lib -lblas
682PARMETISLIB = -L~a/lib \
683 -lptscotchparmetis -lptscotch -lptscotcherr -lptscotcherrexit \
684 -lscotch -lscotcherr -lscotcherrexit
685METISLIB = -L~:*~a/lib \
686 -lscotchmetis -lscotch -lscotcherr -lscotcherrexit
687LIBS = $(DSUPERLULIB) $(PARMETISLIB) $(METISLIB) $(BLASLIB)
688ARCH = ar
689ARCHFLAGS = cr
690RANLIB = ranlib
691CC = mpicc
692PIC = -fPIC
693CFLAGS = -O3 -g -DPRNTlevel=0 $(PIC)
694NOOPTS = -O0 -g $(PIC)
695FORTRAN = mpifort
696FFLAGS = -O2 -g $(PIC)
697LOADER = $(CC)
698CDEFS = -DAdd_"
699 (getcwd)
700 (assoc-ref outputs "out")
701 (assoc-ref inputs "lapack")
702 (assoc-ref inputs "pt-scotch")))))
703 (alist-cons-after
704 'unpack 'remove-broken-symlinks
705 (lambda _
706 (for-each delete-file
707 (find-files "MAKE_INC" "\\.#make\\..*")))
708 (alist-cons-before
709 'build 'create-install-directories
710 (lambda* (#:key outputs #:allow-other-keys)
711 (for-each
712 (lambda (dir)
713 (mkdir-p (string-append (assoc-ref outputs "out")
714 "/" dir)))
715 '("lib" "include")))
716 (alist-replace
717 'check
718 (lambda _
719 (with-directory-excursion "EXAMPLE"
720 (and
721 (zero? (system* "mpirun" "-n" "2"
722 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
723 (zero? (system* "mpirun" "-n" "2"
724 "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
725 (alist-replace
726 'install
727 (lambda* (#:key outputs #:allow-other-keys)
728 ;; Library is placed in lib during the build phase. Copy over
729 ;; headers to include.
730 (let* ((out (assoc-ref outputs "out"))
731 (incdir (string-append out "/include")))
732 (for-each (lambda (file)
733 (let ((base (basename file)))
734 (format #t "installing `~a' to `~a'~%"
735 base incdir)
736 (copy-file file
737 (string-append incdir "/" base))))
738 (find-files "SRC" ".*\\.h$"))))
739 %standard-phases)))))))
740 (home-page (package-home-page superlu))
741 (synopsis "Parallel supernodal direct solver")
742 (description
743 "SuperLU_DIST is a parallel extension to the serial SuperLU library.
744It is targeted for distributed memory parallel machines. SuperLU_DIST is
745implemented in ANSI C, and MPI for communications.")
746 (license license:bsd-3)))
747
f8ed036a
EB
748(define-public scotch
749 (package
750 (name "scotch")
751 (version "6.0.0")
752 (source
753 (origin
754 (method url-fetch)
755 (uri (string-append "https://gforge.inria.fr/frs/download.php/31831/"
756 "scotch_" version ".tar.gz"))
757 (sha256
758 (base32 "0yfqf9lk7chb3h42777x42x4adx0v3n0b41q0cdqrdmscp4iczp5"))
759 (patches (list (search-patch "scotch-test-threading.patch")))))
760 (build-system gnu-build-system)
761 (inputs
762 `(("zlib" ,zlib)
763 ("flex" ,flex)
764 ("bison" ,bison)))
765 (arguments
766 `(#:phases
767 (alist-cons-after
768 'unpack 'chdir-to-src
769 (lambda _ (chdir "src"))
770 (alist-replace
771 'configure
772 (lambda _
773 (call-with-output-file "Makefile.inc"
774 (lambda (port)
775 (format port "
776EXE =
777LIB = .a
778OBJ = .o
779MAKE = make
780AR = ar
781ARFLAGS = -ruv
782CCS = gcc
783CCP = mpicc
784CCD = gcc
785CPPFLAGS =~{ -D~a~}
786CFLAGS = -O2 -g $(CPPFLAGS)
787LDFLAGS = -lz -lm -lrt -lpthread
788CP = cp
789LEX = flex -Pscotchyy -olex.yy.c
790LN = ln
791MKDIR = mkdir
792MV = mv
793RANLIB = ranlib
794YACC = bison -pscotchyy -y -b y
795"
796 '("COMMON_FILE_COMPRESS_GZ"
797 "COMMON_PTHREAD"
798 "COMMON_RANDOM_FIXED_SEED"
799 ;; TODO: Define once our MPI supports
800 ;; MPI_THREAD_MULTIPLE
801 ;; "SCOTCH_PTHREAD"
802 ;; "SCOTCH_PTHREAD_NUMBER=2"
803 "restrict=__restrict")))))
804 (alist-replace
805 'install
806 (lambda* (#:key outputs #:allow-other-keys)
807 (let ((out (assoc-ref outputs "out")))
808 (mkdir out)
809 (zero? (system* "make"
810 (string-append "prefix=" out)
811 "install"))))
812 %standard-phases)))))
813 (home-page "http://www.labri.fr/perso/pelegrin/scotch/")
814 (synopsis "Programs and libraries for graph algorithms")
815 (description "SCOTCH is a set of programs and libraries which implement
816the static mapping and sparse matrix reordering algorithms developed within
817the SCOTCH project. Its purpose is to apply graph theory, with a divide and
818conquer approach, to scientific computing problems such as graph and mesh
819partitioning, static mapping, and sparse matrix ordering, in application
820domains ranging from structural mechanics to operating systems or
821bio-chemistry.")
822 ;; See LICENSE_en.txt
823 (license license:cecill-c)))
6acb4adb
EB
824
825(define-public pt-scotch
826 (package (inherit scotch)
827 (name "pt-scotch")
828 (propagated-inputs
829 `(("openmpi" ,openmpi))) ;Headers include MPI headers
830 (arguments
831 (substitute-keyword-arguments (package-arguments scotch)
832 ((#:phases scotch-phases)
833 `(alist-replace
834 'build
835 ;; TODO: Would like to add parallelism here
836 (lambda _
837 (and
838 (zero? (system* "make" "ptscotch"))
839 ;; Install the serial metis compatibility library
840 (zero? (system* "make" "-C" "libscotchmetis" "install"))))
841 (alist-replace
842 'check
843 (lambda _ (zero? (system* "make" "ptcheck")))
844 (alist-replace
845 'install
846 (lambda* (#:key outputs #:allow-other-keys)
847 (let ((out (assoc-ref outputs "out")))
848 (mkdir out)
849 (zero? (system* "make"
850 (string-append "prefix=" out)
851 "install"))))
852 ,scotch-phases))))))
853 (synopsis "Programs and libraries for graph algorithms (with MPI)")))
5698b8b8
JD
854
855(define-public gsegrafix
856 (package
857 (name "gsegrafix")
858 (version "1.0.6")
859 (source
860 (origin
861 (method url-fetch)
862 (uri (string-append "mirror://gnu/" name "/" name "-"
863 version ".tar.gz"))
864 (sha256
865 (base32
866 "1b13hvx063zv970y750bx41wpx6hwd5ngjhbdrna8w8yy5kmxcda"))))
867 (build-system gnu-build-system)
868 (arguments
869 `(#:configure-flags '("LDFLAGS=-lm")))
870 (inputs
871 `(("libgnomecanvas" ,libgnomecanvas)
872 ("libbonoboui" ,libbonoboui)
873 ("libgnomeui" ,libgnomeui)
874 ("libgnomeprintui" ,libgnomeprintui)
875 ("popt" ,popt)))
876 (native-inputs
877 `(("pkg-config" ,pkg-config)))
878 (home-page "http://www.gnu.org/software/gsegrafix/")
879 (synopsis "GNOME application to create scientific and engineering plots")
880 (description "GSEGrafix is an application which produces high-quality graphical
881plots for science and engineering. Plots are specified via simple ASCII
882parameter files and data files and are presented in an anti-aliased GNOME
883canvas. The program supports rectangular two-dimensional plots, histograms,
884polar-axis plots and three-dimensional plots. Plots can be printed or saved
885to BMP, JPEG or PNG image formats.")
886 (license license:gpl3+)))
8731e527
JD
887
888(define-public maxima
889 (package
890 (name "maxima")
df354a77 891 (version "5.34.1")
8731e527
JD
892 (source
893 (origin
894 (method url-fetch)
895 (uri (string-append "mirror://sourceforge/maxima/Maxima-source/"
896 version "-source/" name "-" version ".tar.gz"))
897 (sha256
898 (base32
df354a77 899 "1dw9vfzldpj7lv303xbw0wpyn6ra6i2yzwlrjbcx7j0jm5n43ji0"))))
8731e527 900 (build-system gnu-build-system)
df354a77
FB
901 (inputs
902 `(("gcl" ,gcl)
903 ("gnuplot" ,gnuplot) ;for plots
f36afe4d 904 ("tk" ,tk))) ;Tcl/Tk is used by 'xmaxima'
df354a77
FB
905 (native-inputs
906 `(("texinfo" ,texinfo)
907 ("perl" ,perl)))
8731e527 908 (arguments
df354a77
FB
909 `(#:configure-flags
910 (list "--enable-gcl"
911 (string-append "--with-posix-shell="
912 (assoc-ref %build-inputs "bash")
913 "/bin/sh")
914 (string-append "--with-wish="
915 (assoc-ref %build-inputs "tk")
916 "/bin/wish"
917 (let ((v ,(package-version tk)))
918 (string-take v (string-index-right v #\.)))))
df354a77
FB
919 ;; By default Maxima attempts to write temporary files to
920 ;; '/tmp/nix-build-maxima-5.34.1', which doesn't exist. Work around
921 ;; that.
922 #:make-flags (list "TMPDIR=/tmp")
df354a77 923 #:phases (alist-cons-before
8731e527 924 'check 'pre-check
df354a77 925 (lambda _
8731e527 926 (chmod "src/maxima" #o555))
f36afe4d
FB
927 ;; Make sure the doc and emacs files are found in the
928 ;; standard location. Also configure maxima to find gnuplot
929 ;; without having it on the PATH.
930 (alist-cons-after
931 'install 'post-install
932 (lambda* (#:key outputs inputs #:allow-other-keys)
933 (let* ((gnuplot (assoc-ref inputs "gnuplot"))
934 (out (assoc-ref outputs "out"))
935 (datadir (string-append out "/share/maxima/" ,version)))
936 (with-directory-excursion out
937 (mkdir-p "share/emacs")
938 (mkdir-p "share/doc")
939 (symlink
940 (string-append datadir "/emacs/")
941 (string-append out "/share/emacs/site-lisp"))
942 (symlink
943 (string-append datadir "/doc/")
944 (string-append out "/share/doc/maxima"))
945 (with-atomic-file-replacement
946 (string-append datadir "/share/maxima-init.lisp")
947 (lambda (in out)
948 (format out "~a ~s~a~%"
949 "(setf $gnuplot_command "
950 (string-append gnuplot "/bin/gnuplot") ")")
951 (dump-port in out))))))
952 %standard-phases))))
8731e527
JD
953 (home-page "http://maxima.sourceforge.net")
954 (synopsis "Numeric and symbolic expression manipulation")
955 (description "Maxima is a system for the manipulation of symbolic and
956numerical expressions. It yields high precision numeric results by using
957exact fractions, arbitrary precision integers, and variable precision floating
958point numbers")
959 ;; Some files are lgpl2.1+. Some are gpl2+. Some explicitly state gpl1+.
960 ;; Others simply say "GNU General Public License" without stating a
961 ;; version (which implicitly means gpl1+).
962 ;; At least one file (src/maxima.asd) says "version 2."
963 ;; GPLv2 only is therefore the smallest subset.
f36afe4d 964 (license license:gpl2)))
ec322be2 965
279663ef
RW
966(define-public muparser
967 (package
968 (name "muparser")
969 (version "2.2.5")
970 (source
971 (origin
972 (method svn-fetch)
973 (uri (svn-reference
974 (url "http://muparser.googlecode.com/svn/trunk/")
975 (revision 34)))
976 (sha256
977 (base32
978 "1d6bdbhx9zj3srwj3m7c9hvr18gnx1fx43h6d25my7q85gicpcwn"))))
979 (build-system gnu-build-system)
980 (arguments
981 `(#:configure-flags '("--enable-samples=no")
982 #:tests? #f)) ;no "check" target
983 (home-page "http://muparser.beltoforion.de/")
984 (synopsis "Fast parser library for mathematical expressions")
985 (description
986 "muParser is an extensible high performance math parser library. It is
987based on transforming an expression into a bytecode and precalculating
988constant parts of it.")
989 (license license:expat)))
990
e1605e36
RW
991(define-public openlibm
992 (package
993 (name "openlibm")
994 (version "0.4.1")
995 (source
996 (origin
997 (method url-fetch)
998 (uri (string-append "https://github.com/JuliaLang/openlibm/archive/v"
999 version ".tar.gz"))
1000 (file-name (string-append name "-" version ".tar.gz"))
1001 (sha256
1002 (base32
1003 "0cwqqqlblj3kzp9aq1wnpfs1fl0qd1wp1xzm5shb09w06i4rh9nn"))))
1004 (build-system gnu-build-system)
1005 (arguments
1006 `(#:make-flags
1007 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1008 #:phases
1009 ;; no configure script
1010 (alist-delete 'configure %standard-phases)
1011 #:tests? #f)) ;the tests are part of the default target
1012 (home-page "http://openlibm.org/")
1013 (synopsis "Portable C mathematical library (libm)")
1014 (description
1015 "OpenLibm is an effort to have a high quality, portable, standalone C
1016mathematical library (libm). It can be used standalone in applications and
1017programming language implementations. The project was born out of a need to
1018have a good libm for the Julia programming langage that worked consistently
1019across compilers and operating systems, and in 32-bit and 64-bit
1020environments.")
1021 ;; See LICENSE.md for details.
1022 (license (list license:expat
1023 license:isc
1024 license:bsd-2
1025 license:public-domain
1026 license:lgpl2.1+))))
1027
e62be58f
RW
1028(define-public openspecfun
1029 (package
1030 (name "openspecfun")
1031 (version "0.4")
1032 (source
1033 (origin
1034 (method url-fetch)
1035 (uri (string-append "https://github.com/JuliaLang/openspecfun/archive/v"
1036 version ".tar.gz"))
1037 (file-name (string-append name "-" version ".tar.gz"))
1038 (sha256
1039 (base32
1040 "0nsa3jjmlhcqkw5ba5ypbn3n0c8b6lc22zzlxnmxkxi9shhdx65z"))))
1041 (build-system gnu-build-system)
1042 (arguments
1043 '(#:tests? #f ;no "check" target
1044 #:make-flags
1045 (list (string-append "prefix=" (assoc-ref %outputs "out")))
1046 ;; no configure script
1047 #:phases (alist-delete 'configure %standard-phases)))
1048 (inputs
1049 `(("fortran" ,gfortran-4.8)))
1050 (home-page "https://github.com/JuliaLang/openspecfun")
1051 (synopsis "Collection of special mathematical functions")
1052 (description
1053 "Openspecfun provides AMOS and Faddeeva. AMOS (from Netlib) is a
1054portable package for Bessel Functions of a Complex Argument and Nonnegative
1055Order; it contains subroutines for computing Bessel functions and Airy
1056functions. Faddeeva allows computing the various error functions of arbitrary
1057complex arguments (Faddeeva function, error function, complementary error
1058function, scaled complementary error function, imaginary error function, and
1059Dawson function); given these, one can also easily compute Voigt functions,
1060Fresnel integrals, and similar related functions as well.")
1061 ;; Faddeeva is released under the Expat license; AMOS is included as
1062 ;; public domain software.
1063 (license (list license:expat license:public-domain))))
1064
ec322be2
FB
1065(define-public atlas
1066 (package
1067 (name "atlas")
1068 (version "3.10.2")
1069 (source (origin
1070 (method url-fetch)
1071 (uri (string-append "mirror://sourceforge/math-atlas/atlas"
1072 version ".tar.bz2"))
1073 (sha256
1074 (base32
1075 "0bqh4bdnjdyww4mcpg6kn0x7338mfqbdgysn97dzrwwb26di7ars"))))
1076 (build-system gnu-build-system)
1077 (home-page "http://math-atlas.sourceforge.net/")
1078 (inputs `(("gfortran" ,gfortran-4.8)
1079 ("lapack-tar" ,(package-source lapack))))
1080 (outputs '("out" "doc"))
01480b9e
FB
1081 ;; For the moment we drop support for MIPS at it fails to compile. See
1082 ;; https://lists.gnu.org/archive/html/guix-devel/2014-11/msg00516.html
1083 (supported-systems (delete "mips64el-linux" %supported-systems))
ec322be2
FB
1084 (arguments
1085 `(#:parallel-build? #f
1086 #:parallel-tests? #f
f15615b1
LC
1087
1088 ;; ATLAS tunes itself for the machine it is built on, as explained at
1089 ;; <http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00305.html>.
1090 ;; For this reason, we want users to build it locally instead of using
1091 ;; substitutes.
1092 #:substitutable? #f
1093
ec322be2
FB
1094 #:modules ((srfi srfi-26)
1095 (srfi srfi-1)
1096 (guix build gnu-build-system)
1097 (guix build utils))
40029cbe 1098 #:configure-flags
ec322be2
FB
1099 `(;; Generate position independent code suitable for dynamic libraries
1100 ;; and use WALL timer to get more accurate timing.
1101 "-Fa" "alg" "-fPIC" "-D" "c" "-DWALL"
1102 ;; Set word width.
1103 "-b"
1104 ,,(if (string-match "64" (%current-system))
1105 "64"
1106 "32")
1107 ;; Disable parallel build as it gives errors: atlas_pthread.h is
1108 ;; needed to compile C files before it is generated.
1109 "-Ss" "pmake" "make -j 1"
af89a667
FB
1110 ;; Probe is failing for MIPS. We therefore define the system
1111 ;; architecture explicitly by setting (-A) MACHINETYPE = 49
1112 ;; 'MIPSR1xK' and (-V) ISA = 1 'none'.
1113 ,,@(if (string-prefix? "mips" (%current-system))
1114 (list "-A" "49" "-V" "1")
1115 (list))
ec322be2
FB
1116 ;; Generate shared libraries.
1117 "--shared"
1118 ;; Build a full LAPACK library.
1119 ,(string-append "--with-netlib-lapack-tarfile="
1120 (assoc-ref %build-inputs "lapack-tar")))
1121 #:phases
1122 (alist-cons-after
1123 'install 'install-doc
1124 (lambda* (#:key outputs inputs #:allow-other-keys)
40029cbe 1125 (let ((doc (string-append (assoc-ref outputs "doc")
ec322be2
FB
1126 "/share/doc/atlas")))
1127 (mkdir-p doc)
40029cbe 1128 (fold (lambda (file previous)
ec322be2
FB
1129 (and previous (zero? (system* "cp" file doc))))
1130 #t (find-files "../ATLAS/doc" ".*"))))
1131 (alist-cons-after
1132 'check 'check-pt
1133 (lambda _ (zero? (system* "make" "ptcheck")))
1134 ;; Fix files required to run configure.
1135 (alist-cons-before
1136 'configure 'fix-/bin/sh
1137 (lambda _
1138 ;; Use `sh', not `/bin/sh'.
1139 (substitute* (find-files "." "Makefile|configure|SpewMakeInc\\.c")
1140 (("/bin/sh")
1141 "sh")))
1142 ;; Fix /bin/sh in generated make files.
1143 (alist-cons-after
1144 'configure 'fix-/bin/sh-in-generated-files
1145 (lambda _
1146 (substitute* (find-files "." "^[Mm]ake\\.inc.*")
1147 (("/bin/sh")
1148 "sh")))
1149 ;; ATLAS configure program does not accepts the default flags
1150 ;; passed by the 'gnu-build-system'.
1151 (alist-replace
1152 'configure
1153 (lambda* (#:key native-inputs inputs outputs
1154 (configure-flags '())
1155 #:allow-other-keys #:rest args)
1156 (let* ((prefix (assoc-ref outputs "out"))
1157 (bash (or (and=> (assoc-ref
1158 (or native-inputs inputs) "bash")
1159 (cut string-append <> "/bin/bash"))
1160 "/bin/sh"))
1161 (flags `(,(string-append "--prefix=" prefix)
1162 ,@configure-flags))
1163 (abs-srcdir (getcwd))
1164 (srcdir (string-append "../" (basename abs-srcdir))))
1165 (format #t "source directory: ~s (relative from build: ~s)~%"
1166 abs-srcdir srcdir)
1167 (mkdir "../build")
1168 (chdir "../build")
1169 (format #t "build directory: ~s~%" (getcwd))
1170 (format #t "configure flags: ~s~%" flags)
1171 (zero? (apply system* bash
1172 (string-append srcdir "/configure")
1173 flags))))
1174 %standard-phases)))))))
1175 (synopsis "Automatically Tuned Linear Algebra Software")
1176 (description
1177 "ATLAS is an automatically tuned linear algebra software library
1178providing C and Fortran77 interfaces to a portably efficient BLAS
1179implementation, as well as a few routines from LAPACK.
1180
f15615b1
LC
1181Optimization occurs at build time. For this reason, the library is built on
1182the machine where it is installed, without resorting to pre-built substitutes.
ec322be2 1183
f15615b1
LC
1184Before building the library, CPU throttling should be disabled. This can be
1185done in the BIOS, or, on GNU/Linux, with the following commands:
ec322be2
FB
1186
1187cpufreq-selector -g performance -c 0
1188...
1189cpufreq-selector -g performance -c N-1
1190
1191where N is the number of cores of your CPU. Failure to do so will result in a
1192library with poor performance.")
1193 (license license:bsd-3)))