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

Contents of /mail-mta/postfix/postfix-2.5.7.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Fri Apr 2 17:20:39 2010 UTC (10 years ago) by dertobi123
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +1 -1 lines
FILE REMOVED
Version bump
(Portage version: 2.2_rc67/cvs/Linux x86_64)

1 # Copyright 1999-2010 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.5.7.ebuild,v 1.9 2010/02/05 22:15:04 ulm Exp $
4
5 # NOTE: this ebuild is a regular ebuild without mailer-config support!
6 # Comment lines below "regular ebuild" and uncomment lines below "mailer-config support"
7 # to turn this ebuild to a mailer-config enabled ebuild.
8
9 # regular ebuild
10 inherit eutils multilib ssl-cert toolchain-funcs flag-o-matic pam
11 # mailer-config support
12 #inherit eutils multilib ssl-cert toolchain-funcs flag-o-matic mailer pam
13
14 KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 s390 sh sparc x86 ~x86-fbsd"
15
16 # regular ebuild
17 IUSE="cdb dovecot-sasl hardened ipv6 ldap mailwrapper mbox mysql nis pam postgres sasl selinux ssl vda"
18 # mailer-config support
19 #IUSE="cdb dovecot-sasl hardened ipv6 ldap mbox mysql nis pam postgres sasl selinux ssl vda"
20
21 MY_PV="${PV/_rc/-RC}"
22 MY_SRC="${PN}-${MY_PV}"
23 MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
24 VDA_PV="2.5.5"
25 VDA_P="${PN}-${VDA_PV}-vda-ng"
26 RC_VER="2.5"
27
28 DESCRIPTION="A fast and secure drop-in replacement for sendmail."
29 HOMEPAGE="http://www.postfix.org/"
30 SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
31 vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch.gz ) "
32
33 LICENSE="IBM"
34 SLOT="0"
35
36 # regular ebuild
37 PROVIDE="virtual/mta virtual/mda"
38 # mailer-config support
39 #PROVIDE="${PROVIDE} virtual/mda"
40
41 DEPEND=">=sys-libs/db-3.2
42 >=dev-libs/libpcre-3.4
43 cdb? ( || ( >=dev-db/cdb-0.75-r1 >=dev-db/tinycdb-0.76 ) )
44 ldap? ( >=net-nds/openldap-1.2 )
45 mysql? ( virtual/mysql )
46 pam? ( virtual/pam )
47 postgres? ( virtual/postgresql-base )
48 sasl? ( >=dev-libs/cyrus-sasl-2 )
49 ssl? ( >=dev-libs/openssl-0.9.6g )"
50
51 # regular ebuild
52 RDEPEND="${DEPEND}
53 >=net-mail/mailbase-0.00
54 !mailwrapper? (
55 !virtual/mta
56 !net-mail/mailwrapper
57 )
58 mailwrapper? ( >=net-mail/mailwrapper-0.2 )
59 selinux? ( sec-policy/selinux-postfix )"
60
61 # mailer-config support
62 #RDEPEND="${DEPEND}
63 # >=net-mail/mailbase-0.00
64 # selinux? ( sec-policy/selinux-postfix )"
65
66 S="${WORKDIR}/${MY_SRC}"
67
68 group_user_check() {
69 einfo "Checking for postfix group ..."
70 enewgroup postfix 207
71 einfo "Checking for postdrop group ..."
72 enewgroup postdrop 208
73 einfo "Checking for postfix user ..."
74 enewuser postfix 207 -1 /var/spool/postfix postfix,mail
75 }
76
77 pkg_setup() {
78 # Do not upgrade live from Postfix <2.5
79 if [[ -f /var/lib/init.d/started/postfix ]] ; then
80 if has_version '<mail-mta/postfix-2.5.0' ; then
81 if [[ "${FORCE_UPGRADE}" ]] ; then
82 echo
83 ewarn "You are upgrading from an incompatible version and you have"
84 ewarn "FORCE_UPGRADE set, will build this package while Postfix is running."
85 ewarn "You MUST stop Postfix BEFORE installing this version to your system."
86 echo
87 else
88 echo
89 eerror "You are upgrading from an incompatible version."
90 eerror "You MUST stop Postfix BEFORE installing this version to your system."
91 eerror "If you want minimal downtime, emerge postfix with:"
92 eerror " FORCE_UPGRADE=1 emerge --buildpkgonly postfix"
93 eerror " /etc/init.d/postfix stop"
94 eerror " emerge --usepkgonly postfix"
95 eerror "Then run etc-update or dispatch-conf and merge the configuration files."
96 eerror "Then restart Postfix with: /etc/init.d/postfix start"
97 die "Upgrade from an incompatible version!"
98 echo
99 fi
100 else
101 echo
102 ewarn "It's safe to upgrade your current version while it's running."
103 ewarn "If you don't want to take any chance, please hit Ctrl+C now,"
104 ewarn "stop Postfix, then emerge again."
105 ewarn "You have been warned!"
106 ewarn "Waiting 5 seconds before continuing ..."
107 echo
108 epause 5
109 fi
110 fi
111
112 echo
113 ewarn "Read \"ftp://ftp.porcupine.org/mirrors/postfix-release/official/${MY_SRC}.RELEASE_NOTES\""
114 ewarn "for incompatible changes before continueing."
115 ewarn "Bugs should be filed at \"http://bugs.gentoo.org/\" and"
116 ewarn "assigned to \"net-mail@gentoo.org\"."
117 echo
118
119 # Warnings to work around bug #45764
120 if has_version '<=mail-mta/postfix-2.0.18' ; then
121 echo
122 ewarn "You are upgrading from postfix-2.0.18 or earlier, some of the empty queue"
123 ewarn "directories get deleted while unmerging the older version (see bug #45764)."
124 ewarn "Please run '/etc/postfix/post-install upgrade-source' to recreate them."
125 echo
126 fi
127
128 # TLS non-prod warning
129 if use ssl ; then
130 echo
131 ewarn "You have \"ssl\" in your USE flags, TLS will be enabled."
132 ewarn "This service is incompatible with the previous TLS patch."
133 ewarn "Visit http://www.postfix.org/TLS_README.html for more info."
134 echo
135 fi
136
137 # IPV6 non-prod warn
138 if use ipv6 ; then
139 echo
140 ewarn "You have \"ipv6\" in your USE flags, IPV6 will be enabled."
141 ewarn "Visit http://www.postfix.org/IPV6_README.html for more info."
142 echo
143 fi
144
145 # SASL non-prod warning
146 if use sasl ; then
147 echo
148 elog "Postfix 2.3 and newer supports two SASL implementations."
149 elog "Cyrus SASL and Dovecot protocol version 1 (server only)"
150 elog "Visit http://www.postfix.org/SASL_README.html for more info."
151 echo
152 fi
153
154 # Add postfix, postdrop user/group (bug #77565)
155 group_user_check || die "Failed to check/add needed user/group"
156 }
157
158 src_unpack() {
159 unpack ${A}
160
161 cd "${S}"
162 if use vda ; then
163 epatch "${WORKDIR}/${VDA_P}.patch"
164 fi
165
166 sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
167 src/util/sys_defs.h || die "sed failed"
168
169 # change default paths to better comply with portage standard paths
170 sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
171 }
172
173 src_compile() {
174 # 1) Added -Wl,-z,now wrt bug #62674
175 # 2) Remove -ldl as it is not necessary, solves bug #106446
176 # 3) -Wl,-z,now replaced by $(bindnow-flags)
177 # 4) Then bindnow-flags has been simply dropped according to
178 # http://www.mail-archive.com/gentoo-dev@lists.gentoo.org/msg23679.html
179 # 5) Make sure LDFLAGS get passed down to the executables.
180 local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -lpcre -lcrypt -lpthread"
181
182 use pam && mylibs="${mylibs} -lpam"
183
184 if use ldap ; then
185 mycc="${mycc} -DHAS_LDAP"
186 mylibs="${mylibs} -lldap -llber"
187 fi
188
189 if use mysql ; then
190 mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
191 mylibs="${mylibs} -lmysqlclient -lm -lz"
192 fi
193
194 if use postgres ; then
195 mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
196 mylibs="${mylibs} -lpq -L$(pg_config --libdir)"
197 fi
198
199 if use ssl ; then
200 mycc="${mycc} -DUSE_TLS"
201 mylibs="${mylibs} -lssl -lcrypto"
202 fi
203
204 if use sasl ; then
205 if use dovecot-sasl ; then
206 # Set dovecot as default.
207 mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
208 fi
209 mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
210 mylibs="${mylibs} -lsasl2"
211 elif use dovecot-sasl ; then
212 mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
213 fi
214
215 if ! use nis ; then
216 sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
217 src/util/sys_defs.h || die "sed failed"
218 fi
219
220 if use cdb ; then
221 mycc="${mycc} -DHAS_CDB"
222 CDB_LIBS=""
223
224 # Tinycdb is preferred.
225 if has_version dev-db/tinycdb ; then
226 einfo "Building with dev-db/tinycdb"
227 CDB_LIBS="-lcdb"
228 else
229 einfo "Building with dev-db/cdb"
230 CDB_PATH="/usr/$(get_libdir)"
231 for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
232 CDB_LIBS="${CDB_LIBS} ${CDB_PATH}/${i}"
233 done
234 fi
235
236 mylibs="${mylibs} ${CDB_LIBS}"
237 fi
238
239 mycc="${mycc} -DDEF_DAEMON_DIR=\\\"/usr/$(get_libdir)/postfix\\\""
240 mycc="${mycc} -DDEF_MANPAGE_DIR=\\\"/usr/share/man\\\""
241 mycc="${mycc} -DDEF_README_DIR=\\\"/usr/share/doc/${PF}/readme\\\""
242 mycc="${mycc} -DDEF_HTML_DIR=\\\"/usr/share/doc/${PF}/html\\\""
243
244 # Robin H. Johnson <robbat2@gentoo.org> 17/Nov/2006
245 # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
246 mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
247 filter-lfs-flags
248
249 local my_cc=$(tc-getCC)
250 einfo "CC=${my_cc:=gcc}"
251
252 # Workaround for bug #76512
253 if use hardened ; then
254 [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
255 fi
256
257 make DEBUG="" CC="${my_cc:=gcc}" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" \
258 makefiles || die "configure problem"
259
260 emake || die "compile problem"
261 }
262
263 src_install () {
264 /bin/sh postfix-install \
265 -non-interactive \
266 install_root="${D}" \
267 config_directory="/usr/share/doc/${PF}/defaults" \
268 readme_directory="/usr/share/doc/${PF}/readme" \
269 || die "postfix-install failed"
270
271 # Fix spool removal on upgrade
272 rm -Rf "${D}/var"
273 keepdir /var/spool/postfix
274
275 # Install rmail for UUCP, closes bug #19127
276 dobin auxiliary/rmail/rmail
277
278 # mailwrapper stuff
279 if use mailwrapper ; then
280 mv "${D}/usr/sbin/sendmail" "${D}/usr/sbin/sendmail.postfix"
281 mv "${D}/usr/bin/rmail" "${D}/usr/bin/rmail.postfix"
282 # mailer-config support
283 #rm "${D}/usr/bin/mailq" "${D}/usr/bin/newaliases"
284
285 mv "${D}/usr/share/man/man1/sendmail.1" \
286 "${D}/usr/share/man/man1/sendmail-postfix.1"
287 mv "${D}/usr/share/man/man1/newaliases.1" \
288 "${D}/usr/share/man/man1/newaliases-postfix.1"
289 mv "${D}/usr/share/man/man1/mailq.1" \
290 "${D}/usr/share/man/man1/mailq-postfix.1"
291 mv "${D}/usr/share/man/man5/aliases.5" \
292 "${D}/usr/share/man/man5/aliases-postfix.5"
293
294 # regular ebuild
295 insinto /etc/mail
296 doins "${FILESDIR}/mailer.conf"
297 # mailer-config support
298 #mailer_install_conf
299 else
300 # Provide another link for legacy FSH
301 dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
302 fi
303
304 # Install qshape tool
305 dobin auxiliary/qshape/qshape.pl
306 doman man/man1/qshape.1
307
308 # Performance tuning tools and their manuals
309 dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
310 doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
311
312 # Set proper permissions on required files/directories
313 dodir /var/lib/postfix
314 keepdir /var/lib/postfix
315 fowners postfix:postfix /var/lib/postfix
316 fowners postfix:postfix /var/lib/postfix/.keep_${CATEGORY}_${PN}-${SLOT}
317 fperms 0750 /var/lib/postfix
318 fowners root:postdrop /usr/sbin/post{drop,queue}
319 fperms 02711 /usr/sbin/post{drop,queue}
320
321 keepdir /etc/postfix
322 mv "${D}"/usr/share/doc/${PF}/defaults/{*.cf,post*-*} "${D}"/etc/postfix
323 if use mbox ; then
324 mypostconf="mail_spool_directory=/var/spool/mail"
325 else
326 mypostconf="home_mailbox=.maildir/"
327 fi
328 "${D}/usr/sbin/postconf" -c "${D}/etc/postfix" \
329 -e ${mypostconf} || die "postconf failed"
330
331 insinto /etc/postfix
332 newins "${FILESDIR}/smtp.pass" saslpass
333 fperms 600 /etc/postfix/saslpass
334
335 newinitd "${FILESDIR}/postfix.rc6.${RC_VER}" postfix || die "newinitd failed"
336
337 mv "${S}/examples" "${D}/usr/share/doc/${PF}/"
338 dodoc *README COMPATIBILITY HISTORY INSTALL PORTING RELEASE_NOTES*
339 dohtml html/*
340
341 pamd_mimic_system smtp auth account
342
343 if use sasl ; then
344 insinto /etc/sasl2
345 newins "${FILESDIR}/smtp.sasl" smtpd.conf
346 fi
347 }
348
349 pkg_postinst() {
350 # Add postfix, postdrop user/group (bug #77565)
351 group_user_check || die "Failed to check/add needed user/group"
352
353 # Do not install server.{key,pem) SSL certificates if they already exist
354 if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
355 && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
356 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
357 install_cert /etc/ssl/postfix/server
358 chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
359 fi
360
361 ebegin "Fixing queue directories and permissions"
362 "${ROOT}/etc/postfix/post-install" upgrade-permissions
363 echo
364 ewarn "If you upgraded from Postfix-1.x, you must revisit"
365 ewarn "your configuration files. See"
366 ewarn " /usr/share/doc/${PF}/RELEASE_NOTES"
367 ewarn "for a list of changes."
368
369 if [[ ! -e /etc/mail/aliases.db ]] ; then
370 echo
371 ewarn "You must edit /etc/mail/aliases to suit your needs"
372 ewarn "and then run /usr/bin/newaliases. Postfix will not"
373 ewarn "work correctly without it."
374 fi
375
376 # regular ebuild
377 if ! use mailwrapper && [[ -e /etc/mailer.conf ]] ; then
378 einfo
379 einfo "Since you emerged Postfix without mailwrapper in USE,"
380 einfo "you may want to 'emerge -C mailwrapper' now."
381 einfo
382 fi
383 # mailer-config support
384 #mailer_pkg_postinst
385 }

  ViewVC Help
Powered by ViewVC 1.1.20