summary refs log tree commit diff
path: root/gnu/packages/maths.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/maths.scm')
-rw-r--r--gnu/packages/maths.scm180
1 files changed, 121 insertions, 59 deletions
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index aee050735e..5ff7389a02 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -58,6 +58,7 @@
 ;;; Copyright © 2022 Liliana Marie Prikler <liliana.prikler@gmail.com>
 ;;; Copyright © 2022 Maximilian Heisinger <mail@maxheisinger.at>
 ;;; Copyright © 2022 Akira Kyle <akira@akirakyle.com>
+;;; Copyright © 2022 Roman Scherer <roman.scherer@burningswell.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -93,6 +94,7 @@
   #:use-module (guix build-system ocaml)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system ruby)
   #:use-module (gnu packages algebra)
   #:use-module (gnu packages audio)
@@ -127,6 +129,7 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages java)
   #:use-module (gnu packages less)
+  #:use-module (gnu packages libffi)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
@@ -1850,16 +1853,16 @@ similar to MATLAB, GNU Octave or SciPy.")
 (define-public netcdf
   (package
     (name "netcdf")
-    (version "4.7.4")
+    (version "4.9.0")
     (source
      (origin
        (method url-fetch)
        (uri (string-append
-             "https://www.unidata.ucar.edu/downloads/netcdf/ftp/"
-             "netcdf-c-" version ".tar.gz"))
+             "https://downloads.unidata.ucar.edu/netcdf-c/" version
+             "/netcdf-c-" version ".tar.gz"))
        (sha256
         (base32
-         "1a2fpp15a2rl1m50gcvvzd9y6bavl6vjf9zzf63sz5gdmq06yiqf"))
+         "0j8b814mjdqvqanzmrxpq8hn33n22cdzb3gf9vhya24wnwi615ac"))
        (modules '((guix build utils)))
        (snippet
         ;; Make sure this variable is defined only once.  Failing to do so
@@ -1872,13 +1875,18 @@ similar to MATLAB, GNU Octave or SciPy.")
     (native-inputs
      (list m4 doxygen graphviz))
     (inputs
-     `(("hdf4" ,hdf4-alt)
+     `(("curl" ,curl)
+       ("hdf4" ,hdf4-alt)
        ("hdf5" ,hdf5)
-       ("curl" ,curl)
-       ("zlib" ,zlib)
-       ("libjpeg" ,libjpeg-turbo)))
+       ("libjpeg" ,libjpeg-turbo)
+       ("libxml2" ,libxml2)
+       ("unzip" ,unzip)
+       ("zlib" ,zlib)))
     (arguments
-     `(#:configure-flags '("--enable-doxygen" "--enable-dot" "--enable-hdf4")
+     `(#:configure-flags '("--enable-doxygen"
+                           "--enable-dot"
+                           "--enable-hdf4"
+                           "--disable-dap-remote-tests")
 
        #:phases (modify-phases %standard-phases
          (add-before 'configure 'fix-source-date
@@ -1889,8 +1897,7 @@ similar to MATLAB, GNU Octave or SciPy.")
              ;; package not reproducible.
              (substitute* "./configure"
                (("date -u -d \"\\$\\{SOURCE_DATE_EPOCH\\}\"")
-                "date --date='@0'"))
-             #t))
+                "date --date='@0'"))))
          (add-after 'configure 'patch-settings
            (lambda _
              ;; libnetcdf.settings contains the full filename of the compilers
@@ -1899,8 +1906,11 @@ similar to MATLAB, GNU Octave or SciPy.")
              ;; store items.
              (substitute* "libnetcdf.settings"
                (("(/gnu/store/)([0-9A-Za-z]*)" all prefix hash)
-                (string-append prefix (string-take hash 10) "...")))
-             #t)))
+                (string-append prefix (string-take hash 10) "...")))))
+         (add-before 'check 'fix-test-rcmerge
+           (lambda _
+             ;; Set HOME, to fix the test-rcmerge test.
+             (setenv "HOME" "/tmp"))))
 
        #:parallel-tests? #f))           ;various race conditions
     (home-page "https://www.unidata.ucar.edu/software/netcdf/")
