GNU bug report logs - #58398
[core-updates] gnu: dbm: Regenerate Autotools files.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Maxime Devos <maximedevos@HIDDEN>; Keywords: patch; dated Sun, 9 Oct 2022 17:23:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Added tag(s) patch. Request was from Maxime Devos <maximedevos@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Oct 2022 17:23:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 09 13:23:00 2022
Received: from localhost ([127.0.0.1]:44890 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oha0x-0006wa-MQ
	for submit <at> debbugs.gnu.org; Sun, 09 Oct 2022 13:23:00 -0400
Received: from lists.gnu.org ([209.51.188.17]:40246)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1oha0v-0006wT-UY
 for submit <at> debbugs.gnu.org; Sun, 09 Oct 2022 13:22:58 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51680)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maximedevos@HIDDEN>)
 id 1oha0v-0000Zb-PH
 for guix-patches@HIDDEN; Sun, 09 Oct 2022 13:22:57 -0400
Received: from michel.telenet-ops.be ([2a02:1800:110:4::f00:18]:48714)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maximedevos@HIDDEN>)
 id 1oha0q-0002Yu-Pv
 for guix-patches@HIDDEN; Sun, 09 Oct 2022 13:22:57 -0400
Received: from localhost.localdomain
 ([IPv6:2a02:1811:8c09:9d00:5dba:d409:33f7:a16])
 by michel.telenet-ops.be with bizsmtp
 id VtNm2800D20ykKC06tNm3k; Sun, 09 Oct 2022 19:22:48 +0200
From: Maxime Devos <maximedevos@HIDDEN>
To: guix-patches@HIDDEN
Subject: [core-updates] gnu: dbm: Regenerate Autotools files.
Date: Sun,  9 Oct 2022 19:22:44 +0200
Message-Id: <20221009172244.26683-1-maximedevos@HIDDEN>
X-Mailer: git-send-email 2.37.3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22;
 t=1665336168; bh=hV9q1prn4lempa1Qtp1tyTFQ7vBMJ3QcJWnpQZ7kpaY=;
 h=From:To:Cc:Subject:Date;
 b=ltCbsULuzw1nteFfkBXeg1QIFskIMis+x4I3JG/XhG2NwR52YrXJEd20A9W4HYxMx
 ifgvdNJjzISrp74YtT6evy113WJ+PUXlDx+xN5l4tVeYqAePP+hAgdvK31Loi7SzMh
 557aHhOnRAh3hXWerNYP5Qfy5DVWASxTKhi6VWvEJeHHlNrN3kqREXN+uJoW8emOZH
 /Lud/ZRNnzUujCnY+k3OUo0nCVieDqCkVm7hrSQQmmlf0XhwWgmxWMxAoh+hiXBRaB
 0+1jW0VrBlllOp//uDQURViANcKOJQn3qP5cTyANT4BXEP2l8t1PWQK/4pw6zIDvAM
 bMrrlKVXgcMfg==
Received-SPF: pass client-ip=2a02:1800:110:4::f00:18;
 envelope-from=maximedevos@HIDDEN; helo=michel.telenet-ops.be
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.6 (/)
X-Debbugs-Envelope-To: submit
Cc: Maxime Devos <maximedevos@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

This way, overriding the 'detection of 'build' isn't needed anymore.

I switched from 'config' to 'automake' to prevent a hang of
'./pre-inst-env guix build bdb@HIDDEN' with ever-increasing memory usage,
presumably indicating a cycle.

Build-tested on a x86_64-linux with:

$ ./pre-inst-env guix build --system=x86_64-linux bdb@4 bdb@5 bdb@6
$ ./pre-inst-env guix build --system=x86_64-linux --target=aarch64-linux-gnu bdb@4 bdb@5 bdb@6

It could not be tested with a non-x86_64 system (aarch64-linux) because of
an (presumably unrelated) coreutils build failure.

* gnu/packages/dbm.scm (bdb-snippet): New procedure.
(bdb-4.8)[source]: Add the snippet.
[arguments]: Copy "config.sub"," "config.guess" and "install-sh" in a new
'boostrap phase', this time from automake.  Move macros from aclocal_java
to aclocal.  Move configure flags to #:configure-flags.  Remove 'configure'
phase, instead add a pre-configure phase for adjusting Makefile.in and use
'#:out-of-source' to perform an out-of-source build.  Run "s_config" to fix up
the version numbers.
(bdb-5.3)[source]: Inherit from bdb-4.8's source, to get the snippet.
(bdb-6)[source]: Likewise, and be careful to not add a patch.
---
 gnu/packages/dbm.scm | 149 ++++++++++++++++++++++++-------------------
 1 file changed, 82 insertions(+), 67 deletions(-)

