Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
42e735df | 2 | ;;; Copyright © 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org> |
24aaf2f2 | 3 | ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> |
df131dba | 4 | ;;; Copyright © 2015, 2018 Andreas Enge <andreas@enge.fr> |
61bb3555 | 5 | ;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr> |
3e3364fc | 6 | ;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
abd402e3 | 7 | ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
cbc084e1 | 8 | ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org> |
1a753385 | 9 | ;;; Copyright © 2018, 2019 Efraim Flashner <efraim@flashner.co.il> |
c44899a2 | 10 | ;;; |
233e7676 | 11 | ;;; This file is part of GNU Guix. |
c44899a2 | 12 | ;;; |
233e7676 | 13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
c44899a2 LC |
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 | ;;; | |
233e7676 | 18 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
c44899a2 LC |
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 | |
233e7676 | 24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
c44899a2 | 25 | |
1ffa7090 | 26 | (define-module (gnu packages multiprecision) |
4a44e743 | 27 | #:use-module (guix licenses) |
59a43334 | 28 | #:use-module (gnu packages) |
7ed018e8 | 29 | #:use-module (gnu packages autotools) |
1ffa7090 | 30 | #:use-module (gnu packages m4) |
cbc084e1 | 31 | #:use-module (gnu packages gcc) |
c44899a2 | 32 | #:use-module (guix packages) |
87f5d366 | 33 | #:use-module (guix download) |
24aaf2f2 | 34 | #:use-module (guix utils) |
c44899a2 LC |
35 | #:use-module (guix build-system gnu)) |
36 | ||
37 | (define-public gmp | |
38 | (package | |
39 | (name "gmp") | |
89ccb1d8 | 40 | (version "6.1.2") |
c44899a2 | 41 | (source (origin |
87f5d366 | 42 | (method url-fetch) |
704197f4 | 43 | (uri |
93a6f552 AE |
44 | (string-append "mirror://gnu/gmp/gmp-" |
45 | version ".tar.xz")) | |
c44899a2 LC |
46 | (sha256 |
47 | (base32 | |
89ccb1d8 | 48 | "04hrwahdxyqdik559604r7wrj9ffklwvipgfxgj4ys4skbl6bdc7")) |
fc1adab1 | 49 | (patches (search-patches "gmp-faulty-test.patch")))) |
c44899a2 LC |
50 | (build-system gnu-build-system) |
51 | (native-inputs `(("m4" ,m4))) | |
9bf62d9b | 52 | (outputs '("out" "debug")) |
3e3364fc JN |
53 | (arguments |
54 | `(#:parallel-tests? #f ; mpz/reuse fails otherwise | |
55 | #:configure-flags | |
56 | '(;; Build a "fat binary", with routines for several | |
57 | ;; sub-architectures. | |
58 | "--enable-fat" | |
59 | "--enable-cxx" | |
60 | ,@(cond ((target-mingw?) | |
61 | ;; Static and shared cannot be built in one go: | |
62 | ;; they produce different headers. We need shared. | |
63 | `("--disable-static" | |
64 | "--enable-shared")) | |
65 | (else '()))) | |
66 | ;; Remove after core-updates merge. | |
67 | ;; Workaround for gcc-7 transition breakage, -system and cross-build, | |
68 | ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'. | |
69 | ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co. | |
70 | ,@(if (target-mingw?) | |
71 | `(#:phases | |
72 | (modify-phases %standard-phases | |
73 | (add-before 'configure 'setenv | |
74 | (lambda _ | |
75 | (let ((gcc (assoc-ref %build-inputs "cross-gcc")) | |
76 | (libc (assoc-ref %build-inputs "cross-libc"))) | |
77 | (setenv "CROSS_CPLUS_INCLUDE_PATH" | |
78 | (string-append gcc "/include/c++" | |
79 | ":" gcc "/include" | |
80 | ":" libc "/include")) | |
81 | (format #t "environment variable `CROSS_CPLUS_INCLUDE_PATH' set to `~a'\n" | |
82 | (getenv "CROSS_CPLUS_INCLUDE_PATH")) | |
83 | #t))))) | |
84 | '()))) | |
f50d2669 | 85 | (synopsis "Multiple-precision arithmetic library") |
c44899a2 | 86 | (description |
245fae90 TGR |
87 | "The @acronym{GMP, the GNU Multiple Precision Arithmetic} library performs |
88 | arbitrary-precision arithmetic on signed integers, rational numbers and floating | |
89 | point numbers. The precision is only limited by the available memory. | |
90 | The library is highly optimized, with a design focus on execution speed. | |
91 | It is aimed at use in, for example, cryptography and computational algebra.") | |
4a44e743 | 92 | (license lgpl3+) |
75213ad2 | 93 | (home-page "https://gmplib.org/"))) |
c44899a2 | 94 | |
8309c389 LC |
95 | (define-public gmp-6.0 |
96 | ;; We keep this one around to bootstrap GCC, to work around a compilation | |
97 | ;; issue on ARM. See | |
98 | ;; <https://gmplib.org/list-archives/gmp-bugs/2015-December/003848.html>. | |
99 | (package | |
100 | (inherit gmp) | |
101 | (version "6.0.0a") | |
102 | (source (origin | |
103 | (method url-fetch) | |
104 | (uri (string-append "mirror://gnu/gmp/gmp-" | |
105 | version ".tar.xz")) | |
106 | (sha256 | |
107 | (base32 | |
108 | "0r5pp27cy7ch3dg5v0rsny8bib1zfvrza6027g2mp5f6v8pd6mli")) | |
fc1adab1 AK |
109 | (patches (search-patches "gmp-arm-asm-nothumb.patch" |
110 | "gmp-faulty-test.patch")))))) | |
8309c389 | 111 | |
c44899a2 LC |
112 | (define-public mpfr |
113 | (package | |
114 | (name "mpfr") | |
e34ae707 | 115 | (version "4.0.2") |
c44899a2 | 116 | (source (origin |
87f5d366 | 117 | (method url-fetch) |
0db342a5 | 118 | (uri (string-append "mirror://gnu/mpfr/mpfr-" version |
c44899a2 LC |
119 | ".tar.xz")) |
120 | (sha256 (base32 | |
e34ae707 | 121 | "12m3amcavhpqygc499s3fzqlb8f2j2rr7fkqsm10xbjfc04fffqx")))) |
c44899a2 | 122 | (build-system gnu-build-system) |
9bf62d9b | 123 | (outputs '("out" "debug")) |
a6ef51e3 | 124 | (propagated-inputs `(("gmp" ,gmp))) ; <mpfr.h> refers to <gmp.h> |
5b7900d7 | 125 | (synopsis "C library for arbitrary-precision floating-point arithmetic") |
c44899a2 | 126 | (description |
932b6072 | 127 | "GNU@tie{}@acronym{MPFR, Multiple Precision Floating-Point Reliably} is a C |
5b7900d7 TGR |
128 | library for performing multiple-precision, floating-point computations with |
129 | correct rounding.") | |
4a44e743 | 130 | (license lgpl3+) |
617cf5de | 131 | (home-page "https://www.mpfr.org/"))) |
c44899a2 LC |
132 | |
133 | (define-public mpc | |
134 | (package | |
135 | (name "mpc") | |
e48859b2 | 136 | (version "1.1.0") |
c44899a2 | 137 | (source (origin |
87f5d366 | 138 | (method url-fetch) |
c44899a2 | 139 | (uri (string-append |
8e1cd713 | 140 | "mirror://gnu/mpc/mpc-" version ".tar.gz")) |
945562d4 AE |
141 | (sha256 |
142 | (base32 | |
e48859b2 | 143 | "0biwnhjm3rx3hc0rfpvyniky4lpzsvdcwhmcn7f0h4iw2hwcb1b9")))) |
c44899a2 | 144 | (build-system gnu-build-system) |
9bf62d9b | 145 | (outputs '("out" "debug")) |
a6ef51e3 LC |
146 | (propagated-inputs `(("gmp" ,gmp) ; <mpc.h> refers to both |
147 | ("mpfr" ,mpfr))) | |
246db471 | 148 | (synopsis "C library for arbitrary-precision complex arithmetic") |
c44899a2 | 149 | (description |
aaf80ba7 TGR |
150 | "GNU@tie{}@acronym{MPC, Multiple Precision Complex library} is a C library |
151 | for performing arithmetic on complex numbers. It supports arbitrarily high | |
246db471 | 152 | precision and correctly rounds the results.") |
4a44e743 | 153 | (license lgpl3+) |
cd5b85c3 | 154 | (home-page "http://www.multiprecision.org/mpc/"))) |
61bb3555 NG |
155 | |
156 | (define-public mpfi | |
157 | (package | |
158 | (name "mpfi") | |
f89cebb1 TGR |
159 | (version "1.5.3") |
160 | (source | |
161 | (origin | |
162 | (method url-fetch) | |
163 | (uri (string-append "https://gforge.inria.fr/frs/download.php" | |
164 | "/latestfile/181/" name "-" version ".tar.bz2")) | |
165 | (sha256 | |
166 | (base32 "0bqr8yibl7jbrp0bw7xk1lm7nis7rv26jsz6y8ycvih8n9bx90r3")))) | |
61bb3555 NG |
167 | (build-system gnu-build-system) |
168 | (propagated-inputs `(("gmp" ,gmp) ; <mpfi.h> refers to both | |
169 | ("mpfr" ,mpfr))) | |
24a87a14 TGR |
170 | (synopsis "C library for arbitrary-precision interval arithmetic") |
171 | (description | |
ded545d5 | 172 | "@acronym{MPFI, Multiple Precision Floating-point Interval} is a portable C |
24a87a14 | 173 | library for arbitrary-precision interval arithmetic, with intervals represented |
ded545d5 TGR |
174 | using MPFR reliable floating-point numbers. It's based on the @acronym{GMP, GNU |
175 | Multiple Precision Arithmetic} and GNU@tie{}@acronym{MPFR, Multiple Precision | |
176 | Floating-Point Reliably} libraries. | |
24a87a14 TGR |
177 | |
178 | The purpose of arbitrary-precision interval arithmetic is to get results that | |
179 | are both guaranteed, thanks to interval computation, and accurate, thanks to | |
180 | multiple-precision arithmetic.") | |
61bb3555 NG |
181 | (license lgpl2.1+) |
182 | (home-page "https://perso.ens-lyon.fr/nathalie.revol/software.html"))) | |
cbc084e1 | 183 | |
df131dba AE |
184 | (define-public irram |
185 | (package | |
186 | (name "irram") | |
187 | (version "2013_01") | |
188 | (source | |
189 | (origin | |
190 | (method url-fetch) | |
191 | (uri (string-append "http://irram.uni-trier.de/irram-files/iRRAM_" | |
192 | version ".tar.bz2")) | |
193 | (sha256 | |
194 | (base32 "1cdmvb4hsa161rfdjqyhd9sb3fcr43p3a6nsj7cb4kn9f94qmjpj")))) | |
195 | (build-system gnu-build-system) | |
196 | (propagated-inputs `(("gmp" ,gmp) ; <mpfi.h> refers to both | |
197 | ("mpfr" ,mpfr))) | |
198 | (arguments | |
199 | `(#:parallel-build? #f)) | |
200 | (synopsis "C++ package for real arithmetic based on the Real-RAM concept") | |
201 | (description | |
202 | "@dfn{iRRAM} is a C++ package for error-free real arithmetic based on | |
203 | the concept of a Real-RAM. Its capabilities range from ordinary arithmetic | |
204 | over trigonometric functions to linear algebra and differential | |
205 | equations. A program using iRRAM is coded in ordinary C++, but may use a | |
206 | special class that behaves like real numbers without any | |
207 | error. Additionally, iRRAM uses the concept of multi-valued functions.") | |
208 | (license lgpl2.0+) | |
209 | (home-page "http://irram.uni-trier.de/"))) | |
210 | ||
cbc084e1 EB |
211 | (define-public qd |
212 | (package | |
213 | (name "qd") | |
8eb2c565 | 214 | (version "2.3.22") |
f52e8347 TGR |
215 | (source |
216 | (origin | |
217 | (method url-fetch) | |
218 | (uri (string-append "https://crd-legacy.lbl.gov/~dhbailey/mpdist/qd-" | |
219 | version ".tar.gz")) | |
220 | (sha256 | |
221 | (base32 "1lq609rsp6zpg7zda75lyxzzk1fabzp4jn88j7xfk84mdgjgzh9h")))) | |
cbc084e1 EB |
222 | (build-system gnu-build-system) |
223 | (native-inputs | |
224 | `(("gfortran" ,gfortran))) | |
225 | (arguments | |
226 | `(#:configure-flags `("--disable-enable_fma" ;weird :/ | |
227 | "--enable-shared" | |
228 | ,,@(if (string-prefix? "aarch64" | |
229 | (or (%current-target-system) | |
230 | (%current-system))) | |
231 | ;; XXX: The qd_test test fails numerical | |
232 | ;; accuracy checks for 'dd_real::exp()' on | |
233 | ;; aarch64 with GCC 5.4 at -O2. Disabling | |
234 | ;; expensive optimizations lets it pass. | |
235 | '("CXXFLAGS=-O3 -fno-expensive-optimizations") | |
236 | '("CXXFLAGS=-O3"))))) | |
f52e8347 | 237 | (home-page "https://www.davidhbailey.com/dhbsoftware/") |
cbc084e1 EB |
238 | (synopsis "Double-double and quad-double library") |
239 | (description "This package supports both a double-double | |
240 | datatype (approx. 32 decimal digits) and a quad-double datatype (approx. 64 | |
241 | decimal digits). The computational library is written in C++. Both C++ and | |
242 | Fortran-90 high-level language interfaces are provided to permit one to | |
243 | convert an existing C++ or Fortran-90 program to use the library with only | |
244 | minor changes to the source code. In most cases only a few type statements | |
245 | and (for Fortran-90 programs) read/write statements need to be changed. PSLQ | |
246 | and numerical quadrature programs are included.") | |
247 | (license bsd-3))) | |
7ed018e8 EB |
248 | |
249 | (define-public tomsfastmath | |
250 | (package | |
251 | (name "tomsfastmath") | |
d0d207cd | 252 | (version "0.13.1") |
7ed018e8 EB |
253 | (synopsis "Large integer arithmetic library") |
254 | (source (origin | |
255 | (method url-fetch) | |
256 | (uri (string-append "https://github.com/libtom/tomsfastmath/" | |
257 | "releases/download/v" version "/" | |
d0d207cd | 258 | "tfm-" version ".tar.xz")) |
7ed018e8 EB |
259 | (sha256 |
260 | (base32 | |
d0d207cd | 261 | "0f0pmiaskh89sp0q933pafxb914shpaj5ad8sb5rzk1wv8d7mja7")))) |
7ed018e8 EB |
262 | (build-system gnu-build-system) |
263 | (native-inputs | |
264 | `(("libtool" ,libtool))) | |
265 | (arguments | |
266 | `(#:make-flags (list "-f" "makefile.shared" | |
267 | (string-append "LIBPATH=" %output "/lib") | |
268 | (string-append "INCPATH=" %output "/include") | |
269 | "GROUP=root" "USER=root" | |
270 | "CC=gcc") | |
271 | #:phases | |
272 | (modify-phases %standard-phases | |
d0d207cd | 273 | (delete 'configure) ; no configuration |
7ed018e8 EB |
274 | (replace 'check |
275 | (lambda* (#:key make-flags #:allow-other-keys) | |
20fe9728 RW |
276 | (apply invoke "make" |
277 | "stest" "test_standalone" | |
278 | make-flags) | |
279 | (invoke "./stest") | |
280 | (invoke "./test"))) | |
7ed018e8 EB |
281 | (add-before 'install 'install-nogroup |
282 | (lambda _ | |
d0d207cd | 283 | ;; Let permissions inherit from the current process. |
7ed018e8 EB |
284 | (substitute* "makefile.shared" |
285 | (("-g \\$\\(GROUP\\) -o \\$\\(USER\\)") "")) | |
286 | #t)) | |
287 | (add-after 'install 'install-doc | |
288 | (lambda* (#:key outputs #:allow-other-keys) | |
289 | (let ((docdir (string-append (assoc-ref outputs "out") | |
290 | "/share/doc/tomsfastmath"))) | |
291 | (install-file "doc/tfm.pdf" docdir) | |
292 | #t))) | |
293 | (add-after 'install 'install-pc | |
294 | (lambda* (#:key outputs #:allow-other-keys) | |
295 | (let* ((out (assoc-ref outputs "out")) | |
296 | (pc-dir (string-append out "/lib/pkgconfig"))) | |
297 | (call-with-output-file "tomsfastmath.pc" | |
298 | (lambda (port) | |
299 | (format port "~ | |
300 | Name: TomsFastMath | |
301 | Description: ~a | |
302 | Version: ~a | |
303 | Libs: -L~a/lib -ltfm~%" | |
304 | ,synopsis ,version out))) | |
305 | (install-file "tomsfastmath.pc" pc-dir) | |
306 | #t)))))) | |
abd402e3 | 307 | (home-page "https://www.libtom.net/TomsFastMath/") |
7ed018e8 EB |
308 | (description "TomsFastMath is a large integer library written in portable |
309 | ISO C. It is a port of LibTomMath with optional support for inline assembler | |
310 | multiplies.") | |
311 | (license public-domain))) | |
1a753385 EF |
312 | |
313 | (define-public libtommath | |
314 | (package | |
315 | (name "libtommath") | |
0201e34c | 316 | (version "1.2.0") |
1a753385 EF |
317 | (outputs '("out" "static")) |
318 | (source | |
319 | (origin | |
320 | (method url-fetch) | |
321 | (uri (string-append "https://github.com/libtom/libtommath/releases/" | |
322 | "download/v" version "/ltm-" version ".tar.xz")) | |
323 | (sha256 | |
324 | (base32 | |
0201e34c | 325 | "1c8q1qy88cjhdjlk3g24mra94h34c1ldvkjz0n2988c0yvn5xixp")))) |
1a753385 EF |
326 | (build-system gnu-build-system) |
327 | (arguments | |
328 | '(#:phases | |
329 | (modify-phases %standard-phases | |
330 | (delete 'configure) ; no configure | |
331 | (add-after 'unpack 'prepare-build | |
332 | (lambda _ | |
1a753385 EF |
333 | ;; We want the shared library by default so force it to be the |
334 | ;; default makefile target. | |
335 | (delete-file "makefile") | |
336 | (symlink "makefile.shared" "makefile") | |
337 | #t)) | |
338 | (add-after 'install 'remove-static-library | |
339 | (lambda* (#:key outputs #:allow-other-keys) | |
340 | (delete-file (string-append (assoc-ref outputs "out") | |
341 | "/lib/libtommath.a")) | |
342 | #t)) | |
343 | (replace 'check | |
0201e34c EF |
344 | (lambda* (#:key test-target make-flags #:allow-other-keys) |
345 | (apply invoke "make" test-target make-flags) | |
1a753385 EF |
346 | (invoke "sh" "test"))) |
347 | (add-after 'install 'install-static-library | |
348 | (lambda* (#:key outputs #:allow-other-keys) | |
349 | (invoke "make" "-f" "makefile.unix" "install" | |
350 | (string-append "PREFIX=" (assoc-ref outputs "static")) | |
351 | (string-append "CC=" (which "gcc")))))) | |
0201e34c | 352 | #:test-target "test" |
1a753385 EF |
353 | #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")) |
354 | "CC=gcc"))) | |
355 | (native-inputs | |
356 | `(("libtool" ,libtool))) | |
357 | (home-page "https://www.libtom.net/LibTomMath/") | |
358 | (synopsis "Portable number theoretic multiple-precision integer library") | |
359 | (description "LibTomMath is a portable number theoretic multiple-precision | |
360 | integer library written entirely in C. It's designed to provide an API that is | |
361 | simple to work with that provides fairly efficient routines that build out of | |
362 | the box without configuration.") | |
363 | (license unlicense))) | |
cf3f12f6 | 364 | |
0201e34c | 365 | (define-public libtommath-1.1 |
cf3f12f6 EF |
366 | (package |
367 | (inherit libtommath) | |
0201e34c EF |
368 | (version "1.1.0") |
369 | (source | |
370 | (origin | |
371 | (method url-fetch) | |
372 | (uri (string-append "https://github.com/libtom/libtommath/releases/" | |
373 | "download/v" version "/ltm-" version ".tar.xz")) | |
374 | (sha256 | |
375 | (base32 | |
376 | "1bbyagqzfdbg37k1n08nsqzdf44z8zsnjjinqbsyj7rxg246qilh")) | |
377 | (patches (search-patches "libtommath-fix-linkage.patch")))) | |
378 | (arguments | |
379 | (substitute-keyword-arguments (package-arguments libtommath) | |
380 | ((#:phases phases) | |
381 | `(modify-phases ,phases | |
382 | (add-after 'unpack 'patch-coreutils-call | |
383 | (lambda _ | |
384 | ;; Don't pull in coreutils. | |
385 | (substitute* "makefile_include.mk" | |
386 | (("arch") "uname -m")) | |
387 | #t)))) | |
388 | ((#:test-target _) "test_standalone"))))) | |
389 | ||
390 | (define-public libtommath-1.0 | |
391 | (package | |
392 | (inherit libtommath-1.1) | |
cf3f12f6 EF |
393 | (version "1.0.1") |
394 | (outputs '("out")) | |
395 | (source | |
396 | (origin | |
397 | (method url-fetch) | |
398 | (uri (string-append "https://github.com/libtom/libtommath/releases/" | |
399 | "download/v" version "/ltm-" version ".tar.xz")) | |
400 | (sha256 | |
401 | (base32 | |
402 | "0sbccdwbkfc680id2fi0x067j23biqcjqilwkk7y9339knrjy0s7")))) | |
403 | (arguments | |
0201e34c | 404 | (substitute-keyword-arguments (package-arguments libtommath-1.1) |
cf3f12f6 EF |
405 | ((#:phases phases) |
406 | `(modify-phases ,phases | |
407 | (delete 'install-static-library))))))) |