commit:     69a1d78f738ab43adb3f6638980daed0d6566ddf
Author:     Jan Smutný <js <AT> excello <DOT> cz>
AuthorDate: Thu Nov 27 14:13:00 2025 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Fri Nov 28 06:59:05 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=69a1d78f

mail-filter/maildrop: add patch to fix reformime

patch fixing reformime, created from already accepted PR:
 - https://github.com/svarshavchik/courier-libs/pull/51

Signed-off-by: Jan Smutný <js <AT> excello.cz>
Part-of: https://github.com/gentoo/gentoo/pull/44796
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 .../maildrop/files/maildrop-3.2.1-reformime.patch  |  20 +++
 mail-filter/maildrop/maildrop-3.2.1-r1.ebuild      | 152 +++++++++++++++++++++
 2 files changed, 172 insertions(+)

diff --git a/mail-filter/maildrop/files/maildrop-3.2.1-reformime.patch 
b/mail-filter/maildrop/files/maildrop-3.2.1-reformime.patch
new file mode 100644
index 000000000000..6dda726207ac
--- /dev/null
+++ b/mail-filter/maildrop/files/maildrop-3.2.1-reformime.patch
@@ -0,0 +1,20 @@
+--- a/libs/rfc2045/reformime.C
++++ b/libs/rfc2045/reformime.C
+@@ -342,14 +342,15 @@ std::string get_suitable_filename(const rfc2045::entity 
&message,
+                              filename.begin()+2);     /* Skip over ./ */
+       }
+ 
+-      filename.insert(filename.begin(), pfix.begin(), pfix.end());
+-
+       for (char &c:filename)
+       {
+               unsigned char d=c;
+               if (!isalnum(d) && d != '.' && d != '-' && d != '=')
+                       c='_';
+       }
++
++      filename.insert(filename.begin(), pfix.begin(), pfix.end());
++
+       if (pfix.size() == 0)
+       {
+               std::fstream tty{"/dev/tty"};

diff --git a/mail-filter/maildrop/maildrop-3.2.1-r1.ebuild 
b/mail-filter/maildrop/maildrop-3.2.1-r1.ebuild
new file mode 100644
index 000000000000..77afc9d266b0
--- /dev/null
+++ b/mail-filter/maildrop/maildrop-3.2.1-r1.ebuild
@@ -0,0 +1,152 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit flag-o-matic autotools
+
+DESCRIPTION="Mail delivery agent/filter"
+[[ -z ${PV/?.?/}   ]] && 
SRC_URI="https://downloads.sourceforge.net/courier/${P}.tar.bz2";
+[[ -z ${PV/?.?.?/} ]] && 
SRC_URI="https://downloads.sourceforge.net/courier/${P}.tar.bz2";
+[[ -z ${SRC_URI}   ]] && 
SRC_URI="https://www.courier-mta.org/beta/${PN}/${P%%_pre}.tar.bz2";
+HOMEPAGE="https://www.courier-mta.org/maildrop/";
+
+S=${WORKDIR}/${P%%_pre}
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~s390 ~sparc ~x86"
+IUSE="berkdb debug dovecot gdbm ldap mysql postgres static-libs authlib +tools 
trashquota"
+
+RESTRICT="test" # No more working
+
+CDEPEND="!mail-mta/courier
+       net-mail/mailbase
+       dev-libs/libpcre2
+       net-dns/libidn2:=
+       >=net-libs/courier-unicode-2.4.0:=
+       gdbm?     ( sys-libs/gdbm:= )
+       mysql?    ( net-libs/courier-authlib )
+       postgres? ( net-libs/courier-authlib )
+       ldap?     ( net-libs/courier-authlib )
+       authlib?  ( net-libs/courier-authlib )
+       !gdbm? (
+               berkdb? ( sys-libs/db:= )
+       )
+       tools? (
+               !mail-mta/netqmail
+               !<net-mail/courier-imap-5.2.6
+               net-mail/courier-common[gdbm?,berkdb?]
+       )"
+DEPEND="${CDEPEND}"
+RDEPEND="${CDEPEND}
+       dev-lang/perl
+       dovecot? ( net-mail/dovecot )"
+BDEPEND="virtual/pkgconfig"
+
+REQUIRED_USE="
+       mysql? ( authlib )
+       postgres? ( authlib )
+       ldap? ( authlib )"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-reformime.patch
+       "${FILESDIR}"/${P}-testsuite.patch
+       "${FILESDIR}"/${P}-valgrind.patch
+       "${FILESDIR}"/${PN}-3.1.6-test.patch
+)
+
+src_prepare() {
+       # Prefer gdbm over berkdb
+       if use gdbm ; then
+               use berkdb && elog "Both gdbm and berkdb selected. Using gdbm."
+       fi
+
+       # no need to error out if no default - it will be given to econf anyway
+       sed -i -e \
+               's~AC_MSG_ERROR(Cannot determine default 
mailbox)~SPOOLDIR="./.maildir"~' \
+               "${S}"/libs/maildrop/configure.ac || die "sed failed"
+
+       default
+       eautoreconf
+}
+
+src_configure() {
+       local myeconfargs=(
+               --with-devel
+               --disable-tempdir
+               --enable-syslog=1
+               --enable-use-flock=1
+               --enable-use-dotlock=1
+               --enable-restrict-trusted=1
+               --enable-maildrop-uid=root
+               --enable-maildrop-gid=mail
+               --enable-sendmail=/usr/sbin/sendmail
+               --cache-file="${S}"/configuring.cache
+               $(use_enable static-libs static)
+               $(use_enable dovecot dovecotauth)
+               $(use_with trashquota)
+       )
+
+       local mytrustedusers="apache dspam root mail fetchmail"
+       mytrustedusers+=" daemon postmaster qmaild mmdf vmail alias"
+       myeconfargs+=( --enable-trusted-users="${mytrustedusers}" )
+
+       # These flags make maildrop cry
+       replace-flags -Os -O2
+       filter-flags -fomit-frame-pointer
+
+       if use gdbm ; then
+               myeconfargs+=( --with-db=gdbm )
+       elif use berkdb ; then
+               myeconfargs+=( --with-db=db )
+       else
+               myeconfargs+=( --without-db )
+       fi
+
+       if ! use mysql && ! use postgres && ! use ldap && ! use authlib ; then
+               myeconfargs+=( --disable-authlib )
+       fi
+
+       # default mailbox is $HOME/.maildir for Gentoo
+       maildrop_cv_SYS_INSTALL_MBOXDIR="./.maildir" econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+
+       if use authlib ; then
+               fperms 4755 /usr/bin/maildrop
+       fi
+
+       #  Moved to courier-common
+       rm "${D}"/usr/bin/deliverquota || die
+       rm "${D}"/usr/bin/maildirkw || die
+       if use gdbm; then
+               rm "${D}"/usr/bin/makedat || die
+               rm "${D}"/usr/bin/makedatprog || die
+       fi
+       rm "${D}"/usr/share/man/man1/maildirkw.1 || die
+       rm "${D}"/usr/share/man/man1/makedat.1 || die
+       rm "${D}"/usr/share/man/man8/deliverquota.8 || die
+
+       dodoc AUTHORS ChangeLog INSTALL NEWS README \
+               README.postfix README.dovecotauth UPGRADE \
+               maildroptips.txt
+       docinto maildir
+       dodoc libs/maildir/AUTHORS libs/maildir/INSTALL \
+               libs/maildir/README*.txt libs/maildir/*.html
+
+       # bugs 61116, 639124
+       if ! use tools ; then
+               for tool in "maildirmake" "maildirwatch"; do
+                       rm "${D}/usr/bin/${tool}" || die
+                       rm "${D}/usr/share/man/man"[0-9]"/${tool}."[0-9] || die
+               done
+               rm "${D}/usr/share/man/man5/maildir.5" || die
+       fi
+
+       insinto /etc
+       doins "${FILESDIR}"/maildroprc
+
+       use static-libs || find "${D}"/usr/lib* -name '*.la' -delete
+}

Reply via email to