gnu: Remove python2-pyaudio.
[jackhill/guix/guix.git] / gnu / packages / multiprecision.scm
index 8e89836..6c0d163 100644 (file)
@@ -2,11 +2,12 @@
 ;;; Copyright © 2012, 2013, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015, 2018 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
-;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2016, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2016, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
-;;; Copyright © 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,6 +30,7 @@
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages texinfo)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -37,7 +39,7 @@
 (define-public gmp
   (package
    (name "gmp")
-   (version "6.1.2")
+   (version "6.2.1")
    (source (origin
             (method url-fetch)
             (uri
                             version ".tar.xz"))
             (sha256
              (base32
-              "04hrwahdxyqdik559604r7wrj9ffklwvipgfxgj4ys4skbl6bdc7"))
+              "1wml97fdmpcynsbw9yl77rj29qibfp652d0w3222zlfx5j8jjj7x"))
             (patches (search-patches "gmp-faulty-test.patch"))))
    (build-system gnu-build-system)
-   (native-inputs `(("m4" ,m4)))
+   (native-inputs (list m4))
    (outputs '("out" "debug"))
-   (arguments `(#:parallel-tests? #f ; mpz/reuse fails otherwise
-                #:configure-flags
-                '(;; Build a "fat binary", with routines for several
-                  ;; sub-architectures.
-                  "--enable-fat"
-                  "--enable-cxx"
-                  ,@(cond ((target-mingw?)
-                           ;; Static and shared cannot be built in one go:
-                           ;; they produce different headers.  We need shared.
-                           `("--disable-static"
-                             "--enable-shared"))
-                          (else '())))))
+   (arguments
+    `(#:parallel-tests? #f ; mpz/reuse fails otherwise
+      #:configure-flags
+      '(;; Build a "fat binary", with routines for several
+        ;; sub-architectures.
+        "--enable-fat"
+        "--enable-cxx"
+        ,@(cond ((target-mingw?)
+                 ;; Static and shared cannot be built in one go:
+                 ;; they produce different headers.  We need shared.
+                 `("--disable-static"
+                   "--enable-shared"))
+                (else '())))
+      ;; Remove after core-updates merge.
+      ;; Workaround for gcc-7 transition breakage, -system and cross-build,
+      ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
+      ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
+      ,@(if (target-mingw?)
+            `(#:phases
+              (modify-phases %standard-phases
+                (add-before 'configure 'setenv
+                  (lambda _
+                    (let ((gcc (assoc-ref %build-inputs "cross-gcc"))
+                          (libc (assoc-ref %build-inputs "cross-libc")))
+                      (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                              (string-append gcc "/include/c++"
+                                             ":" gcc "/include"
+                                             ":" libc "/include"))
+                      (format #t "environment variable `CROSS_CPLUS_INCLUDE_PATH' set to `~a'\n"
+                              (getenv "CROSS_CPLUS_INCLUDE_PATH"))
+                      #t)))))
+            '())))
    (synopsis "Multiple-precision arithmetic library")
    (description
     "The @acronym{GMP, the GNU Multiple Precision Arithmetic} library performs
@@ -92,16 +114,16 @@ It is aimed at use in, for example, cryptography and computational algebra.")
 (define-public mpfr
   (package
    (name "mpfr")
-   (version "4.0.2")
+   (version "4.1.0")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/mpfr/mpfr-" version
                                 ".tar.xz"))
             (sha256 (base32
-                     "12m3amcavhpqygc499s3fzqlb8f2j2rr7fkqsm10xbjfc04fffqx"))))
+                     "0zwaanakrqjf84lfr5hfsdr7hncwv9wj0mchlr7cmxigfgqs760c"))))
    (build-system gnu-build-system)
    (outputs '("out" "debug"))
-   (propagated-inputs `(("gmp" ,gmp)))            ; <mpfr.h> refers to <gmp.h>
+   (propagated-inputs (list gmp))            ; <mpfr.h> refers to <gmp.h>
    (synopsis "C library for arbitrary-precision floating-point arithmetic")
    (description
     "GNU@tie{}@acronym{MPFR, Multiple Precision Floating-Point Reliably} is a C
@@ -113,40 +135,50 @@ correct rounding.")
 (define-public mpc
   (package
    (name "mpc")
-   (version "1.1.0")
+   (version "1.2.1")
    (source (origin
             (method url-fetch)
             (uri (string-append
                   "mirror://gnu/mpc/mpc-" version ".tar.gz"))
             (sha256
               (base32
-                "0biwnhjm3rx3hc0rfpvyniky4lpzsvdcwhmcn7f0h4iw2hwcb1b9"))))
+                "0n846hqfqvmsmim7qdlms0qr86f1hck19p12nq3g3z2x74n3sl0p"))))
    (build-system gnu-build-system)
    (outputs '("out" "debug"))
-   (propagated-inputs `(("gmp" ,gmp)              ; <mpc.h> refers to both
-                        ("mpfr" ,mpfr)))
+   (propagated-inputs (list gmp ; <mpc.h> refers to both
+                            mpfr))
    (synopsis "C library for arbitrary-precision complex arithmetic")
    (description
     "GNU@tie{}@acronym{MPC, Multiple Precision Complex library} is a C library
 for performing arithmetic on complex numbers.  It supports arbitrarily high
 precision and correctly rounds the results.")
    (license lgpl3+)
-   (home-page "http://multiprecision.org/mpc/")))
+   (home-page "http://www.multiprecision.org/mpc/")))
 
 (define-public mpfi
   (package
     (name "mpfi")
-    (version "1.5.3")
+    (version "1.5.4")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://gforge.inria.fr/frs/download.php"
-                           "/latestfile/181/" name "-" version ".tar.bz2"))
+                           "/latestfile/181/mpfi-" version ".tgz"))
        (sha256
-        (base32 "0bqr8yibl7jbrp0bw7xk1lm7nis7rv26jsz6y8ycvih8n9bx90r3"))))
+        (base32 "0mismr1ll3wp788dq2n22s5irm0dziy75byyfdwz22kjbmckhf9v"))))
     (build-system gnu-build-system)
