/[gentoo-x86]/mail-mta/postfix/postfix-2.11_pre20130211.ebuild
Gentoo

Contents of /mail-mta/postfix/postfix-2.11_pre20130211.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Feb 13 16:37:37 2013 UTC (20 months, 1 week ago) by eras
Branch: MAIN
Version bump

(Portage version: 2.2.0_alpha162/cvs/Linux x86_64, signed Manifest commit with key 0x77F1F175586A3B1F)

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/postfix-2.10_pre20130204.ebuild,v 1.1 2013/02/09 10:12:40 eras Exp $
4
5 EAPI=5
6 inherit eutils multilib ssl-cert toolchain-funcs flag-o-matic pam user versionator
7
8 MY_PV="${PV/_pre/-}"
9 MY_SRC="${PN}-${MY_PV}"
10 MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/experimental"
11 VDA_PV="2.9.5"
12 VDA_P="${PN}-vda-v11-${VDA_PV}"
13 RC_VER="2.7"
14
15 DESCRIPTION="A fast and secure drop-in replacement for sendmail."
16 HOMEPAGE="http://www.postfix.org/"
17 SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
18 vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch ) "
19
20 LICENSE="IBM"
21 SLOT="0"
22 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
23 IUSE="+berkdb cdb doc dovecot-sasl hardened ldap ldap-bind memcached mbox mysql nis pam postgres sasl selinux sqlite ssl vda"
24
25 DEPEND=">=dev-libs/libpcre-3.4
26 dev-lang/perl
27 berkdb? ( >=sys-libs/db-3.2 )
28 cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r1 ) )
29 ldap? ( net-nds/openldap )
30 ldap-bind? ( net-nds/openldap[sasl] )
31 mysql? ( virtual/mysql )
32 pam? ( virtual/pam )
33 postgres? ( dev-db/postgresql-base )
34 sasl? ( >=dev-libs/cyrus-sasl-2 )
35 sqlite? ( dev-db/sqlite:3 )
36 ssl? ( >=dev-libs/openssl-0.9.6g )"
37
38 RDEPEND="${DEPEND}
39 dovecot-sasl? ( net-mail/dovecot )
40 memcached? ( net-misc/memcached )
41 net-mail/mailbase
42 selinux? ( sec-policy/selinux-postfix )
43 !mail-mta/courier
44 !mail-mta/esmtp
45 !mail-mta/exim
46 !mail-mta/mini-qmail
47 !mail-mta/msmtp[mta]
48 !mail-mta/netqmail
49 !mail-mta/nullmailer
50 !mail-mta/qmail-ldap
51 !mail-mta/sendmail
52 !<mail-mta/ssmtp-2.64-r2
53 !>=mail-mta/ssmtp-2.64-r2[mta]
54 !net-mail/fastforward"
55
56 REQUIRED_USE="ldap-bind? ( ldap sasl )"
57
58 S="${WORKDIR}/${MY_SRC}"
59
60 pkg_setup() {
61 # Add postfix, postdrop user/group (bug #77565)
62 enewgroup postfix 207
63 enewgroup postdrop 208
64 enewuser postfix 207 -1 /var/spool/postfix postfix,mail
65 }
66
67 src_prepare() {
68 if use vda; then
69 epatch "${DISTDIR}"/${VDA_P}.patch
70 fi
71
72 if ! use berkdb; then
73 epatch "${FILESDIR}/${PN}_no-berkdb.patch"
74 fi
75
76 sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
77 src/util/sys_defs.h || die "sed failed"
78
79 # change default paths to better comply with portage standard paths
80 sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
81 }
82
83 src_configure() {
84 # Make sure LDFLAGS get passed down to the executables.
85 local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -lpcre -lcrypt -lpthread"
86
87 use pam && mylibs="${mylibs} -lpam"
88
89 if use ldap; then
90 mycc="${mycc} -DHAS_LDAP"
91 mylibs="${mylibs} -lldap -llber"
92 fi
93
94 if use mysql; then
95 mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
96 mylibs="${mylibs} $(mysql_config --libs)"
97 fi
98
99 if use postgres; then
100 mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
101 mylibs="${mylibs} -lpq -L$(pg_config --libdir)"
102 fi
103
104 if use sqlite; then
105 mycc="${mycc} -DHAS_SQLITE"
106 mylibs="${mylibs} -lsqlite3"
107 fi
108
109 if use ssl; then
110 mycc="${mycc} -DUSE_TLS"
111 mylibs="${mylibs} -lssl -lcrypto"
112 fi
113
114 # broken. and "in other words, not supported" by upstream.
115 # Use inet_protocols setting in main.cf
116 #if ! use ipv6; then
117 # mycc="${mycc} -DNO_IPV6"
118 #fi
119
120 if use sasl; then
121 if use dovecot-sasl; then
122 # Set dovecot as default.
123 mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
124 fi
125 if use ldap-bind; then
126 mycc="${mycc} -DUSE_LDAP_SASL"
127 fi
128 mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
129 mylibs="${mylibs} -lsasl2"
130 elif use dovecot-sasl; then
131 mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
132 fi
133
134 if ! use nis; then
135 sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
136 src/util/sys_defs.h || die "sed failed"
137 fi
138
139 if ! use berkdb; then
140 mycc="${mycc} -DNO_DB"
141 if use cdb; then
142 # change default hash format from Berkeley DB to cdb
143 sed -i -e "s/hash/cdb/" src/util/sys_defs.h || die
144 fi
145 fi
146
147 if use cdb; then
148 mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
149 CDB_LIBS=""
150 # Tinycdb is preferred.
151 if has_version dev-db/tinycdb ; then
152 einfo "Building with dev-db/tinycdb"
153 CDB_LIBS="-lcdb"
154 else
155 einfo "Building with dev-db/cdb"
156 CDB_PATH="/usr/$(get_libdir)"
157 for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
158 CDB_LIBS="${CDB_LIBS} ${CDB_PATH}/${i}"
159 done
160 fi
161 mylibs="${mylibs} ${CDB_LIBS}"
162 fi
163
164 # Robin H. Johnson <robbat2@gentoo.org> 17/Nov/2006
165 # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
166 mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
167 filter-lfs-flags
168
169 # Workaround for bug #76512
170 if use hardened; then
171 [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
172 fi
173
174 # Remove annoying C++ comment style warnings - bug #378099
175 append-flags -Wno-comment
176
177 sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
178 sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
179 emake DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" makefiles
180 }
181
182 src_install () {
183 local myconf
184 use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
185 html_directory=\"/usr/share/doc/${PF}/html\""
186
187 /bin/sh postfix-install \
188 -non-interactive \
189 install_root="${D}" \
190 config_directory="/etc/postfix" \
191 manpage_directory="/usr/share/man" \
192 command_directory="/usr/sbin" \
193 mailq_path="/usr/bin/mailq" \
194 newaliases_path="/usr/bin/newaliases" \
195 sendmail_path="/usr/sbin/sendmail" \
196 ${myconf} \
197 || die "postfix-install failed"
198
199 # Fix spool removal on upgrade
200 rm -Rf "${D}"/var
201 keepdir /var/spool/postfix
202
203 # Install rmail for UUCP, closes bug #19127
204 dobin auxiliary/rmail/rmail
205
206 # Provide another link for legacy FSH
207 dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
208
209 # Install qshape tool
210 dobin auxiliary/qshape/qshape.pl
211 doman man/man1/qshape.1
212
213 # Performance tuning tools and their manuals
214 dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
215 doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
216
217 # Set proper permissions on required files/directories
218 dodir /var/lib/postfix
219 keepdir /var/lib/postfix
220 fowners -R postfix:postfix /var/lib/postfix
221 fperms 0750 /var/lib/postfix
222 fowners root:postdrop /usr/sbin/post{drop,queue}
223 fperms 02711 /usr/sbin/post{drop,queue}
224
225 keepdir /etc/postfix
226 if use mbox; then
227 mypostconf="mail_spool_directory=/var/spool/mail"
228 else
229 mypostconf="home_mailbox=.maildir/"
230 fi
231 "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
232 -e ${mypostconf} || die "postconf failed"
233
234 insinto /etc/postfix
235 newins "${FILESDIR}"/smtp.pass saslpass
236 fperms 600 /etc/postfix/saslpass
237
238 newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
239 # do not start mysql/postgres unnecessarily - bug #359913
240 use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
241 use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
242
243 dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
244 mv "${D}"/etc/postfix/{*.default,makedefs.out} "${D}"/usr/share/doc/${PF}/
245 use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
246
247 pamd_mimic_system smtp auth account
248
249 if use sasl; then
250 insinto /etc/sasl2
251 newins "${FILESDIR}"/smtp.sasl smtpd.conf
252 fi
253
254 # header files
255 insinto /usr/include/postfix
256 doins include/*.h
257
258 # Remove unnecessary files
259 rm -f "${D}"/etc/postfix/{*LICENSE,access,aliases,canonical,generic}
260 rm -f "${D}"/etc/postfix/{header_checks,relocated,transport,virtual}
261 }
262
263 pkg_preinst() {
264 # Postfix 2.9.
265 # default for inet_protocols changed from ipv4 to all in postfix-2.9.
266 # check inet_protocols setting in main.cf and modify if necessary to prevent
267 # performance loss with useless DNS lookups and useless connection attempts.
268 [[ -d ${ROOT}/etc/postfix ]] && {
269 if [[ "$(${D}/usr/sbin/postconf -dh inet_protocols)" != "ipv4" ]]; then
270 if [[ ! -n "$(${D}/usr/sbin/postconf -c ${ROOT}/etc/postfix -n inet_protocols)" ]];
271 then
272 ewarn "\nCOMPATIBILITY: adding inet_protocols=ipv4 to main.cf."
273 ewarn "That will keep the same behaviour as previous postfix versions."
274 ewarn "Specify inet_protocols explicitly if you want to enable IPv6.\n"
275 else
276 # delete inet_protocols setting. there is already one in /etc/postfix
277 sed -i -e /inet_protocols/d "${D}"/etc/postfix/main.cf || die
278 fi
279 fi
280 }
281
282 # Postfix 2.10.
283 # Safety net for incompatible changes due to the introduction
284 # of the smtpd_relay_restrictions feature to separate the
285 # mail relay policy from the spam blocking policy.
286 [[ -d ${ROOT}/etc/postfix ]] && has_version '<=mail-mta/postfix-2.9.99' && {
287 if [[ -z "$(${D}/usr/sbin/postconf -c ${ROOT}/etc/postfix -n smtpd_relay_restrictions)" ]];
288 then
289 local myconf="smtpd_relay_restrictions=permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination"
290 ewarn "\nCOMPATIBILITY: adding smtpd_relay_restrictions to main.cf"
291 ewarn "to prevent inbound mail from unexpectedly bouncing."
292 ewarn "Specify an empty smtpd_relay_restrictions value to keep using"
293 ewarn "smtpd_recipient_restrictions as before.\n"
294 "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix -e ${myconf} || die
295 fi
296 }
297 }
298
299 pkg_postinst() {
300 # Do not install server.{key,pem) SSL certificates if they already exist
301 if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
302 && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
303 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
304 install_cert /etc/ssl/postfix/server
305 chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
306 fi
307
308 if [[ ! -e /etc/mail/aliases.db ]] ; then
309 ewarn
310 ewarn "You must edit /etc/mail/aliases to suit your needs"
311 ewarn "and then run /usr/bin/newaliases. Postfix will not"
312 ewarn "work correctly without it."
313 ewarn
314 fi
315
316 if [[ $(get_version_component_range 2 ${REPLACING_VERSIONS}) -lt 9 ]]; then
317 elog "If you are using old style postfix instances by symlinking"
318 elog "startup scripts in ${ROOT}etc/init.d, please consider"
319 elog "upgrading your config for postmulti support. For more info:"
320 elog "http://www.postfix.org/MULTI_INSTANCE_README.html"
321 if ! use berkdb; then
322 ewarn "\nPostfix is installed without BerkeleyDB support."
323 ewarn "Please turn on berkdb USE flag if you need hash or"
324 ewarn "btree table lookups.\n"
325 fi
326 ewarn "Postfix daemons now live under /usr/libexec/postfix"
327 ewarn "Please adjust your main.cf accordingly by running"
328 ewarn "etc-update/dispatch-conf or similar and accepting the new"
329 ewarn "daemon_directory setting."
330 fi
331 }

  ViewVC Help
Powered by ViewVC 1.1.20