aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2015-05-31 13:38:21 -0500
committerLudovic Courtès <ludo@gnu.org>2015-05-31 23:44:09 +0200
commit93e7199b3551729e892255190fdd290ba9feccca (patch)
treec5140f21a9a2822cadd85167a3194fbda10ae6d1
parentc687f73110e09f32d58e0835efdde7b340cb0202 (diff)
downloadguix-93e7199b3551729e892255190fdd290ba9feccca.tar
guix-93e7199b3551729e892255190fdd290ba9feccca.tar.gz
gnu: Add guile-gdbm-ffi.
* gnu/packages/guile.scm (guile-gdbm-ffi): New variable. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/packages/guile.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 4446ccf337..33048538e8 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,69 @@ 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)
+ (system base compile))
+
+ (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)
+
+ ;; 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
+ (compile-file gdbm.scm-dest
+ #:output-file gdbm.go-dest)))))
+ (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