git: cff251c080e4 - main - devel/apr1: Switch to bdb from base

From: Bernard Spil <brnrd_at_FreeBSD.org>
Date: Sun, 10 Nov 2024 11:51:08 UTC
The branch main has been updated by brnrd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cff251c080e400ccc5919f208240267531a00ffa

commit cff251c080e400ccc5919f208240267531a00ffa
Author:     Bernard Spil <brnrd@FreeBSD.org>
AuthorDate: 2024-11-10 11:47:26 +0000
Commit:     Bernard Spil <brnrd@FreeBSD.org>
CommitDate: 2024-11-10 11:47:26 +0000

    devel/apr1: Switch to bdb from base
    
     * Requires rebuilding bdb databases (if any)
    
    Reported by:    ngie, rfyu28uyeg_snkmail.com
    Differential Revision:  https://reviews.freebsd.org/D40366
---
 UPDATING                                           | 11 ++++++++
 devel/apr1/Makefile                                | 33 ++++++++++++++--------
 devel/apr1/files/patch-apr-util-1.6.3_build_dbm.m4 |  9 ++++++
 devel/apr1/pkg-message                             | 20 ++++++++++++-
 devel/apr1/pkg-plist                               |  6 ++--
 5 files changed, 63 insertions(+), 16 deletions(-)

