gnu: libhilbert: Remove package.
[jackhill/guix/guix.git] / gnu / packages / maths.scm
index 272a097..e37a9a1 100644 (file)
@@ -2,22 +2,24 @@
 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014, 2016, 2017 John Darrington <jmd@gnu.org>
-;;; Copyright © 2014, 2015, 2016 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2015, 2016, 2017 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2014 Mathieu Lirzin <mathieu.lirzin@openmailbox.org>
-;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015, 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2015 Fabian Harfert <fhmgufs@web.de>
 ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
-;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
+;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
 ;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
-;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
+;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
 ;;; Copyright © 2017 Paul Garlick <pgarlick@tourbillion-technology.com>
 ;;; Copyright © 2017 ng0 <contact.ng0@cryptolab.net>
 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
+;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
+;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -48,6 +50,7 @@
   #:use-module (guix build-system ocaml)
   #:use-module (guix build-system r)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -67,6 +70,7 @@
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages java)
   #:use-module (gnu packages less)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages logging)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xml)
-  #:use-module (gnu packages zip)
   #:use-module (srfi srfi-1))
 
 (define-public aris
@@ -148,14 +151,14 @@ interactive dialogs to guide them.")
 (define-public coda
   (package
     (name "coda")
-    (version "2.18")
+    (version "2.18.2")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://github.com/stcorp/coda/releases/download/"
                            version "/coda-" version ".tar.gz"))
        (sha256
-        (base32 "11asla1ap8vd73farqjlpb179sfiy0biydcwxjfcakrp9sf8v9bs"))
+        (base32 "01fnqcby9jijvf3jxr1fk4bny059lvvq5wbqm7ns60ilykfdnm6a"))
        (patches (search-patches "coda-use-system-libs.patch"))
        (modules '((guix build utils)))
        (snippet
@@ -259,19 +262,18 @@ semiconductors.")
 (define-public gsl
   (package
     (name "gsl")
-    (version "2.3")
+    (version "2.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://gnu/gsl/gsl-"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1yxdzqjwmi2aid650fa9zyr8llw069x7lm489wx9nnfdi6vh09an"))
+                "16yfs5n444s03np1naj6yp1fsysd42kdscxzkg0k2yvfjixx0ijd"))
               (patches (search-patches "gsl-test-i686.patch"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:parallel-tests? #f
-       ;; Currently there are numerous tests that fail on "exotic"
+     `(;; Currently there are numerous tests that fail on "exotic"
        ;; architectures such as aarch64 and ppc64le.
        ,@(if (string-prefix? "aarch64-linux"
                              (or (%current-target-system) (%current-system)))
@@ -311,10 +313,13 @@ numbers.")
 the OCaml language.")
     (license license:gpl3+)))
 
+(define-public ocaml4.01-gsl
+  (package-with-ocaml4.01 ocaml-gsl))
+
 (define-public glpk
   (package
     (name "glpk")
-    (version "4.61")
+    (version "4.63")
     (source
      (origin
       (method url-fetch)
@@ -322,7 +327,7 @@ the OCaml language.")
                           version ".tar.gz"))
       (sha256
        (base32
-        "1adbvwiaqrv9pql9ry3lhn2vfsxnff2vh4fs477d90kpfx0xwrlq"))))
+        "1xp7nclmp8inp20968bvvfcwmz3mz03sbm0v3yjz8aqwlpqjfkci"))))
     (build-system gnu-build-system)
     (inputs
      `(("gmp" ,gmp)))
@@ -427,7 +432,7 @@ large scale eigenvalue problems.")
 (define-public lapack
   (package
     (name "lapack")
-    (version "3.5.0")
+    (version "3.7.1")
     (source
      (origin
       (method url-fetch)
@@ -435,21 +440,32 @@ large scale eigenvalue problems.")
                           version ".tgz"))
       (sha256
        (base32
-        "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
+        "1j51r7n5w4k7r3lrvy7710xrpkg40wf4rqnmngfz6ck9ypckzign"))))
     (build-system cmake-build-system)
     (home-page "http://www.netlib.org/lapack/")
     (inputs `(("fortran" ,gfortran)
               ("python" ,python-2)))
     (arguments
-     `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
-                           "-DLAPACKE=ON")
-       #:phases (alist-cons-before
-                 'check 'patch-python
-                 (lambda* (#:key inputs #:allow-other-keys)
-                   (let ((python (assoc-ref inputs "python")))
-                     (substitute* "lapack_testing.py"
-                       (("/usr/bin/env python") python))))
-                  %standard-phases)))
+     `(#:configure-flags (list
+                          ;; Install to PREFIX/lib (the default is
+                          ;; PREFIX/lib64).
+                          (string-append "-DCMAKE_INSTALL_LIBDIR="
+                                         (assoc-ref %outputs "out")
+                                         "/lib")
+
+                          "-DBUILD_SHARED_LIBS:BOOL=YES"
+                          "-DLAPACKE=ON"
+
+                          ;; Build the 'LAPACKE_clatms' functions.
+                          "-DLAPACKE_WITH_TMG=ON")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'patch-python
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((python (assoc-ref inputs "python")))
+               (substitute* "lapack_testing.py"
+                 (("/usr/bin/env python") python)))
+             #t)))))
     (synopsis "Library for numerical linear algebra")
     (description
      "LAPACK is a Fortran 90 library for solving the most commonly occurring
@@ -457,6 +473,19 @@ problems in numerical linear algebra.")
     (license (license:non-copyleft "file://LICENSE"
                                 "See LICENSE in the distribution."))))
 
+(define-public lapack-3.5
+  (package
+    (inherit lapack)
+    (version "3.5.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://www.netlib.org/lapack/lapack-"
+                           version ".tgz"))
+       (sha256
+        (base32
+         "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))))
+
 (define-public scalapack
   (package
     (name "scalapack")
@@ -489,7 +518,7 @@ singular value problems.")
 (define-public gnuplot
   (package
     (name "gnuplot")
-    (version "5.0.5")
+    (version "5.0.6")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/gnuplot/gnuplot/"
@@ -497,15 +526,16 @@ singular value problems.")
                                   version ".tar.gz"))
        (sha256
         (base32
-         "0lr065qdlgss8lmy31l7hkmnk9fp4lvqq9qgb1f1209f36zy1wr5"))))
+         "0q5lr6nala3ln6f3yp6g17ziymb9r9gx9zylnw1y3hjmwl9lggjv"))))
     (build-system gnu-build-system)
     (inputs `(("readline" ,readline)
               ("cairo" ,cairo)
               ("pango" ,pango)
               ("gd" ,gd)
               ("lua" ,lua)))
-    (native-inputs `(("pkg-config" ,pkg-config)
-                     ("texlive" ,texlive-minimal)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("texlive" ,texlive-tiny)))
     (home-page "http://www.gnuplot.info")
     (synopsis "Command-line driven graphing utility")
     (description "Gnuplot is a portable command-line driven graphing
@@ -547,18 +577,17 @@ computations.")
 (define-public hdf4
   (package
     (name "hdf4")
-    (version "4.2.12")
+    (version "4.2.13")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://support.hdfgroup.org/ftp/HDF/releases/HDF"
                            version "/src/hdf-" version ".tar.bz2"))
        (sha256
-        (base32 "020jh563sjyxsgml8l809d2i1d4ms9shivwj3gbm7n0ilxbll8id"))
+        (base32 "1wz0586zh91pqb95wvr0pbh71a8rz358fdj6n2ksp85x2cis9lsm"))
        (patches (search-patches "hdf4-architectures.patch"
                                 "hdf4-reproducibility.patch"
                                 "hdf4-shared-fortran.patch"))))
-
     (build-system gnu-build-system)
     (native-inputs
      `(("gfortran" ,gfortran)
@@ -572,6 +601,14 @@ computations.")
        #:configure-flags '("--enable-shared")
        #:phases
        (modify-phases %standard-phases
+         ;; This is inspired by two of Debian's patches.
+         (add-before 'configure 'add-more-aarch64-support
+           (lambda _
+             (substitute* '("mfhdf/ncgen/ncgen.l"
+                            "mfhdf/ncgen/ncgenyy.c"
+                            "mfhdf/libsrc/netcdf.h.in")
+               (("AIX5L64") "__aarch64__"))
+             #t))
          (add-before 'configure 'patchbuild
            (lambda _
              (substitute*
@@ -583,7 +620,19 @@ computations.")
 -R\\$\\(abs_top_builddir\\)/mfhdf/xdr/\\.libs") "")
                (("@HDF_BUILD_SHARED_TRUE@AM_LDFLAGS = \
 -R\\$\\(abs_top_builddir\\)/mfhdf/libsrc/\\.libs \
--R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") "")))))))
+-R\\$\\(abs_top_builddir\\)/hdf/src/\\.libs \\$\\(XDR_ADD\\)") ""))
+             #t))
+         (add-after 'configure 'patch-settings
+           (lambda _
+             ;; libhdf4.settings contains the full path of the
+             ;; compilers used, and its contents are included in
+             ;; .so-files.  We truncate the hashes to avoid
+             ;; unnecessary store references to those compilers:
+             (substitute* "libhdf4.settings"
+               (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
+                (string-append prefix (string-take hash 10) "...")))
+             #t))
+         )))
     (home-page "https://www.hdfgroup.org/products/hdf4/")
     (synopsis
      "Library and multi-object file format for storing and managing data")
@@ -607,12 +656,13 @@ incompatible with HDF5.")
 (define-public hdf5
   (package
     (name "hdf5")
-    (version "1.8.18")
+    (version "1.8.19")
     (source
      (origin
       (method url-fetch)
-      (uri (list (string-append "http://www.hdfgroup.org/ftp/HDF5/releases/"
-                                "hdf5-" version "/src/hdf5-"
+      (uri (list (string-append "https://support.hdfgroup.org/ftp/HDF5/releases/"
+                                "hdf5-" (version-major+minor version)
+                                "/hdf5-" version "/src/hdf5-"
                                 version ".tar.bz2")
                  (string-append "https://support.hdfgroup.org/ftp/HDF5/"
                                 "current"
@@ -620,21 +670,45 @@ incompatible with HDF5.")
                                        (take (string-split version #\.) 2))
                                 "/src/hdf5-" version ".tar.bz2")))
       (sha256
-       (base32 "13542vrnl1p35n8vbq0wzk40vddmm33q5nh04j98c7r1yjnxxih1"))
+       (base32 "0f3jfbqpaaq21ighi40qzs52nb52kc2d2yjk541rjmsx20b3ih2r"))
       (patches (list (search-patch "hdf5-config-date.patch")))))
     (build-system gnu-build-system)
     (inputs
      `(("zlib" ,zlib)))
+    (native-inputs
+     `(("gfortran" ,gfortran)))
+    (outputs '("out"       ; core library
+               "fortran")) ; fortran interface
     (arguments
      `(;; Some of the users, notably Flann, need the C++ interface.
-       #:configure-flags '("--enable-cxx")
+       #:configure-flags '("--enable-cxx"
+                           "--enable-fortran"
+                           "--enable-fortran2003")
 
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'patch-configure
-           (lambda _
+           (lambda* (#:key outputs #:allow-other-keys)
              (substitute* "configure"
                (("/bin/mv") "mv"))
+             (substitute* "fortran/src/Makefile.in"
+               (("libhdf5_fortran_la_LDFLAGS =")
+                (string-append "libhdf5_fortran_la_LDFLAGS = -Wl-rpath="
+                               (assoc-ref outputs "fortran") "/lib")))
+             (substitute* "hl/fortran/src/Makefile.in"
+               (("libhdf5hl_fortran_la_LDFLAGS =")
+                (string-append "libhdf5hl_fortran_la_LDFLAGS = -Wl,-rpath="
+                               (assoc-ref outputs "fortran") "/lib")))
+             #t))
+         (add-after 'configure 'patch-settings
+           (lambda _
+             ;; libhdf5.settings contains the full path of the
+             ;; compilers used, and its contents are included in
+             ;; libhdf5.so.  We truncate the hashes to avoid
+             ;; unnecessary store references to those compilers:
+             (substitute* "src/libhdf5.settings"
+              (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
+               (string-append prefix (string-take hash 10) "...")))
              #t))
          (add-after 'install 'patch-references
            (lambda* (#:key inputs outputs #:allow-other-keys)
@@ -643,7 +717,40 @@ incompatible with HDF5.")
                (substitute* (find-files bin "h5p?cc")
                  (("-lz" lib)
                   (string-append "-L" zlib "/lib " lib)))
-               #t))))))
+               #t)))
+         (add-after 'install 'split
+            (lambda* (#:key inputs outputs #:allow-other-keys)
+              ;; Move all fortran-related files
+              (let* ((out (assoc-ref outputs "out"))
+                     (bin (string-append out "/bin"))
+                     (lib (string-append out "/lib"))
+                     (inc (string-append out "/include"))
+                     (ex (string-append out "/share/hdf5_examples/fortran"))
+                     (fort (assoc-ref outputs "fortran"))
+                     (fbin (string-append fort "/bin"))
+                     (flib (string-append fort "/lib"))
+                     (finc (string-append fort "/include"))
+                     (fex (string-append fort "/share/hdf5_examples/fortran")))
+                (mkdir-p fbin)
+                (mkdir-p flib)
+                (mkdir-p finc)
+                (mkdir-p fex)
+                (rename-file (string-append bin "/h5fc")
+                             (string-append fbin "/h5fc"))
+                (for-each (lambda (file)
+                            (rename-file file
+                                         (string-append flib "/" (basename file))))
+                          (find-files lib ".*fortran.*"))
+                (for-each (lambda (file)
+                            (rename-file file
+                                         (string-append finc "/" (basename file))))
+                          (find-files inc ".*mod"))
+                (for-each (lambda (file)
+                            (rename-file file
+                                         (string-append fex "/" (basename file))))
+                          (find-files ex ".*"))
+                (delete-file-recursively ex))
+              #t)))))
     (home-page "http://www.hdfgroup.org")
     (synopsis "Management suite for extremely large and complex data")
     (description "HDF5 is a suite that makes possible the management of
@@ -651,6 +758,124 @@ extremely large and complex data collections.")
     (license (license:x11-style
               "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
 
+(define-public hdf-java
+  (package
+   (name "hdf-java")
+   (version "3.3.2")
+   (source
+    (origin
+      (method url-fetch)
+      (uri (string-append
+            "http://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfjni-"
+            version "/src/CMake-hdfjava-" version ".tar.gz"))
+      (sha256
+       (base32 "0m1gp2aspcblqzmpqbdpfp6giskws85ds6p5gz8sx7asyp7wznpr"))
+      (modules '((guix build utils)))
+      (snippet ; Make sure we don't use the bundled sources and binaries.
+       `(begin
+          (for-each delete-file
+                    (list "SZip.tar.gz" "ZLib.tar.gz" "JPEG8d.tar.gz"
+                          "HDF4.tar.gz" "HDF5.tar.gz"))
+          (delete-file-recursively ,(string-append "hdfjava-" version "/lib"))))))
+   (build-system gnu-build-system)
+   (native-inputs
+    `(("jdk" ,icedtea "jdk")
+      ("automake" ,automake) ; For up to date 'config.guess' and 'config.sub'.
+      ;; For tests:
+      ("hamcrest-core" ,java-hamcrest-core)
+      ("junit" ,java-junit)
+      ("slf4j-simple" ,java-slf4j-simple)))
+   (inputs
+    `(("hdf4" ,hdf4)
+      ("hdf5" ,hdf5)
+      ("zlib" ,zlib)
+      ("libjpeg" ,libjpeg)
+      ("slf4j-api" ,java-slf4j-api)))
+   (arguments
+    `(#:configure-flags
+      (list (string-append "--target=" ,(or (%current-target-system) (%current-system)))
+            (string-append "--with-jdk=" (assoc-ref %build-inputs "jdk") "/include,"
+                           (assoc-ref %build-inputs "jdk") "/lib" )
+            (string-append "--with-hdf4=" (assoc-ref %build-inputs "hdf4") "/lib")
+            (string-append "--with-hdf5=" (assoc-ref %build-inputs "hdf5") "/lib"))
+
+      #:make-flags
+      (list (string-append "HDFLIB=" (assoc-ref %build-inputs "hdf4") "/lib")
+            (string-append "HDF5LIB=" (assoc-ref %build-inputs "hdf5") "/lib")
+            (string-append "ZLIB=" (assoc-ref %build-inputs "zlib") "/lib/libz.so")
+            (string-append "JPEGLIB="
+                           (assoc-ref %build-inputs "libjpeg") "/lib/libjpeg.so")
+            "LLEXT=so")
+
+      #:phases
+      (modify-phases %standard-phases
+        (add-before 'configure 'chdir-to-source
+          (lambda _ (chdir ,(string-append "hdfjava-" version))))
+        (add-before 'configure 'patch-build
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (substitute* "configure"
+              (("COPT=\"") "COPT=\"-O2 ") ; CFLAGS is ignored in Makefiles
+              (("/bin/cat") (which "cat")))
+            ;; Set classpath for compilation
+            (substitute* '("hdf/hdf5lib/Makefile.in"
+                           "hdf/hdf5lib/exceptions/Makefile.in"
+                           "hdf/hdflib/Makefile.in")
+              (("\\$\\(TOP\\)/lib/slf4j-api-1\\.7\\.5\\.jar")
+               (string-append (assoc-ref inputs "slf4j-api")
+                              "/share/java/slf4j-api.jar")))
+            ;; Replace outdated config.sub and config.guess:
+            (with-directory-excursion "config"
+              (for-each (lambda (file)
+                          (copy-file
+                           (string-append (assoc-ref inputs "automake")
+                                          "/share/automake-1.15/" file) file))
+                        '("config.sub" "config.guess")))
+            (mkdir-p (string-append (assoc-ref outputs "out")))
+            ;; Set classpath for tests
+            (let* ((build-dir (getcwd))
+                   (lib (string-append build-dir "/lib"))
+                   (jhdf (string-append lib "/jhdf.jar"))
+                   (jhdf5 (string-append lib "/jhdf5.jar"))
+                   (testjars
+                    (map (lambda (i)
+                           (string-append (assoc-ref inputs i)
+                                          "/share/java/" i ".jar"))
+                         '("junit" "hamcrest-core" "slf4j-api" "slf4j-simple")))
+                   (class-path
+                    (string-join `("." ,build-dir ,jhdf ,jhdf5 ,@testjars) ":")))
+
+              (substitute* '("test/hdf5lib/Makefile.in"
+                             "test/hdf5lib/junit.sh.in"
+                             "examples/runExample.sh.in")
+                (("/usr/bin/test")
+                 (string-append (assoc-ref inputs "coreutils")
+                                "/bin/test"))
+                (("/usr/bin/uname")
+                 (string-append (assoc-ref inputs "coreutils")
+                                "/bin/uname"))
+                (("CLASSPATH=[^\n]*")
+                 (string-append "CLASSPATH=" class-path)))
+              (setenv "CLASSPATH" class-path))
+            #t))
+        (add-before 'check 'build-examples
+          (lambda _
+            (zero? (apply system* `("javac"
+                                    ,@(find-files "examples" ".*\\.java")))))))
+
+      #:parallel-build? #f
+
+      #:parallel-tests? #f ))
+   (home-page "https://support.hdfgroup.org/products/java")
+   (synopsis "Java interface for the HDF4 and HDF5 libraries")
+   (description "Java HDF Interface (JHI) and Java HDF5 Interface (JHI5) use
+the Java Native Interface to wrap the HDF4 and HDF5 libraries, which are
+implemented in C.")
+
+   ;; BSD-style license:
+   (license (license:x11-style
+             "https://support.hdfgroup.org/ftp/HDF5/hdf-java\
+/current/src/unpacked/COPYING"))))
+
 (define-public hdf-eos2
   (package
     (name "hdf-eos2")
@@ -785,8 +1010,12 @@ HDF5 file is encoded according to the HDF File Format Specification.")
     (arguments `(#:tests? #f)) ; Tests require googletest *sources*
     (inputs `(("lapack" ,lapack)
               ("fftw" ,fftw)))
-    (native-inputs `(("texlive-minimal" ,texlive-minimal)
-                     ("doxygen" ,doxygen)))
+    ;; FIXME: Even though the fonts are available dvips complains:
+    ;; "Font cmmi10 not found; characters will be left blank."
+    (native-inputs
+     `(("texlive" ,texlive-tiny)
+       ("ghostscript" ,ghostscript)
+       ("doxygen" ,doxygen)))
     (home-page "http://itpp.sourceforge.net")
     (synopsis "C++ library of maths, signal processing and communication classes")
     (description "IT++ is a C++ library of mathematical, signal processing and
@@ -823,6 +1052,29 @@ similar to MATLAB, GNU Octave or SciPy.")
        ("libjpeg" ,libjpeg)))
     (arguments
      `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
+
+       #:phases (modify-phases %standard-phases
+         (add-before 'configure 'fix-source-date
+           (lambda _
+             ;; As we ${SOURCE_DATE_EPOCH} evaluates to "1" in the build
+             ;; environment, `date -u -d ${SOURCE_DATE_EPOCH}` will evaluate
+             ;; to '1st hour of the current day', and therefore makes the
+             ;; package not reproducible.
+             (substitute* "./configure"
+               (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
+                "date --date='@0'"))
+             #t))
+         (add-after 'configure 'patch-settings
+           (lambda _
+             ;; libnetcdf.settings contains the full filename of the compilers
+             ;; used to build the library.  We truncate the hashes of those
+             ;; filenames to avoid unnecessary references to the corresponding
+             ;; store items.
+             (substitute* "libnetcdf.settings"
+               (("(/gnu/store/)([a-Z0-9]*)" all prefix hash)
+                (string-append prefix (string-take hash 10) "...")))
+             #t)))
+
        #:parallel-tests? #f))           ;various race conditions
     (home-page "http://www.unidata.ucar.edu/software/netcdf/")
     (synopsis "Library for scientific data")
@@ -850,6 +1102,30 @@ sharing of scientific data.")
                 "--disable-shared" "--with-pic"
                 ,flags))))))
 
+(define-public netcdf-fortran
+  (package
+    (name "netcdf-fortran")
+    (version "4.4.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-fortran-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "0xaxdcg1p83zmypwml3swsnr3ccn38inwldyr1l3wa4dbwbrblxj"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:parallel-tests? #f))
+    (inputs
+     `(("netcdf" ,netcdf)))
+    (native-inputs
+     `(("gfortran" ,gfortran)))
+    (synopsis "Fortran interface for the netCDF library")
+    (description (package-description netcdf))
+    (home-page (package-home-page netcdf))
+    (license (package-license netcdf))))
+
 (define-public nlopt
   (package
     (name "nlopt")
@@ -984,7 +1260,7 @@ can solve two kinds of problems:
     (license license:bsd-3)))
 
 ;; For a fully featured Octave, users  are strongly recommended also to install
-;; the following packages: texinfo, less, ghostscript, gnuplot.
+;; the following packages: less, ghostscript, gnuplot.
 (define-public octave
   (package
     (name "octave")
@@ -1016,6 +1292,7 @@ can solve two kinds of problems:
        ("glu" ,glu)
        ("zlib" ,zlib)
        ("curl" ,curl)
+       ("texinfo" ,texinfo)
        ("graphicsmagick" ,graphicsmagick)))
     (native-inputs
      `(("lzip" ,lzip)
@@ -1030,14 +1307,23 @@ can solve two kinds of problems:
        ;; will still run without them, albeit without the features they
        ;; provide.
        ("less" ,less)
-       ("texinfo" ,texinfo)
        ("ghostscript" ,ghostscript)
        ("gnuplot" ,gnuplot)))
     (arguments
      `(#:configure-flags
        (list (string-append "--with-shell="
                             (assoc-ref %build-inputs "bash")
-                            "/bin/sh"))))
+                            "/bin/sh"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'configure 'configure-makeinfo
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "libinterp/corefcn/help.cc"
+               (("Vmakeinfo_program = \"makeinfo\"")
+                (string-append "Vmakeinfo_program = \""
+                               (assoc-ref inputs "texinfo")
+                               "/bin/makeinfo\"")))
+             #t)))))
     (home-page "https://www.gnu.org/software/octave/")
     (synopsis "High-level language for numerical computation")
     (description "GNU Octave is a high-level interpreted language that is
@@ -1174,7 +1460,7 @@ September 2004}")
 (define-public petsc
   (package
     (name "petsc")
-    (version "3.7.2")
+    (version "3.8.0")
     (source
      (origin
       (method url-fetch)
@@ -1182,11 +1468,10 @@ September 2004}")
       (uri (string-append "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/"
                           "petsc-lite-" version ".tar.gz"))
       (sha256
-       (base32 "0jfrq6rd4zagw1iimz05m2w91k0jvz3qbik1lk8pqcxw3rvdqk5d"))))
+       (base32 "1lajbk3c29hnh83v6cbmm3a8wv6bdykh0p70kwrr4vrnizalk88s"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("python" ,python-2)
-       ("perl" ,perl)))
+     `(("python" ,python-2)))
     (inputs
      `(("gfortran" ,gfortran)
        ("lapack" ,lapack)
@@ -1205,6 +1490,10 @@ September 2004}")
                          (assoc-ref %build-inputs "superlu") "/include")
          ,(string-append "--with-superlu-lib="
                          (assoc-ref %build-inputs "superlu") "/lib/libsuperlu.a"))
+       #:make-flags
+       ;; Honor (parallel-job-count) for build.  Do not use --with-make-np,
+       ;; whose value is dumped to $out/lib/petsc/conf/petscvariables.
+       (list (format #f "MAKE_NP=~a" (parallel-job-count)))
        #:phases
        (modify-phases %standard-phases
         (replace 'configure
@@ -1219,13 +1508,17 @@ September 2004}")
               (format #t "configure flags: ~s~%" flags)
               (zero? (apply system* "./configure" flags)))))
         (add-after 'configure 'clean-local-references
-          (lambda* (#:key inputs outputs #:allow-other-keys)
+          (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (substitute* (find-files "." "^petsc(conf|machineinfo).h$")
                 ;; Prevent build directory from leaking into compiled code
                 (((getcwd)) out)
                 ;; Scrub timestamp for reproducibility
                 ((".*Libraries compiled on.*") ""))
+              (substitute* (find-files "." "petscvariables")
+                ;; Do not expose build machine characteristics, set to defaults.
+                (("MAKE_NP = [:digit:]+") "MAKE_NP = 2")
+                (("NPMAX = [:digit:]+") "NPMAX = 2"))
               #t)))
         (add-after 'install 'clean-install
           ;; Try to keep installed files from leaking build directory names.
@@ -1300,16 +1593,15 @@ scientific applications modeled by partial differential equations.")
 (define-public slepc
   (package
     (name "slepc")
-    (version "3.7.1")
+    (version "3.8.0")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "http://slepc.upv.es/download/download.php?"
-                           "filename=slepc-" version ".tar.gz"))
-       (file-name (string-append name "-" version ".tar.gz"))
+       (uri (string-append "http://slepc.upv.es/download/distrib/slepc-"
+                           version ".tar.gz"))
        (sha256
         (base32
-         "1hijlmrvxvfqslnx8yydzw5xqbsn1yy02g32w0hln1z3cgr1c0k7"))))
+         "0qyrsdndfdw2g0jmj9iskxj3j20zlkplhv26288s079dhm7cr365"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("python" ,python-2)))
@@ -1323,6 +1615,8 @@ scientific applications modeled by partial differential equations.")
        #:configure-flags
        `(,(string-append "--with-arpack-dir="
                          (assoc-ref %build-inputs "arpack") "/lib"))
+       #:make-flags                     ;honor (parallel-job-count)
+       `(,(format #f "MAKE_NP=~a" (parallel-job-count)))
        #:phases
        (modify-phases %standard-phases
          (replace 'configure
@@ -1584,12 +1878,12 @@ programming problems.")
 (define-public r-pracma
   (package
     (name "r-pracma")
-    (version "2.0.4")
+    (version "2.0.7")
     (source (origin
       (method url-fetch)
       (uri (cran-uri "pracma" version))
       (sha256
-        (base32 "1z3i90mkzwvp9di17caf4934z2xlb2imm3hwxllcrbwvmnmhrwyc"))))
+        (base32 "0hxa0rbbp54j0c05qj7vfwhqfdmiz5ax8vhqxd09g33x7c0hqbc5"))))
     (build-system r-build-system)
     (propagated-inputs
      `(("r-quadprog" ,r-quadprog)))
@@ -1715,12 +2009,12 @@ void mc64ad_ (int *a, int *b, int *c, int *d, int *e, double *f, int *g,
     (arguments
      `(#:parallel-build? #f             ;race conditions using ar
        #:phases
-       (alist-replace
-        'configure
-        (lambda* (#:key inputs outputs #:allow-other-keys)
-          (call-with-output-file "make.inc"
-            (lambda (port)
-              (format port "
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (call-with-output-file "make.inc"
+               (lambda (port)
+                 (format port "
 PLAT        =
 DSuperLUroot = ~a
 DSUPERLULIB  = ~a/lib/libsuperlu_dist.a
@@ -1743,47 +2037,46 @@ FORTRAN     = mpifort
 FFLAGS      = -O2 -g $(PIC)
 LOADER      = $(CC)
 CDEFS       = -DAdd_"
-                      (getcwd)
-                      (assoc-ref outputs "out")
-                      (assoc-ref inputs "lapack")
-                      (assoc-ref inputs "pt-scotch")))))
-        (alist-cons-after
-         'unpack 'remove-broken-symlinks
-         (lambda _
-           (for-each delete-file
-                     (find-files "MAKE_INC" "\\.#make\\..*")))
-         (alist-cons-before
-          'build 'create-install-directories
-          (lambda* (#:key outputs #:allow-other-keys)
-            (for-each
-             (lambda (dir)
-               (mkdir-p (string-append (assoc-ref outputs "out")
-                                       "/" dir)))
-             '("lib" "include")))
-          (alist-replace
-           'check
+                         (getcwd)
+                         (assoc-ref outputs "out")
+                         (assoc-ref inputs "lapack")
+                         (assoc-ref inputs "pt-scotch"))))
+             #t))
+         (add-after 'unpack 'remove-broken-symlinks
+           (lambda _
+             (for-each delete-file
+                       (find-files "MAKE_INC" "\\.#make\\..*"))
+             #t))
+         (add-before 'build 'create-install-directories
+           (lambda* (#:key outputs #:allow-other-keys)
+             (for-each
+              (lambda (dir)
+                (mkdir-p (string-append (assoc-ref outputs "out")
+                                        "/" dir)))
+              '("lib" "include"))
+             #t))
+         (replace 'check
            (lambda _
              (with-directory-excursion "EXAMPLE"
                (and
                 (zero? (system* "mpirun" "-n" "2"
                                 "./pddrive" "-r" "1" "-c" "2" "g20.rua"))
                 (zero? (system* "mpirun" "-n" "2"
-                                "./pzdrive" "-r" "1" "-c" "2" "cg20.cua")))))
-           (alist-replace
-            'install
-            (lambda* (#:key outputs #:allow-other-keys)
-              ;; Library is placed in lib during the build phase.  Copy over
-              ;; headers to include.
-              (let* ((out    (assoc-ref outputs "out"))
-                     (incdir (string-append out "/include")))
-                (for-each (lambda (file)
-                            (let ((base (basename file)))
-                              (format #t "installing `~a' to `~a'~%"
-                                      base incdir)
-                              (copy-file file
-                                         (string-append incdir "/" base))))
-                          (find-files "SRC" ".*\\.h$"))))
-            %standard-phases)))))))
+                                "./pzdrive" "-r" "1" "-c" "2" "cg20.cua"))))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Library is placed in lib during the build phase.  Copy over
+             ;; headers to include.
+             (let* ((out    (assoc-ref outputs "out"))
+                    (incdir (string-append out "/include")))
+               (for-each (lambda (file)
+                           (let ((base (basename file)))
+                             (format #t "installing `~a' to `~a'~%"
+                                     base incdir)
+                             (copy-file file
+                                        (string-append incdir "/" base))))
+                         (find-files "SRC" ".*\\.h$")))
+             #t)))))
     (home-page (package-home-page superlu))
     (synopsis "Parallel supernodal direct solver")
     (description
@@ -1808,7 +2101,7 @@ implemented in ANSI C, and MPI for communications.")
     (build-system gnu-build-system)
     (inputs
      `(("zlib" ,zlib)
-       ("flex" ,flex-2.6.1) ; A bug in flex prevents building with flex-2.6.3.
+       ("flex" ,flex)
        ("bison" ,bison)))
     (arguments
      `(#:phases
@@ -1846,6 +2139,7 @@ YACC = bison -pscotchyy -y -b y
                         '("COMMON_FILE_COMPRESS_GZ"
                           "COMMON_PTHREAD"
                           "COMMON_RANDOM_FIXED_SEED"
+                          "INTSIZE64"             ;use 'long' instead of 'int'
                           ;; Prevents symbolc clashes with libesmumps
                           "SCOTCH_RENAME"
                           ;; XXX: Causes invalid frees in superlu-dist tests
@@ -1885,6 +2179,55 @@ bio-chemistry.")
     ;; See LICENSE_en.txt
     (license license:cecill-c)))
 
+(define-public scotch32
+  ;; This is the 'INTSIZE32' variant, which uses 32-bit integers, as needed by
+  ;; some applications.
+  (package (inherit scotch)
+    (name "scotch32")
+    (arguments
+     (substitute-keyword-arguments (package-arguments scotch)
+       ((#:phases scotch-phases)
+        `(modify-phases ,scotch-phases
+          (replace
+           'configure
+           (lambda _
+             (call-with-output-file "Makefile.inc"
+               (lambda (port)
+                 (format port "
+EXE =
+LIB = .a
+OBJ = .o
+MAKE = make
+AR = ar
+ARFLAGS = -ruv
+CAT = cat
+CCS = gcc
+CCP = mpicc
+CCD = gcc
+CPPFLAGS =~{ -D~a~}
+CFLAGS = -O2 -g -fPIC $(CPPFLAGS)
+LDFLAGS = -lz -lm -lrt -lpthread
+CP = cp
+LEX = flex -Pscotchyy -olex.yy.c
+LN = ln
+MKDIR = mkdir
+MV = mv
+RANLIB = ranlib
+YACC = bison -pscotchyy -y -b y
+"
+                        '("COMMON_FILE_COMPRESS_GZ"
+                          "COMMON_PTHREAD"
+                          "COMMON_RANDOM_FIXED_SEED"
+                          "INTSIZE32"   ;use 32-bit integers.  See INSTALL.txt
+                          ;; Prevents symbolc clashes with libesmumps
+                          "SCOTCH_RENAME"
+                          ;; XXX: Causes invalid frees in superlu-dist tests
+                          ;; "SCOTCH_PTHREAD"
+                          ;; "SCOTCH_PTHREAD_NUMBER=2"
+                          "restrict=__restrict"))))))))))
+    (synopsis
+     "Programs and libraries for graph algorithms (32-bit integers)")))
+
 (define-public pt-scotch
   (package (inherit scotch)
     (name "pt-scotch")
@@ -1908,6 +2251,29 @@ bio-chemistry.")
             (lambda _ (zero? (system* "make" "ptcheck"))))))))
     (synopsis "Programs and libraries for graph algorithms (with MPI)")))
 
+(define-public pt-scotch32
+  (package (inherit scotch32)
+    (name "pt-scotch32")
+    (propagated-inputs
+     `(("openmpi" ,openmpi)))                     ;headers include MPI headers
+    (arguments
+     (substitute-keyword-arguments (package-arguments scotch32)
+       ((#:phases scotch32-phases)
+        `(modify-phases ,scotch32-phases
+           (replace 'build
+             (lambda _
+               (and
+                (zero? (system* "make"
+                                (format #f "-j~a" (parallel-job-count))
+                                "ptscotch" "ptesmumps"))
+                ;; Install the serial metis compatibility library
+                (zero? (system* "make" "-C" "libscotchmetis" "install")))))
+           (replace 'check
+             (lambda _
+               (zero? (system* "make" "ptcheck"))))))))
+    (synopsis
+     "Programs and libraries for graph algorithms (with MPI and 32-bit integers)")))
+
 (define-public metis
   (package
     (name "metis")
@@ -2020,7 +2386,7 @@ to BMP, JPEG or PNG image formats.")
 (define-public maxima
   (package
     (name "maxima")
-    (version "5.39.0")
+    (version "5.41.0")
     (source
      (origin
        (method url-fetch)
@@ -2028,7 +2394,7 @@ to BMP, JPEG or PNG image formats.")
                            version "-source/" name "-" version ".tar.gz"))
        (sha256
         (base32
-         "1cvignn5y6qzrby6qb885yc8zdcdqdr1d50vcvc3gapw2f0gk3zm"))
+         "0x0n81z0s4pl8nwpf7ivlsbvsdphm9w42250g7qdkizl0132by6s"))
        (patches (search-patches "maxima-defsystem-mkdir.patch"))))
     (build-system gnu-build-system)
     (inputs
@@ -2054,36 +2420,43 @@ to BMP, JPEG or PNG image formats.")
        ;; '/tmp/nix-build-maxima-*', which won't exist at run time.
        ;; Work around that.
        #:make-flags (list "TMPDIR=/tmp")
-       #:phases (alist-cons-before
-                 'check 'pre-check
-                 (lambda _
-                   (chmod "src/maxima" #o555))
-                 ;; Make sure the doc and emacs files are found in the
-                 ;; standard location.  Also configure maxima to find gnuplot
-                 ;; without having it on the PATH.
-                 (alist-cons-after
-                  'install 'post-install
-                  (lambda* (#:key outputs inputs #:allow-other-keys)
-                    (let* ((gnuplot (assoc-ref inputs "gnuplot"))
-                          (out (assoc-ref outputs "out"))
-                          (datadir (string-append out "/share/maxima/" ,version)))
-                      (with-directory-excursion out
-                        (mkdir-p "share/emacs")
-                        (mkdir-p "share/doc")
-                        (symlink
-                         (string-append datadir "/emacs/")
-                         (string-append out "/share/emacs/site-lisp"))
-                        (symlink
-                         (string-append datadir "/doc/")
-                         (string-append out "/share/doc/maxima"))
-                        (with-atomic-file-replacement
-                         (string-append datadir "/share/maxima-init.lisp")
-                         (lambda (in out)
-                           (format out "~a ~s~a~%"
-                                   "(setf $gnuplot_command "
-                                   (string-append gnuplot "/bin/gnuplot") ")")
-                           (dump-port in out))))))
-                  %standard-phases))))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'pre-check
+           (lambda _
+             (chmod "src/maxima" #o555)
+             #t))
+         ;; Make sure the doc and emacs files are found in the
+         ;; standard location.  Also configure maxima to find gnuplot
+         ;; without having it on the PATH.
+         (add-after 'install 'post-install
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let* ((gnuplot (assoc-ref inputs "gnuplot"))
+                    (out (assoc-ref outputs "out"))
+                    (datadir (string-append out "/share/maxima/" ,version))
+                    (binutils (string-append (assoc-ref inputs "binutils")
+                                             "/bin")))
+               (with-directory-excursion out
+                 (mkdir-p "share/emacs")
+                 (mkdir-p "share/doc")
+                 (symlink
+                  (string-append datadir "/emacs/")
+                  (string-append out "/share/emacs/site-lisp"))
+                 (symlink
+                  (string-append datadir "/doc/")
+                  (string-append out "/share/doc/maxima"))
+                 (with-atomic-file-replacement
+                  (string-append datadir "/share/maxima-init.lisp")
+                  (lambda (in out)
+                    (format out "~a ~s~a~%"
+                            "(setf $gnuplot_command "
+                            (string-append gnuplot "/bin/gnuplot") ")")
+                    (dump-port in out))))
+               ;; Ensure that Maxima will have access to the GNU binutils
+               ;; components at runtime.
+               (wrap-program (string-append out "/bin/maxima")
+                 `("PATH" prefix (,binutils))))
+             #t)))))
     (home-page "http://maxima.sourceforge.net")
     (synopsis "Numeric and symbolic expression manipulation")
     (description "Maxima is a system for the manipulation of symbolic and
@@ -2100,18 +2473,21 @@ point numbers.")
 (define-public wxmaxima
   (package
     (name "wxmaxima")
-    ;; Versions 16.12.0 to 16.12.2 have a bug which causes output lines to
-    ;; overlap. See <https://debbugs.gnu.org/25793>
-    (version "16.04.2")
+    (version "17.05.1")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/wxmaxima/wxMaxima/"
-                           version "/" name "-" version ".tar.gz"))
+       (uri (string-append "https://github.com/andrejv/" name "/archive"
+                           "/Version-" version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "1fpqzk1921isiqrpgpf433ldq41924qs9sy99fl1zn5661b2l73n"))))
+         "0dv0cy0cf46v0cbw32izscpkdmpxg1qhwq1f4cz46kkqd8k4yfbj"))))
     (build-system gnu-build-system)
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gettext" ,gettext-minimal)))
     (inputs
      `(("wxwidgets" ,wxwidgets)
        ("maxima" ,maxima)
@@ -2120,27 +2496,30 @@ point numbers.")
        ("gtk+" ,gtk+)
        ("shared-mime-info" ,shared-mime-info)))
     (arguments
-     `(#:phases (modify-phases %standard-phases
-                  (add-after
-                   'install 'wrap-program
-                   (lambda* (#:key inputs outputs #:allow-other-keys)
-                     (wrap-program (string-append (assoc-ref outputs "out")
-                                                  "/bin/wxmaxima")
-                       `("PATH" ":" prefix
-                         (,(string-append (assoc-ref inputs "maxima")
-                                          "/bin")))
-                       ;; For GtkFileChooserDialog.
-                       `("GSETTINGS_SCHEMA_DIR" =
-                         (,(string-append (assoc-ref inputs "gtk+")
-                                          "/share/glib-2.0/schemas")))
-                       `("XDG_DATA_DIRS" ":" prefix
-                         (;; Needed by gdk-pixbuf to know supported icon formats.
-                          ,(string-append
-                            (assoc-ref inputs "shared-mime-info") "/share")
-                          ;; The default icon theme of GTK+.
-                          ,(string-append
-                            (assoc-ref inputs "adwaita-icon-theme") "/share"))))
-                     #t)))))
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'autoconf
+           (lambda _
+             (zero? (system* "sh" "bootstrap"))))
+         (add-after 'install 'wrap-program
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (wrap-program (string-append (assoc-ref outputs "out")
+                                          "/bin/wxmaxima")
+               `("PATH" ":" prefix
+                 (,(string-append (assoc-ref inputs "maxima")
+                                  "/bin")))
+               ;; For GtkFileChooserDialog.
+               `("GSETTINGS_SCHEMA_DIR" =
+                 (,(string-append (assoc-ref inputs "gtk+")
+                                  "/share/glib-2.0/schemas")))
+               `("XDG_DATA_DIRS" ":" prefix
+                 (;; Needed by gdk-pixbuf to know supported icon formats.
+                  ,(string-append
+                    (assoc-ref inputs "shared-mime-info") "/share")
+                  ;; The default icon theme of GTK+.
+                  ,(string-append
+                    (assoc-ref inputs "adwaita-icon-theme") "/share"))))
+             #t)))))
     (home-page "https://andrejv.github.io/wxmaxima/")
     (synopsis "Graphical user interface for the Maxima computer algebra system")
     (description
@@ -2279,6 +2658,92 @@ parts of it.")
      "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
     (license license:bsd-3)))
 
+(define* (make-blis implementation #:optional substitutable?)
+  "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
+source tree for a list of implementations.)
+
+SUBSTITUTABLE? determines whether the package is made available as a
+substitute.
+
+Currently the specialization must be selected at configure-time, but work is
+underway to allow BLIS to select the right optimized kernels at run time:
+<https://github.com/flame/blis/issues/129>."
+  (package
+    (name (if (string=? implementation "reference")
+              "blis"
+              (string-append "blis-" implementation)))
+    (version "0.2.2")
+    (home-page "https://github.com/flame/blis")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference (url home-page) (commit version)))
+              (sha256
+               (base32
+                "1wr79a50nm4abhw8w3sn96nmwp5mrzifcigk7khw9qcgyyyqayfh"))
+              (file-name (git-file-name "blis" version))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+
+       #:substitutable? ,substitutable?
+
+       #:phases (modify-phases %standard-phases
+                  (replace 'configure
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      ;; This is a home-made 'configure' script.
+                      (let ((out (assoc-ref outputs "out")))
+                        (zero? (system* "./configure" "-p" out
+                                        "-d" "opt"
+                                        "--disable-static"
+                                        "--enable-shared"
+                                        "--enable-threading=openmp"
+
+                                        ,implementation)))))
+                  (add-before 'check 'show-test-output
+                    (lambda _
+                      ;; By default "make check" is silent.  Make it verbose.
+                      (system "tail -F output.testsuite &")
+                      #t)))))
+    (synopsis "High-performance basic linear algebra (BLAS) routines")
+    (description
+     "BLIS is a portable software framework for instantiating high-performance
+BLAS-like dense linear algebra libraries.  The framework was designed to
+isolate essential kernels of computation that, when optimized, immediately
+enable optimized implementations of most of its commonly used and
+computationally intensive operations.  While BLIS exports a new BLAS-like API,
+it also includes a BLAS compatibility layer which gives application developers
+access to BLIS implementations via traditional BLAS routine calls.")
+    (license license:bsd-3)))
+
+(define-public blis
+  ;; This is the "reference" implementation, which is the non-optimized but
+  ;; portable variant (no assembly).
+  (make-blis "reference" #t))
+
+(define ignorance blis)
+
+(define-syntax-rule (blis/x86_64 processor)
+  "Expand to a package specialized for PROCESSOR."
+  (package
+    (inherit (make-blis processor))
+    (supported-systems '("x86_64-linux"))))
+
+(define-public blis-sandybridge
+  ;; BLIS specialized for Sandy Bridge processors (launched 2011):
+  ;; <http://ark.intel.com/products/codename/29900/Sandy-Bridge>.
+  (blis/x86_64 "sandybridge"))
+
+(define-public blis-haswell
+  ;; BLIS specialized for Haswell processors (launched 2013):
+  ;; <http://ark.intel.com/products/codename/42174/Haswell>.
+  (blis/x86_64 "haswell"))
+
+(define-public blis-knl
+  ;; BLIS specialized for Knights Landing processor (launched 2016):
+  ;; <http://ark.intel.com/products/series/92650/Intel-Xeon-Phi-x200-Product-Family>.
+  (blis/x86_64 "knl"))
+
+
 (define-public openlibm
   (package
     (name "openlibm")
@@ -2298,7 +2763,7 @@ parts of it.")
        (list (string-append "prefix=" (assoc-ref %outputs "out")))
        #:phases
        ;; no configure script
-       (alist-delete 'configure %standard-phases)
+       (modify-phases %standard-phases (delete 'configure))
        #:tests? #f)) ;the tests are part of the default target
     (home-page "http://openlibm.org/")
     (synopsis "Portable C mathematical library (libm)")
@@ -2337,7 +2802,7 @@ environments.")
        #:make-flags
        (list (string-append "prefix=" (assoc-ref %outputs "out")))
        ;; no configure script
-       #:phases (alist-delete 'configure %standard-phases)))
+       #:phases (modify-phases %standard-phases (delete 'configure))))
     (inputs
      `(("fortran" ,gfortran)))
     (home-page "https://github.com/JuliaLang/openspecfun")
@@ -2358,7 +2823,7 @@ Fresnel integrals, and similar related functions as well.")
 (define-public suitesparse
   (package
     (name "suitesparse")
-    (version "4.4.3")
+    (version "4.5.5")
     (source
      (origin
        (method url-fetch)
@@ -2367,33 +2832,31 @@ Fresnel integrals, and similar related functions as well.")
              version ".tar.gz"))
        (sha256
         (base32
-         "100hdzr0mf4mzlwnqpmwpfw4pymgsf9n3g0ywb1yps2nk1zbkdy5"))))
+         "1dnr6pmjzc2qmbkmb4shigx1l74ilf6abn7svyd6brxgvph8vadr"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; Remove bundled metis source
+        '(delete-file-recursively "metis-5.1.0"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:parallel-build? #f ;cholmod build fails otherwise
-       #:tests? #f  ;no "check" target
+     '(#:tests? #f  ;no "check" target
        #:make-flags
        (list "CC=gcc"
              "BLAS=-lblas"
              "TBB=-ltbb"
-             "CHOLMOD_CONFIG=-DNPARTITION" ;required when METIS is not used
+             "MY_METIS_LIB=-lmetis"
              (string-append "INSTALL_LIB="
                             (assoc-ref %outputs "out") "/lib")
              (string-append "INSTALL_INCLUDE="
-                            (assoc-ref %outputs "out") "/include"))
+                            (assoc-ref %outputs "out") "/include")
+             "library")
        #:phases
-       (alist-cons-before
-        'install 'prepare-out
-        ;; README.txt states that the target directories must exist prior to
-        ;; running "make install".
-        (lambda _
-          (mkdir-p (string-append (assoc-ref %outputs "out") "/lib"))
-          (mkdir-p (string-append (assoc-ref %outputs "out") "/include")))
-        ;; no configure script
-        (alist-delete 'configure %standard-phases))))
+       (modify-phases %standard-phases
+         (delete 'configure))))         ;no configure script
     (inputs
      `(("tbb" ,tbb)
-       ("lapack" ,lapack)))
+       ("lapack" ,lapack)
+       ("metis" ,metis)))
     (home-page "http://faculty.cse.tamu.edu/davis/suitesparse.html")
     (synopsis "Suite of sparse matrix software")
     (description
@@ -2629,7 +3092,7 @@ revised simplex and the branch-and-bound methods.")
 (define-public dealii
   (package
     (name "dealii")
-    (version "8.4.1")
+    (version "8.5.0")
     (source
      (origin
        (method url-fetch)
@@ -2637,7 +3100,7 @@ revised simplex and the branch-and-bound methods.")
                            "download/v" version "/dealii-" version ".tar.gz"))
        (sha256
         (base32
-         "1bdksvvyp1rj37df1ndh8j3x9nzpc3sazw8nd0hzvnlw0qnyk800"))
+         "0yfpy4zh8j7hmqakw17zdlmvfdcmhwgs66wcb716plc4y7v3z4g6"))
        (modules '((guix build utils)))
        (snippet
         ;; Remove bundled sources: UMFPACK, TBB, muParser, and boost
@@ -2656,21 +3119,10 @@ revised simplex and the branch-and-bound methods.")
        ("suitesparse" ,suitesparse)))   ;for UMFPACK
     (arguments
      `(#:build-type "DebugRelease" ;only supports Release, Debug, or DebugRelease
-       #:configure-flags '("-DCOMPAT_FILES=OFF") ;Follow new directory structure
-       #:phases (modify-phases %standard-phases
-                  (add-after
-                   'install 'hint-example-prefix
-                   ;; Set Cmake hints in examples so that they can find this
-                   ;; deal.II when configuring.
-                   (lambda* (#:key outputs #:allow-other-keys)
-                     (let* ((out (assoc-ref %outputs "out"))
-                            (exmpl (string-append out "/share/doc"
-                                                  "/dealii/examples")))
-                       (substitute* (find-files exmpl "CMakeLists.txt")
-                         (("([[:space:]]*HINTS.*)\n" _ line)
-                          (string-append line " $ENV{HOME}/.guix-profile "
-                                         out "\n")))
-                       #t))))))
+       #:configure-flags
+       ;; Work around a bug in libsuitesparseconfig linking
+       ;; see https://github.com/dealii/dealii/issues/4745
+       '("-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON")))
     (home-page "https://www.dealii.org")
     (synopsis "Finite element library")
     (description
@@ -2956,28 +3408,6 @@ structured and unstructured grid problems.")))
 supports compressed MAT files, as well as newer (version 7.3) MAT files.")
     (license license:bsd-2)))
 
-(define-public libhilbert
-  (package
-    (name "libhilbert")
-    (version "0.2-1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "http://web.cs.dal.ca/~chamilto/hilbert/"
-                           "libhilbert-" version ".tar.gz"))
-       (sha256
-        (base32
-         "0v48x8405dj95gjn2saja4bzhw86d6zl6d3dg8h7dzac2qr97s34"))))
-    (build-system gnu-build-system)
-    (home-page "http://web.cs.dal.ca/~chamilto/hilbert")
-    (synopsis "Hilbert indices for multidimensional data")
-    (description "The libhilbert library can efficiently calculate Hilbert
-curves and order-preserving representations of Hilbert curve indices that use
-the same amount of space as the original point representation.  This is useful
-when using the Gilbert curve as a space filling curve through a
-high-dimensional space where not all demensions have the same cardinality.")
-    (license license:lgpl2.1+)))
-
 (define-public vc
   (package
     (name "vc")
@@ -3010,6 +3440,8 @@ instruction sets.  Thus, an application written with Vc can be compiled for:
 @item NVIDIA GPUs / CUDA (in development)
 @end enumerate\n")
     (home-page "https://github.com/VcDevel/Vc")
+    ;; "No support_???.cpp file exists for this architecture."
+    (supported-systems '("x86_64-linux" "i686-linux"))
     (license license:bsd-3)))
 
 (define-public reducelcs
@@ -3104,3 +3536,92 @@ as equations, scalars, vectors, and matrices.")
     (home-page "https://www.gnu.org/software/jacal/")
     (license license:gpl3+)))
 
+(define-public z3
+  (package
+    (name "z3")
+    (version "4.5.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/Z3Prover/z3/archive/z3-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "032a5lvji2liwmc25jv52bdrhimqflvqbpg77ccaq1jykhiivbmf"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list "-DBUILD_PYTHON_BINDINGS=true"
+             "-DINSTALL_PYTHON_BINDINGS=true"
+             (string-append "-DCMAKE_INSTALL_PYTHON_PKG_DIR="
+                            %output
+                            "/lib/python2.7/site-packages")
+             (string-append "-DCMAKE_INSTALL_LIBDIR="
+                            %output
+                            "/lib"))
+
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'bootstrap
+           (lambda _
+             (zero?
+              (system* "python" "contrib/cmake/bootstrap.py" "create"))))
+         (add-before 'check 'make-test-z3
+           (lambda _
+             ;; Build the test suite executable.
+             (zero? (system* "make" "test-z3" "-j"
+                             (number->string (parallel-job-count))))))
+         (replace 'check
+           (lambda _
+             ;; Run all the tests that don't require arguments.
+             (zero? (system* "./test-z3" "/a")))))))
+    (native-inputs
+     `(("python" ,python-2)))
+    (synopsis "Theorem prover")
+    (description "Z3 is a theorem prover and @dfn{satisfiability modulo
+theories} (SMT) solver.  It provides a C/C++ API, as well as Python bindings.")
+    (home-page "https://github.com/Z3Prover/z3")
+    (license license:expat)))
+
+(define-public cubicle
+  (package
+    (name "cubicle")
+    (version "1.1.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://cubicle.lri.fr/cubicle-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1sny9c4fm14k014pk62ibpwbrjjirkx8xmhs9jg7q1hk7y7x3q2h"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("ocaml" ,ocaml)
+       ("which" ,(@@ (gnu packages base) which))))
+    (propagated-inputs
+     `(("z3" ,z3)))
+    (arguments
+     `(#:configure-flags (list "--with-z3")
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'configure-for-release
+           (lambda _
+             (substitute* "Makefile.in"
+               (("SVNREV=") "#SVNREV="))))
+         (add-before 'configure 'fix-/bin/sh
+           (lambda _
+             (substitute* "configure"
+               (("/bin/sh") (which "sh")))))
+         (add-before 'configure 'fix-smt-z3wrapper.ml
+           (lambda _
+             (substitute* "Makefile.in"
+               (("\\\\n") "")))))))
+    (home-page "http://cubicle.lri.fr/")
+    (synopsis "Model checker for array-based systems")
+    (description "Cubicle is an open source model checker for verifying safety
+properties of array-based systems.  This is a syntactically restricted class of
+parametrized transition systems with states represented as arrays indexed by an
+arbitrary number of processes.  Cache coherence protocols and mutual exclusion
+algorithms are typical examples of such systems.")
+    (license license:asl2.0)))