gnu: bdb-4.8, bdb-5.3: Fix build on arm.

* gnu/packages/patches/bdb-4-5-configure.patch: New file.
* gnu/local.mk [dist_patch_DATA]: Register file.
* gnu/packages/dbm.scm (bdb-4.8)[arguments]<#:phases>: Add
'bdb-configure-patch on arm.
(bdb-6)[arguments]: Copy-paste the arguments from bdb-4.8 without the
additional phase.

Change-Id: Id75bbb519006f3b3871a23ba3d668e0ef24e6a7a
Co-authored-by: Andreas Enge <andreas@enge.fr>
Co-authored-by: Brennan Vincent <brennan@umanwizard.com>
This commit is contained in:
Vagrant Cascadian 2025-07-19 11:02:42 -07:00 committed by Andreas Enge
parent 9d26fe0758
commit a41eca569f
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3
3 changed files with 323 additions and 1 deletions

View file

@ -1051,6 +1051,7 @@ dist_patch_DATA = \
%D%/packages/patches/bash-linux-pgrp-pipe.patch \
%D%/packages/patches/bastet-change-source-of-unordered_set.patch \
%D%/packages/patches/bc-fix-cross-compilation.patch \
%D%/packages/patches/bdb-4-5-configure.patch \
%D%/packages/patches/bdb-5.3-atomics-on-gcc-9.patch \
%D%/packages/patches/biboumi-cmake-ignore-git.patch \
%D%/packages/patches/brightnessctl-elogind-support.patch \

View file

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2016, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013, 2015, 2025 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2016, 2017, 2018, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017, 2018 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
@ -9,6 +9,7 @@
;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2021 LuHui <luhux76@gmail.com>
;;; Copyright © 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2025 Brennan Vincent <brennan@umanwizard.com>
;;;
;;; This file is part of GNU Guix.
;;;
@ -119,6 +120,14 @@
(symlink (string-append automake-files "/" file) file))
(for-each replace '("config.sub" "config.guess"
"install-sh"))))))
#$@(if (target-arm?)
#~((add-after 'unpack 'bdb-configure-patch
(lambda _
(invoke
"patch" "-p1" "-i"
#$(local-file
(search-patch "bdb-4-5-configure.patch"))))))
#~())
(add-before 'configure 'pre-configure
(lambda _
(chdir "dist")
@ -173,6 +182,60 @@ SQL, Key/Value, XML/XQuery or Java Object storage for their data model.")
(base32
"1yx8wzhch5wwh016nh0kfxvknjkafv6ybkqh6nh7lxx50jqf5id9"))
(patches '())))
;; Copy-paste the arguments from bdb-4.8 and drop the
;; 'bdb-configure patch phase.
(arguments
(list #:tests? #f ; no check target available
#:disallowed-references '("doc")
#:out-of-source? #true
#:configure-flags
#~(list
"CFLAGS=-g -O2 -Wno-error=implicit-function-declaration"
;; 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")
#: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"))))))
;; 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))))

View file

