[PATCH] gnu: Add guile-gsl.

  • Done
  • quality assurance status badge
Details
3 participants
  • Artyom Bologov
  • Artyom V. Poptsov
  • Sharlatan Hellseher
Owner
unassigned
Submitted by
Artyom Bologov
Severity
normal

Debbugs page

A
A
Artyom Bologov wrote on 27 Feb 14:56 -0800
(name . Guix patches)(address . guix-patches@gnu.org)
877ciptsq4.fsf@aartaka.me
Hi y'all,

This is both a patch submission and a call for help—I'm far out of my
waters with this package and am not sure of the proper Guix-y way to
build it.

So the build sequence for Guile GSL is:
(1) Compile a bundled libguilegslblas.so with a C compiler, using the GSL
libraries from package inputs.
(2) Put proper paths to the GSL libraries and libguilegslblas into the
Scheme files.
(3) Compile Scheme files as per guile-build-system.

I've got (2) and (3) more or less working. The problem is: which build
system should I use and how do I synthesize GNU build system (makefile,
libguilegslblas.so, (1)) and Guile one?

You can find my draft (doesn't build and is not usable in general) patch
attached below. Any help appreciated!
From 5bd38a674fff008c189d1c39495d771354c945fb Mon Sep 17 00:00:00 2001
From: Artyom Bologov <mail@aartaka.me>
Date: Wed, 28 Feb 2024 02:54:31 +0400
Subject: [PATCH] gnu: Add guile-gsl.

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

Toggle diff (47 lines)
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index b34472d5bd..6b9492c4b7 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -4474,6 +4474,40 @@ (define-public guile-ffi-cblas
function: raw, typed, and functional.")
(license license:lgpl3+))))
+(define-public guile-gsl
+ (let ((commit "8540bcb6afa9be37153852255608d26d5a4df9dd")
+ (revision "0"))
+ (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)
+ (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))))))))
+ (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.
+Only vector, matrix, and BLAS operations are covered for now.")
+ (license license:gpl3+))))
+
(define-public guile-ffi-fftw
(let ((commit "294ad9e7491dcb40026d2fec9be2af05263be1c0")
(revision "2"))
--
2.41.0
Thanks,
--
Artyom Bologov.
A
A
Artyom V. Poptsov wrote on 8 Mar 15:29 -0800
[PATCH] gnu: guile-gsl: Fix build.
(address . 69443@debbugs.gnu.org)
04ce2de3be93a1a06345350f46b29b159c3ef6a3.1709940581.git.poptsov.artyom@gmail.com
* 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(-)

Toggle diff (105 lines)
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
S
S
Sharlatan Hellseher wrote on 4 Apr 04:27 -0700
[PATCH] gnu: Add guile-gsl.
(address . 69443-done@debbugs.gnu.org)
87il0x5pwt.fsf@gmail.com
Hi,

Patch applied based on https://issues.guix.gnu.org/69820.

Thanks,
Oleg
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEmEeB3micIcJkGAhndtcnv/Ys0rUFAmYOjpIACgkQdtcnv/Ys
0rUDuQ//bAZpvBbnRcFHUhrhTRtMioHhMBX224ckPk30TDqStnjI/SIggnzbZv51
V4/VorZ27KIQeMFKYBIMeyMtv2Pyi8X4nZPWdcXQcEcQBQCD6xyemggu3+FHCsEp
37lpy0atmURTdNl+r2YNdhffHi4HTnMaoCyQOcyWf5tRcbXSEpR1/HN4X5/65fjz
pf7TsJfD10p8HqWu318nHitH5v+rQkmjypOEnD3tQ1Nzkq1tpGpsTzCDHeplkF5l
+3Whoiy5zJsOrIhU4O1UA8KyFESKfE6VGGljoZUblViwJX3xXACNEohsJzUYszyB
BzpTwaQpRzi9LUML1VRqYMyGLUycHwOKphFUrE1R4coKk0/XGJlXLlwdR4hemHHU
lxblpKjQK6BmRcQYXEeNX8ryjk2l17KTalK+J6IhINl40+ontbkMeOCH84aG7o+x
jM5dEiO9zEleprb2nQOTFwd552o6LF83ojDM4M2M8uG+V4TIMAs2jduM00MOOdG0
RCd2kpdaxv2B+8S7q/GkFIgk7F33lVYLIQi7J4cKhSr1DCf29ISZxu+bQPkqAmWz
3bIg1CMySeP7ITwECujjzmgRm/5AK//wFqtOpgelKL2PY7w8jvdc+L8QG5HNpCI6
r8Ey12SAchVJZM/avyveLFiknCIlcfRZC7V7TidmUb+bnbMcSos=
=n/Le
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 69443@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 69443
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch