diff options
author | David Elsing <david.elsing@posteo.net> | 2023-10-05 21:34:53 +0000 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2023-10-06 12:26:45 +0200 |
commit | 95ecbdc9b162998c55eb7b355c59fa5205a4373c (patch) | |
tree | 81cd8025679ccb7bf916b3ad96de34f135109c1a /gnu | |
parent | 9b5dbc46e6945fbb03cdf5918d93ba06de3deb2b (diff) | |
download | guix-95ecbdc9b162998c55eb7b355c59fa5205a4373c.tar guix-95ecbdc9b162998c55eb7b355c59fa5205a4373c.tar.gz |
gnu: Add gklib-suitesparse.
* gnu/packages/maths.scm (gklib-suitesparse): New variable.
* gnu/packages/patches/gklib-suitesparse.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/maths.scm | 25 | ||||
-rw-r--r-- | gnu/packages/patches/gklib-suitesparse.patch | 65 |
3 files changed, 91 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 65d50abc71..83eba7c4a6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1272,6 +1272,7 @@ dist_patch_DATA = \ %D%/packages/patches/ghostscript-no-header-uuid.patch \ %D%/packages/patches/ghostscript-no-header-creationdate.patch \ %D%/packages/patches/gitg-fix-positional-argument.patch \ + %D%/packages/patches/gklib-suitesparse.patch \ %D%/packages/patches/glib-appinfo-watch.patch \ %D%/packages/patches/glib-networking-gnutls-binding.patch \ %D%/packages/patches/glib-skip-failing-test.patch \ diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 76d770466f..a096b24cfe 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -5397,6 +5397,31 @@ matrix with which the LU factorization becomes sparser. It is a variant of COLAMD which has the the option to apply constraints to the ordering.") (license license:bsd-3))) +(define-public gklib-suitesparse + (package/inherit gklib + (name "gklib-suitesparse") + (source (origin + (inherit (package-source gklib)) + (patches (cons + (search-patch + "gklib-suitesparse.patch") + (origin-patches (package-source gklib)))))) + (arguments + (substitute-keyword-arguments (package-arguments gklib) + ((#:phases phases #~%standard-phases) + #~(modify-phases #$phases + (add-after 'unpack 'patch-cmake + (lambda _ + (substitute* "CMakeLists.txt" + (("add_library\\(GKlib.*" all) + (string-append + all + "target_link_libraries(GKlib PUBLIC" + " ${SUITESPARSE_CONFIG_LIBRARIES} m)\n"))))))))) + (inputs + (modify-inputs (package-inputs gklib) + (prepend suitesparse-config))))) + (define-public suitesparse (package (name "suitesparse") diff --git a/gnu/packages/patches/gklib-suitesparse.patch b/gnu/packages/patches/gklib-suitesparse.patch new file mode 100644 index 0000000000..8b6c708b6a --- /dev/null +++ b/gnu/packages/patches/gklib-suitesparse.patch @@ -0,0 +1,65 @@ +This patch contains the relevant changes to GKlib made in SuiteSparse +(CHOLMOD) for the version 7.2.0 +(https://github.com/DrTimothyAldenDavis/SuiteSparse/commit/8a7641cdb4809533c681417e94f98058c07c5da2). +The disabling of signal handling when MATLAB_MEX_FILE is defined is omitted. + +diff -ur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,6 +3,8 @@ + + option(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" OFF) + ++find_package ( SuiteSparse_config 7.1.0 REQUIRED ) ++ + get_filename_component(abs "." ABSOLUTE) + set(GKLIB_PATH ${abs}) + unset(abs) +diff -ur a/GKlib.h b/GKlib.h +--- a/GKlib.h ++++ b/GKlib.h +@@ -59,6 +59,24 @@ + #include <omp.h> + #endif + ++/* -------------------------------------------------------------------------- */ ++/* Added for incorporation into SuiteSparse. ++ Tim Davis, Oct 31, 2022, Texas A&M University. */ ++#include "SuiteSparse_config.h" ++#define malloc SuiteSparse_config_malloc ++#define calloc SuiteSparse_config_calloc ++#define realloc SuiteSparse_config_realloc ++#define free(p) \ ++{ \ ++ if ((p) != NULL) \ ++ { \ ++ SuiteSparse_config_free (p) ; \ ++ (p) = NULL ; \ ++ } \ ++} ++ ++/* -------------------------------------------------------------------------- */ ++ + + + +diff -ur a/memory.c b/memory.c +--- a/memory.c ++++ b/memory.c +@@ -108,6 +108,8 @@ + /*************************************************************************/ + int gk_malloc_init() + { ++ gkmcore = NULL; ++#if 0 + if (gkmcore == NULL) + gkmcore = gk_gkmcoreCreate(); + +@@ -115,6 +117,7 @@ + return 0; + + gk_gkmcorePush(gkmcore); ++#endif + + return 1; + } |