@ -0,0 +1,258 @@
Taken from https://lists.debian.org/debian-qa-packages/2024/10/msg00088.html,
modified to also be applicable to bdb-5.3
by Vagrant Cascadian <vagrant@debian.org>
diff -ur db-4.8.30-pristine/dist/aclocal/mutex.m4 dist/aclocal/mutex.m4
--- db-4.8.30-pristine/dist/aclocal/mutex.m4 2025-07-19 10:38:23.425962695 -0700
+++ dist/aclocal/mutex.m4 2025-07-19 10:40:42.146993750 -0700
@@ -4,12 +4,12 @@
AC_DEFUN(AM_PTHREADS_SHARED, [
AC_TRY_RUN([
#include <pthread.h>
-main() {
+int main() {
pthread_cond_t cond;
pthread_mutex_t mutex;
pthread_condattr_t condattr;
pthread_mutexattr_t mutexattr;
- exit (
+ return (
pthread_condattr_init(&condattr) ||
pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED) ||
pthread_mutexattr_init(&mutexattr) ||
@@ -29,7 +29,7 @@
pthread_mutex_t mutex;
pthread_condattr_t condattr;
pthread_mutexattr_t mutexattr;
- exit (
+ return (
pthread_condattr_init(&condattr) ||
pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED) ||
pthread_mutexattr_init(&mutexattr) ||
@@ -46,12 +46,12 @@
AC_DEFUN(AM_PTHREADS_PRIVATE, [
AC_TRY_RUN([
#include <pthread.h>
-main() {
+int main() {
pthread_cond_t cond;
pthread_mutex_t mutex;
pthread_condattr_t condattr;
pthread_mutexattr_t mutexattr;
- exit (
+ return (
pthread_condattr_init(&condattr) ||
pthread_mutexattr_init(&mutexattr) ||
pthread_cond_init(&cond, &condattr) ||
@@ -69,7 +69,7 @@
pthread_mutex_t mutex;
pthread_condattr_t condattr;
pthread_mutexattr_t mutexattr;
- exit (
+ return (
pthread_condattr_init(&condattr) ||
pthread_mutexattr_init(&mutexattr) ||
pthread_cond_init(&cond, &condattr) ||
@@ -163,7 +163,7 @@
static lwp_cond_t ci = SHAREDCV;
lwp_mutex_t mutex = mi;
lwp_cond_t cond = ci;
- exit (
+ return (
_lwp_mutex_lock(&mutex) ||
_lwp_mutex_unlock(&mutex));
], [db_cv_mutex=Solaris/lwp])
@@ -178,7 +178,7 @@
mutex_t mutex;
cond_t cond;
int type = USYNC_PROCESS;
- exit (
+ return (
mutex_init(&mutex, type, NULL) ||
cond_init(&cond, type, NULL) ||
mutex_lock(&mutex) ||
@@ -193,7 +193,7 @@
mutex_t mutex;
cond_t cond;
int type = USYNC_PROCESS;
- exit (
+ return (
mutex_init(&mutex, type, NULL) ||
cond_init(&cond, type, NULL) ||
mutex_lock(&mutex) ||
@@ -213,7 +213,7 @@
# x86/gcc: FreeBSD, NetBSD, BSD/OS, Linux
AC_TRY_COMPILE(,[
#if (defined(i386) || defined(__i386__)) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -222,7 +222,7 @@
# x86_64/gcc: FreeBSD, NetBSD, BSD/OS, Linux
AC_TRY_COMPILE(,[
#if (defined(x86_64) || defined(__x86_64__)) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -245,7 +245,7 @@
AC_TRY_COMPILE(,[
#if defined(__sparc__) && defined(__GNUC__)
asm volatile ("membar #StoreStore|#StoreLoad|#LoadStore");
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -287,7 +287,7 @@
msem_init(&x, 0);
msem_lock(&x, 0);
msem_unlock(&x, 0);
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -304,7 +304,7 @@
msem_init(&x, 0);
msem_lock(&x, 0);
msem_unlock(&x, 0);
- exit(0);
+ return(0);
], [db_cv_mutex=UNIX/msem_init])
fi
@@ -326,7 +326,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if defined(__USLC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -383,7 +383,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if defined(__alpha) && defined(__DECC)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -394,7 +394,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if defined(__alpha) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -405,7 +405,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if defined(__arm__) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -416,7 +416,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if (defined(__mips) || defined(__mips__)) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -427,7 +427,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if (defined(__hppa) || defined(__hppa__)) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -438,7 +438,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if (defined(__powerpc__) || defined(__ppc__)) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -449,7 +449,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if (defined(mc68020) || defined(sun3)) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -460,7 +460,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if defined(__MVS__) && defined(__IBMC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -471,7 +471,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if defined(__s390__) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -482,7 +482,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if defined(__ia64) && defined(__GNUC__)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -493,7 +493,7 @@
if test "$db_cv_mutex" = no; then
AC_TRY_COMPILE(,[
#if defined(_UTS)
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -814,9 +814,9 @@
if test "$db_cv_atomic" = no; then
AC_TRY_COMPILE(,[
#if ((defined(i386) || defined(__i386__)) && defined(__GNUC__))
- exit(0);
+ return(0);
#elif ((defined(x86_64) || defined(__x86_64__)) && defined(__GNUC__))
- exit(0);
+ return(0);
#else
FAIL TO COMPILE/LINK
#endif
@@ -827,7 +827,7 @@
AC_TRY_LINK([
#include <sys/atomic.h>],[
volatile unsigned val = 1;
- exit (atomic_inc_uint_nv(&val) != 2 ||
+ return (atomic_inc_uint_nv(&val) != 2 ||
atomic_dec_uint_nv(&val) != 1 ||
atomic_cas_32(&val, 1, 3) != 3);
], [db_cv_atomic="solaris/atomic"])
Nur in db-4.8.30/dist/aclocal: mutex.m4~.