Subject: [PATCH v2 20/20] gnu: Add suitesparse-umfpack.

From: David Elsing <[email-masked]>
Date: Thu, 21 Sep 2023 13:27:55 +0000

* gnu/packages/maths.scm (suitesparse-umfpack): New variable.
---
 gnu/packages/maths.scm | 68 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index a5d7f4ebd3..fbfa94265b 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -5747,6 +5747,74 @@ (define-public suitesparse-spqr
 matrices.")
     (license license:gpl2+)))
 
+(define-public suitesparse-umfpack
+  (package
+    (name "suitesparse-umfpack")
+    (version "6.2.0")
+    (source (suitesparse-package-src name "UMFPACK"))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'set-cmake-module-path
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("set.*CMAKE_MODULE_PATH.*")
+                 (string-append
+                  "set(CMAKE_MODULE_PATH "
+                  (string-join
+                   (map (lambda (path)
+                          (string-append path "/lib/cmake/SuiteSparse"))
+                        (list #$suitesparse-amd
+                              #$suitesparse-camd
+                              #$suitesparse-ccolamd
+                              #$suitesparse-cholmod
+                              #$suitesparse-colamd
+                              #$suitesparse-config)))
+                  ")\nset(DUMMY\n")))))
+          (add-after 'build 'build-doc
+            (lambda _
+              (with-directory-excursion "../source/Doc"
+                (invoke "make"))))
+          (add-after 'install 'install-doc
+            (lambda _
+              (let ((outdir
+                     (string-append #$output "/share/doc/"
+                                    #$name "-" #$version)))
+                (install-file "../source/Doc/UMFPACK_UserGuide.pdf" outdir)
+                (install-file "../source/Doc/UMFPACK_QuickStart.pdf" outdir))))
+          (replace 'install-license-files
+            (lambda _
+              (let ((outdir
+                     (string-append #$output "/share/doc/"
+                                    #$name "-" #$version)))
+                (install-file "../source/Doc/License.txt" outdir)
+                (install-file "../source/Doc/gpl.txt" outdir)))))))
+    (inputs
+     (list openblas
+           suitesparse-amd
+           suitesparse-camd
+           suitesparse-ccolamd
+           suitesparse-cholmod
+           suitesparse-colamd
+           suitesparse-config))
+    (native-inputs
+     (list (texlive-updmap.cfg
+            (list texlive-etoolbox
+                  texlive-framed
+                  texlive-mdframed
+                  texlive-needspace
+                  texlive-xcolor
+                  texlive-zref))))
+    (home-page "https://people.engr.tamu.edu/davis/suitesparse.html")
+    (synopsis "Routines for solving sparse linear problems via LU factorization")
+    (description "UMFPACK is a set of routines for solving unsymmetric sparse
+linear systems using the Unsymmetric MultiFrontal method and direct sparse LU
+factorization.")
+    (license license:gpl2+)))
+
 (define-public suitesparse
   (package
     (name "suitesparse")
-- 
2.41.0