Subject: [bug#69820] [PATCH] gnu: Add guile-gsl.

From: Artyom Bologov <[email-masked]>
Date: Sat, 16 Mar 2024 01:31:53 +0400

Hi y'all,

This is another shot at packaging Guile GSL bindings. See the attached
patch. The related bugs 69443 and 69737 are resolved then.

>From 0185af4d2c467a45de568d1193f76cfcf23e8bab Mon Sep 17 00:00:00 2001
From: Artyom Bologov <[email-masked]>
Date: Sat, 16 Mar 2024 01:11:09 +0400
Subject: [PATCH] gnu: Add guile-gsl.

* gnu/packages/guile-xyz.scm (guile-gsl): New variable.
---
 gnu/packages/guile-xyz.scm | 40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 9d683199ac..3c85c35b45 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -1438,6 +1438,46 @@ (define-public guile-algorithms
     (home-page "https://guile-algorithms.lajszczak.dev/")
     (license license:gpl3+)))
 
+(define-public guile-gsl
+  (let ((commit "739a0ddcf00fdf4bdd409e6dd75de23e01aceded")
+        (revision "0"))
+    (package
+      (name "guile-gsl")
+      (version (git-version "0.0.1" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/aartaka/guile-gsl")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0x0z5xx6jx5zhjy83zi7l9mzi65v58wl2khf11q5d2vf4hya16bb"))))
+      (build-system guile-build-system)
+      (arguments
+       (list #:source-directory "modules"
+             #:phases
+             #~(modify-phases %standard-phases
+                 (add-before 'build 'substitute-gsl-so
+                   (lambda _
+                     (let ((gsl (string-append #$(this-package-input "gsl")
+                                               "/lib/libgsl.so"))
+                           (gslcblas (string-append #$(this-package-input "gsl")
+                                                    "/lib/libgslcblas.so")))
+                       (substitute* '("modules/gsl/core.scm")
+                         (("libgsl.so")
+                          gsl)
+                         (("libgslcblas.so")
+                          gslcblas))
+                       #t))))))
+      (native-inputs (list guile-3.0))
+      (inputs (list guile-3.0 gsl))
+      (home-page "https://github.com/aartaka/guile-gsl")
+      (synopsis "Bindings for GNU Scientific library.")
+      (description "Scheme wrapper around @code{libgsl.so}.
+Implements vector, matrix, and BLAS operations.")
+      (license license:gpl3+))))
+
 (define-public guile-aws
   (let ((commit "f32bea12333e1054b97ab50e58a72636edabb5b7")
         (revision "1"))
-- 
2.41.0

Thanks,
--
Artyom.