Artyom Bologov wrote 1 years ago
(name . Guix patches)(address . guix-patches@gnu.org)
Hello Guix,
This patch adds guile-lmdb module.
From 9d67b6438d8e5c42d6d4e9c8eca46038c80f05ea Mon Sep 17 00:00:00 2001
From: Artyom Bologov <aartaka@protonmail.com>
Date: Wed, 24 Jan 2024 23:20:52 +0400
Subject: [PATCH] gnu: Add guile-lmdb.
* gnu/packages/guile-xyz.scm (guile-lmdb): New variable.
---
gnu/packages/guile-xyz.scm | 41 ++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
Toggle diff (54 lines)
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 9c4c308d05..08f4a67d07 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -2012,6 +2012,47 @@ (define-public guile-dbd-mysql
for MySQL.")
(license license:gpl2+)))
+(define-public guile-lmdb
+ (package
+ (name "guile-lmdb")
+ (version "0.0.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/aartaka/guile-lmdb")
+ (commit "438143ca9ba157faec6f4c2740092c31c733fbfe")))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0p43c8ppbhzpi944in0z2jqr7acl8pm7s1x0p5f0idqda6n6f828"))))
+ (build-system guile-build-system)
+ (arguments
+ '(#:source-directory "modules"
+ #:phases (modify-phases %standard-phases
+ (add-before 'build 'substitute-lmdb-so
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((lmdb (string-append (assoc-ref inputs "lmdb")
+ "/lib/liblmdb.so")))
+ (substitute*
+ '("modules/lmdb/lmdb.scm")
+ (("liblmdb.so")
+ lmdb))
+ #t))))))
+ (native-inputs (list guile-3.0))
+ (inputs (list guile-3.0 lmdb))
+ (home-page "https://github.com/aartaka/guile-lmdb")
+ (synopsis "Bindings for LMDB (Lightning Memory-Mapped Database) in Guile.")
+ (description "Scheme wrapper around liblmdb.so.
+Most name are the same as LMDB ones, except for prefix absence.
+Several conveniences are added on top:
+@itemize
+@item @code{call-with-env-and-txn} and @code{call-with-cursor} wrappers.
+@item @code{for-cursor} procedure for cursor iteration.
+@item @code{val} and @code{stat} types.
+@item Error signaling instead of integer return values.
+@end itemize\n")
+ (license license:gpl3+)))
+
(define-public guile-config
(package
(name "guile-config")
--
2.41.0
Thanks,
--
Artyom Bologov