summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mail-mta/postfix/Manifest33
-rw-r--r--mail-mta/postfix/files/digest-postfix-2.3.86
-rw-r--r--mail-mta/postfix/files/mailer.conf11
-rw-r--r--mail-mta/postfix/files/postfix-2.0.9-get-FQDN.patch32
-rw-r--r--mail-mta/postfix/files/postfix-master.cf.patch20
-rw-r--r--mail-mta/postfix/files/postfix.rc6.2.2.929
-rw-r--r--mail-mta/postfix/files/smtp.pass3
-rw-r--r--mail-mta/postfix/files/smtp.sasl2
-rw-r--r--mail-mta/postfix/postfix-2.3.8.ebuild386
9 files changed, 522 insertions, 0 deletions
diff --git a/mail-mta/postfix/Manifest b/mail-mta/postfix/Manifest
new file mode 100644
index 0000000..cc3f7ef
--- /dev/null
+++ b/mail-mta/postfix/Manifest
@@ -0,0 +1,33 @@
+AUX mailer.conf 438 RMD160 b9efd9921c9e6295d8791e621e4e08510b526ac4 SHA1 fad8603d181a0d1ba104f09719e5620bae421288 SHA256 4ea1fb59653bd12841501f30781bda51a66aae56a5560623f7d41709dc97c839
+MD5 a3c32f8c9d1344be08f018d377a61f59 files/mailer.conf 438
+RMD160 b9efd9921c9e6295d8791e621e4e08510b526ac4 files/mailer.conf 438
+SHA256 4ea1fb59653bd12841501f30781bda51a66aae56a5560623f7d41709dc97c839 files/mailer.conf 438
+AUX postfix-2.0.9-get-FQDN.patch 1057 RMD160 492e9de53c0a16e71940ab4f4ed99bc4f76061fa SHA1 38f0322792822612a836ded1845368b23d3c1120 SHA256 6e5f5a1f9bc60e04d6decc8491c5955c625396f23698d961c412b50ec793e878
+MD5 fd78f3c5211f280a77dc8c8acd3dd898 files/postfix-2.0.9-get-FQDN.patch 1057
+RMD160 492e9de53c0a16e71940ab4f4ed99bc4f76061fa files/postfix-2.0.9-get-FQDN.patch 1057
+SHA256 6e5f5a1f9bc60e04d6decc8491c5955c625396f23698d961c412b50ec793e878 files/postfix-2.0.9-get-FQDN.patch 1057
+AUX postfix-master.cf.patch 1064 RMD160 25283e8c3c27ff156e229ad1ae8643d3be61d6b7 SHA1 86088a034f6cf4a09a68436c97df5e5babf11251 SHA256 b1f7040cb9445379c4318e2161efd79c74bc6927125f4542eb87500ece145f60
+MD5 5741da441965a63229e3ded4a4bc4ec0 files/postfix-master.cf.patch 1064
+RMD160 25283e8c3c27ff156e229ad1ae8643d3be61d6b7 files/postfix-master.cf.patch 1064
+SHA256 b1f7040cb9445379c4318e2161efd79c74bc6927125f4542eb87500ece145f60 files/postfix-master.cf.patch 1064
+AUX postfix.rc6.2.2.9 637 RMD160 155fc1e1420089b6144f7ae1065c46a8fd622aa7 SHA1 89b2d0b3149e7f5b661b90197ac1456b61b97602 SHA256 a8a6561a039a766e4e999ca52c45d94de7a7790cbee93740d021eb3eb4e1cd27
+MD5 c6f19aa72d695ad889f9130c1b8c8baa files/postfix.rc6.2.2.9 637
+RMD160 155fc1e1420089b6144f7ae1065c46a8fd622aa7 files/postfix.rc6.2.2.9 637
+SHA256 a8a6561a039a766e4e999ca52c45d94de7a7790cbee93740d021eb3eb4e1cd27 files/postfix.rc6.2.2.9 637
+AUX smtp.pass 141 RMD160 799433a4ee9e9e32f20aa2d31f85f33faa2bc7e6 SHA1 e1d75aa259fa07b257a617e056662aecfd19957f SHA256 c9b3b56a8df2367cc15bc43a70304fac7ebdd7697e1d450d1bcb4bfdd3e078e9
+MD5 889559c8b5d02597e9e7eec89e328360 files/smtp.pass 141
+RMD160 799433a4ee9e9e32f20aa2d31f85f33faa2bc7e6 files/smtp.pass 141
+SHA256 c9b3b56a8df2367cc15bc43a70304fac7ebdd7697e1d450d1bcb4bfdd3e078e9 files/smtp.pass 141
+AUX smtp.sasl 131 RMD160 6831f9bbfd76be0d39fdda4270120824ebb9f52f SHA1 613dff95ac21bd306c2917e5360430772efbb146 SHA256 954ba1e80537ca01b935b856e31ec4e3e41c138f04b7cf99ccb969876b8b78e7
+MD5 43e9368a07952c4aae9e370b59ce1450 files/smtp.sasl 131
+RMD160 6831f9bbfd76be0d39fdda4270120824ebb9f52f files/smtp.sasl 131
+SHA256 954ba1e80537ca01b935b856e31ec4e3e41c138f04b7cf99ccb969876b8b78e7 files/smtp.sasl 131
+DIST postfix-2.3.3-vda.patch.gz 7944 RMD160 bdbd0798ca4d23c6e8443b26b957b8d0d252da1d SHA1 70c2d41363ead6d9129849e09df551d6ed77920a SHA256 4fdff601e0b2653025c9b9ca8875e995b8052e2e362c3a5e035c3d2859bd4fa2
+DIST postfix-2.3.8.tar.gz 2787761 RMD160 2984ca8e81375a3124801c999d23637e745de54c SHA1 c40ebae5cdcd53e13ae8ba5cac1a70167576859b SHA256 f19c26646e19cc93bdb01b1118ad6bdc67c0ec506c7dc989370e117c8d43f3e6
+EBUILD postfix-2.3.8.ebuild 11693 RMD160 40cd50eee6bbba23e123a59eccaf01f675d1f303 SHA1 fbad26c568ee4bfc87008642f8f8e9b8417816b4 SHA256 dd10252221134c446d7c2ddb40247dee3735fb88fb058feafd05582b1aafffdc
+MD5 97b85ad61e58f97ba07652873c6b2898 postfix-2.3.8.ebuild 11693
+RMD160 40cd50eee6bbba23e123a59eccaf01f675d1f303 postfix-2.3.8.ebuild 11693
+SHA256 dd10252221134c446d7c2ddb40247dee3735fb88fb058feafd05582b1aafffdc postfix-2.3.8.ebuild 11693
+MD5 8e03a4793fdbe095803afcdef12ea9c6 files/digest-postfix-2.3.8 497
+RMD160 3557801f5b54683dacb56a00614b8ea46e865ad0 files/digest-postfix-2.3.8 497
+SHA256 b8294770197613e1d50b69e88044824637c2de976ec848e9f3e749a331471382 files/digest-postfix-2.3.8 497
diff --git a/mail-mta/postfix/files/digest-postfix-2.3.8 b/mail-mta/postfix/files/digest-postfix-2.3.8
new file mode 100644
index 0000000..60f8039
--- /dev/null
+++ b/mail-mta/postfix/files/digest-postfix-2.3.8
@@ -0,0 +1,6 @@
+MD5 3506ab432360766b6a2708042b29943a postfix-2.3.3-vda.patch.gz 7944
+RMD160 bdbd0798ca4d23c6e8443b26b957b8d0d252da1d postfix-2.3.3-vda.patch.gz 7944
+SHA256 4fdff601e0b2653025c9b9ca8875e995b8052e2e362c3a5e035c3d2859bd4fa2 postfix-2.3.3-vda.patch.gz 7944
+MD5 a6c560657788fc7a5444fa9ea32f5513 postfix-2.3.8.tar.gz 2787761
+RMD160 2984ca8e81375a3124801c999d23637e745de54c postfix-2.3.8.tar.gz 2787761
+SHA256 f19c26646e19cc93bdb01b1118ad6bdc67c0ec506c7dc989370e117c8d43f3e6 postfix-2.3.8.tar.gz 2787761
diff --git a/mail-mta/postfix/files/mailer.conf b/mail-mta/postfix/files/mailer.conf
new file mode 100644
index 0000000..4662958
--- /dev/null
+++ b/mail-mta/postfix/files/mailer.conf
@@ -0,0 +1,11 @@
+# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/mailer.conf,v 1.5 2005/07/05 01:04:50 ticho Exp $
+# $OpenBSD: mailer.conf,v 1.3 2000/04/06 18:24:19 millert Exp $
+
+# Execute the "real" sendmail program from postfix,
+# named /usr/sbin/sendmail.postfix
+#
+sendmail /usr/sbin/sendmail.postfix
+send-mail /usr/sbin/sendmail.postfix
+mailq /usr/sbin/sendmail.postfix
+newaliases /usr/sbin/sendmail.postfix
+rmail /usr/bin/rmail.postfix
diff --git a/mail-mta/postfix/files/postfix-2.0.9-get-FQDN.patch b/mail-mta/postfix/files/postfix-2.0.9-get-FQDN.patch
new file mode 100644
index 0000000..06336d4
--- /dev/null
+++ b/mail-mta/postfix/files/postfix-2.0.9-get-FQDN.patch
@@ -0,0 +1,32 @@
+--- postfix-2.0.9/src/util/get_hostname.c.orig 2003-04-28 13:15:08.000000000 +0200
++++ postfix-2.0.9/src/util/get_hostname.c 2003-04-28 13:36:47.000000000 +0200
+@@ -33,6 +33,7 @@
+ #include <sys/param.h>
+ #include <string.h>
+ #include <unistd.h>
++#include <netdb.h>
+
+ #if (MAXHOSTNAMELEN < 256)
+ #undef MAXHOSTNAMELEN
+@@ -55,6 +56,7 @@
+ const char *get_hostname(void)
+ {
+ char namebuf[MAXHOSTNAMELEN + 1];
++ struct hostent *hp;
+
+ /*
+ * The gethostname() call is not (or not yet) in ANSI or POSIX, but it is
+@@ -66,9 +68,11 @@
+ if (gethostname(namebuf, sizeof(namebuf)) < 0)
+ msg_fatal("gethostname: %m");
+ namebuf[MAXHOSTNAMELEN] = 0;
+- if (valid_hostname(namebuf, DO_GRIPE) == 0)
++ if (!(hp = gethostbyname(namebuf)))
++ msg_fatal("gethostbyname(\"%s\") does not resolve as a fully qualified domain name.", namebuf);
++ if (valid_hostname(hp->h_name, DO_GRIPE) == 0)
+ msg_fatal("unable to use my own hostname");
+- my_host_name = mystrdup(namebuf);
++ my_host_name = mystrdup(hp->h_name);
+ }
+ return (my_host_name);
+ }
diff --git a/mail-mta/postfix/files/postfix-master.cf.patch b/mail-mta/postfix/files/postfix-master.cf.patch
new file mode 100644
index 0000000..fa53dd1
--- /dev/null
+++ b/mail-mta/postfix/files/postfix-master.cf.patch
@@ -0,0 +1,20 @@
+--- conf/master.cf.orig 2006-03-02 10:57:19.000000000 -0800
++++ conf/master.cf 2006-03-02 11:08:03.000000000 -0800
+@@ -60,11 +60,15 @@
+ # The Cyrus deliver program has changed incompatibly, multiple times.
+ #
+ old-cyrus unix - n n - - pipe
+- flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
++ flags=R user=cyrus argv=/usr/lib/cyrus/deliver -e -m ${extension} ${user}
+ # Cyrus 2.1.5 (Amos Gouaux)
+ # Also specify in main.cf: cyrus_destination_recipient_limit=1
+ cyrus unix - n n - - pipe
+- user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
++ flags=hu user=cyrus argv=/usr/lib/cyrus/deliver -e -r ${sender} -m ${extension} ${user}
++# Cyrus with "virtdomains: yes"
++# Also specify in main.cf: virtual_transport = virt-cyrus
++virt-cyrus unix - n n - - pipe
++ flags=hu user=cyrus argv=/usr/lib/cyrus/deliver -e -r ${sender} -m ${recipient} ${user}
+ #
+ # See the Postfix UUCP_README file for configuration details.
+ #
diff --git a/mail-mta/postfix/files/postfix.rc6.2.2.9 b/mail-mta/postfix/files/postfix.rc6.2.2.9
new file mode 100644
index 0000000..2e222ff
--- /dev/null
+++ b/mail-mta/postfix/files/postfix.rc6.2.2.9
@@ -0,0 +1,29 @@
+#!/sbin/runscript
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/postfix.rc6.2.2.9,v 1.1 2006/03/07 21:07:20 ferdy Exp $
+
+opts="${opts} reload"
+
+depend() {
+ use logger dns ypbind amavisd mysql postgresql antivirus postfix_greylist net saslauthd
+ provide mta
+}
+
+start() {
+ ebegin "Starting postfix"
+ /usr/sbin/postfix start &>/dev/null
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping postfix"
+ /usr/sbin/postfix stop &>/dev/null
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading postfix"
+ /usr/sbin/postfix reload &>/dev/null
+ eend $?
+}
diff --git a/mail-mta/postfix/files/smtp.pass b/mail-mta/postfix/files/smtp.pass
new file mode 100644
index 0000000..3ccf36d
--- /dev/null
+++ b/mail-mta/postfix/files/smtp.pass
@@ -0,0 +1,3 @@
+# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/smtp.pass,v 1.2 2004/07/18 03:26:56 dragonheart Exp $
+#
+# remotehost user:password
diff --git a/mail-mta/postfix/files/smtp.sasl b/mail-mta/postfix/files/smtp.sasl
new file mode 100644
index 0000000..452fafa
--- /dev/null
+++ b/mail-mta/postfix/files/smtp.sasl
@@ -0,0 +1,2 @@
+# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/smtp.sasl,v 1.2 2004/07/18 03:26:56 dragonheart Exp $
+pwcheck_method:pam
diff --git a/mail-mta/postfix/postfix-2.3.8.ebuild b/mail-mta/postfix/postfix-2.3.8.ebuild
new file mode 100644
index 0000000..3bfb514
--- /dev/null
+++ b/mail-mta/postfix/postfix-2.3.8.ebuild
@@ -0,0 +1,386 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/postfix-2.3.8.ebuild,v 1.2 2007/03/29 15:30:20 drizzt Exp $
+
+# NOTE: this ebuild is regular ebuild without mailer-config support
+# comment lines below "regular ebuild" and uncomment lines below "mailer-config support"
+# to turn this ebuild to mailer-config supported ebuild.
+
+# regular ebuild
+inherit eutils ssl-cert toolchain-funcs flag-o-matic pam
+# mailer-config support.
+#inherit eutils ssl-cert toolchain-funcs flag-o-matic mailer pam
+
+# regular ebuild.
+IUSE="ipv6 pam ldap mysql postgres ssl sasl dovecot-sasl mailwrapper mbox nis selinux hardened cdb vda"
+# mailer-config support.
+#IUSE="ipv6 pam ldap mysql postgres ssl sasl dovecot-sasl mbox nis selinux hardened cdb"
+
+MY_PV=${PV/_rc/-RC}
+MY_SRC=${PN}-${MY_PV}
+MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
+VDA_VER=2.3.3
+VDA_P="${PN}-${VDA_VER}-vda"
+RC_VER="2.2.9"
+
+DESCRIPTION="A fast and secure drop-in replacement for sendmail."
+HOMEPAGE="http://www.postfix.org/"
+SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
+ vda? ( http://web.onda.com.br/nadal/postfix/VDA/${VDA_P}.patch.gz ) "
+# devel? ( ftp://ftp.porcupine.org/mirrors/postfix-release/experimental/${DEV_SRC}.tar.gz ) "
+
+LICENSE="IPL-1"
+SLOT="0"
+#KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+
+# regular ebuild.
+PROVIDE="virtual/mta virtual/mda"
+# mailer-config support.
+#PROVIDE="${PROVIDE} virtual/mda"
+
+DEPEND="cdb? ( || ( >=dev-db/cdb-0.75-r1 >=dev-db/tinycdb-0.74 ) )
+ >=sys-libs/db-3.2
+ >=dev-libs/libpcre-3.4
+ pam? ( virtual/pam )
+ ldap? ( >=net-nds/openldap-1.2 )
+ mysql? ( virtual/mysql )
+ postgres? ( >=dev-db/postgresql-7.1 )
+ ssl? ( >=dev-libs/openssl-0.9.6g )
+ sasl? ( >=dev-libs/cyrus-sasl-2 )"
+
+# regular ebuild.
+RDEPEND="${DEPEND}
+ >=net-mail/mailbase-0.00
+ !mailwrapper? ( !virtual/mta )
+ mailwrapper? ( >=net-mail/mailwrapper-0.2 )
+ selinux? ( sec-policy/selinux-postfix )"
+
+# mailer-config support.
+#RDEPEND="${DEPEND}
+# >=net-mail/mailbase-0.00
+# selinux? ( sec-policy/selinux-postfix )"
+
+#if use devel; then
+# MY_SRC=${DEV_SRC}
+#fi
+
+S=${WORKDIR}/${MY_SRC}
+
+group_user_check() {
+ einfo "checking for postfix group... create if missing."
+ enewgroup postfix 207
+ einfo "checking for postdrop group... create if missing."
+ enewgroup postdrop 208
+ einfo "checking for postfix user... create if missing."
+ enewuser postfix 207 -1 /var/spool/postfix postfix,mail
+}
+
+pkg_setup() {
+ # do not upgrade live from postfix <2.3.
+ if [[ -f /var/lib/init.d/started/postfix ]] ; then
+ if has_version '<mail-mta/postfix-2.3.0' ; then
+ if [ "${FORCE_UPGRADE}" ]; then
+ echo
+ ewarn "You are upgrading from a incompatible version and"
+ ewarn "you have FORCE_UPGRADE set, will build this package with postfix running."
+ ewarn "You MUST stop postfix BEFORE install it to your system."
+ echo
+ else
+ echo
+ eerror "You are upgrading from a incompatible version."
+ eerror "You MUST stop postfix BEFORE install it to your system."
+ eerror "If you want a minimal downtime, emerge postfix with:"
+ eerror "\`FORCE_UPGRADE=1 emerge --buildpkgonly postfix\`; then"
+ eerror "\`/etc/init.d/postfix stop && emerge --usepkgonly postfix\`"
+ eerror "run etc-update or dispatch-conf and merge the configuration files."
+ eerror "Next /etc/init.d/postfix start"
+ die "upgrade from an incompatible version!"
+ echo
+ fi
+
+ else
+ echo
+ ewarn "It is safe to upgrade your current version while it's running."
+ ewarn "If you don't want to take any chance; please hit Ctrl+C now;"
+ ewarn "stop Postfix then emerge again."
+ ewarn "You have been warned!"
+ ewarn "Waiting 5 seconds before continuing."
+ echo
+ epause 5
+ fi
+ fi
+
+ echo
+ ewarn "Read \"ftp://ftp.porcupine.org/mirrors/postfix-release/official/${MY_SRC}.RELEASE_NOTES\""
+ ewarn "for incompatible changes before continue."
+ ewarn "Bugs should be filed at \"http://bugs.gentoo.org\""
+ ewarn "assign to \"net-mail@gentoo.org\"."
+ echo
+ #epause 5
+
+ # put out warnings to work around bug #45764
+ if has_version '<=mail-mta/postfix-2.0.18'; then
+ echo
+ ewarn "You are upgrading from postfix-2.0.18 or earlier, one of the empty queue"
+ ewarn "directory get deleted during unmerge the older version (#45764). Please run"
+ ewarn "\`etc/postfix/post-install upgrade-source\` to recreate them."
+ echo
+ #epause 5
+ fi
+
+ #TLS non-prod warn
+ if use ssl; then
+ echo
+ ewarn "you have \"ssl\" in your USE flags, TLS will be enabled."
+ ewarn "This service entry is incompatible with previous TLS patch."
+ ewarn "Visit http://www.postfix.org/TLS_README.html for more info."
+ echo
+ #epause 5
+ fi
+
+ # IPV6 non-prod warn
+ if use ipv6; then
+ echo
+ ewarn "you have \"ipv6\" in your USE flags, IPV6 will be enabled."
+ ewarn "Visit http://www.postfix.org/IPV6_README.html for more info."
+ echo
+ fi
+
+ if use sasl ; then
+ echo
+ elog "postfix 2.3 supports two SASL implementations."
+ elog "Cyrus SASL and Dovecot protocol version 1 (server only)"
+ elog "detail at http://www.postfix.org/SASL_README.html"
+ echo
+ fi
+
+ # add postfix, postdrop user/group. Bug #77565.
+ group_user_check || die "failed to check/add needed user/group"
+}
+
+src_unpack() {
+ unpack ${A} && cd "${S}"
+
+ epatch "${FILESDIR}/${PN}-master.cf.patch"
+
+ if use vda ; then
+ epatch "${WORKDIR}/${VDA_P}.patch"
+ fi
+
+ # Postfix does not get the FQDN if no hostname is configured.
+ epatch "${FILESDIR}/${PN}-2.0.9-get-FQDN.patch"
+
+ sed -i -e "/^#define ALIAS_DB_MAP/s|hash:/etc/aliases|hash:/etc/mail/aliases|" \
+ src/util/sys_defs.h || die "sed failed"
+
+}
+
+src_compile() {
+ cd ${S}
+ # added -Wl,-z,now wrt 62674.
+ # remove -ldl as it is not necessary, resolve bug #106446.
+ # -Wl,-z,now replaced by $(bindnow-flags)
+ local mycc="-DHAS_PCRE" mylibs="$(bindnow-flags) -L/usr/lib -lpcre -lcrypt -lpthread"
+
+ use pam && mylibs="${mylibs} -lpam"
+
+ if use ldap ; then
+ mycc="${mycc} -DHAS_LDAP"
+ mylibs="${mylibs} -lldap -llber"
+ fi
+
+ if use mysql ; then
+ mycc="${mycc} -DHAS_MYSQL -I/usr/include/mysql"
+ mylibs="${mylibs} -lmysqlclient -lm -lz"
+ fi
+
+ if use postgres ; then
+ if best_version '=dev-db/postgresql-7.3*' ; then
+ mycc="${mycc} -DHAS_PGSQL -I/usr/include/postgresql"
+ else
+ mycc="${mycc} -DHAS_PGSQL -I/usr/include/postgresql/pgsql"
+ fi
+ mylibs="${mylibs} -lpq"
+ fi
+
+ if use ssl ; then
+ mycc="${mycc} -DUSE_TLS"
+ mylibs="${mylibs} -lssl -lcrypto"
+ fi
+
+ if use sasl ; then
+ if use dovecot-sasl ; then
+ # set dovecot as default.
+ mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
+ fi
+ mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
+ mylibs="${mylibs} -lsasl2"
+ elif use dovecot-sasl ; then
+ mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
+ fi
+
+ if ! use nis; then
+ sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" src/util/sys_defs.h || \
+ die "sed failed"
+ fi
+
+ if use cdb; then
+ mycc="${mycc} -DHAS_CDB"
+ CDB_LIBS=""
+
+ # tinycdb is preferred.
+ if has_version dev-db/tinycdb; then
+ einfo "build with dev-db/tinycdb"
+ # ugly hack because gentoo doesn't install cdb.h
+ cp /usr/include/tinycdb.h ${S}/src/util/cdb.h || die \
+ "failed to cp /usr/include/tinycdb.h to ${S}/util/cdb.h"
+ CDB_LIBS="-ltinycdb"
+ else
+ CDB_PATH="/usr/lib"
+ for i in cdb.a alloc.a buffer.a unix.a byte.a
+ do CDB_LIBS="${CDB_LIBS} ${CDB_PATH}/${i}"
+ done
+ fi
+
+ mylibs="${mylibs} ${CDB_LIBS}"
+ fi
+
+ mycc="${mycc} -DDEF_DAEMON_DIR=\\\"/usr/lib/postfix\\\""
+ mycc="${mycc} -DDEF_MANPAGE_DIR=\\\"/usr/share/man\\\""
+ mycc="${mycc} -DDEF_README_DIR=\\\"/usr/share/doc/${PF}/readme\\\""
+ mycc="${mycc} -DDEF_HTML_DIR=\\\"/usr/share/doc/${PF}/html\\\""
+
+ ebegin "Starting make makefiles..."
+
+ local my_cc=$(tc-getCC)
+ einfo "CC=${my_cc:=gcc}"
+
+ # workaround for bug #76512
+ [ "$(gcc-version)" == "3.4" ] && use hardened && replace-flags -O? -Os
+
+ make DEBUG="" CC="${my_cc:=gcc}" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" \
+ makefiles || die "configure problem"
+
+ emake || die "compile problem"
+}
+
+src_install () {
+ /bin/sh postfix-install \
+ -non-interactive \
+ install_root="${D}" \
+ config_directory="/usr/share/doc/${PF}/defaults" \
+ readme_directory="/usr/share/doc/${PF}/readme" \
+ || die "postfix-install failed"
+
+ # Fix spool removal on upgrade.
+ rm -rf "${D}/var"
+ keepdir /var/spool/postfix
+
+ # Install an rmail for UUCP, closing bug #19127.
+ dobin auxiliary/rmail/rmail
+
+ # mailwrapper stuff
+ if use mailwrapper ; then
+ mv "${D}/usr/sbin/sendmail" "${D}/usr/sbin/sendmail.postfix"
+ mv "${D}/usr/bin/rmail" "${D}/usr/bin/rmail.postfix"
+ # mailer-config support
+ #rm "${D}/usr/bin/mailq" "${D}/usr/bin/newaliases"
+
+ mv "${D}/usr/share/man/man1/sendmail.1" \
+ "${D}/usr/share/man/man1/sendmail-postfix.1"
+ mv "${D}/usr/share/man/man1/newaliases.1" \
+ "${D}/usr/share/man/man1/newaliases-postfix.1"
+ mv "${D}/usr/share/man/man1/mailq.1" \
+ "${D}/usr/share/man/man1/mailq-postfix.1"
+ mv "${D}/usr/share/man/man5/aliases.5" \
+ "${D}/usr/share/man/man5/aliases-postfix.5"
+
+ # regular ebuild.
+ insinto /etc/mail
+ doins "${FILESDIR}/mailer.conf"
+ # mailer-config support
+ #mailer_install_conf
+ else
+ # Provide another link for legacy FSH.
+ dosym /usr/sbin/sendmail /usr/lib/sendmail
+ fi
+
+ # Install qshape tool.
+ dobin auxiliary/qshape/qshape.pl
+
+ # performance tuning tools.
+ dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
+ doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
+
+ # Set proper permissions on required files/directories.
+ fowners root:postdrop /usr/sbin/post{drop,queue}
+ fperms 02711 /usr/sbin/post{drop,queue}
+
+ keepdir /etc/postfix
+ mv ${D}/usr/share/doc/${PF}/defaults/{*.cf,post*-*} ${D}/etc/postfix
+ if use mbox ; then
+ mypostconf="mail_spool_directory=/var/spool/mail"
+ else
+ mypostconf="home_mailbox=.maildir/"
+ fi
+ "${D}/usr/sbin/postconf" -c "${D}/etc/postfix" -e \
+ ${mypostconf} || die "postconf failed"
+
+ insinto /etc/postfix
+ newins "${FILESDIR}/smtp.pass" saslpass
+ fperms 600 /etc/postfix/saslpass
+
+ newinitd "${FILESDIR}/postfix.rc6.${RC_VER}" postfix || \
+ die "newinitd failed"
+
+ mv "${S}/examples" "${D}/usr/share/doc/${PF}/"
+ dodoc *README COMPATIBILITY HISTORY INSTALL LICENSE PORTING RELEASE_NOTES*
+ dohtml html/*
+
+ pamd_mimic_system smtp auth account
+
+ # do not install server.{key,pem) if they are exist.
+ if use ssl && [[ ! -f /etc/ssl/postfix/server.key && ! -f /etc/ssl/postfix/server.pem ]]; then
+ SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
+ insinto /etc/ssl/postfix
+ docert server
+ fowners postfix:mail /etc/ssl/postfix/server.{key,pem}
+ fi
+
+ if use sasl ; then
+ insinto /etc/sasl2
+ newins "${FILESDIR}/smtp.sasl" smtpd.conf
+ fi
+}
+
+pkg_postinst() {
+ # add postfix, postdrop user/group. Bug #77565.
+ group_user_check || die "failed to check/add needed user/group"
+
+ ebegin "Fixing queue directories and permissions"
+ "${ROOT}/etc/postfix/post-install" upgrade-permissions
+ echo
+ ewarn "If you upgraded from postfix-1.x, you must revisit"
+ ewarn "your configuration files. See"
+ ewarn " /usr/share/doc/${PF}/RELEASE_NOTES"
+ ewarn "for a list of changes."
+
+ if [ ! -e /etc/mail/aliases.db ] ; then
+ echo
+ ewarn "You must edit /etc/mail/aliases to suit your needs"
+ ewarn "and then run /usr/bin/newaliases. Postfix will not"
+ ewarn "work correctly without it."
+ fi
+
+ # regular ebuild
+ if ! use mailwrapper && [[ -e /etc/mailer.conf ]]
+ then
+ einfo
+ einfo "Since you emerged $PN without mailwrapper in USE,"
+ einfo "you probably want to 'emerge -C mailwrapper' now."
+ einfo
+ fi
+ # mailer-config support
+ #mailer_pkg_postinst
+}