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

Contents of /mail-mta/postfix/postfix-2.10_pre20120617.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Jun 26 15:46:07 2012 UTC (10 months, 4 weeks ago) by eras
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
version bump

(Portage version: 2.1.11.1/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.13