From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark H Weaver Newsgroups: gmane.comp.gnu.guix.devel,gmane.lisp.guile.user Subject: Re: guile-gdbm doesn't work with gdbm-1.14 Date: Sun, 18 Mar 2018 09:50:32 -0400 Message-ID: <87efkhebmf.fsf@netris.org> References: <874lldvktm.fsf@member.fsf.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1521380995 25987 195.159.176.226 (18 Mar 2018 13:49:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 18 Mar 2018 13:49:55 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cc: guix-devel@gnu.org, guile-user@gnu.org To: iyzsong@member.fsf.org (=?utf-8?B?5a6L5paH5q2m?=) Original-X-From: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sun Mar 18 14:49:51 2018 Return-path: Envelope-to: gcggd-guix-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1exYh3-0006dk-CY for gcggd-guix-devel@m.gmane.org; Sun, 18 Mar 2018 14:49:49 +0100 Original-Received: from localhost ([::1]:37974 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exYj6-0002ZU-Fc for gcggd-guix-devel@m.gmane.org; Sun, 18 Mar 2018 09:51:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1exYif-0002Xc-KT for guix-devel@gnu.org; Sun, 18 Mar 2018 09:51:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1exYie-0001aT-90 for guix-devel@gnu.org; Sun, 18 Mar 2018 09:51:29 -0400 Original-Received: from world.peace.net ([50.252.239.5]:36574) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1exYiY-0001Yd-Nc; Sun, 18 Mar 2018 09:51:22 -0400 Original-Received: from pool-72-93-29-2.bstnma.east.verizon.net ([72.93.29.2] helo=jojen) by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1exYiV-00028G-Px; Sun, 18 Mar 2018 09:51:20 -0400 In-Reply-To: <874lldvktm.fsf@member.fsf.org> (=?utf-8?B?IuWui+aWh+atpiIn?= =?utf-8?B?cw==?= message of "Sun, 18 Mar 2018 16:39:49 +0800") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 50.252.239.5 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Original-Sender: "Guix-devel" Xref: news.gmane.org gmane.comp.gnu.guix.devel:41911 gmane.lisp.guile.user:14491 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable iyzsong@member.fsf.org (=E5=AE=8B=E6=96=87=E6=AD=A6) writes: > Hello, since version 1.14, gdbm doesn't export "gdbm_errno" anymore [1], > so the guile-gdbm ffi binding code [2] need updates now (I'm not > confident to do it myself...). > > [1] http://git.gnu.org.ua/cgit/gdbm.git/commit/?id=3Dc175231e2781abd17eab= f412cfb597654a076c7b > [2] https://github.com/ijp/guile-gdbm/blob/master/gdbm.scm#L156 Here's a preliminary fix. Mark --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-gnu-guile-gdbm-ffi-Add-support-for-gdbm-1.14.patch Content-Description: [PATCH] gnu: guile-gdbm-ffi: Add support for gdbm-1.14 >From 353abb66adb756c0ad51b4784004034a8a06de8c Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sun, 18 Mar 2018 08:43:06 -0400 Subject: [PATCH] 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)[native-inputs]: New field. [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. --- gnu/local.mk | 1 + gnu/packages/guile.scm | 21 +++++++-- .../patches/guile-gdbm-ffi-support-gdbm-1.14.patch | 53 ++++++++++++++++++++++ 3 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch diff --git a/gnu/local.mk b/gnu/local.mk index 010f1417f..a03b482df 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -742,6 +742,7 @@ dist_patch_DATA = \ %D%/packages/patches/guile-1.8-cpp-4.5.patch \ %D%/packages/patches/guile-2.2-default-utf8.patch \ %D%/packages/patches/guile-default-utf8.patch \ + %D%/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch \ %D%/packages/patches/guile-linux-syscalls.patch \ %D%/packages/patches/guile-present-coding.patch \ %D%/packages/patches/guile-relocatable.patch \ diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index 1c8eaa9ec..f6f8ef9b9 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -1134,6 +1134,15 @@ inspired by the SCSH regular expression system.") (base32 "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj")))) (build-system trivial-build-system) + (inputs + `(("guile" ,guile-2.2) + ;; patch-and-repack doesn't work for git checkouts, + ;; so we must apply the patch manually. + ("patch" ,patch) + ("patch-file" ,(search-patch + "guile-gdbm-ffi-support-gdbm-1.14.patch")))) + (propagated-inputs + `(("gdbm" ,gdbm))) (arguments `(#:modules ((guix build utils)) @@ -1186,12 +1195,16 @@ inspired by the SCSH regular expression system.") (format #f "(dynamic-link \"~a/lib/libgdbm.so\")" (assoc-ref %build-inputs "gdbm")))) + ;; Apply the patch to add support for gdbm-1.14. + (let ((patch-command (string-append (assoc-ref %build-inputs "patch") + "/bin/patch")) + (patch-file (assoc-ref %build-inputs "patch-file"))) + (with-directory-excursion (dirname gdbm.scm-dest) + (format #t "applying '~a'...~%" patch-file) + (invoke patch-command "--force" "--input" patch-file))) + ;; compile to the destination (compile-file gdbm.scm-dest gdbm.go-dest))))) - (inputs - `(("guile" ,guile-2.2))) - (propagated-inputs - `(("gdbm" ,gdbm))) (home-page "https://github.com/ijp/guile-gdbm") (synopsis "Guile bindings to the GDBM library via Guile's FFI") (description 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 000000000..e6b578bdb --- /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 +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 . + ++;; Modified by Mark H Weaver 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 + -- 2.16.2 --=-=-=--