Subject: [PATCH v2 science-team 1/7] gnu: Add %suitesparse-package-versions.

From: Greg Hogan <[email-masked]>
Date: Mon, 5 May 2025 16:43:21 +0000

* gnu/packages/maths.scm (%suitesparse-package-versions): New variable.
(suitesparse-version): Update to 7.10.2.
(suitesparse-source)[origin]: Update deletion list.
(suitesparse-amd, suitesparse-btf, suitesparse-camd, suitesparse-colamd,
suitesparse-ccolamd, suitesparse-cholmod, suitesparse-cxsparse,
suitesparse-klu, suitesparse-ldl, suitesparse-rbio,
suitesparse-mongoose, suitesparse-spex, suitesparse-spqr,
suitesparse-umfpack)[version]: Use %suitesparse-package-versions.
[arguments]<#:configure-flags>: Preserve include path.
(suitesparse-cholmod)[arguments]<#:phases>('install-license-files):
Update paths.
(suitesparse-cholmod)[arguments]<#:phases>('build-doc): Update paths.
(suitesparse-spex)[native-inputs]: Add texlive-fncychap.
(suitesparse-spqr)[native-inputs]: Add texlive-etoolbox.
* gnu/packages/patches/gklib-suitesparse.patch: Update version.

Change-Id: I14a9bfeddb37330c88a2e94b0992c2f1afbc5310
---
 gnu/packages/maths.scm                       | 77 ++++++++++++++------
 gnu/packages/patches/gklib-suitesparse.patch |  4 +-
 2 files changed, 55 insertions(+), 26 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index eb23a375b4..b1ff9c36bd 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -6179,9 +6179,25 @@ (define-public openspecfun
     ;; public domain software.
     (license (list license:expat license:public-domain))))
 
+(define %suitesparse-package-versions
+  '(("AMD" . "3.3.3")
+    ("BTF" . "2.3.2")
+    ("CAMD" . "3.3.3")
+    ("CCOLAMD" . "3.3.4")
+    ("CHOLMOD" . "5.3.2")
+    ("COLAMD" . "3.3.4")
+    ("CXSparse" . "4.4.1")
+    ("KLU" . "2.3.5")
+    ("LDL" . "3.3.2")
+    ("SuiteSparse_Mongoose" . "3.3.4")
+    ("RBio" . "4.3.4")
+    ("SPEX" . "3.2.3")
+    ("SPQR" . "4.3.4")
+    ("UMFPACK" . "6.3.5")))
+
 ;; Source for the modular SuiteSparse packages. When updating, also update the
 ;; (different) versions of the subpackages.
