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