diff --git a/UPDATING b/UPDATING
index 5a5daad9ddeb..3f1dd379d4ca 100644
--- a/UPDATING
+++ b/UPDATING
@@ -5,6 +5,17 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+20241110
+  AFFECTS: users of devel/apr1 and www/apache24
+  AUTHOR: brnrd@FreeBSD.org
+
+  The default BerkeleyDB provider for apr-util was changed from BerkeleyDB
+  5 (deprecated) to BerkeleyDB 1 from base libc. The change of version
+  results in a non-compatible database format.
+
+  After upgrading, you must rebuild all BerkeleyDB databases used by
+  apr-util (example: Apache databases created with `httxt2dbm -F db` 
+
 20241109:
   AFFECTS: all users of i386
   AUTHOR: asomers@FreeBSD.org
diff --git a/devel/apr1/Makefile b/devel/apr1/Makefile
index 96f45de7427c..ddc270e103df 100644
--- a/devel/apr1/Makefile
+++ b/devel/apr1/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	apr
 PORTVERSION=	${APR_VERSION}.${APU_VERSION}
+PORTREVISION=	1
 CATEGORIES=	devel
 MASTER_SITES=	APACHE/apr
 DISTFILES=	apr-${APR_VERSION}.tar.gz \
@@ -11,10 +12,9 @@ WWW=		https://apr.apache.org/
 
 LICENSE=	APACHE20
 
-BUILD_DEPENDS+=	automake>=1.16.1:devel/automake
 LIB_DEPENDS=	libexpat.so:textproc/expat2
 
-USES=		iconv pathfix libtool cpe
+USES=		autoreconf iconv pathfix libtool cpe
 USE_LDCONFIG=	yes
 GNU_CONFIGURE=	yes
 
@@ -30,13 +30,14 @@ OPTIONS_GROUP=		APU
 OPTIONS_DEFINE=		IPV6
 OPTIONS_GROUP_APU=	GDBM LDAP MYSQL NDBM ODBC PGSQL SQLITE
 OPTIONS_RADIO=		BERKELEYDB CRYPTO
-OPTIONS_RADIO_BERKELEYDB=	BDB BDB5
+OPTIONS_RADIO_BERKELEYDB=	BDB1 BDB5 BDB18
 OPTIONS_RADIO_CRYPTO=	SSL NSS
-OPTIONS_DEFAULT=	BDB GDBM SSL
+OPTIONS_DEFAULT=	BDB1 GDBM SSL
 
 APU_DESC=		Database support
-BDB_DESC=		Berkeley DB support (AGPLv3)
+BDB1_DESC=		Berkeley DB 1.85 support (BSD 4-clause)
 BDB5_DESC=		Berkeley DB v5 support (deprecated)
+BDB18_DESC=		Berkeley DB 18.x support (AGPLv3)
 BERKELEYDB_DESC=	Berkeley DB provider
 CRYPTO_DESC=		Cryptography provider
 NDBM_DESC=		NDBM support
@@ -44,15 +45,15 @@ NSS_DESC=		NSS crypto driver
 SSL_DESC=		OpenSSL crypto driver
 
 # APR-Util Options
-BDB_USES=		bdb:18
 BDB5_USES=		bdb:5
+BDB18_USES=		bdb:18
 GDBM_LIB_DEPENDS=	libgdbm.so:databases/gdbm
 LDAP_USES=		ldap
 MYSQL_USES=		mysql
 NSS_LIB_DEPENDS=	libnss3.so:security/nss
 ODBC_LIB_DEPENDS=	libodbc.so:databases/unixODBC
-PGSQL_USES=		pgsql
-SQLITE_USES=		sqlite
+
+QLITE_USES=		sqlite
 SSL_USES=		ssl
 
 APR_WRKDIR=	${WRKDIR}/apr-${APR_VERSION}
@@ -84,9 +85,14 @@ IPV6_VARS_OFF=		APR_CONF_ARGS+=--disable-ipv6
 # to avoid failures if previous apr_version.h is present
 APU_CPPFLAGS=	-I${APR_WRKDIR}/include
 
-BDB_VARS=	${BDB5_VARS} \
-		LICENSE_COMB=dual LICENSE+=AGPLv3
-BDB5_VARS=	APU_CONF_ARGS+=--with-berkeley-db=${BDB_INCLUDE_DIR}:${BDB_LIB_DIR}
+BDB1_VARS=	LICENSE_COMB=dual LICENSE+=BSD4CLAUSE \
+		APU_CONF_ARGS+="--with-berkeley-db=/usr/include:/usr/lib \
+		--with-dbm=db1"
+BDB5_VARS=	APU_CONF_ARGS+="--with-berkeley-db=${BDB_INCLUDE_DIR}:${BDB_LIB_DIR} \
+		--with-dbm=db185"
+BDB18_VARS=	LICENSE_COMB=dual LICENSE+=AGPLv3 \
+		APU_CONF_ARGS+="--with-berkeley-db=${BDB_INCLUDE_DIR}:${BDB_LIB_DIR} \
+		--with-dbm=db185"
 GDBM_VARS=	APU_CONF_ARGS+=--with-gdbm=${LOCALBASE}
 LDAP_VARS=	APU_CONF_ARGS+="--with-ldap-include=${LOCALBASE}/include \
 			--with-ldap-lib=${LOCALBASE}/lib --with-ldap=ldap"
@@ -118,8 +124,11 @@ APU_CONF_ENV+=	${CONFIGURE_ENV:O:u} CC="${CC}" CFLAGS="${CFLAGS}" CPPFLAGS="${AP
 
 .include <bsd.port.options.mk>
 
-.if !${PORT_OPTIONS:MBDB} && !${PORT_OPTIONS:MBDB5}
+.if !${PORT_OPTIONS:MBDB1} && !${PORT_OPTIONS:MBDB18} && !${PORT_OPTIONS:MBDB5}
 APU_CONF_ARGS+=	--without-berkeley-db
+PLIST_SUB+=	BERKELEYDB="@comment "
+.else
+PLIST_SUB+=	BERKELEYDB=""
 .endif
 
 .if ${PORT_OPTIONS:MSSL} || ${PORT_OPTIONS:MNSS}
diff --git a/devel/apr1/files/patch-apr-util-1.6.3_build_dbm.m4 b/devel/apr1/files/patch-apr-util-1.6.3_build_dbm.m4
index 6bb9ed5e8343..7f8a6b221a91 100644
--- a/devel/apr1/files/patch-apr-util-1.6.3_build_dbm.m4
+++ b/devel/apr1/files/patch-apr-util-1.6.3_build_dbm.m4
@@ -11,6 +11,15 @@ index 57bd131f..5cbee4b3 100644
              # We generate a separate cache variable for each prefix and libname
              # we search under.  That way, we avoid caching information that
              # changes if the user runs `configure' with a different set of
+@@ -293,7 +293,7 @@ AC_DEFUN([APU_CHECK_DB1], [
+   APU_CHECK_BERKELEY_DB(1, 0, 0,
+     "$places",
+     "db1/db.h db.h",
+-    "db1"
++    "c db1"
+   )
+   if test "$apu_have_db" = "1"; then
+     apu_db_version=1
 @@ -432,7 +432,15 @@ AC_DEFUN([APU_CHECK_DB], [
        AC_MSG_ERROR(Berkeley db$db_major not found)
      fi
diff --git a/devel/apr1/pkg-message b/devel/apr1/pkg-message
index ccf5adca9f44..e99ab3e48f04 100644
--- a/devel/apr1/pkg-message
+++ b/devel/apr1/pkg-message
@@ -1,9 +1,27 @@
 [
-{ type: install
+{
+  type: install
   message: <<EOM
 The Apache Portable Runtime project removed support for FreeTDS with
 version 1.6. Users requiring MS-SQL connectivity must migrate
 configurations to use the added ODBC driver and FreeTDS' ODBC features.
 EOM
 }
+{
+  type: upgrade
+  message: <<EOM
+The default BerkeleyDB implementation switched from deprecated
+version 5 from ports to BerkeleyDB 1 from base libc. Any BerkeleyDB
+databases created with apr-util MUST be rebuilt. Verify your database
+files using
+
+  $ file file.dbm
+
+and check they report
+
+  Berkeley DB 1.85 (Hash, version 2, native byte-order)
+
+other database formats (GDBM etc.) are not affected.
+EOM
+}
 ]
diff --git a/devel/apr1/pkg-plist b/devel/apr1/pkg-plist
index a04ebe020dca..b0f17002c831 100644
--- a/devel/apr1/pkg-plist
+++ b/devel/apr1/pkg-plist
@@ -95,9 +95,9 @@ lib/apr-util-1/.keep.me
 %%SQLITE%%lib/apr-util-1/apr_dbd_sqlite3-1.so
 %%SQLITE%%lib/apr-util-1/apr_dbd_sqlite3.a
 %%SQLITE%%lib/apr-util-1/apr_dbd_sqlite3.so
-%%BDB%%lib/apr-util-1/apr_dbm_db-1.so
-%%BDB%%lib/apr-util-1/apr_dbm_db.a
-%%BDB%%lib/apr-util-1/apr_dbm_db.so
+%%BERKELEYDB%%lib/apr-util-1/apr_dbm_db-1.so
+%%BERKELEYDB%%lib/apr-util-1/apr_dbm_db.a
+%%BERKELEYDB%%lib/apr-util-1/apr_dbm_db.so
 %%GDBM%%lib/apr-util-1/apr_dbm_gdbm-1.so
 %%GDBM%%lib/apr-util-1/apr_dbm_gdbm.a
 %%GDBM%%lib/apr-util-1/apr_dbm_gdbm.so