unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] guile-gdbm-ffi
@ 2015-05-31 18:44 Christopher Allan Webber
  2015-05-31 18:59 ` Christopher Allan Webber
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Allan Webber @ 2015-05-31 18:44 UTC (permalink / raw)
  To: guix-devel

Hello,

Here'a a patch for Ian Price's FFI bindings to GDBM for Guile.

Note that there's a C implementation of bindings also with the name
guile-gdbm.  In order to not cause confusion in case this is also
packaged, I chose the name guile-gdbm-ffi here.  Feel free to adjust
this or anything else if you find appropriate.

 - Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] guile-gdbm-ffi
  2015-05-31 18:44 [PATCH] guile-gdbm-ffi Christopher Allan Webber
@ 2015-05-31 18:59 ` Christopher Allan Webber
  2015-05-31 21:45   ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Allan Webber @ 2015-05-31 18:59 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

Christopher Allan Webber writes:

> Hello,
>
> Here'a a patch for Ian Price's FFI bindings to GDBM for Guile.
>
> Note that there's a C implementation of bindings also with the name
> guile-gdbm.  In order to not cause confusion in case this is also
> packaged, I chose the name guile-gdbm-ffi here.  Feel free to adjust
> this or anything else if you find appropriate.
>
>  - Chris

Annnnd I forgot the patch, sorry


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-guile-gdbm-ffi.patch --]
[-- Type: text/x-diff, Size: 3583 bytes --]

From b7f67bb064e02075b38c5c559895d33b784cfccf Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <cwebber@dustycloud.org>
Date: Sun, 31 May 2015 13:38:21 -0500
Subject: [PATCH] gnu: Add guile-gdbm-ffi

* gnu/packages/guile.scm (guile-gdbm-ffi): New variable.
---
 gnu/packages/guile.scm | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 4446ccf..2a033bb 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -38,6 +38,7 @@
   #:use-module (gnu packages base)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages gdbm)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -475,4 +476,72 @@ slightly from miniKanren mainline.
 See http://minikanren.org/ for more on miniKanren generally.")
     (license expat)))
 
+
+;; There are two guile-gdbm packages, one using the FFI and one with
+;; direct C bindings, hence the verbose name.
+
+(define-public guile-gdbm-ffi
+  (package
+    (name "guile-gdbm-ffi")
+    (version "20120209.fa1d5b6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/ijp/guile-gdbm.git")
+                    (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
+              (sha256
+               (base32
+                "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules
+       ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let* ((out (assoc-ref %outputs "out"))
+                (module-dir (string-append out "/share/guile/site/2.0"))
+                (source (assoc-ref %build-inputs "source"))
+                (doc (string-append out "/share/doc"))
+                (guild (string-append (assoc-ref %build-inputs "guile")
+                                      "/bin/guild"))
+                (gdbm.scm-dest
+                 (string-append module-dir "/gdbm.scm"))
+                (gdbm.go-dest
+                 (string-append module-dir "/gdbm.go")))
+           ;; Make installation directories.
+           (mkdir-p module-dir)
+           (mkdir-p doc)
+
+           ;; Switch directory for compiling and installing
+           (chdir source)
+
+           ;; Compile and install files
+           (setenv "GUILE_AUTO_COMPILE" "0")
+           ;; copy the source
+           (copy-file "gdbm.scm" gdbm.scm-dest)
+
+           ;; Patch the FFI
+           (substitute* gdbm.scm-dest
+             (("\\(dynamic-link \"libgdbm\"\\)")
+              (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
+                      (assoc-ref %build-inputs "gdbm"))))
+
+           ;; compile to the destination
+           (unless (zero? (system* guild "compile"
+                                   "-L" module-dir
+                                   "-o" gdbm.go-dest
+                                   gdbm.scm-dest))
+             (error (format #f "Failed to compile gdbm.go!")))))))
+    (inputs
+     `(("guile" ,guile-2.0)))
+    (propagated-inputs
+     `(("gdbm" ,gdbm)))
+    (home-page "https://github.com/ijp/guile-gdbm")
+    (synopsis "Guile bindings to the GDBM library via Guile's FFI")
+    (description
+     "Guile bindings to the GDBM key-value storage system, using
+Guile's foreign function interface.")
+    (license gpl3+)))
+
 ;;; guile.scm ends here
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] guile-gdbm-ffi
  2015-05-31 18:59 ` Christopher Allan Webber
@ 2015-05-31 21:45   ` Ludovic Courtès
  0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2015-05-31 21:45 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: guix-devel

Christopher Allan Webber <cwebber@dustycloud.org> skribis:

> From b7f67bb064e02075b38c5c559895d33b784cfccf Mon Sep 17 00:00:00 2001
> From: Christopher Allan Webber <cwebber@dustycloud.org>
> Date: Sun, 31 May 2015 13:38:21 -0500
> Subject: [PATCH] gnu: Add guile-gdbm-ffi
>
> * gnu/packages/guile.scm (guile-gdbm-ffi): New variable.

Applied.  I took the freedom to change it to use ‘compile-file’ instead
of spawning a process and all that.  ;-)

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-31 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-31 18:44 [PATCH] guile-gdbm-ffi Christopher Allan Webber
2015-05-31 18:59 ` Christopher Allan Webber
2015-05-31 21:45   ` Ludovic Courtès

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).