unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
To: 69443@debbugs.gnu.org
Cc: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>,
	mail@aartaka.me, glv@posteo.net, cox.katherine.e+guix@gmail.com,
	me@bonfacemunyoki.com, sharlatanus@gmail.com, jgart@dismail.de
Subject: [bug#69443] [PATCH] gnu: guile-gsl: Fix build.
Date: Sat,  9 Mar 2024 02:29:41 +0300	[thread overview]
Message-ID: <04ce2de3be93a1a06345350f46b29b159c3ef6a3.1709940581.git.poptsov.artyom@gmail.com> (raw)
In-Reply-To: <877ciptsq4.fsf@aartaka.me>

* gnu/packages/guile-xyz.scm (guile-gsl): Fix build.

Change-Id: Iaf653f25fd2b972e575d9c2fd1607cd490cc17db
---
 gnu/packages/guile-xyz.scm | 86 ++++++++++++++++++++++++++++----------
 1 file changed, 65 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 9ddcc626fe..1f9d1ecb3e 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -4522,31 +4522,75 @@ (define-public guile-gsl
     (package
       (name "guile-gsl")
       (version "0.0.1")
-      (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
-                  "00dy33ibvfhzs5xp65g4g8d02wy4fiamjbp3pg87cghg41q4lwkr"))))
-      (build-system guile-build-system)
+      (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 "00dy33ibvfhzs5xp65g4g8d02wy4fiamjbp3pg87cghg41q4lwkr"))))
+      (build-system gnu-build-system)
       (arguments
-       '(#:source-directory "modules"
-         #:phases
-         #~(modify-phases %standard-phases
-             (add-before 'build 'substitute-gsl-so
-               (lambda _
-                 (let ((gsl (string-append #$(this-package-input "lmdb")
-                                           "/lib/libgsl.so")))
-                   (substitute* "modules/gsl/core.scm"
-                     (("libgsl.so") gsl))))))))
+       (list
+        #:modules `(((guix build guile-build-system)
+                     #:select (target-guile-effective-version))
+                    ,@%gnu-build-system-modules)
+        #:imported-modules `((guix build guile-build-system)
+                             ,@%gnu-build-system-modules)
+        #:phases #~(modify-phases %standard-phases
+                     (add-before 'build 'substitute-gsl-so
+                       (lambda _
+                         (let ((gsl (string-append #$(this-package-input "gsl")
+                                                   "/lib/libgsl.so")))
+                           (substitute* "modules/gsl/core.scm"
+                             (("libgsl.so")
+                              gsl)))))
+                     (delete 'configure)
+                     (replace 'build
+                       (lambda* (#:key inputs #:allow-other-keys)
+                         (setenv "CC" "gcc")
+                         (setenv "GUILE_AUTO_COMPILE" "0")
+                         (invoke "make")
+                         (setenv "LD_LIBRARY_PATH" "./")
+                         (let* ((module-dir "modules")
+                                (prefix (string-length module-dir)))
+                           (for-each (lambda (file)
+                                       (let* ((base (string-drop (string-drop-right
+                                                                  file 4)
+                                                                 prefix))
+                                              (go (string-append "go" base
+                                                                 ".go")))
+                                         (invoke "guild"
+                                                 "compile"
+                                                 "-L"
+                                                 module-dir
+                                                 file
+                                                 "-o"
+                                                 go)))
+                                     (find-files module-dir "\\.scm$")))))
+                     (delete 'check) ;no tests
+                     (replace 'install
+                       (lambda* (#:key outputs #:allow-other-keys)
+                         (let* ((lib (string-append #$output "/lib"))
+                                (guile #$(this-package-input "guile"))
+                                (version (target-guile-effective-version guile))
+                                (scm (string-append "/share/guile/site/"
+                                                    version))
+                                (go (string-append "/lib/guile/" version
+                                                   "/site-ccache")))
+                           (install-file "libguilegslblas.so" lib)
+                           (copy-recursively "modules/"
+                                             (string-append #$output scm))
+                           (copy-recursively "go/"
+                                             (string-append #$output go))))))))
       (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 in Guile.")
-      (description "This package provides Guile Scheme wrapper for libgsl.so.
+      (synopsis "Bindings for GNU Scientific library in Guile")
+      (description
+       "This package provides Guile Scheme wrapper for @code{libgsl.so}.
 Only vector, matrix, and BLAS operations are covered for now.")
       (license license:gpl3+))))
 

base-commit: 38a00bc089205818a351c363a107b8ba5c99fd0d
-- 
2.41.0





  reply	other threads:[~2024-03-08 23:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27 22:56 [bug#69443] [PATCH] gnu: Add guile-gsl Artyom Bologov
2024-03-08 23:29 ` Artyom V. Poptsov [this message]
2024-04-04 11:27 ` bug#69443: " Sharlatan Hellseher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04ce2de3be93a1a06345350f46b29b159c3ef6a3.1709940581.git.poptsov.artyom@gmail.com \
    --to=poptsov.artyom@gmail.com \
    --cc=69443@debbugs.gnu.org \
    --cc=cox.katherine.e+guix@gmail.com \
    --cc=glv@posteo.net \
    --cc=jgart@dismail.de \
    --cc=mail@aartaka.me \
    --cc=me@bonfacemunyoki.com \
    --cc=sharlatanus@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).