guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] guile-gdbm-ffi


From: Christopher Allan Webber
Subject: Re: [PATCH] guile-gdbm-ffi
Date: Sun, 31 May 2015 13:59:21 -0500

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

>From b7f67bb064e02075b38c5c559895d33b784cfccf Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <address@hidden>
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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]