summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2018-03-18 08:43:06 -0400
committerMark H Weaver <mhw@netris.org>2018-03-18 23:30:31 -0400
commit56f31a9fd5806d490570550a0446d41502c6c6eb (patch)
tree2862482a33280d2e6095f6dbedb59699b6f0e27c /gnu/packages/patches
parent07e36357a51a62ce14afd19a3187ddf6a813cf0a (diff)
downloadguix-56f31a9fd5806d490570550a0446d41502c6c6eb.tar.gz
gnu: guile-gdbm-ffi: Add support for gdbm-1.14.
* gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.

* gnu/packages/guile.scm (guile-gdbm-ffi)[inputs]: Move above arguments.  Add
the patch, and the 'patch' program.
[propagated-inputs]: Move above arguments.
[arguments]: In the builder, add code to apply the patch.
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch b/gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch
new file mode 100644
index 0000000000..e6b578bdb7
--- /dev/null
+++ b/gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch
@@ -0,0 +1,53 @@
+From 1da99396dc65993ba34ac0370ca5d6acda6a3322 Mon Sep 17 00:00:00 2001
+From: Mark H Weaver <mhw@netris.org>
+Date: Sun, 18 Mar 2018 07:02:37 -0400
+Subject: [PATCH] Add support for gdbm-1.14.
+
+As of gdbm-1.14, 'gdbm_errno' no longer exists as a binary interface.
+It has been replaced by 'gdbm_errno_location', a function that returns
+int*.  We now use this new interface if it's available.
+---
+ gdbm.scm | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/gdbm.scm b/gdbm.scm
+index b92992f..4d38cc3 100644
+--- a/gdbm.scm
++++ b/gdbm.scm
+@@ -17,6 +17,9 @@
+ ;; You should have received a copy of the GNU General Public License
+ ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+ 
++;; Modified by Mark H Weaver <mhw@netris.org> in March 2018 to support
++;; gdbm-1.14 with its new 'gdbm_errno_location' interface.
++
+ (define-module (gdbm)
+   #:use-module (system foreign)
+   #:use-module (rnrs bytevectors)
+@@ -151,10 +154,21 @@
+ 
+ ;;; errors
+ 
+-(define %errno (dynamic-pointer "gdbm_errno" libgdbm))
++(define %list-int
++  (list int))
++
++(define (dereference-int ptr)
++  (apply (lambda (errno) errno)
++         (parse-c-struct ptr %list-int)))
++
++(define %errno-location
++  (or (false-if-exception
++       (let ((func (dynamic-func "gdbm_errno_location" libgdbm)))
++         (pointer->procedure '* func '())))
++      (const (dynamic-pointer "gdbm_errno" libgdbm))))
+ 
+ (define (gdbm-errno)
+-  (pointer-address (dereference-pointer %errno)))
++  (dereference-int (%errno-location)))
+ 
+ (define (gdbm-error)
+   (error (pointer->string (%gdbm-strerror (gdbm-errno)))))
+-- 
+2.16.2
+