diff --git a/gnu/packages/dbm.scm b/gnu/packages/dbm.scm
index 8c49094697..4a8acb7ab6 100644
--- a/gnu/packages/dbm.scm
+++ b/gnu/packages/dbm.scm
@@ -6,7 +6,7 @@
 ;;; Copyright © 2018 Mark H Weaver <mhw@HIDDEN>
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@HIDDEN>
 ;;; Copyright © 2021 Leo Le Bouter <lle-bout@HIDDEN>
-;;; Copyright © 2021 Maxime Devos <maximedevos@HIDDEN>
+;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,6 +29,7 @@ (define-module (gnu packages dbm)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix build-system gnu)
   #:use-module (guix utils)
   #:use-module (ice-9 match))
@@ -38,6 +39,29 @@ (define-module (gnu packages dbm)
 ;;; This module has been separated from (gnu packages databases) to reduce the
 ;;; number of module references for core packages.
 
+(define bdb-snippet
+  ;; Remove some bundled and generated files.  Some of the old
+  ;; Autotools files are too old for some architectures
+  ;; (e.g. aarch64 and powerpc64le).
+  #~(begin
+      (for-each delete-file-recursively
+                '("dist/configure"
+                  "dist/config.sub"
+                  "dist/config.guess"
+                  "dist/install-sh"
+                  "dist/ltmain.sh"
+                  "dist/aclocal/libtool.m4"
+                  "dist/aclocal/ltoptions.m4"
+                  "dist/aclocal/ltsugar.m4"
+                  "dist/aclocal/ltversion.m4"
+                  "dist/aclocal/lt~obsolete.m4"))
+      (substitute* "dist/configure.ac"
+        ;; Placate 'automake'.
+        (("AC_DEFINE\\(DB_WIN32\\)")
+         "AC_DEFINE(DB_WIN32, [], [Description])")
+        (("AC_DEFINE\\(HAVE_SYSTEM_INCLUDE_FILES\\)")
+         "AC_DEFINE(HAVE_SYSTEM_INCLUDE_FILES, [], [Description])"))))
+
 (define-public bdb-4.8
   (package
     (name "bdb")
@@ -51,76 +75,65 @@ (define-public bdb-4.8
              (sha256
               (base32
                "0ampbl2f0hb1nix195kz1syrqqxpmvnvnfvphambj7xjrl3iljg0"))
-             (patches (search-patches "bdb-5.3-atomics-on-gcc-9.patch"))))
+             (patches (search-patches "bdb-5.3-atomics-on-gcc-9.patch"))
+             (modules '((guix build utils)
+                        (srfi srfi-1)))
+             (snippet bdb-snippet)))
     (build-system gnu-build-system)
     (outputs '("out"                             ; programs, libraries, headers
                "doc"))                           ; 94 MiB of HTML docs
     (arguments
-     `(#:tests? #f                            ; no check target available
-       #:disallowed-references ("doc")
-       #:phases
-       (modify-phases %standard-phases
-         ;; The configure script is too old to recognise aarch64 and
-         ;; powerpc64le as valid architectures.  The trick below works
-         ;; for "--build", but not for "--host", so update config.sub.
-         ,@(if (and (%current-target-system)
-                    (or (target-ppc64le? (%current-target-system))
-                        (target-aarch64? (%current-target-system))))
-               `((add-after 'unpack 'update-config.sub
-                   (lambda* (#:key native-inputs #:allow-other-keys)
-                     (delete-file "dist/config.sub")
-                     (symlink
-                      (search-input-file native-inputs "/bin/config.sub")
-                      "dist/config.sub"))))
-               '())
-         (replace 'configure
-           (lambda* (#:key target outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (doc (assoc-ref outputs "doc")))
-               ;; '--docdir' is not honored, so we need to patch.
-               (substitute* "dist/Makefile.in"
-                 (("docdir[[:blank:]]*=.*")
-                  (string-append "docdir = " doc "/share/doc/bdb")))
-
-               (chdir "build_unix")
-               (invoke "../dist/configure"
-                       (string-append "--prefix=" out)
-                       (string-append "CONFIG_SHELL=" (which "bash"))
-                       (string-append "SHELL=" (which "bash"))
-
-                       ;; Bdb's config script doesn't recognize very many
-                       ;; architectures, and is a dependant on the 'config'
-                       ;; package, so we manually define the build target.
-                       ,@(match (%current-system)
-                           ("aarch64-linux"
-                            '("--build=aarch64-unknown-linux-gnu"))
-                           ("powerpc64le-linux"
-                            '("--build=powerpc64le-unknown-linux-gnu"))
-                           ("riscv64-linux"
-                            '("--build=riscv64-unknown-linux-gnu"))
-                           (_ '()))
+     (list #:tests? #f                        ; no check target available
+           #:disallowed-references '("doc")
+           #:out-of-source? #true
+           #:configure-flags
+           #~(list
+              ;; Remove 7 MiB of .a files.
+              "--disable-static"
 
-                       ,@(if (%current-target-system)         ; cross building
-                             '((string-append "--host=" target))
-                             '())
+              ;; The compatibility mode is needed by some packages,
+              ;; notably iproute2.
+              "--enable-compat185"
 
-                       ;; Remove 7 MiB of .a files.
-                       "--disable-static"
-
-                       ;; The compatibility mode is needed by some packages,
-                       ;; notably iproute2.
-                       "--enable-compat185"
-
-                       ;; The following flag is needed so that the inclusion
-                       ;; of db_cxx.h into C++ files works; it leads to
-                       ;; HAVE_CXX_STDHEADERS being defined in db_cxx.h.
-                       "--enable-cxx")))))))
-    (native-inputs
-     (if (and (%current-target-system)
-              (or (target-ppc64le? (%current-target-system))
-                  (target-aarch64? (%current-target-system))))
-         `(("config" ,config)) ; for config.sub
-         '()))
+              ;; The following flag is needed so that the inclusion
+              ;; of db_cxx.h into C++ files works; it leads to
+              ;; HAVE_CXX_STDHEADERS being defined in db_cxx.h.
+              "--enable-cxx")
+           #:phases
+           #~(modify-phases %standard-phases
+               (replace 'bootstrap
+                 (lambda* (#:key inputs native-inputs outputs
+                           #:allow-other-keys #:rest arguments)
+                   (with-directory-excursion "dist"
+                     (for-each (lambda (x)
+                                 (install-file x "aclocal"))
+                               (find-files "aclocal_java"))
+                     (apply (assq-ref %standard-phases 'bootstrap) arguments)
+                     (let ((automake-files (search-input-directory
+                                            (or native-inputs inputs)
+                                            "share/automake-1.16")))
+                       (define (replace file)
+                         (symlink (string-append automake-files "/" file) file))
+                       (for-each replace '("config.sub" "config.guess"
+                                           "install-sh"))))))
+               (add-before 'configure 'pre-configure
+                 (lambda _
+                   (chdir "dist")
+                   ;; '--docdir' is not honored, so we need to patch.
+                   (substitute* "Makefile.in"
+                     (("docdir[[:blank:]]*=.*")
+                      (string-append "docdir = " #$output:doc
+                                     "/share/doc/bdb")))
+                   ;; Replace __EDIT_DB_VERSION__... by actual version numbers.
+                   ;; s_config is responsible for this, but also runs autoconf
+                   ;; again, so patch out the autoconf bits.
+                   (substitute* "s_config"
+                     (("^.*(aclocal|autoconf|autoheader|config\\.hin).*$") "")
+                     (("^.*auto4mte.*$") "")
+                     (("rm (.*) configure") "")
+                     (("chmod (.*) config.guess(.*)$") ""))
+                   (invoke "sh" "s_config"))))))
+    (native-inputs (list autoconf automake libtool))
     (synopsis "Berkeley database")
     (description
      "Berkeley DB is an embeddable database allowing developers the choice of
@@ -135,7 +148,7 @@ (define-public bdb-5.3
     (name "bdb")
     (version "5.3.28")
     (source (origin
-              (method url-fetch)
+              (inherit (package-source bdb-4.8))
               (uri (string-append "https://download.oracle.com/berkeley-db/db-"
                                   version ".tar.gz"))
               (sha256
@@ -149,12 +162,14 @@ (define-public bdb-6
     (name "bdb")
     (version "6.2.32")
     (source (origin
+              (inherit (package-source bdb-4.8))
               (method url-fetch)
               (uri (string-append "https://download.oracle.com/berkeley-db/db-"
                                   version ".tar.gz"))
               (sha256
                (base32
-                "1yx8wzhch5wwh016nh0kfxvknjkafv6ybkqh6nh7lxx50jqf5id9"))))
+                "1yx8wzhch5wwh016nh0kfxvknjkafv6ybkqh6nh7lxx50jqf5id9"))
+              (patches '())))
     ;; Starting with version 6, BDB is distributed under AGPL3. Many individual
     ;; files are covered by the 3-clause BSD license.
     (license (list license:agpl3+ license:bsd-3))))

base-commit: ccc2658e2a111590ec25e308946e47a24d357785
prerequisite-patch-id: 87e197146284fb770478e0c2d73027e68ee3db6d
prerequisite-patch-id: 32ea6453c34258e3ac8a8766aa14ebb5fe1f5f88
prerequisite-patch-id: b359f1dbbcd6374492720ebd67b0212bd3dfe246
-- 
2.37.3





Acknowledgement sent to Maxime Devos <maximedevos@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#58398; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 21 Oct 2022 09:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.