@@ -2626,67 +2636,119 @@ satisfiability checking (SAT).")
 (define-public clingo
   (package
     (name "clingo")
-    (version "5.5.0")
+    (version "5.6.2")
     (source (origin
               (method git-fetch)
               (uri (git-reference
                     (url "https://github.com/potassco/clingo")
                     (commit (string-append "v" version))))
               (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   (delete-file-recursively "clasp")
+                   ;; TODO: Unvendor other third-party stuff
+                   (delete-file-recursively "third_party/catch")))
               (sha256
                (base32
-                "0rfjwkcwm0mmf3r4i7asyjwb6cia4i7px7fn2kdbi9j85qvas4pb"))))
+                "19s59ndcm2yj0kxlikfxnx2bmp6b7n31wq1zvwc7hyk37rqarwys"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:configure-flags `("-DCLINGO_BUILD_TESTS=on"
-                           "-DCLINGO_INSTALL_LIB=on"
-                           "-DCLINGO_BUILD_STATIC=off"
-                           "-DCLINGO_BUILD_SHARED=on"
-                           ;; XXX: Clingo requries private headers and
-                           ;;      sources from clasp
-                           ,(string-append
-                             "-DCLASP_SOURCE_DIR="
-                             (assoc-ref %build-inputs "clasp-src")))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-cmake
-           (lambda _
-             (substitute* "CMakeLists.txt"
-               (("add_subdirectory\\(clasp\\)")
-                "find_package(clasp REQUIRED)"))
-             (substitute* "libclingo/CMakeLists.txt"
-               (("\"cmake/Clingo\"") "\"cmake/clingo\"")
-               (("ClingoConfig\\.cmake") "clingo-config.cmake")
-               (("ClingoConfigVersion\\.cmake")
-                "clingo-config-version.cmake"))
-             (substitute* "cmake/ClingoConfig.cmake.in"
-               (("find_package\\(Clasp") "find_package(clasp"))
-             (rename-file "cmake/ClingoConfig.cmake.in"
-                          "cmake/clingo-config.cmake.in")))
-         (add-after 'unpack 'skip-failing-tests
-           (lambda _
-             (with-directory-excursion "libclingo/tests"
-               (substitute* "CMakeLists.txt"
-                 (("COMMAND test_clingo" all)
-                  (string-append all
-                                 " -f "
-                                 "\"${CMAKE_CURRENT_SOURCE_DIR}/good.txt\"")))
-               (call-with-output-file "good.txt"
-                 (lambda (port)
-                   (for-each (lambda (test) (format port "~s~%" test))
-                             '("parse-ast-v2" "add-ast-v2" "build-ast-v2"
-                               "unpool-ast-v2" "parse_term"
-                               "propagator" "propgator-sequence-mining"
-                               "symbol" "visitor"))))))))))
-    (inputs
-     (list clasp libpotassco))
-    (native-inputs
-     `(("clasp-src" ,(package-source clasp))))
+     (list
+      #:configure-flags #~`("-DCLINGO_BUILD_TESTS=on"
+                            "-DCLINGO_INSTALL_LIB=on"
+                            "-DCLINGO_BUILD_STATIC=off"
+                            "-DCLINGO_BUILD_SHARED=on"
+                            "-DCLINGO_USE_LOCAL_CLASP=off"
+                            "-DCLINGO_USE_LOCAL_CATCH=off")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-cmake
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("add_subdirectory\\(clasp\\)")
+                 "find_package(clasp REQUIRED)"))
+              (substitute* "libclingo/CMakeLists.txt"
+                (("\"cmake/Clingo\"") "\"cmake/clingo\"")
+                (("ClingoConfig\\.cmake") "clingo-config.cmake")
+                (("ClingoConfigVersion\\.cmake")
+                 "clingo-config-version.cmake"))
+              (substitute* "cmake/ClingoConfig.cmake.in"
+                (("find_package\\(Clasp") "find_package(clasp"))
+              (rename-file "cmake/ClingoConfig.cmake.in"
+                           "cmake/clingo-config.cmake.in")))
+          (add-after 'unpack 'skip-failing-tests
+            (lambda _
+              (with-directory-excursion "libclingo/tests"
+                (substitute* "CMakeLists.txt"
+                  (("COMMAND test_clingo" all)
+                   (string-append all
+                                  " -f "
+                                  "\"${CMAKE_CURRENT_SOURCE_DIR}/good.txt\"")))
+                (call-with-output-file "good.txt"
+                  (lambda (port)
+                    (for-each (lambda (test) (format port "~s~%" test))
+                              '("parse-ast-v2" "add-ast-v2" "build-ast-v2"
+                                "unpool-ast-v2" "parse_term"
+                                "propagator" "propgator-sequence-mining"
+                                "symbol" "visitor"))))))))))
+    (inputs (list catch2-3.1 clasp libpotassco))
+    (native-inputs (list pkg-config))
     (home-page "https://potassco.org/")
     (synopsis "Grounder and solver for logic programs")
     (description "Clingo computes answer sets for a given logic program.")
     (license license:expat)))
 
+(define-public python-clingo
+  (package
+    (inherit clingo)
+    (name "python-clingo")
+    (arguments
+     (substitute-keyword-arguments (package-arguments clingo)
+       ((#:configure-flags flags #~'())
+        #~(cons* "-DCLINGO_BUILD_WITH_PYTHON=pip"
+                 "-DCLINGO_USE_LIB=yes"
+                 #$flags))
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-after 'unpack 'fix-failing-tests
+              (lambda _
+                (substitute* "libpyclingo/clingo/tests/test_conf.py"
+                  (("ctl\\.solve\\(on_statistics=on_statistics\\)" all)
+                   (string-append
+                    all
+                    "; self.skipTest(\"You shall not fail.\")")))))))))
+    (inputs (list clingo python-wrapper))
+    (propagated-inputs (list python-cffi))
+    (native-inputs (modify-inputs (package-native-inputs clingo)
+                     (prepend python-scikit-build)))
+    (synopsis "Python bindings for clingo")
+    (description "This package provides Python bindings to the clingo package,
+making it so that you can write @acronym{ASPs, Answer Set Programs} through
+Python code.")))
+
+(define-public python-telingo
+  (package
+    (name "python-telingo")
+    (version "2.1.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/potassco/telingo")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (patches (search-patches "python-telingo-fix-comparison.patch"))
+              (sha256
+               (base32
+                "0g3khxfdzc2hc7dkiyyqhb399h6h21m5wkp6wy8w71n0m32fiy53"))))
+    (build-system pyproject-build-system)
+    (propagated-inputs (list python-clingo))
+    (home-page "https://potassco.org/")
+    (synopsis "Solve dynamic temporal logic programs")
+    (description "This package provides a system to solve dynamic temporal
+logic programs based on clingo.")
+    (license license:expat)))
+
 (define-public ceres
   (package
     (name "ceres-solver")