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