Gentoo Archives: gentoo-commits

From: Eray Aslan <eras@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-mta/postfix/
Date: Mon, 02 Nov 2015 07:14:55
Message-Id: 1446448165.a02d8cc408c3b69f9dd39ec86a9013857c7ab24c.eras@gentoo
1 commit: a02d8cc408c3b69f9dd39ec86a9013857c7ab24c
2 Author: Eray Aslan <eras <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 2 07:09:25 2015 +0000
4 Commit: Eray Aslan <eras <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 2 07:09:25 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a02d8cc4
7
8 mail-mta/postfix: fix dev-db/cdb dependency
9
10 Package-Manager: portage-2.2.23
11
12 mail-mta/postfix/postfix-3.0.3-r1.ebuild | 314 +++++++++++++++++++++++++++++++
13 1 file changed, 314 insertions(+)
14
15 diff --git a/mail-mta/postfix/postfix-3.0.3-r1.ebuild b/mail-mta/postfix/postfix-3.0.3-r1.ebuild
16 new file mode 100644
17 index 0000000..3490dd6
18 --- /dev/null
19 +++ b/mail-mta/postfix/postfix-3.0.3-r1.ebuild
20 @@ -0,0 +1,314 @@
21 +# Copyright 1999-2015 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +# $Id$
24 +
25 +EAPI=5
26 +inherit eutils flag-o-matic multilib pam ssl-cert systemd toolchain-funcs user versionator
27 +
28 +MY_PV="${PV/_rc/-RC}"
29 +MY_SRC="${PN}-${MY_PV}"
30 +MY_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official"
31 +VDA_PV="2.10.0"
32 +VDA_P="${PN}-vda-v13-${VDA_PV}"
33 +RC_VER="2.7"
34 +
35 +DESCRIPTION="A fast and secure drop-in replacement for sendmail"
36 +HOMEPAGE="http://www.postfix.org/"
37 +SRC_URI="${MY_URI}/${MY_SRC}.tar.gz
38 + vda? ( http://vda.sourceforge.net/VDA/${VDA_P}.patch ) "
39 +
40 +LICENSE="IBM"
41 +SLOT="0"
42 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
43 +IUSE="+berkdb cdb doc dovecot-sasl +eai hardened ldap ldap-bind libressl lmdb memcached mbox mysql nis pam postgres sasl selinux sqlite ssl vda"
44 +
45 +DEPEND=">=dev-libs/libpcre-3.4
46 + dev-lang/perl
47 + berkdb? ( >=sys-libs/db-3.2:* )
48 + cdb? ( || ( >=dev-db/tinycdb-0.76 >=dev-db/cdb-0.75-r4 ) )
49 + eai? ( dev-libs/icu:= )
50 + ldap? ( net-nds/openldap )
51 + ldap-bind? ( net-nds/openldap[sasl] )
52 + lmdb? ( >=dev-db/lmdb-0.9.11 )
53 + mysql? ( virtual/mysql )
54 + pam? ( virtual/pam )
55 + postgres? ( dev-db/postgresql:* )
56 + sasl? ( >=dev-libs/cyrus-sasl-2 )
57 + sqlite? ( dev-db/sqlite:3 )
58 + ssl? (
59 + !libressl? ( dev-libs/openssl:0 )
60 + libressl? ( dev-libs/libressl )
61 + )"
62 +
63 +RDEPEND="${DEPEND}
64 + dovecot-sasl? ( net-mail/dovecot )
65 + memcached? ( net-misc/memcached )
66 + net-mail/mailbase
67 + !mail-mta/courier
68 + !mail-mta/esmtp
69 + !mail-mta/exim
70 + !mail-mta/mini-qmail
71 + !mail-mta/msmtp[mta]
72 + !mail-mta/netqmail
73 + !mail-mta/nullmailer
74 + !mail-mta/qmail-ldap
75 + !mail-mta/sendmail
76 + !mail-mta/opensmtpd
77 + !<mail-mta/ssmtp-2.64-r2
78 + !>=mail-mta/ssmtp-2.64-r2[mta]
79 + !net-mail/fastforward
80 + selinux? ( sec-policy/selinux-postfix )"
81 +
82 +# No vda support for postfix-3.0
83 +REQUIRED_USE="ldap-bind? ( ldap sasl )
84 + !vda"
85 +
86 +S="${WORKDIR}/${MY_SRC}"
87 +
88 +pkg_setup() {
89 + # Add postfix, postdrop user/group (bug #77565)
90 + enewgroup postfix 207
91 + enewgroup postdrop 208
92 + enewuser postfix 207 -1 /var/spool/postfix postfix,mail
93 +}
94 +
95 +src_prepare() {
96 + if use vda; then
97 + epatch "${DISTDIR}"/${VDA_P}.patch
98 + fi
99 +
100 + sed -i -e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/mail/aliases|" \
101 + src/util/sys_defs.h || die "sed failed"
102 +
103 + # change default paths to better comply with portage standard paths
104 + sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || die "sed failed"
105 +
106 + epatch_user
107 +}
108 +
109 +src_configure() {
110 + for name in CDB LDAP LMDB MYSQL PCRE PGSQL SDBM SQLITE
111 + do
112 + local AUXLIBS_${name}=""
113 + done
114 +
115 + # Make sure LDFLAGS get passed down to the executables.
116 + local mycc="-DHAS_PCRE" mylibs="${LDFLAGS} -ldl"
117 + AUXLIBS_PCRE="$(pcre-config --libs)"
118 +
119 + use pam && mylibs="${mylibs} -lpam"
120 +
121 + if use ldap; then
122 + mycc="${mycc} -DHAS_LDAP"
123 + AUXLIBS_LDAP="-lldap -llber"
124 + fi
125 +
126 + if use mysql; then
127 + mycc="${mycc} -DHAS_MYSQL $(mysql_config --include)"
128 + AUXLIBS_MYSQL="$(mysql_config --libs)"
129 + fi
130 +
131 + if use postgres; then
132 + mycc="${mycc} -DHAS_PGSQL -I$(pg_config --includedir)"
133 + AUXLIBS_PGSQL="-L$(pg_config --libdir) -lpq"
134 + fi
135 +
136 + if use sqlite; then
137 + mycc="${mycc} -DHAS_SQLITE"
138 + AUXLIBS_SQLITE="-lsqlite3 -lpthread"
139 + fi
140 +
141 + if use ssl; then
142 + mycc="${mycc} -DUSE_TLS"
143 + mylibs="${mylibs} -lssl -lcrypto"
144 + fi
145 +
146 + if use lmdb; then
147 + mycc="${mycc} -DHAS_LMDB"
148 + AUXLIBS_LMDB="-llmdb -lpthread"
149 + fi
150 +
151 + if ! use eai; then
152 + mycc="${mycc} -DNO_EAI"
153 + fi
154 +
155 + # broken. and "in other words, not supported" by upstream.
156 + # Use inet_protocols setting in main.cf
157 + #if ! use ipv6; then
158 + # mycc="${mycc} -DNO_IPV6"
159 + #fi
160 +
161 + if use sasl; then
162 + if use dovecot-sasl; then
163 + # Set dovecot as default.
164 + mycc="${mycc} -DDEF_SASL_SERVER=\\\"dovecot\\\""
165 + fi
166 + if use ldap-bind; then
167 + mycc="${mycc} -DUSE_LDAP_SASL"
168 + fi
169 + mycc="${mycc} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
170 + mylibs="${mylibs} -lsasl2"
171 + elif use dovecot-sasl; then
172 + mycc="${mycc} -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
173 + fi
174 +
175 + if ! use nis; then
176 + mycc="${mycc} -DNO_NIS"
177 + fi
178 +
179 + if ! use berkdb; then
180 + mycc="${mycc} -DNO_DB"
181 + if use cdb; then
182 + # change default hash format from Berkeley DB to cdb
183 + mycc="${mycc} -DDEF_DB_TYPE=\\\"cdb\\\""
184 + fi
185 + fi
186 +
187 + if use cdb; then
188 + mycc="${mycc} -DHAS_CDB -I/usr/include/cdb"
189 + # Tinycdb is preferred.
190 + if has_version dev-db/tinycdb ; then
191 + einfo "Building with dev-db/tinycdb"
192 + AUXLIBS_CDB="-lcdb"
193 + else
194 + einfo "Building with dev-db/cdb"
195 + CDB_PATH="/usr/$(get_libdir)"
196 + for i in cdb.a alloc.a buffer.a unix.a byte.a ; do
197 + AUXLIBS_CDB="${AUXLIBS_CDB} ${CDB_PATH}/${i}"
198 + done
199 + fi
200 + fi
201 +
202 + # Robin H. Johnson <robbat2@g.o> 17/Nov/2006
203 + # Fix because infra boxes hit 2Gb .db files that fail a 32-bit fstat signed check.
204 + mycc="${mycc} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
205 + filter-lfs-flags
206 +
207 + # Workaround for bug #76512
208 + if use hardened; then
209 + [[ "$(gcc-version)" == "3.4" ]] && replace-flags -O? -Os
210 + fi
211 +
212 + # Remove annoying C++ comment style warnings - bug #378099
213 + append-flags -Wno-comment
214 +
215 + sed -i -e "/^RANLIB/s/ranlib/$(tc-getRANLIB)/g" "${S}"/makedefs
216 + sed -i -e "/^AR/s/ar/$(tc-getAR)/g" "${S}"/makedefs
217 +
218 + emake makefiles shared=yes dynamicmaps=no pie=yes \
219 + shlib_directory="/usr/$(get_libdir)/postfix/MAIL_VERSION" \
220 + DEBUG="" CC="$(tc-getCC)" OPT="${CFLAGS}" CCARGS="${mycc}" AUXLIBS="${mylibs}" \
221 + AUXLIBS_CDB="${AUXLIBS_CDB}" AUXLIBS_LDAP="${AUXLIBS_LDAP}" \
222 + AUXLIBS_LMDB="${AUXLIBS_LMDB}" AUXLIBS_MYSQL="${AUXLIBS_MYSQL}" \
223 + AUXLIBS_PCRE="${AUXLIBS_PCRE}" AUXLIBS_PGSQL="${AUXLIBS_PGSQL}" \
224 + AUXLIBS_SQLITE="${AUXLIBS_SQLITE}"
225 +}
226 +
227 +src_install () {
228 + local myconf
229 + use doc && myconf="readme_directory=\"/usr/share/doc/${PF}/readme\" \
230 + html_directory=\"/usr/share/doc/${PF}/html\""
231 +
232 + LD_LIBRARY_PATH="${S}/lib" \
233 + /bin/sh postfix-install \
234 + -non-interactive \
235 + install_root="${D}" \
236 + config_directory="/etc/postfix" \
237 + manpage_directory="/usr/share/man" \
238 + command_directory="/usr/sbin" \
239 + mailq_path="/usr/bin/mailq" \
240 + newaliases_path="/usr/bin/newaliases" \
241 + sendmail_path="/usr/sbin/sendmail" \
242 + ${myconf} \
243 + || die "postfix-install failed"
244 +
245 + # Fix spool removal on upgrade
246 + rm -Rf "${D}"/var
247 + keepdir /var/spool/postfix
248 +
249 + # Install rmail for UUCP, closes bug #19127
250 + dobin auxiliary/rmail/rmail
251 +
252 + # Provide another link for legacy FSH
253 + dosym /usr/sbin/sendmail /usr/$(get_libdir)/sendmail
254 +
255 + # Install qshape tool and posttls-finger
256 + dobin auxiliary/qshape/qshape.pl
257 + doman man/man1/qshape.1
258 + dobin bin/posttls-finger
259 + doman man/man1/posttls-finger.1
260 +
261 + # Performance tuning tools and their manuals
262 + dosbin bin/smtp-{source,sink} bin/qmqp-{source,sink}
263 + doman man/man1/smtp-{source,sink}.1 man/man1/qmqp-{source,sink}.1
264 +
265 + # Set proper permissions on required files/directories
266 + dodir /var/lib/postfix
267 + keepdir /var/lib/postfix
268 + fowners -R postfix:postfix /var/lib/postfix
269 + fperms 0750 /var/lib/postfix
270 + fowners root:postdrop /usr/sbin/post{drop,queue}
271 + fperms 02711 /usr/sbin/post{drop,queue}
272 +
273 + keepdir /etc/postfix
274 + if use mbox; then
275 + mypostconf="mail_spool_directory=/var/spool/mail"
276 + else
277 + mypostconf="home_mailbox=.maildir/"
278 + fi
279 + LD_LIBRARY_PATH="${S}/lib" \
280 + "${D}"/usr/sbin/postconf -c "${D}"/etc/postfix \
281 + -e ${mypostconf} || die "postconf failed"
282 +
283 + insinto /etc/postfix
284 + newins "${FILESDIR}"/smtp.pass saslpass
285 + fperms 600 /etc/postfix/saslpass
286 +
287 + newinitd "${FILESDIR}"/postfix.rc6.${RC_VER} postfix
288 + # do not start mysql/postgres unnecessarily - bug #359913
289 + use mysql || sed -i -e "s/mysql //" "${D}/etc/init.d/postfix"
290 + use postgres || sed -i -e "s/postgresql //" "${D}/etc/init.d/postfix"
291 +
292 + dodoc *README COMPATIBILITY HISTORY PORTING RELEASE_NOTES*
293 + use doc && mv "${S}"/examples "${D}"/usr/share/doc/${PF}/
294 +
295 + pamd_mimic_system smtp auth account
296 +
297 + if use sasl; then
298 + insinto /etc/sasl2
299 + newins "${FILESDIR}"/smtp.sasl smtpd.conf
300 + fi
301 +
302 + # header files
303 + insinto /usr/include/postfix
304 + doins include/*.h
305 +
306 + # Remove unnecessary files
307 + rm -f "${D}"/etc/postfix/{*LICENSE,access,aliases,canonical,generic}
308 + rm -f "${D}"/etc/postfix/{header_checks,relocated,transport,virtual}
309 +
310 + if has_version mail-mta/postfix; then
311 + # let the sysadmin decide when to change the compatibility_level
312 + sed -i -e /^compatibility_level/"s/^/#/" "${D}"/etc/postfix/main.cf || die
313 + fi
314 +
315 + systemd_dounit "${FILESDIR}/${PN}.service"
316 +}
317 +
318 +pkg_postinst() {
319 + # Do not install server.{key,pem) SSL certificates if they already exist
320 + if use ssl && [[ ! -f "${ROOT}"/etc/ssl/postfix/server.key \
321 + && ! -f "${ROOT}"/etc/ssl/postfix/server.pem ]] ; then
322 + SSL_ORGANIZATION="${SSL_ORGANIZATION:-Postfix SMTP Server}"
323 + install_cert /etc/ssl/postfix/server
324 + chown postfix:mail "${ROOT}"/etc/ssl/postfix/server.{key,pem}
325 + fi
326 +
327 + if [[ ! -e /etc/mail/aliases.db ]] ; then
328 + ewarn
329 + ewarn "You must edit /etc/mail/aliases to suit your needs"
330 + ewarn "and then run /usr/bin/newaliases. Postfix will not"
331 + ewarn "work correctly without it."
332 + ewarn
333 + fi
334 +}