-(define suitesparse-version "7.2.0")
+(define suitesparse-version "7.10.2")
 (define suitesparse-source
   (origin
     (method git-fetch)
@@ -6191,10 +6207,12 @@ (define suitesparse-source
     (file-name (git-file-name "suitesparse" suitesparse-version))
     (sha256
      (base32
-      "1draljn8i46862drc6008cnb2zjpklf74j8c34jirjazzpf53kaa"))
+      "1ndwx2cp5zxrikq4xdrzjrxk1b5ps7lyi6qw34m8jpfpa0ba01ln"))
     (modules '((guix build utils)))
     (snippet
      #~(begin
+         ;; Empty except for a .gitignore.
+         (delete-file-recursively "build")
          ;; Delete autogenerated and bundled files
          (for-each delete-file (find-files "." "\\.pdf$"))
          ;; ssget
@@ -6205,19 +6223,13 @@ (define suitesparse-source
          (delete-file-recursively "CHOLMOD/SuiteSparse_metis")
          ; GraphBLAS
          (delete-file "GraphBLAS/README.md")
-         (delete-file "GraphBLAS/Config/GB_config.h")
          (delete-file "GraphBLAS/Config/GB_prejit.c")
          (delete-file-recursively "GraphBLAS/cpu_features")
-         (delete-file "GraphBLAS/CUDA/GB_cuda_common_jitFactory.hpp")
-         (delete-file "GraphBLAS/JITpackage/GB_JITpackage.c")
          (delete-file-recursively "GraphBLAS/lz4/lz4.c")
          (delete-file-recursively "GraphBLAS/lz4/lz4.h")
          (delete-file-recursively "GraphBLAS/lz4/lz4hc.c")
          (delete-file-recursively "GraphBLAS/lz4/lz4hc.h")
-         (delete-file "GraphBLAS/GraphBLAS/Config/GB_config.h")
          (delete-file "GraphBLAS/Tcov/PreJIT/GB_prejit.c")
-         (delete-file-recursively "GraphBLAS/Source/FactoryKernels")
-         (delete-file "GraphBLAS/Source/GB_AxB__include1.h")
          (delete-file "GraphBLAS/xxHash/xxhash.h")
          (delete-file-recursively "GraphBLAS/zstd/zstd_subset")
          ;; KLU
@@ -6247,6 +6259,7 @@ (define-public suitesparse-config
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6263,12 +6276,13 @@ (define-public suitesparse-config
 (define-public suitesparse-amd
   (package
     (name "suitesparse-amd")
-    (version "3.2.0")
+    (version (assoc-ref %suitesparse-package-versions "AMD"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6311,12 +6325,13 @@ (define-public suitesparse-amd
 (define-public suitesparse-btf
   (package
     (name "suitesparse-btf")
-    (version "2.2.0")
+    (version (assoc-ref %suitesparse-package-versions "BTF"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6344,12 +6359,13 @@ (define-public suitesparse-btf
 (define-public suitesparse-camd
   (package
     (name "suitesparse-camd")
-    (version "3.2.0")
+    (version (assoc-ref %suitesparse-package-versions "CAMD"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6389,12 +6405,13 @@ (define-public suitesparse-camd
 (define-public suitesparse-colamd
   (package
     (name "suitesparse-colamd")
-    (version "3.2.0")
+    (version (assoc-ref %suitesparse-package-versions "COLAMD"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6422,12 +6439,13 @@ (define-public suitesparse-colamd
 (define-public suitesparse-ccolamd
   (package
     (name "suitesparse-ccolamd")
-    (version "3.2.0")
+    (version (assoc-ref %suitesparse-package-versions "CCOLAMD"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6505,12 +6523,13 @@ (define-public metis-suitesparse
 (define-public suitesparse-cholmod
   (package
     (name "suitesparse-cholmod")
-    (version "4.2.0")
+    (version (assoc-ref %suitesparse-package-versions "CHOLMOD"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6567,7 +6586,7 @@ (define-public suitesparse-cholmod
               (let ((out (string-append #$output
                                         "/share/doc/" #$name "-" #$version)))
                 (install-file "../CHOLMOD/Doc/License.txt" out)
-                (install-file "../CHOLMOD/Core/lesser.txt" out)
+                (install-file "../CHOLMOD/Check/lesser.txt" out)
                 (install-file "../CHOLMOD/MatrixOps/gpl.txt" out)))))))
     (inputs
      (list gklib-suitesparse
@@ -6590,12 +6609,13 @@ (define-public suitesparse-cholmod
 (define-public suitesparse-cxsparse
   (package
     (name "suitesparse-cxsparse")
-    (version "4.2.0")
+    (version (assoc-ref %suitesparse-package-versions "CXSparse"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6624,12 +6644,13 @@ (define-public suitesparse-cxsparse
 (define-public suitesparse-klu
   (package
     (name "suitesparse-klu")
-    (version "2.2.0")
+    (version (assoc-ref %suitesparse-package-versions "KLU"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6688,12 +6709,13 @@ (define-public suitesparse-klu
 (define-public suitesparse-ldl
   (package
     (name "suitesparse-ldl")
-    (version "3.2.0")
+    (version (assoc-ref %suitesparse-package-versions "LDL"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6741,12 +6763,13 @@ (define-public suitesparse-ldl
 (define-public suitesparse-rbio
   (package
     (name "suitesparse-rbio")
-    (version "4.2.0")
+    (version (assoc-ref %suitesparse-package-versions "RBio"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6779,12 +6802,13 @@ (define-public suitesparse-rbio
 (define-public suitesparse-mongoose
   (package
     (name "suitesparse-mongoose")
-    (version "3.2.0")
+    (version (assoc-ref %suitesparse-package-versions "SuiteSparse_Mongoose"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6854,12 +6878,13 @@ (define-public suitesparse-mongoose
 (define-public suitesparse-spex
   (package
     (name "suitesparse-spex")
-    (version "2.2.0")
+    (version (assoc-ref %suitesparse-package-versions "SPEX"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6897,6 +6922,7 @@ (define-public suitesparse-spex
                   texlive-soul
                   texlive-multirow
                   texlive-algorithms
+                  texlive-fncychap
                   texlive-float
                   texlive-algorithmicx
                   texlive-cprotect
@@ -6920,12 +6946,13 @@ (define-public suitesparse-spex
 (define-public suitesparse-spqr
   (package
     (name "suitesparse-spqr")
-    (version "4.2.0")
+    (version (assoc-ref %suitesparse-package-versions "SPQR"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
@@ -6970,7 +6997,8 @@ (define-public suitesparse-spqr
     (propagated-inputs (list suitesparse-cholmod))
     (native-inputs
      (list (texlive-updmap.cfg
-            (list texlive-epsf))))
+            (list texlive-epsf
+                  texlive-etoolbox))))
     (home-page "https://people.engr.tamu.edu/davis/suitesparse.html")
     (synopsis "Sparse QR factorization method")
     (description "The SPQR (SuiteSparseQR) package provides sparse QR
@@ -6981,12 +7009,13 @@ (define-public suitesparse-spqr
 (define-public suitesparse-umfpack
   (package
     (name "suitesparse-umfpack")
-    (version "6.2.0")
+    (version (assoc-ref %suitesparse-package-versions "UMFPACK"))
     (source suitesparse-source)
     (build-system cmake-build-system)
     (arguments
      (list
       #:tests? #f
+      #:configure-flags #~(list "-DSUITESPARSE_INCLUDEDIR_POSTFIX=")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'chdir
diff --git a/gnu/packages/patches/gklib-suitesparse.patch b/gnu/packages/patches/gklib-suitesparse.patch
index 8b6c708b6a..757354f9ba 100644
--- a/gnu/packages/patches/gklib-suitesparse.patch
+++ b/gnu/packages/patches/gklib-suitesparse.patch
@@ -1,5 +1,5 @@
 This patch contains the relevant changes to GKlib made in SuiteSparse
-(CHOLMOD) for the version 7.2.0
+(CHOLMOD) for the version 7.10.2
 (https://github.com/DrTimothyAldenDavis/SuiteSparse/commit/8a7641cdb4809533c681417e94f98058c07c5da2).
 The disabling of signal handling when MATLAB_MEX_FILE is defined is omitted.
 
@@ -10,7 +10,7 @@ diff -ur a/CMakeLists.txt b/CMakeLists.txt
  
  option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF)
  
-+find_package ( SuiteSparse_config 7.1.0 REQUIRED )
++find_package ( SuiteSparse_config 7.10.2 REQUIRED )
 +
  get_filename_component(abs "." ABSOLUTE)
  set(GKLIB_PATH ${abs})
-- 
2.49.0