diff mbox series

[bug#66129,v3,03/20] gnu: Add suitesparse-amd.

Message ID bece635e7913b0405dad9dd4a3e01dd4f5b70b08.1696541452.git.david.elsing@posteo.net
State New
Headers show
Series [bug#66129,v3,01/20] gnu: suitesparse: Tweak description. | expand

Commit Message

David Elsing Oct. 5, 2023, 9:34 p.m. UTC
* gnu/packages/maths.scm (suitesparse-amd): New variable.
---
 gnu/packages/maths.scm | 48 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

Comments

Ludovic Courtès Oct. 19, 2023, 6:58 a.m. UTC | #1
Hi David,

David Elsing <david.elsing@posteo.net> skribis:

> +(define-public suitesparse-amd
> +  (package
> +    (name "suitesparse-amd")

[...]

> +    (inputs (list suitesparse-config))

One issue that I discovered is that, most of the time, dependencies on
other SuiteSparse packages should be propagated because headers include
one another.

For example, public headers of ‘suitesparse-amd’ include those from
‘suitesparse-config’:

--8<---------------cut here---------------start------------->8---
$ grep config $(guix build suitesparse-amd)/include/*.h
/gnu/store/kiq1bwzx4dlmmpqv14l9crqrjwigmgns-suitesparse-amd-3.2.0/include/amd.h:#include "SuiteSparse_config.h"
--8<---------------cut here---------------end--------------->8---

We should check and probably change most ‘inputs’ to
‘propagated-inputs’.

Could you take a look?

TIA,
Ludo’.
David Elsing Oct. 19, 2023, 10:29 p.m. UTC | #2
Ludovic Courtès <ludovic.courtes@inria.fr> writes:

> Hi David,
Hi,

> We should check and probably change most ‘inputs’ to
> ‘propagated-inputs’.
yes I agree.

Before, I put all packages searched for in the
CMakeLists.txt file into 'inputs'. Of these, I now moved the packages
referenced in the header files into 'propagated-inputs'.

> TIA,
> Ludo’.
Cheers,
David
diff mbox series

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 0dcd456a2e..2216cc67b8 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -5120,6 +5120,54 @@  (define-public suitesparse-config
 package contains a library with common configuration options.")
     (license license:bsd-3)))
 
+(define-public suitesparse-amd
+  (package
+    (name "suitesparse-amd")
+    (version "3.2.0")
+    (source suitesparse-source)
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'chdir
+            (lambda _
+              (chdir "AMD")))
+          (add-after 'chdir 'set-cmake-module-path
+            (lambda _
+              (substitute* "CMakeLists.txt"
+                (("set.*CMAKE_MODULE_PATH.*")
+                 (string-append "set(CMAKE_MODULE_PATH "
+                                #$suitesparse-config "/lib/cmake/SuiteSparse)\n"
+                                "set(DUMMY\n")))))
+          (add-after 'build 'build-doc
+            (lambda _
+              (with-directory-excursion "../AMD/Doc"
+                (invoke "make"))))
+          ;; Required for suitesparse-umfpack
+          (add-after 'install 'install-internal-header
+              (lambda _
+                (install-file "../AMD/Include/amd_internal.h"
+                              (string-append #$output "/include"))))
+          (add-after 'install-internal-header 'install-doc
+            (lambda _
+              (install-file "../AMD/Doc/AMD_UserGuide.pdf"
+                            (string-append #$output "/share/doc/"
+                                           #$name "-" #$version))))
+          (replace 'install-license-files
+            (lambda _
+              (install-file "../AMD/Doc/License.txt"
+                            (string-append #$output "/share/doc/"
+                                           #$name "-" #$version)))))))
+    (inputs (list suitesparse-config))
+    (native-inputs (list gfortran (texlive-updmap.cfg '())))
+    (home-page "https://people.engr.tamu.edu/davis/suitesparse.html")
+    (synopsis "Sparse matrix ordering for Cholesky factorization")
+    (description "AMD is a set of routines for ordering a sparse matrix prior
+to Cholesky factorization (or for LU factorization with diagonal pivoting).")
+    (license license:bsd-3)))
+
 (define-public suitesparse
   (package
     (name "suitesparse")