diff mbox series

[bug#66129,v2,11/20] gnu: Add metis-suitesparse.

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

Commit Message

David Elsing Sept. 21, 2023, 1:27 p.m. UTC
* gnu/packages/maths.scm (metis-suitesparse): New variable.
---
 gnu/packages/maths.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 3a86e90cb5..3f80029414 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -5263,6 +5263,32 @@  (define-public gklib-suitesparse
      (modify-inputs (package-inputs gklib)
        (prepend suitesparse-config)))))
 
+(define-public metis-suitesparse
+  (package/inherit metis-5.2
+    (name "metis-suitesparse")
+    (arguments
+     (substitute-keyword-arguments (package-arguments metis-5.2)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (add-before 'prepare-cmake 'set-idxwidth
+              (lambda _
+                (substitute* "Makefile"
+                  (("IDXWIDTH.*=.*")
+                   "IDXWIDTH = \"\\#define IDXTYPEWIDTH 64\"\n"))))
+            (add-before 'prepare-cmake 'link-suitesparse-config
+              (lambda _
+                (substitute* "programs/CMakeLists.txt"
+                  (("include_directories.*" all)
+                   (string-append
+                    all "find_package(SuiteSparse_config REQUIRED)\n"))
+                  (("(target_link_libraries.*)GKlib(.*)" _ start end)
+                   (string-append
+                    start "GKlib ${SUITESPARSE_CONFIG_LIBRARIES}" end)))))))
+       ((#:configure-flags _)
+        #~(list "-DSHARED=ON"
+                (string-append "-DGKLIB_PATH=" #$gklib-suitesparse)))))
+    (inputs (list suitesparse-config gklib-suitesparse))))
+
 (define-public suitesparse
   (package
     (name "suitesparse")