-    (propagated-inputs `(("gmp" ,gmp)   ; <mpfi.h> refers to both
-                         ("mpfr" ,mpfr)))
+    (arguments
+     `(#:tests? #f                      ;tests are broken in this release
+       #:configure-flags '("--enable-static=no")))
+    (native-inputs
+     `(("automake" ,automake)
+       ("autoreconf" ,autoconf)
+       ("libtool" ,libtool)
+       ("texinfo" ,texinfo)))
+    (propagated-inputs
+     (list gmp ; <mpfi.h> refers to both
+           mpfr))
+    (home-page "https://gforge.inria.fr/projects/mpfi/")
     (synopsis "C library for arbitrary-precision interval arithmetic")
     (description
      "@acronym{MPFI, Multiple Precision Floating-point Interval} is a portable C
@@ -158,8 +190,7 @@ Floating-Point Reliably} libraries.
 The purpose of arbitrary-precision interval arithmetic is to get results that
 are both guaranteed, thanks to interval computation, and accurate, thanks to
 multiple-precision arithmetic.")
-    (license lgpl2.1+)
-    (home-page "https://perso.ens-lyon.fr/nathalie.revol/software.html")))
+    (license lgpl2.1+)))
 
 (define-public irram
   (package
@@ -173,8 +204,8 @@ multiple-precision arithmetic.")
        (sha256
         (base32 "1cdmvb4hsa161rfdjqyhd9sb3fcr43p3a6nsj7cb4kn9f94qmjpj"))))
     (build-system gnu-build-system)
-    (propagated-inputs `(("gmp" ,gmp)   ; <mpfi.h> refers to both
-                         ("mpfr" ,mpfr)))
+    (propagated-inputs (list gmp ; <mpfi.h> refers to both
+                             mpfr))
     (arguments
      `(#:parallel-build? #f))
     (synopsis "C++ package for real arithmetic based on the Real-RAM concept")
@@ -191,19 +222,20 @@ error.  Additionally, iRRAM uses the concept of multi-valued functions.")
 (define-public qd
   (package
     (name "qd")
-    (version "2.3.22")
+    (version "2.3.23")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://crd-legacy.lbl.gov/~dhbailey/mpdist/qd-"
                            version ".tar.gz"))
        (sha256
-        (base32 "1lq609rsp6zpg7zda75lyxzzk1fabzp4jn88j7xfk84mdgjgzh9h"))))
+        (base32 "09pfd77rmy370hy7qdqw84z21y9zpl3fcwzf93rhiv0kwhfg9smk"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("gfortran" ,gfortran)))
+     (list gfortran))
     (arguments
      `(#:configure-flags `("--disable-enable_fma" ;weird :/
+                           "--disable-static"
                            "--enable-shared"
                            ,,@(if (string-prefix? "aarch64"
                                                   (or (%current-target-system)
@@ -226,6 +258,29 @@ and (for Fortran-90 programs) read/write statements need to be changed.  PSLQ
 and numerical quadrature programs are included.")
     (license bsd-3)))
 
+(define-public cln
+  (package
+    (name "cln")
+    (version "1.3.6")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://www.ginac.de/CLN/cln-"
+                           version ".tar.bz2"))
+       (sha256
+        (base32 "0jlq9l4hphk7qqlgqj9ihjp4m3rwjbhk6q4v00lsbgbri07574pl"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags (list "--disable-static")))
+    (inputs
+     (list gmp))
+    (home-page "https://www.ginac.de/CLN/")
+    (synopsis "Library for arbitrary precision computations")
+    (description "CLN is a C++ library for efficient computations with all
+kinds of numbers in arbitrary precision.  It provides a rich set of number
+classes and elementary, logical and transcendental functions.")
+    (license gpl2+)))
+
 (define-public tomsfastmath
   (package
     (name "tomsfastmath")
@@ -241,7 +296,7 @@ and numerical quadrature programs are included.")
                 "0f0pmiaskh89sp0q933pafxb914shpaj5ad8sb5rzk1wv8d7mja7"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("libtool" ,libtool)))
+     (list libtool))
     (arguments
      `(#:make-flags (list "-f" "makefile.shared"
                           (string-append "LIBPATH=" %output "/lib")
@@ -290,10 +345,86 @@ ISO C.  It is a port of LibTomMath with optional support for inline assembler
 multiplies.")
     (license public-domain)))
 
+(define-public libtomcrypt
+  (package
+    (name "libtomcrypt")
+    (version "1.18.2")
+    (outputs '("out" "static"))
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/libtom/libtomcrypt"
+                            "/releases/download/v" version
+                            "/crypt-" version ".tar.xz"))
+        (sha256
+         (base32
+          "113vfrgapyv72lalhd3nkw7jnks8az0gcb5wqn9hj19nhcxlrbcn"))
+        (modules '((guix build utils)))
+        (snippet
+         '(begin
+            ;; Patch CVE-2019-17362
+            ;; https://github.com/libtom/libtomcrypt/commit/25c26a3b7a9ad8192ccc923e15cf62bf0108ef94
+            (substitute* "src/pk/asn1/der/utf8/der_decode_utf8_string.c"
+              (("z > 4") "z == 1 || z > 4"))
+            #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure) ; no configure
+         (add-after 'unpack 'prepare-build
+           (lambda _
+             ;; We want the shared library by default so force it to be the
+             ;; default makefile target.
+             (delete-file "makefile")
+             (symlink "makefile.shared" "makefile")
+             ;; We link to libtommath, so we need to add it to the pc file
+             (substitute* "libtomcrypt.pc.in"
+               (("-ltomcrypt") "-ltomcrypt -ltommath"))
+             #t))
+         (add-after 'build 'build-static
+           (lambda* (#:key make-flags #:allow-other-keys)
+             (apply invoke "make" "-f" "makefile.unix" make-flags)))
+         (replace 'check
+           (lambda* (#:key test-target make-flags #:allow-other-keys)
+             (apply invoke "make" "-f" "makefile.unix" test-target make-flags)
+             (invoke "./test")))
+         (add-after 'install 'install-static-library
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (static (assoc-ref outputs "static")))
+               (mkdir-p (string-append static "/lib"))
+               (mkdir-p (string-append static "/include"))
+               (rename-file (string-append out "/lib/libtomcrypt.a")
+                            (string-append static "/lib/libtomcrypt.a"))
+               (copy-recursively (string-append out "/include")
+                                 (string-append static "/include"))
+               #t))))
+       #:test-target "test"
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             "CFLAGS += -DLTM_DESC -DUSE_LTM"
+             (string-append "EXTRALIBS="
+                            (search-input-file %build-inputs
+                                               "/lib/libtommath.so"))
+             (string-append "CC=" ,(cc-for-target)))))
+    (native-inputs
+     (list libtool))
+    (inputs
+     (list libtommath))
+    (home-page "https://www.libtom.net/LibTomCrypt/")
+    (synopsis "Cryptographic toolkit")
+    (description "LibTomCrypt is a fairly comprehensive, modular and portable
+cryptographic toolkit that provides developers with a vast array of well known
+published block ciphers, one-way hash functions, chaining modes, pseudo-random
+number generators, public key cryptography and a plethora of other routines.")
+    (properties `((lint-hidden-cve . ("CVE-2019-17362"))))
+    (license unlicense)))
+
 (define-public libtommath
   (package
     (name "libtommath")
-    (version "1.1.0")
+    (version "1.2.0")
     (outputs '("out" "static"))
     (source
       (origin
@@ -302,8 +433,7 @@ multiplies.")
                             "download/v" version "/ltm-" version ".tar.xz"))
         (sha256
          (base32
-          "1bbyagqzfdbg37k1n08nsqzdf44z8zsnjjinqbsyj7rxg246qilh"))
-        (patches (search-patches "libtommath-fix-linkage.patch"))))
+          "1c8q1qy88cjhdjlk3g24mra94h34c1ldvkjz0n2988c0yvn5xixp"))))
     (build-system gnu-build-system)
     (arguments
      '(#:phases
@@ -311,10 +441,6 @@ multiplies.")
          (delete 'configure) ; no configure
          (add-after 'unpack 'prepare-build
            (lambda _
-             ;; Don't pull in coreutils.
-             (substitute* "makefile_include.mk"
-               (("arch") "uname -m"))
-
              ;; We want the shared library by default so force it to be the
              ;; default makefile target.
              (delete-file "makefile")
@@ -326,18 +452,19 @@ multiplies.")
                                          "/lib/libtommath.a"))
              #t))
          (replace 'check
-           (lambda* (#:key make-flags #:allow-other-keys)
-             (apply invoke "make" "test_standalone" make-flags)
+           (lambda* (#:key test-target make-flags #:allow-other-keys)
+             (apply invoke "make" test-target make-flags)
              (invoke "sh" "test")))
          (add-after 'install 'install-static-library
            (lambda* (#:key outputs #:allow-other-keys)
              (invoke "make" "-f" "makefile.unix" "install"
                      (string-append "PREFIX=" (assoc-ref outputs "static"))
                      (string-append "CC=" (which "gcc"))))))
+       #:test-target "test"
        #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
                           "CC=gcc")))
     (native-inputs
-     `(("libtool" ,libtool)))
+     (list libtool))
     (home-page "https://www.libtom.net/LibTomMath/")
     (synopsis "Portable number theoretic multiple-precision integer library")
     (description "LibTomMath is a portable number theoretic multiple-precision
@@ -346,9 +473,34 @@ simple to work with that provides fairly efficient routines that build out of
 the box without configuration.")
     (license unlicense)))
 
-(define-public libtommath-1.0
+(define-public libtommath-1.1
   (package
     (inherit libtommath)
+    (version "1.1.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/libtom/libtommath/releases/"
+                            "download/v" version "/ltm-" version ".tar.xz"))
+        (sha256
+         (base32
+          "1bbyagqzfdbg37k1n08nsqzdf44z8zsnjjinqbsyj7rxg246qilh"))
+        (patches (search-patches "libtommath-fix-linkage.patch"))))
+    (arguments
+      (substitute-keyword-arguments (package-arguments libtommath)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (add-after 'unpack 'patch-coreutils-call
+              (lambda _
+                ;; Don't pull in coreutils.
+                (substitute* "makefile_include.mk"
+                  (("arch") "uname -m"))
+                #t))))
+        ((#:test-target _) "test_standalone")))))
+
+(define-public libtommath-1.0
+  (package
+    (inherit libtommath-1.1)
     (version "1.0.1")
     (outputs '("out"))
     (source
@@ -360,7 +512,7 @@ the box without configuration.")
          (base32
           "0sbccdwbkfc680id2fi0x067j23biqcjqilwkk7y9339knrjy0s7"))))
     (arguments
-      (substitute-keyword-arguments (package-arguments libtommath)
+      (substitute-keyword-arguments (package-arguments libtommath-1.1)
         ((#:phases phases)
          `(modify-phases ,phases
             (delete 'install-static-library)))))))