summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-mail/courier-imap
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-mail/courier-imap')
-rw-r--r--net-mail/courier-imap/Manifest2
-rw-r--r--net-mail/courier-imap/courier-imap-4.15-r1.ebuild230
-rw-r--r--net-mail/courier-imap/courier-imap-4.16.0.ebuild219
-rw-r--r--net-mail/courier-imap/files/courier-authdaemond-r1.service11
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd-ssl.rc641
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd.indirect3
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd.rc636
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d-ssl.rc641
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d.indirect3
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d.rc636
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-imapd-ssl.rc32
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-imapd.rc33
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-pop3d-ssl.rc30
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-pop3d.rc31
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.15-aclocal-fix.patch10
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.15-db4-bdbobj_configure.ac.patch33
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.15-db4-configure.ac.patch33
-rw-r--r--net-mail/courier-imap/files/courier-imap-4.15-disable-fam-configure.ac.patch23
-rw-r--r--net-mail/courier-imap/files/courier-imap-gentoo.readme75
-rw-r--r--net-mail/courier-imap/files/courier-imapd-r1.service14
-rw-r--r--net-mail/courier-imap/files/courier-imapd-ssl-r1.service14
-rwxr-xr-xnet-mail/courier-imap/files/mkimapdcert39
-rw-r--r--net-mail/courier-imap/files/mkpop3dcert39
-rw-r--r--net-mail/courier-imap/metadata.xml16
24 files changed, 1044 insertions, 0 deletions
diff --git a/net-mail/courier-imap/Manifest b/net-mail/courier-imap/Manifest
new file mode 100644
index 000000000000..72b89485cbbe
--- /dev/null
+++ b/net-mail/courier-imap/Manifest
@@ -0,0 +1,2 @@
+DIST courier-imap-4.15.tar.bz2 3266353 SHA256 6c34107e7ba9e5396d50b58fb414a495806335cab7135c96ad85a3816785b109 SHA512 7829662282db5e6f414a1d34f06a94c2dd028e263510f01b49ebd3a1a4994055ecc08604568f5a44a30f6411e3a34e0d6c38807c29eaf255752191e885f82e1a WHIRLPOOL 1b5e42bd1f72e3205030b54e9564ce45c4eccb394b31c64a616f225def5a5df05f74ef62c59fbea63b18ce336d77cc2368170a982abb7a6e94d309d0c6ee4dd2
+DIST courier-imap-4.16.0.tar.bz2 3021228 SHA256 20ee63fbb5eef671dfcceecf3ed3eb48663cff3bcb607ecc904d0bc4f8c0b4b2 SHA512 5f84c035e3936cf2b435efee7ecb98f98da8ecdd3afa3661ba03737d870aa038586a49c3a696fd8d028302349279139e90b1befc1d42a8488909c0ca0ea96a5c WHIRLPOOL be8b916ff9526c0a34cbad210bb026ab176a327eba4c4e5d76da7d99e800418749b0ab50bff9ce9a7378ddfd9342a86ad3462e4418e0d36bad159ed2db3af069
diff --git a/net-mail/courier-imap/courier-imap-4.15-r1.ebuild b/net-mail/courier-imap/courier-imap-4.15-r1.ebuild
new file mode 100644
index 000000000000..ab8717f35d0e
--- /dev/null
+++ b/net-mail/courier-imap/courier-imap-4.15-r1.ebuild
@@ -0,0 +1,230 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils multilib libtool systemd
+
+DESCRIPTION="An IMAP daemon designed specifically for maildirs"
+HOMEPAGE="http://www.courier-mta.org/"
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="berkdb debug fam +gdbm ipv6 selinux gnutls trashquota"
+
+REQUIRED_USE="|| ( berkdb gdbm )"
+
+CDEPEND="
+ gnutls? ( net-libs/gnutls )
+ !gnutls? ( >=dev-libs/openssl-0.9.6:0= )
+ >=net-libs/courier-authlib-0.61
+ >=net-mail/mailbase-0.00-r8
+ berkdb? ( sys-libs/db:= )
+ fam? ( virtual/fam )
+ gdbm? ( >=sys-libs/gdbm-1.8.0 )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ !mail-mta/courier
+ userland_GNU? ( sys-process/procps )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-courier )"
+
+# get rid of old style virtual - bug 350792
+# all blockers really needed?
+RDEPEND="${RDEPEND}
+ !mail-mta/courier
+ !net-mail/bincimap
+ !net-mail/cyrus-imapd
+ !net-mail/uw-imap"
+
+RC_VER="4.0.6-r1"
+INITD_VER="4.0.6-r1"
+
+src_prepare() {
+ # Bug #48838. Patch to enable/disable FAM support.
+ # 20 Aug 2004 langthang@gentoo.org
+ # This patch should fix bug #51540. fam USE flag is not needed for shared folder support.
+ epatch "${FILESDIR}"/${P}-disable-fam-configure.ac.patch
+
+ # Kill unneeded call to AC_PROG_SYSCONFTOOL (bug #168206).
+ epatch "${FILESDIR}"/${P}-aclocal-fix.patch
+
+ # These patches should fix problems detecting BerkeleyDB.
+ # We now can compile with db4 support.
+ if use berkdb ; then
+ epatch \
+ "${FILESDIR}"/${P}-db4-bdbobj_configure.ac.patch \
+ "${FILESDIR}"/${P}-db4-configure.ac.patch
+ fi
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=""
+
+ # 19 Aug 2004 langthang@gentoo.org
+ # Default to gdbm if both berkdb and gdbm are present.
+ if use gdbm ; then
+ einfo "Building with GDBM support"
+ myconf="${myconf} --with-db=gdbm"
+ elif use berkdb ; then
+ einfo "Building with BerkeleyDB support"
+ myconf="${myconf} --with-db=db"
+ fi
+
+ # Disabling unicode is no longer supported
+ # By default all available character sets are included
+ # Set ENABLE_UNICODE=iso-8859-1,utf-8,iso-8859-10
+ # to include only specified translation tables.
+ if [[ -z "${ENABLE_UNICODE}" ]] ; then
+ einfo "ENABLE_UNICODE is not set, building with all available character sets"
+ myconf="${myconf} --enable-unicode"
+ else
+ einfo "ENABLE_UNICODE is set, building with unicode=${ENABLE_UNICODE}"
+ myconf="${myconf} --enable-unicode=${ENABLE_UNICODE}"
+ fi
+
+ if use trashquota ; then
+ einfo "Building with Trash Quota Support"
+ myconf="${myconf} --with-trashquota"
+ fi
+
+ use debug && myconf="${myconf} debug=true"
+
+ # Do the actual build now
+ econf \
+ --disable-root-check \
+ --bindir=/usr/sbin \
+ --sysconfdir=/etc/${PN} \
+ --libexecdir=/usr/$(get_libdir)/${PN} \
+ --localstatedir=/var/lib/${PN} \
+ --with-authdaemonvar=/var/lib/${PN}/authdaemon \
+ --enable-workarounds-for-imap-client-bugs \
+ --with-mailuser=mail \
+ --with-mailgroup=mail \
+ $(use_with fam) \
+ $(use_with ipv6) \
+ $(use_with gnutls) \
+ ${myconf}
+
+ # Change the pem file location.
+ sed -i -e "s:^\(TLS_CERTFILE=\).*:\1/etc/courier-imap/imapd.pem:" \
+ libs/imap/imapd-ssl.dist || \
+ die "sed failed"
+
+ sed -i -e "s:^\(TLS_CERTFILE=\).*:\1/etc/courier-imap/pop3d.pem:" \
+ libs/imap/pop3d-ssl.dist || \
+ die "sed failed"
+}
+
+src_compile() {
+ # spurious failures with parallel compiles
+ emake -j1
+}
+
+src_install() {
+ dodir /var/lib/${PN} /etc/pam.d
+ default
+ rm -Rf "${D}/etc/pam.d" || die
+
+ # Avoid name collisions in /usr/sbin wrt imapd and pop3d
+ cd "${D}/usr/sbin" || die
+ for name in imapd pop3d ; do
+ mv -f "${name}" "courier-${name}" || die "Failed to mv ${name} to courier-${name}"
+ done
+
+ # Hack /usr/lib/courier-imap/foo.rc to use ${MAILDIR} instead of
+ # 'Maildir', and to use /usr/sbin/courier-foo names.
+ cd "${D}/usr/$(get_libdir)/${PN}" || die
+ for service in {imapd,pop3d}{,-ssl} ; do
+ sed -i -e 's/Maildir/${MAILDIR}/' "${service}.rc" || die "sed failed"
+ sed -i -e "s/\/usr\/sbin\/${service}/\/usr\/sbin\/courier-${service}/" "${service}.rc" || die "sed failed"
+ done
+
+ # Rename the config files correctly and add a value for ${MAILDIR} to them.
+ cd "${D}/etc/${PN}" || die
+ for service in {imapd,pop3d}{,-ssl} ; do
+ mv -f "${service}.dist" "${service}" || die "Failed to mv ${service}.dist to ${service}"
+ echo -e '\n# Hardwire a value for ${MAILDIR}' >> "${service}"
+ echo 'MAILDIR=.maildir' >> "${service}"
+ echo 'MAILDIRPATH=.maildir' >> "${service}"
+ done
+ for service in imapd pop3d ; do
+ echo -e '# Put any program for ${PRERUN} here' >> "${service}"
+ echo 'PRERUN=' >> "${service}"
+ echo -e '# Put any program for ${LOGINRUN} here' >> "${service}"
+ echo -e '# this is for relay-ctrl-allow in 4*' >> "${service}"
+ echo 'LOGINRUN=' >> "${service}"
+ done
+
+ cd "${D}/usr/sbin" || die
+ for x in * ; do
+ if [[ -L "${x}" ]] ; then
+ rm -f "${x}" || die "Failed to rm ${x}"
+ fi
+ done
+
+ cd ../share || die
+ mv -f * ../sbin || die
+ mv -f ../sbin/man . || die
+ cd .. || die
+
+ for x in mkimapdcert mkpop3dcert ; do
+ mv -f "${D}/usr/sbin/${x}" "${D}/usr/sbin/${x}.orig" || die "Failed to mv /usr/sbin/${x} to /usr/sbin/${x}.orig"
+ done
+
+ dosbin "${FILESDIR}/mkimapdcert" "${FILESDIR}/mkpop3dcert"
+
+ dosym /usr/sbin/courierlogger /usr/$(get_libdir)/${PN}/courierlogger
+
+ mkdir "${WORKDIR}/tmp" && cd "${WORKDIR}/tmp" || die
+
+ for initd in courier-{imapd,pop3d}{,-ssl} ; do
+ sed -e "s:GENTOO_LIBDIR:$(get_libdir):g" "${FILESDIR}/${PN}-${INITD_VER}-${initd}.rc6" > "${initd}" || die "initd libdir-sed failed"
+ doinitd "${initd}"
+ done
+
+ systemd_newunit "${FILESDIR}"/courier-authdaemond-r1.service courier-authdaemond.service
+ systemd_newunit "${FILESDIR}"/courier-imapd-ssl-r1.service courier-imapd-ssl.service
+ systemd_newunit "${FILESDIR}"/courier-imapd-r1.service courier-imapd.service
+
+ exeinto /usr/$(get_libdir)/${PN}
+ for exe in gentoo-{imapd,pop3d}{,-ssl}.rc courier-{imapd,pop3d}.indirect ; do
+ sed -e "s:GENTOO_LIBDIR:$(get_libdir):g" "${FILESDIR}/${PN}-${RC_VER}-${exe}" > "${exe}" || die "exe libdir-sed failed"
+ doexe "${exe}"
+ done
+
+ dodir /usr/bin
+ mv -f "${D}/usr/sbin/maildirmake" "${D}/usr/bin/maildirmake" || die "Failed to mv /usr/sbin/maildirmake to /usr/bin/maildirmake"
+
+ # Bug #45953, more docs.
+ cd "${S}" || die
+ dohtml -r "${S}"/*
+ dodoc "${S}"/{AUTHORS,INSTALL,NEWS,README,ChangeLog} "${FILESDIR}"/${PN}-gentoo.readme
+ docinto imap
+ dodoc "${S}"/libs/imap/{ChangeLog,BUGS,BUGS.html,README}
+ docinto maildir
+ dodoc "${S}"/libs/maildir/{AUTHORS,INSTALL,README.maildirquota.txt,README.sharedfolders.txt}
+ docinto tcpd
+ dodoc "${S}"/libs/tcpd/README.couriertls
+}
+
+pkg_postinst() {
+ elog "Please read http://www.courier-mta.org/imap/INSTALL.html#upgrading"
+ elog "and remove TLS_DHPARAMS from configuration files or run mkdhparams"
+
+ elog "For a quick-start howto please refer to"
+ elog "${PN}-gentoo.readme in /usr/share/doc/${PF}"
+ # Some users have been reporting that permissions on this directory were
+ # getting scrambled, so let's ensure that they are sane.
+ chmod 0755 "${ROOT}/usr/$(get_libdir)/${PN}" || die "Failed to ensure sane permissions on ${ROOT}/usr/$(get_libdir)/${PN}"
+}
+
+src_test() {
+ ewarn "make check is not supported by this package due to the"
+ ewarn "--enable-workarounds-for-imap-client-bugs option."
+}
diff --git a/net-mail/courier-imap/courier-imap-4.16.0.ebuild b/net-mail/courier-imap/courier-imap-4.16.0.ebuild
new file mode 100644
index 000000000000..699524858177
--- /dev/null
+++ b/net-mail/courier-imap/courier-imap-4.16.0.ebuild
@@ -0,0 +1,219 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils multilib libtool systemd
+
+DESCRIPTION="An IMAP daemon designed specifically for maildirs"
+HOMEPAGE="http://www.courier-mta.org/"
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ppc64 ~x86"
+IUSE="berkdb debug fam +gdbm ipv6 selinux gnutls trashquota"
+
+REQUIRED_USE="|| ( berkdb gdbm )"
+
+CDEPEND="
+ gnutls? ( net-libs/gnutls )
+ !gnutls? ( >=dev-libs/openssl-0.9.6:0= )
+ >=net-libs/courier-authlib-0.61
+ >=net-libs/courier-unicode-1.1
+ >=net-mail/mailbase-0.00-r8
+ berkdb? ( sys-libs/db:= )
+ fam? ( virtual/fam )
+ gdbm? ( >=sys-libs/gdbm-1.8.0 )"
+DEPEND="${CDEPEND}
+ dev-lang/perl
+ !mail-mta/courier
+ userland_GNU? ( sys-process/procps )"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-courier )"
+
+# get rid of old style virtual - bug 350792
+# all blockers really needed?
+RDEPEND="${RDEPEND}
+ !mail-mta/courier
+ !net-mail/bincimap
+ !net-mail/cyrus-imapd
+ !net-mail/uw-imap"
+
+RC_VER="4.0.6-r1"
+INITD_VER="4.0.6-r1"
+
+src_prepare() {
+ # Bug #48838. Patch to enable/disable FAM support.
+ # 20 Aug 2004 langthang@gentoo.org
+ # This patch should fix bug #51540. fam USE flag is not needed for shared folder support.
+ epatch "${FILESDIR}"/${PN}-4.15-disable-fam-configure.ac.patch
+
+ # Kill unneeded call to AC_PROG_SYSCONFTOOL (bug #168206).
+ epatch "${FILESDIR}"/${PN}-4.15-aclocal-fix.patch
+
+ # These patches should fix problems detecting BerkeleyDB.
+ # We now can compile with db4 support.
+ if use berkdb ; then
+ epatch \
+ "${FILESDIR}"/${PN}-4.15-db4-bdbobj_configure.ac.patch \
+ "${FILESDIR}"/${PN}-4.15-db4-configure.ac.patch
+ fi
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf=""
+
+ # 19 Aug 2004 langthang@gentoo.org
+ # Default to gdbm if both berkdb and gdbm are present.
+ if use gdbm ; then
+ einfo "Building with GDBM support"
+ myconf="${myconf} --with-db=gdbm"
+ elif use berkdb ; then
+ einfo "Building with BerkeleyDB support"
+ myconf="${myconf} --with-db=db"
+ fi
+
+ if use trashquota ; then
+ einfo "Building with Trash Quota Support"
+ myconf="${myconf} --with-trashquota"
+ fi
+
+ use debug && myconf="${myconf} debug=true"
+
+ # Do the actual build now
+ econf \
+ --disable-root-check \
+ --bindir=/usr/sbin \
+ --sysconfdir=/etc/${PN} \
+ --libexecdir=/usr/$(get_libdir)/${PN} \
+ --localstatedir=/var/lib/${PN} \
+ --with-authdaemonvar=/var/lib/${PN}/authdaemon \
+ --enable-workarounds-for-imap-client-bugs \
+ --with-mailuser=mail \
+ --with-mailgroup=mail \
+ $(use_with fam) \
+ $(use_with ipv6) \
+ $(use_with gnutls) \
+ ${myconf}
+
+ # Change the pem file location.
+ sed -i -e "s:^\(TLS_CERTFILE=\).*:\1/etc/courier-imap/imapd.pem:" \
+ libs/imap/imapd-ssl.dist || \
+ die "sed failed"
+
+ sed -i -e "s:^\(TLS_CERTFILE=\).*:\1/etc/courier-imap/pop3d.pem:" \
+ libs/imap/pop3d-ssl.dist || \
+ die "sed failed"
+}
+
+src_compile() {
+ # spurious failures with parallel compiles
+ emake -j1
+}
+
+src_install() {
+ dodir /var/lib/${PN} /etc/pam.d
+ default
+ rm -Rf "${D}/etc/pam.d" || die
+
+ # Avoid name collisions in /usr/sbin wrt imapd and pop3d
+ cd "${D}/usr/sbin" || die
+ for name in imapd pop3d ; do
+ mv -f "${name}" "courier-${name}" || die "Failed to mv ${name} to courier-${name}"
+ done
+
+ # Hack /usr/lib/courier-imap/foo.rc to use ${MAILDIR} instead of
+ # 'Maildir', and to use /usr/sbin/courier-foo names.
+ cd "${D}/usr/$(get_libdir)/${PN}" || die
+ for service in {imapd,pop3d}{,-ssl} ; do
+ sed -i -e 's/Maildir/${MAILDIR}/' "${service}.rc" || die "sed failed"
+ sed -i -e "s/\/usr\/sbin\/${service}/\/usr\/sbin\/courier-${service}/" "${service}.rc" || die "sed failed"
+ done
+
+ # Rename the config files correctly and add a value for ${MAILDIR} to them.
+ cd "${D}/etc/${PN}" || die
+ for service in {imapd,pop3d}{,-ssl} ; do
+ mv -f "${service}.dist" "${service}" || die "Failed to mv ${service}.dist to ${service}"
+ echo -e '\n# Hardwire a value for ${MAILDIR}' >> "${service}"
+ echo 'MAILDIR=.maildir' >> "${service}"
+ echo 'MAILDIRPATH=.maildir' >> "${service}"
+ done
+ for service in imapd pop3d ; do
+ echo -e '# Put any program for ${PRERUN} here' >> "${service}"
+ echo 'PRERUN=' >> "${service}"
+ echo -e '# Put any program for ${LOGINRUN} here' >> "${service}"
+ echo -e '# this is for relay-ctrl-allow in 4*' >> "${service}"
+ echo 'LOGINRUN=' >> "${service}"
+ done
+
+ cd "${D}/usr/sbin"
+ for x in * ; do
+ if [[ -L "${x}" ]] ; then
+ rm -f "${x}" || die "Failed to rm ${x}"
+ fi
+ done
+
+ cd ../share
+ mv -f * ../sbin
+ mv -f ../sbin/man .
+ cd ..
+
+ for x in mkimapdcert mkpop3dcert ; do
+ mv -f "${D}/usr/sbin/${x}" "${D}/usr/sbin/${x}.orig" || die "Failed to mv /usr/sbin/${x} to /usr/sbin/${x}.orig"
+ done
+
+ dosbin "${FILESDIR}/mkimapdcert" "${FILESDIR}/mkpop3dcert"
+
+ dosym /usr/sbin/courierlogger /usr/$(get_libdir)/${PN}/courierlogger
+
+ mkdir "${WORKDIR}/tmp" ; cd "${WORKDIR}/tmp"
+
+ for initd in courier-{imapd,pop3d}{,-ssl} ; do
+ sed -e "s:GENTOO_LIBDIR:$(get_libdir):g" "${FILESDIR}/${PN}-${INITD_VER}-${initd}.rc6" > "${initd}" || die "initd libdir-sed failed"
+ doinitd "${initd}"
+ done
+
+ systemd_newunit "${FILESDIR}"/courier-authdaemond-r1.service courier-authdaemond.service
+ systemd_newunit "${FILESDIR}"/courier-imapd-ssl-r1.service courier-imapd-ssl.service
+ systemd_newunit "${FILESDIR}"/courier-imapd-r1.service courier-imapd.service
+
+ exeinto /usr/$(get_libdir)/${PN}
+ for exe in gentoo-{imapd,pop3d}{,-ssl}.rc courier-{imapd,pop3d}.indirect ; do
+ sed -e "s:GENTOO_LIBDIR:$(get_libdir):g" "${FILESDIR}/${PN}-${RC_VER}-${exe}" > "${exe}" || die "exe libdir-sed failed"
+ doexe "${exe}"
+ done
+
+ dodir /usr/bin
+ mv -f "${D}/usr/sbin/maildirmake" "${D}/usr/bin/maildirmake" || die "Failed to mv /usr/sbin/maildirmake to /usr/bin/maildirmake"
+
+ # Bug #45953, more docs.
+ cd "${S}" || die
+ dohtml -r "${S}"/*
+ dodoc "${S}"/{AUTHORS,INSTALL,NEWS,README,ChangeLog} "${FILESDIR}"/${PN}-gentoo.readme
+ docinto imap
+ dodoc "${S}"/libs/imap/{ChangeLog,BUGS,BUGS.html,README}
+ docinto maildir
+ dodoc "${S}"/libs/maildir/{AUTHORS,INSTALL,README.maildirquota.txt,README.sharedfolders.txt}
+ docinto tcpd
+ dodoc "${S}"/libs/tcpd/README.couriertls
+}
+
+pkg_postinst() {
+ elog "Please read http://www.courier-mta.org/imap/INSTALL.html#upgrading"
+ elog "and remove TLS_DHPARAMS from configuration files or run mkdhparams"
+
+ elog "For a quick-start howto please refer to"
+ elog "${PN}-gentoo.readme in /usr/share/doc/${PF}"
+ # Some users have been reporting that permissions on this directory were
+ # getting scrambled, so let's ensure that they are sane.
+ chmod 0755 "${ROOT}/usr/$(get_libdir)/${PN}" || die "Failed to ensure sane permissions on ${ROOT}/usr/$(get_libdir)/${PN}"
+}
+
+src_test() {
+ ewarn "make check is not supported by this package due to the"
+ ewarn "--enable-workarounds-for-imap-client-bugs option."
+}
diff --git a/net-mail/courier-imap/files/courier-authdaemond-r1.service b/net-mail/courier-imap/files/courier-authdaemond-r1.service
new file mode 100644
index 000000000000..239821647c26
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-authdaemond-r1.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Courier Authentification Daemon
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/courierlogger -pid=/var/run/authdaemon.pid -start /usr/lib/courier/courier-authlib/authdaemond
+ExecStop=/usr/sbin/courierlogger -pid=/var/run/authdaemon.pid -stop /usr/lib/courier/courier-authlib/authdaemond
+PIDFile=/var/run/authdaemon.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd-ssl.rc6 b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd-ssl.rc6
new file mode 100644
index 000000000000..1d62b80ffd2b
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd-ssl.rc6
@@ -0,0 +1,41 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net courier-authlib
+ use famd
+}
+
+source /etc/courier-imap/imapd-ssl
+
+checkconfig() {
+ if [[ ! -e /etc/courier-imap/imapd-ssl ]] ; then
+ eerror "You need an /etc/courier-imap/imapd-ssl file to run courier-imapd-ssl"
+ return 1
+ fi
+ source /etc/courier-imap/imapd-ssl || {
+ eerror "There are syntax errors in /etc/courier-imap/imapd-ssl"
+ eerror "Please correct them before trying to start courier-imapd-ssl"
+ return 3
+ }
+ if [[ ! -e "${TLS_CERTFILE}" ]] ; then
+ eerror "You need to create a SSL certificate to use IMAP over SSL"
+ eerror "Edit /etc/courier-imap/imapd.cnf, then run: mkimapdcert"
+ return 2
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting courier-imapd over SSL"
+ /usr/bin/env - /usr/GENTOO_LIBDIR/courier-imap/gentoo-imapd-ssl.rc --pid=${SSLPIDFILE}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping courier-imapd over SSL"
+ start-stop-daemon --quiet --stop --pid=${SSLPIDFILE}
+ eend $?
+}
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd.indirect b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd.indirect
new file mode 100644
index 000000000000..26e0ba2cd5c0
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd.indirect
@@ -0,0 +1,3 @@
+#!/bin/bash
+XMAILDIR="$1"
+exec ${LOGINRUN} /usr/sbin/courier-imapd "${XMAILDIR}"
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd.rc6 b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd.rc6
new file mode 100644
index 000000000000..8d78d9a62877
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-imapd.rc6
@@ -0,0 +1,36 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net courier-authlib
+ use famd
+}
+
+source /etc/courier-imap/imapd
+
+checkconfig() {
+ if [[ ! -e /etc/courier-imap/imapd ]] ; then
+ eerror "You need an /etc/courier-imap/imapd file to run courier-imapd"
+ return 1
+ fi
+ source /etc/courier-imap/imapd || {
+ eerror "There are syntax errors in /etc/courier-imap/imapd"
+ eerror "Please correct them before trying to start courier-imapd"
+ return 2
+ }
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting courier-imapd"
+ /usr/bin/env - /usr/GENTOO_LIBDIR/courier-imap/gentoo-imapd.rc --pid=${PIDFILE}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping courier-imapd"
+ start-stop-daemon --quiet --stop --pid=${PIDFILE}
+ eend $?
+}
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d-ssl.rc6 b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d-ssl.rc6
new file mode 100644
index 000000000000..edd157be8595
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d-ssl.rc6
@@ -0,0 +1,41 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net courier-authlib
+ use famd
+}
+
+source /etc/courier-imap/pop3d-ssl
+
+checkconfig() {
+ if [[ ! -e /etc/courier-imap/pop3d-ssl ]] ; then
+ eerror "You need an /etc/courier-imap/pop3d-ssl file to run courier-pop3d-ssl"
+ return 1
+ fi
+ source /etc/courier-imap/pop3d-ssl || {
+ eerror "There are syntax errors in /etc/courier-imap/pop3d-ssl"
+ eerror "Please correct them before trying to start courier-pop3d-ssl"
+ return 3
+ }
+ if [[ ! -e "${TLS_CERTFILE}" ]] ; then
+ eerror "You need to create a SSL certificate to use POP3 over SSL"
+ eerror "Edit /etc/courier-imap/pop3d.cnf, then run: mkpop3dcert"
+ return 2
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting courier-pop3d over SSL"
+ /usr/bin/env - /usr/GENTOO_LIBDIR/courier-imap/gentoo-pop3d-ssl.rc --pidfile ${SSLPIDFILE}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping courier-pop3d over SSL"
+ start-stop-daemon --quiet --stop --pidfile ${SSLPIDFILE}
+ eend $?
+}
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d.indirect b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d.indirect
new file mode 100644
index 000000000000..1a523f24db4f
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d.indirect
@@ -0,0 +1,3 @@
+#!/bin/bash
+XMAILDIR="$1"
+exec ${LOGINRUN} /usr/sbin/courier-pop3d "${XMAILDIR}"
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d.rc6 b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d.rc6
new file mode 100644
index 000000000000..7f3da571fa9f
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-courier-pop3d.rc6
@@ -0,0 +1,36 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+depend() {
+ need net courier-authlib
+ use famd
+}
+
+source /etc/courier-imap/pop3d
+
+checkconfig() {
+ if [[ ! -e /etc/courier-imap/pop3d ]] ; then
+ eerror "You need an /etc/courier-imap/pop3d file to run courier-pop3d"
+ return 1
+ fi
+ source /etc/courier-imap/pop3d || {
+ eerror "There are syntax errors in /etc/courier-imap/pop3d"
+ eerror "Please correct them before trying to start courier-pop3d"
+ return 2
+ }
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting courier-pop3d"
+ /usr/bin/env - /usr/GENTOO_LIBDIR/courier-imap/gentoo-pop3d.rc --pidfile ${PIDFILE}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping courier-pop3d"
+ start-stop-daemon --quiet --stop --pidfile ${PIDFILE}
+ eend $?
+}
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-imapd-ssl.rc b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-imapd-ssl.rc
new file mode 100644
index 000000000000..8fd426955c57
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-imapd-ssl.rc
@@ -0,0 +1,32 @@
+#!/bin/bash
+# $Id$
+#
+# Copyright 1998-2014 - 2000 Double Precision, Inc.
+# See COPYING for distribution information.
+
+prefix=/usr
+exec_prefix=/usr
+bindir=/usr/sbin
+libexecdir=/usr/GENTOO_LIBDIR/courier-imap
+
+source /etc/courier-imap/imapd
+source /etc/courier-imap/imapd-ssl
+
+ulimit -d ${IMAP_ULIMITD}
+
+export IMAP_TLS=1
+
+eval `sed -n '/^#/d;/=/p' </etc/courier-imap/imapd | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+eval `sed -n '/^#/d;/=/p' </etc/courier-imap/imapd-ssl | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+
+eval ${PRERUN} ${libexecdir}/couriertcpd \
+ -address=${SSLADDRESS} \
+ -stderrlogger=${libexecdir}/courierlogger \
+ -stderrloggername=imapd-ssl \
+ -maxprocs=${MAXDAEMONS} -maxperip=${MAXPERIP} \
+ -pid=${SSLPIDFILE} ${TCPDOPTS} ${SSLPORT} \
+ ${COURIERTLS} -server -tcpd \
+ ${bindir}/imaplogin \
+ ${libexecdir}/courier-imapd.indirect "${MAILDIR}"
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-imapd.rc b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-imapd.rc
new file mode 100644
index 000000000000..4d8ca821deca
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-imapd.rc
@@ -0,0 +1,33 @@
+#!/bin/bash
+# $Id$
+#
+# Copyright 1998-2014 - 2000 Double Precision, Inc.
+# See COPYING for distribution information.
+
+prefix=/usr
+exec_prefix=/usr
+bindir=/usr/sbin
+libexecdir=/usr/GENTOO_LIBDIR/courier-imap
+
+source /etc/courier-imap/imapd-ssl
+source /etc/courier-imap/imapd
+
+ulimit -d ${IMAP_ULIMITD}
+
+IMAP_STARTTLS="${IMAPDSTARTTLS}"
+export IMAPDSTARTTLS IMAP_STARTTLS
+TLS_PROTOCOL="${TLS_STARTTLS_PROTOCOL}"
+
+eval `sed -n '/^#/d;/=/p' </etc/courier-imap/imapd | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+eval `sed -n '/^#/d;/=/p' </etc/courier-imap/imapd-ssl | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+
+eval ${PRERUN} ${libexecdir}/couriertcpd \
+ -address=${ADDRESS} \
+ -stderrlogger=${libexecdir}/courierlogger \
+ -stderrloggername=imapd \
+ -maxprocs=${MAXDAEMONS} -maxperip=${MAXPERIP} \
+ -pid=${PIDFILE} ${TCPDOPTS} ${PORT} \
+ ${bindir}/imaplogin \
+ ${libexecdir}/courier-imapd.indirect "${MAILDIR}"
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-pop3d-ssl.rc b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-pop3d-ssl.rc
new file mode 100644
index 000000000000..cdb9c323fc7d
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-pop3d-ssl.rc
@@ -0,0 +1,30 @@
+#!/bin/bash
+# $Id$
+#
+# Copyright 1998-2014 - 2000 Double Precision, Inc.
+# See COPYING for distribution information.
+
+prefix=/usr
+exec_prefix=/usr
+bindir=/usr/sbin
+libexecdir=/usr/GENTOO_LIBDIR/courier-imap
+
+source /etc/courier-imap/pop3d
+source /etc/courier-imap/pop3d-ssl
+
+export POP3_TLS=1
+
+eval `sed -n '/^#/d;/=/p' </etc/courier-imap/pop3d | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+eval `sed -n '/^#/d;/=/p' </etc/courier-imap/pop3d-ssl | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+
+eval ${PRERUN} ${libexecdir}/couriertcpd \
+ -address=${SSLADDRESS} \
+ -stderrlogger=${libexecdir}/courierlogger \
+ -stderrloggername=pop3d-ssl \
+ -maxprocs=${MAXDAEMONS} -maxperip=${MAXPERIP} \
+ -pid=${SSLPIDFILE} ${TCPDOPTS} ${SSLPORT} \
+ ${COURIERTLS} -server -tcpd \
+ ${bindir}/pop3login \
+ ${libexecdir}/courier-pop3d.indirect "${MAILDIR}"
diff --git a/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-pop3d.rc b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-pop3d.rc
new file mode 100644
index 000000000000..eda52abbed14
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.0.6-r1-gentoo-pop3d.rc
@@ -0,0 +1,31 @@
+#!/bin/bash
+# $Id$
+#
+# Copyright 1998-2014 - 2000 Double Precision, Inc.
+# See COPYING for distribution information.
+
+prefix=/usr
+exec_prefix=/usr
+bindir=/usr/sbin
+libexecdir=/usr/GENTOO_LIBDIR/courier-imap
+
+source /etc/courier-imap/pop3d-ssl
+source /etc/courier-imap/pop3d
+
+POP3DSTARTTLS="${POP3_STARTTLS}"
+export POP3_STARTTLS POP3DSTARTTLS
+TLS_PROTOCOL="${TLS_STARTTLS_PROTOCOL}"
+
+eval `sed -n '/^#/d;/=/p' </etc/courier-imap/pop3d | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+eval `sed -n '/^#/d;/=/p' </etc/courier-imap/pop3d-ssl | \
+ sed 's/=.*//;s/^/export /;s/$/;/'`
+
+eval ${PRERUN} ${libexecdir}/couriertcpd \
+ -address=${ADDRESS} \
+ -stderrlogger=${libexecdir}/courierlogger \
+ -stderrloggername=pop3d \
+ -maxprocs=${MAXDAEMONS} -maxperip=${MAXPERIP} \
+ -pid=${PIDFILE} ${TCPDOPTS} ${PORT} \
+ ${bindir}/pop3login \
+ ${libexecdir}/courier-pop3d.indirect "${MAILDIR}"
diff --git a/net-mail/courier-imap/files/courier-imap-4.15-aclocal-fix.patch b/net-mail/courier-imap/files/courier-imap-4.15-aclocal-fix.patch
new file mode 100644
index 000000000000..bc68698ea247
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.15-aclocal-fix.patch
@@ -0,0 +1,10 @@
+--- configure.ac.orig 2006-12-30 09:28:52.000000000 -0500
++++ configure.ac 2007-02-27 12:13:38.000000000 -0500
+@@ -15,7 +15,6 @@
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
+ AC_PROG_MAKE_SET
+-AC_PROG_SYSCONFTOOL
+ AC_LIBTOOL_DLOPEN
+ AM_PROG_LIBTOOL
+
diff --git a/net-mail/courier-imap/files/courier-imap-4.15-db4-bdbobj_configure.ac.patch b/net-mail/courier-imap/files/courier-imap-4.15-db4-bdbobj_configure.ac.patch
new file mode 100644
index 000000000000..ba75db9ff5dd
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.15-db4-bdbobj_configure.ac.patch
@@ -0,0 +1,33 @@
+--- libs/bdbobj/configure.ac.orig 2013-08-25 20:52:10.000000000 +0200
++++ libs/bdbobj/configure.ac 2013-11-22 10:39:25.787861774 +0100
+@@ -23,15 +23,22 @@
+ dnl Checks for libraries.
+
+ saveLIBS="$LIBS"
+-AC_CHECK_LIB(db, dbopen, [ LIBDB=-ldb ; LIBS="-ldb $LIBS" ],
+- AC_CHECK_LIB(db, db_open, [ LIBDB=-ldb ; LIBS="-ldb $LIBS"],
+- AC_CHECK_LIB(db, db_env_create, [ LIBDB=-ldb; LIBS="-ldb $LIBS"])
+- ))
+-
++for dbname in db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db
++ do
++ AC_CHECK_LIB($dbname, db_create_4004, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create_4003, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create_4002, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create_4001, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create_4000, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ]))))))
++ done
+ FOUND_DB=0
+-AC_CHECK_FUNC(dbopen, FOUND_DB=1)
+-AC_CHECK_FUNC(db_open, FOUND_DB=1)
+-AC_CHECK_FUNC(db_env_create, FOUND_DB=1)
++AC_CHECK_FUNC(db_create_4004, FOUND_DB=1)
++AC_CHECK_FUNC(db_create_4003, FOUND_DB=1)
++AC_CHECK_FUNC(db_create_4002, FOUND_DB=1)
++AC_CHECK_FUNC(db_create_4001, FOUND_DB=1)
++AC_CHECK_FUNC(db_create_4000, FOUND_DB=1)
++AC_CHECK_FUNC(db_create, FOUND_DB=1)
+
+ LIBS="$saveLIBS"
+
diff --git a/net-mail/courier-imap/files/courier-imap-4.15-db4-configure.ac.patch b/net-mail/courier-imap/files/courier-imap-4.15-db4-configure.ac.patch
new file mode 100644
index 000000000000..19fe77e28f69
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.15-db4-configure.ac.patch
@@ -0,0 +1,33 @@
+--- configure.ac.orig 2013-09-28 19:44:24.000000000 +0200
++++ configure.ac 2013-11-22 10:46:34.910990069 +0100
+@@ -180,15 +180,21 @@
+ if test "$db" != "gdbm"
+ then
+
+- AC_CHECK_LIB(db, dbopen, [ LIBDB=-ldb ; LIBS="-ldb $LIBS" ],
+- AC_CHECK_LIB(db, db_open, [ LIBDB=-ldb ; LIBS="-ldb $LIBS"],
+- AC_CHECK_LIB(db, db_env_create,
+- [ LIBDB=-ldb; LIBS="-ldb $LIBS"])
+- ))
+-
+- AC_CHECK_FUNC(dbopen, HAVE_BDB=1)
+- AC_CHECK_FUNC(db_open, HAVE_BDB=1)
+- AC_CHECK_FUNC(db_env_create, HAVE_BDB=1)
++for dbname in db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db
++ do
++ AC_CHECK_LIB($dbname, db_create_4004, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create_4003, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create_4002, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create_4001, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create_4000, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ],
++ AC_CHECK_LIB($dbname, db_create, [ LIBDB=-l$dbname ; LIBS="-l$dbname $LIBS"; break ]))))))
++ done
++AC_CHECK_FUNC(db_create_4004, HAVE_BDB=1)
++AC_CHECK_FUNC(db_create_4003, HAVE_BDB=1)
++AC_CHECK_FUNC(db_create_4002, HAVE_BDB=1)
++AC_CHECK_FUNC(db_create_4001, HAVE_BDB=1)
++AC_CHECK_FUNC(db_create_4000, HAVE_BDB=1)
++AC_CHECK_FUNC(db_create, HAVE_BDB=1)
+ fi
+
+ LIBS="$saveLIBS"
diff --git a/net-mail/courier-imap/files/courier-imap-4.15-disable-fam-configure.ac.patch b/net-mail/courier-imap/files/courier-imap-4.15-disable-fam-configure.ac.patch
new file mode 100644
index 000000000000..940703d1b6ca
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-4.15-disable-fam-configure.ac.patch
@@ -0,0 +1,23 @@
+--- libs/maildir/configure.ac.orig 2004-06-08 15:44:23.000000000 -0700
++++ libs/maildir/configure.ac 2004-08-14 15:28:20.525714876 -0700
+@@ -73,6 +73,12 @@
+ dnl Checks for library functions.
+ AC_CHECK_HEADER(fam.h, :, :)
+ AC_CHECK_FUNCS(symlink readlink strcasecmp utime utimes)
++AC_ARG_WITH(fam, [ --with-fam Compile with FAM support],
++ fam="$withval",
++ fam="no")
++
++if test "$fam" != "no"
++then
+ AC_CHECK_LIB(fam, FAMOpen, [
+ LIBFAM=-lfam
+ AC_DEFINE_UNQUOTED(HAVE_FAM,1,
+@@ -87,6 +93,7 @@
+ AC_MSG_ERROR([[FAM development libraries not found.]]) ]
+ )
+ ])
++fi
+
+ AC_SUBST(LIBFAM)
+
diff --git a/net-mail/courier-imap/files/courier-imap-gentoo.readme b/net-mail/courier-imap/files/courier-imap-gentoo.readme
new file mode 100644
index 000000000000..b11a804fc3ea
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imap-gentoo.readme
@@ -0,0 +1,75 @@
+// This quick guide is for mysql authentication support base on the Gentoo Virtual Mailhosting Guide
+// turn ON mysql USE flag for courier-authlib. Need to authenticate against mysql database backend.
+localhost ~ # nano -w /etc/portage/package.use
+net-libs/courier-authlib mysql
+net-mail/courier-imap mysql
+localhost ~ # emerge courier-imap
+// limit to mysql module only, instead load all of them.
+localhost ~ # nano -w /etc/courier/authlib/authdaemonrc
+authmodulelist="authmysql"
+
+// set variables to match your setup.
+localhost ~ # nano -w /etc/courier/authlib/authmysqlrc
+MYSQL_SERVER localhost
+MYSQL_USERNAME mailsql_admin_username
+MYSQL_PASSWORD password
+MYSQL_DATABASE mailsql_database
+MYSQL_USER_TABLE users
+# MYSQL_CRYPT_PWFIELD crypt (commented this out if you want CRAM-MD5)
+MYSQL_CLEAR_PWFIELD clear
+MYSQL_LOGIN_FIELD email
+MYSQL_HOME_FIELD homedir
+MYSQL_MAILDIR_FIELD maildir
+
+// Start authdaemond
+localhost ~ # etc/init.d/courier-authlib start
+* Starting courier-authlib: authdaemond ... [ ok ]
+
+### Courier-IMAP' ssl certificate setup
+localhost ~ # nano -w /etc/courier-imap/imapd.cnf
+localhost ~ # nano -w /etc/courier-imap/pop3.cnf
+// change to match your site.
+[ req_dn ]
+C=US
+ST=NY
+L=New York
+O=Courier Mail Server
+OU=Automatically-generated IMAP SSL key
+CN=mailhost.example.com
+emailAddress=postmaster@example.com
+
+// Generate Certificate
+localhost ~ # mkimapdcert
+...
+writing new private key to '/etc/courier-imap/imapd.pem'
+...
+localhost ~ # mkpop3dcert
+...
+writing new private key to '/etc/courier-imap/pop3d.pem'
+...
+
+### Secure Authentication Setup (CRAM-MD5)
+localhost ~ # nano -w /etc/courier-imap/imapd
+IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=CRAM-MD5"
+
+### Start Courier-imap daemons.
+localhost ~ # /etc/init.d/courier-pop3d start
+localhost ~ # /etc/init.d/courier-pop3d-ssl start
+localhost ~ # /etc/init.d/courier-imapd start
+localhost ~ # /etc/init.d/courier-imapd-ssl start
+
+### Checking authentication.
+// From your favorite client send an email to user@your_domain.com
+// so your mail user's maildir created by your MTA.
+// you can not login unless user maildir has been created.
+localhost ~ $ telnet mailexample.com 143
+Trying xxx.xxx.xxx.xxx...
+Connected to mail.example.com (xxx.xxx.xxx.xxx).
+Escape character is '^]'.
+* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=CRAM-MD5 ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information.
+a login user@example.com password
+a OK LOGIN Ok.
+ OK LOGOUT completed
+Connection closed by foreign host.
+
+### That's all folks.
diff --git a/net-mail/courier-imap/files/courier-imapd-r1.service b/net-mail/courier-imap/files/courier-imapd-r1.service
new file mode 100644
index 000000000000..9510b31041d8
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imapd-r1.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Courier IMAP Daemon
+After=network.target
+Wants=courier-authdaemond.service
+
+[Service]
+Type=forking
+EnvironmentFile=/etc/courier-imap/imapd
+ExecStart=/usr/lib/courier-imap/gentoo-imapd.rc
+ExecStop=/bin/kill $MAINPID
+PIDFile=/var/run/imapd.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-mail/courier-imap/files/courier-imapd-ssl-r1.service b/net-mail/courier-imap/files/courier-imapd-ssl-r1.service
new file mode 100644
index 000000000000..79ae0dc93cae
--- /dev/null
+++ b/net-mail/courier-imap/files/courier-imapd-ssl-r1.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Courier IMAP Daemon
+After=network.target
+Wants=courier-authdemond.service
+
+[Service]
+Type=forking
+EnvironmentFile=/etc/courier-imap/imapd-ssl
+ExecStart=/usr/lib/courier-imap/gentoo-imapd-ssl.rc
+ExecStop=/bin/kill $MAINPID
+PIDFile=/var/run/imapd-ssl.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-mail/courier-imap/files/mkimapdcert b/net-mail/courier-imap/files/mkimapdcert
new file mode 100755
index 000000000000..1261e12c9021
--- /dev/null
+++ b/net-mail/courier-imap/files/mkimapdcert
@@ -0,0 +1,39 @@
+#! /bin/sh
+#
+# mkimapdcert,v 1.1 2001/01/02 03:54:25 drobbins Exp
+#
+# Copyright 2000 Double Precision, Inc. See COPYING for
+# distribution information.
+#
+# This is a short script to quickly generate a self-signed X.509 key for
+# IMAP over SSL. Normally this script would get called by an automatic
+# package installation routine.
+
+test -x /usr/bin/openssl || exit 0
+
+prefix="/usr"
+pemfile="/etc/courier-imap/imapd.pem"
+randfile="/etc/courier-imap/imapd.rand"
+
+if test -f $pemfile
+then
+ echo "$pemfile already exists."
+ exit 1
+fi
+
+cp /dev/null $pemfile
+chmod 600 $pemfile
+chown root $pemfile
+
+cleanup() {
+ rm -f $pemfile
+ rm -f $randfile
+ exit 1
+}
+
+dd if=/dev/urandom of=$randfile count=1 2>/dev/null
+/usr/bin/openssl req -new -x509 -days 365 -nodes \
+ -config /etc/courier-imap/imapd.cnf -out $pemfile -keyout $pemfile || cleanup
+/usr/bin/openssl gendh -rand $randfile 512 >> $pemfile || cleanup
+/usr/bin/openssl x509 -subject -dates -fingerprint -noout -in $pemfile || cleanup
+rm -f $randfile
diff --git a/net-mail/courier-imap/files/mkpop3dcert b/net-mail/courier-imap/files/mkpop3dcert
new file mode 100644
index 000000000000..6a55e99f9c8e
--- /dev/null
+++ b/net-mail/courier-imap/files/mkpop3dcert
@@ -0,0 +1,39 @@
+#! /bin/sh
+#
+# mkimapdcert,v 1.1 2001/01/02 03:54:25 drobbins Exp
+#
+# Copyright 2000 Double Precision, Inc. See COPYING for
+# distribution information.
+#
+# This is a short script to quickly generate a self-signed X.509 key for
+# IMAP over SSL. Normally this script would get called by an automatic
+# package installation routine.
+
+test -x /usr/bin/openssl || exit 0
+
+prefix="/usr"
+pemfile="/etc/courier-imap/pop3d.pem"
+randfile="/etc/courier-imap/pop3d.rand"
+
+if test -f $pemfile
+then
+ echo "$pemfile already exists."
+ exit 1
+fi
+
+cp /dev/null $pemfile
+chmod 600 $pemfile
+chown root $pemfile
+
+cleanup() {
+ rm -f $pemfile
+ rm -f $randfile
+ exit 1
+}
+
+dd if=/dev/urandom of=$randfile count=1 2>/dev/null
+/usr/bin/openssl req -new -x509 -days 365 -nodes \
+ -config /etc/courier-imap/pop3d.cnf -out $pemfile -keyout $pemfile || cleanup
+/usr/bin/openssl gendh -rand $randfile 512 >> $pemfile || cleanup
+/usr/bin/openssl x509 -subject -dates -fingerprint -noout -in $pemfile || cleanup
+rm -f $randfile
diff --git a/net-mail/courier-imap/metadata.xml b/net-mail/courier-imap/metadata.xml
new file mode 100644
index 000000000000..f6c602339de3
--- /dev/null
+++ b/net-mail/courier-imap/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>proxy-maintainers</herd>
+ <maintainer>
+ <email>david@ixit.cz</email>
+ <name>David Heidelberg</name>
+ <description>Assign bugs to him.</description>
+ </maintainer>
+ <use>
+ <flag name="trashquota">include deleted messages, and the Trash folder, in the estimated quota usage for maildirs</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">courier</remote-id>
+ </upstream>
+</pkgmetadata>