commit:     24c18ee750d5716d8c293ef9677c9876457ef7cd
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 29 11:51:22 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 29 11:52:13 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=24c18ee7

mail-mta/exim-4.94.2-r2: allow moving away from sys-libs/db

Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 mail-mta/exim/exim-4.94.2-r2.ebuild | 59 +++++++++++++++++++++++++++++--------
 mail-mta/exim/metadata.xml          |  2 ++
 2 files changed, 48 insertions(+), 13 deletions(-)

diff --git a/mail-mta/exim/exim-4.94.2-r2.ebuild 
b/mail-mta/exim/exim-4.94.2-r2.ebuild
index c825df4517e..1174eca77da 100644
--- a/mail-mta/exim/exim-4.94.2-r2.ebuild
+++ b/mail-mta/exim/exim-4.94.2-r2.ebuild
@@ -5,7 +5,10 @@ EAPI="7"
 
 inherit db-use toolchain-funcs multilib pam systemd
 
-IUSE="arc +dane dcc +dkim dlfunc dmarc +dnsdb doc dovecot-sasl dsn elibc_glibc 
exiscan-acl gnutls idn ipv6 ldap lmtp maildir mbx mysql nis pam perl pkcs11 
postgres +prdr proxy radius redis sasl selinux socks5 spf sqlite srs +srs-alt 
srs-native +ssl syslog tcpd +tpda X"
+IUSE="arc +dane dcc +dkim dlfunc dmarc +dnsdb doc dovecot-sasl
+dsn elibc_glibc exiscan-acl gdbm gnutls idn ipv6 ldap lmtp maildir mbx
+mysql nis pam perl pkcs11 postgres +prdr proxy radius redis sasl selinux
+socks5 spf sqlite srs +srs-alt srs-native +ssl syslog tdb tcpd +tpda X"
 REQUIRED_USE="
        arc? ( dkim spf )
        dane? ( ssl !gnutls )
@@ -26,6 +29,8 @@ REQUIRED_USE="
 # have left is to a) ignore the dependency (but that results in bug
 # #661164) or b) mask the usage of USE=dane with USE=gnutls.  Both are
 # incorrect, but b) is the only "correct" view from repoman.
+# We cannot express a required use for berkdb/gdbm/tdb because berkdb
+# and gdbm are both enabled in base profile
 
 SDIR=$([[ ${PV} == *_rc* ]]   && echo /test
         [[ ${PV} == *.*.*.* ]] && echo /fixes)
@@ -42,8 +47,10 @@ LICENSE="GPL-2"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 
~x86-solaris"
 
 COMMON_DEPEND=">=sys-apps/sed-4.0.5
-       ( >=sys-libs/db-3.2:= <sys-libs/db-6:= )
-       dev-libs/libpcre
+       dev-libs/libpcre:=
+       tdb? ( sys-libs/tdb:= )
+       !tdb? ( gdbm? ( sys-libs/gdbm:= ) )
+       !tdb? ( !gdbm? ( >=sys-libs/db-3.2:= <sys-libs/db-6:= ) )
        idn? ( net-dns/libidn:= net-dns/libidn2:= )
        perl? ( dev-lang/perl:= )
        pam? ( sys-libs/pam )
@@ -58,8 +65,9 @@ COMMON_DEPEND=">=sys-apps/sed-4.0.5
                )
        )
        ldap? ( >=net-nds/openldap-2.0.7 )
-       nis? (
-               elibc_glibc? (
+       elibc_glibc? (
+               net-libs/libnsl
+               nis? (
                        net-libs/libtirpc
                        >=net-libs/libnsl-1:=
                )
@@ -80,7 +88,6 @@ COMMON_DEPEND=">=sys-apps/sed-4.0.5
        sqlite? ( dev-db/sqlite )
        radius? ( net-dialup/freeradius-client )
        virtual/libiconv
-       elibc_glibc? ( net-libs/libnsl )
        "
        # added X check for #57206
 BDEPEND="virtual/pkgconfig"
@@ -173,6 +180,37 @@ src_configure() {
                HAVE_ICONV=yes
        EOC
 
+       # configure db implementation, Exim always needs one for its hints
+       # database, we prefer tdb and gdbm, since bdb is kind of getting
+       # less and less support
+       if use tdb ; then
+               cat >> Makefile <<- EOC
+                       USE_TDB=yes
+                       DBMLIB = -ltdb
+               EOC
+               sed -i -e 's:^USE_DB=yes:# USE_DB=yes:' Makefile || die
+               sed -i -e 's:^USE_GDBM=yes:# USE_GDBM=yes:' Makefile || die
+       elif use gdbm ; then
+               cat >> Makefile <<- EOC
+                       USE_GDBM=yes
+                       DBMLIB = -lgdbm
+               EOC
+               sed -i -e 's:^USE_DB=yes:# USE_DB=yes:' Makefile || die
+               sed -i -e 's:^USE_TDB=yes:# USE_TDB=yes:' Makefile || die
+       else
+               # use the "native" interfaces to the DBM and CDB libraries, 
support
+               # passwd and directory lookups by default
+               local DB_VERS="5.3 5.1 4.8 4.7 4.6 4.5 4.4 4.3 4.2 3.2"
+               cat >> Makefile <<- EOC
+                       USE_DB=yes
+                       # keep include in CFLAGS because exim.h -> dbstuff.h -> 
db.h
+                       CFLAGS += -I$(db_includedir ${DB_VERS})
+                       DBMLIB = -l$(db_libname ${DB_VERS})
+               EOC
+               sed -i -e 's:^USE_GDBM=yes:# USE_GDBM=yes:' Makefile || die
+               sed -i -e 's:^USE_TDB=yes:# USE_TDB=yes:' Makefile || die
+       fi
+
        # if we use libiconv, now is the time to tell so
        if use !elibc_glibc && use !elibc_musl ; then
                cat >> Makefile <<- EOC
@@ -221,18 +259,13 @@ src_configure() {
 
        #
        # lookup methods
+       #
 
-       # use the "native" interfaces to the DBM and CDB libraries, support
-       # passwd and directory lookups by default
-       local DB_VERS="5.3 5.1 4.8 4.7 4.6 4.5 4.4 4.3 4.2 3.2"
+       # support passwd and directory lookups by default
        cat >> Makefile <<- EOC
-               USE_DB=yes
                LOOKUP_CDB=yes
                LOOKUP_PASSWD=yes
                LOOKUP_DSEARCH=yes
-               # keep include in CFLAGS because exim.h -> dbstuff.h -> db.h
-               CFLAGS += -I$(db_includedir ${DB_VERS})
-               DBMLIB = -l$(db_libname ${DB_VERS})
        EOC
 
        if ! use dnsdb; then

diff --git a/mail-mta/exim/metadata.xml b/mail-mta/exim/metadata.xml
index 3c76bb641e6..de42f5fe5af 100644
--- a/mail-mta/exim/metadata.xml
+++ b/mail-mta/exim/metadata.xml
@@ -45,6 +45,8 @@
                <flag name="pkcs11">Require pkcs11 support in 
<pkg>net-libs/gnutls</pkg> with USE=gnutls</flag>
                <flag name="redis">Adds support for querying 
<pkg>dev-db/redis</pkg></flag>
                <flag name="prdr">Adds support for Per-Recipient Data 
Response</flag>
+               <flag name="tdb">Use <pkg>sys-libs/tdb</pkg> for internal 
database
+                       storage (such as hints database)</flag>
                <flag name="tpda">Adds support for Transport Post-Delivery 
Actions</flag>
        </use>
        <upstream>

Reply via email to