Gentoo Archives: gentoo-commits

From: Ionen Wolkens <ionen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: mail-mta/sendmail/
Date: Tue, 01 Jun 2021 09:44:16
Message-Id: 1622540635.2bc8fa7f3b24750c97641e3e3301d9d7f4bd4df7.ionen@gentoo
1 commit: 2bc8fa7f3b24750c97641e3e3301d9d7f4bd4df7
2 Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 1 09:35:01 2021 +0000
4 Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 1 09:43:55 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2bc8fa7f
7
8 mail-mta/sendmail: tidy, use pkg-config, extra error checking
9
10 || die was missing in several places (notably all here-documents),
11 and direct "make" was likely used because emake needs -j1 like
12 libmilter.
13
14 Use pkg-config where possible, single-string -> sed -> m4 layout
15 should ideally be replaced to handle potential use of spaces or
16 other characters that this or *FLAGS may generate.
17
18 Simplified most constructs for easier maintenance, sorted, and
19 removed the unused multilib inherit. Avoided changes that may
20 alter build or configuration files.
21
22 Also added a note to bump together with libmilter.
23
24 Closes: https://bugs.gentoo.org/681232
25 Closes: https://github.com/gentoo/gentoo/pull/21069
26 Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
27
28 mail-mta/sendmail/sendmail-8.16.1-r1.ebuild | 178 ++++++++++++++--------------
29 1 file changed, 88 insertions(+), 90 deletions(-)
30
31 diff --git a/mail-mta/sendmail/sendmail-8.16.1-r1.ebuild b/mail-mta/sendmail/sendmail-8.16.1-r1.ebuild
32 index 8de7878ecb7..8b5b4f3cdc0 100644
33 --- a/mail-mta/sendmail/sendmail-8.16.1-r1.ebuild
34 +++ b/mail-mta/sendmail/sendmail-8.16.1-r1.ebuild
35 @@ -3,7 +3,9 @@
36
37 EAPI=7
38
39 -inherit multilib systemd toolchain-funcs
40 +# Note: please bump this together with mail-filter/libmilter
41 +
42 +inherit systemd toolchain-funcs
43
44 DESCRIPTION="Widely-used Mail Transport Agent (MTA)"
45 HOMEPAGE="https://www.sendmail.org/"
46 @@ -11,20 +13,23 @@ SRC_URI="ftp://ftp.sendmail.org/pub/${PN}/${PN}.${PV}.tar.gz"
47
48 LICENSE="Sendmail GPL-2" # GPL-2 is here for initscript
49 SLOT="0"
50 +# TODO: restore keywords soon for bug 730890 after testing
51 #KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
52 IUSE="ipv6 ldap mbox nis sasl sockets ssl tcpd"
53
54 -BDEPEND="sys-devel/m4"
55 -DEPEND="net-mail/mailbase
56 +BDEPEND="
57 + sys-devel/m4
58 + virtual/pkgconfig"
59 +DEPEND="
60 + net-mail/mailbase
61 + >=sys-libs/db-3.2:=
62 + ldap? ( net-nds/openldap )
63 nis? ( net-libs/libnsl:= )
64 sasl? ( >=dev-libs/cyrus-sasl-2.1.10 )
65 - tcpd? ( sys-apps/tcp-wrappers )
66 - ssl? (
67 - dev-libs/openssl:0=
68 - )
69 - ldap? ( net-nds/openldap )
70 - >=sys-libs/db-3.2:="
71 -RDEPEND="${DEPEND}
72 + ssl? ( dev-libs/openssl:0= )
73 + tcpd? ( sys-apps/tcp-wrappers )"
74 +RDEPEND="
75 + ${DEPEND}
76 acct-group/smmsp
77 >=acct-user/smmsp-0-r2
78 >=mail-filter/libmilter-1.0.2_p1-r1
79 @@ -35,62 +40,65 @@ RDEPEND="${DEPEND}
80 !mail-mta/msmtp[mta]
81 !mail-mta/netqmail
82 !mail-mta/nullmailer
83 - !mail-mta/postfix
84 !mail-mta/opensmtpd
85 + !mail-mta/postfix
86 !mail-mta/qmail-ldap
87 !>=mail-mta/ssmtp-2.64-r2[mta]
88 !net-mail/vacation"
89 -
90 PDEPEND="!mbox? ( mail-filter/procmail )"
91
92 src_prepare() {
93 - eapply "${FILESDIR}"/"${PN}"-8.16.1-build-system.patch
94 - eapply -p0 "${FILESDIR}"/sendmail-delivered_hdr.patch
95 + eapply "${FILESDIR}"/${PN}-8.16.1-build-system.patch
96 + eapply -p0 "${FILESDIR}"/${PN}-delivered_hdr.patch
97 + eapply_user
98
99 - local confCC="$(tc-getCC)"
100 local confCCOPTS="${CFLAGS}"
101 + local confENVDEF="-DMAXDAEMONS=64 -DHAS_GETHOSTBYNAME2=1"
102 local confLDOPTS="${LDFLAGS}"
103 + local confLIBS=
104 local confMAPDEF="-DMAP_REGEX"
105 - local confENVDEF="-DMAXDAEMONS=64"
106 - local conf_sendmail_LIBS=""
107 -
108 - confENVDEF="${confLIBS} -DHAS_GETHOSTBYNAME2=1"
109 -
110 - use sasl && confLIBS="${confLIBS} -lsasl2" \
111 - && confENVDEF="${confENVDEF} -DSASL=2" \
112 - && confCCOPTS="${confCCOPTS} -I/usr/include/sasl" \
113 - && conf_sendmail_LIBS="${conf_sendmail_LIBS} -lsasl2"
114 -
115 - use tcpd && confENVDEF="${confENVDEF} -DTCPWRAPPERS" \
116 - && confLIBS="${confLIBS} -lwrap"
117 -
118 - # Bug #542370 - lets add support for modern crypto (PFS)
119 - use ssl && confENVDEF="${confENVDEF} -DSTARTTLS -D_FFR_DEAL_WITH_ERROR_SSL" \
120 - && confENVDEF="${confENVDEF} -D_FFR_TLS_1 -D_FFR_TLS_EC" \
121 - && confLIBS="${confLIBS} -lssl -lcrypto" \
122 - && conf_sendmail_LIBS="${conf_sendmail_LIBS} -lssl -lcrypto"
123 -
124 - use ldap && confMAPDEF="${confMAPDEF} -DLDAPMAP" \
125 - && confLIBS="${confLIBS} -lldap -llber"
126 + local conf_sendmail_LIBS=
127
128 - use ipv6 && confENVDEF="${confENVDEF} -DNETINET6"
129 -
130 - use nis && confENVDEF="${confENVDEF} -DNIS"
131 + if use ldap; then
132 + confMAPDEF+=" -DLDAPMAP"
133 + confLIBS+=" -lldap -llber"
134 + fi
135
136 - use sockets && confENVDEF="${confENVDEF} -DSOCKETMAP"
137 + if use sasl; then
138 + confCCOPTS+=" $($(tc-getPKG_CONFIG) --cflags libsasl2)"
139 + confENVDEF+=" -DSASL=2"
140 + conf_sendmail_LIBS+=" $($(tc-getPKG_CONFIG) --libs libsasl2)"
141 + fi
142
143 - sed -e "s:@@confCCOPTS@@:${confCCOPTS}:" \
144 - -e "s/@@confLDOPTS@@/${confLDOPTS}/" \
145 - -e "s/@@confCC@@/${confCC}/" \
146 - -e "s/@@confMAPDEF@@/${confMAPDEF}/" \
147 - -e "s/@@confENVDEF@@/${confENVDEF}/" \
148 - -e "s/@@confLIBS@@/${confLIBS}/" \
149 - -e "s/@@conf_sendmail_LIBS@@/${conf_sendmail_LIBS}/" \
150 - "${FILESDIR}"/site.config.m4 > devtools/Site/site.config.m4 || die "sed failed"
151 + if use ssl; then
152 + # Bug #542370 - lets add support for modern crypto (PFS)
153 + confCCOPTS+=" $($(tc-getPKG_CONFIG) --cflags openssl)"
154 + confENVDEF+=" -DSTARTTLS -D_FFR_DEAL_WITH_ERROR_SSL"
155 + confENVDEF+=" -D_FFR_TLS_1 -D_FFR_TLS_EC"
156 + conf_sendmail_LIBS+=" $($(tc-getPKG_CONFIG) --libs openssl)"
157 + fi
158
159 - echo "APPENDDEF(\`confLIBDIRS', \`-L${EPREFIX}/usr/$(get_libdir)')" >> devtools/Site/site.config.m4 || die "echo failed"
160 + if use tcpd; then
161 + confENVDEF+=" -DTCPWRAPPERS"
162 + confLIBS+=" -lwrap"
163 + fi
164
165 - eapply_user
166 + use ipv6 && confENVDEF+=" -DNETINET6"
167 + use nis && confENVDEF+=" -DNIS"
168 + use sockets && confENVDEF+=" -DSOCKETMAP"
169 +
170 + sed -e "s|@@confCC@@|$(tc-getCC)|" \
171 + -e "s|@@confCCOPTS@@|${confCCOPTS}|" \
172 + -e "s|@@confENVDEF@@|${confENVDEF}|" \
173 + -e "s|@@confLDOPTS@@|${confLDOPTS}|" \
174 + -e "s|@@confLIBS@@|${confLIBS}|" \
175 + -e "s|@@confMAPDEF@@|${confMAPDEF}|" \
176 + -e "s|@@conf_sendmail_LIBS@@|${conf_sendmail_LIBS}|" \
177 + "${FILESDIR}"/site.config.m4 > devtools/Site/site.config.m4 \
178 + || die "failed to generate site.config.m4"
179 +
180 + echo "APPENDDEF(\`confLIBDIRS', \`-L${EPREFIX}/usr/$(get_libdir)')" \
181 + >> devtools/Site/site.config.m4 || die "failed adding to site.config.m4"
182 }
183
184 src_compile() {
185 @@ -98,35 +106,27 @@ src_compile() {
186 }
187
188 src_install() {
189 - local MY_LIBDIR=/usr/$(get_libdir)
190 - local MY_OBJDIR="obj.`uname -s`.`uname -r`.`uname -m`"
191 -
192 - dodir /usr/bin ${MY_LIBDIR}
193 + dodir /usr/{bin,$(get_libdir)}
194 dodir /usr/share/man/man{1,5,8} /usr/sbin /usr/share/sendmail-cf
195 dodir /var/spool/{mqueue,clientmqueue} /etc/conf.d
196
197 keepdir /var/spool/{clientmqueue,mqueue}
198
199 - for dir in libsmutil sendmail mailstats praliases smrsh makemap vacation editmap
200 - do
201 - make DESTDIR="${D}" LIBDIR="${MY_LIBDIR}" MANROOT=/usr/share/man/man \
202 - SBINOWN=root SBINGRP=root UBINOWN=root UBINGRP=root \
203 - MANOWN=root MANGRP=root INCOWN=root INCGRP=root \
204 - LIBOWN=root LIBGRP=root GBINOWN=root GBINGRP=root \
205 - MSPQOWN=root CFOWN=root CFGRP=root \
206 - install -C "${MY_OBJDIR}/${dir}" \
207 - || die "install 1 failed"
208 - done
209 + local emakeargs=(
210 + DESTDIR="${D}" LIBDIR="/usr/$(get_libdir)"
211 + MANROOT=/usr/share/man/man
212 + SBINOWN=root SBINGRP=root UBINOWN=root UBINGRP=root
213 + MANOWN=root MANGRP=root INCOWN=root INCGRP=root
214 + LIBOWN=root LIBGRP=root GBINOWN=root GBINGRP=root
215 + MSPQOWN=root CFOWN=root CFGRP=root
216 + )
217
218 - for dir in rmail mail.local
219 - do
220 - make DESTDIR="${D}" LIBDIR="${MY_LIBDIR}" MANROOT=/usr/share/man/man \
221 - SBINOWN=root SBINGRP=root UBINOWN=root UBINGRP=root \
222 - MANOWN=root MANGRP=root INCOWN=root INCGRP=root \
223 - LIBOWN=root LIBGRP=root GBINOWN=root GBINGRP=root \
224 - MSPQOWN=root CFOWN=root CFGRP=root \
225 - force-install -C "${MY_OBJDIR}/${dir}" \
226 - || die "install 2 failed"
227 + local dir
228 + for dir in libsmutil sendmail mailstats praliases smrsh makemap vacation editmap; do
229 + emake -j1 -C obj.*/${dir} "${emakeargs[@]}" install
230 + done
231 + for dir in rmail mail.local; do
232 + emake -j1 -C obj.*/${dir} "${emakeargs[@]}" force-install
233 done
234
235 fowners root:smmsp /usr/sbin/sendmail
236 @@ -137,21 +137,18 @@ src_install() {
237 dosym ../sbin/makemap /usr/bin/makemap
238 dodoc FAQ KNOWNBUGS README RELEASE_NOTES doc/op/op.ps
239
240 + dodoc sendmail/{SECURITY,TUNING}
241 newdoc sendmail/README README.sendmail
242 - newdoc sendmail/SECURITY SECURITY
243 - newdoc sendmail/TUNING TUNING
244 newdoc smrsh/README README.smrsh
245
246 newdoc cf/README README.cf
247 newdoc cf/cf/README README.install-cf
248
249 - cp -pPR cf/* "${ED}"/usr/share/sendmail-cf || die "copy failed"
250 + dodoc -r contrib
251
252 - docinto contrib
253 - dodoc contrib/*
254 + cp -pPR cf/. "${ED}"/usr/share/sendmail-cf || die
255
256 insinto /etc/mail
257 -
258 if use mbox; then
259 newins "${FILESDIR}"/sendmail.mc-r1 sendmail.mc
260 else
261 @@ -160,23 +157,24 @@ src_install() {
262
263 # See discussion on bug #730890
264 m4 "${ED}"/usr/share/sendmail-cf/m4/cf.m4 \
265 - <(grep -v "${EPREFIX}"/usr/share/sendmail-cf/m4/cf.m4 "${ED}"/etc/mail/sendmail.mc) \
266 - > "${ED}"/etc/mail/sendmail.cf || die "cf.m4 failed"
267 + <(grep -v "${EPREFIX}"/usr/share/sendmail-cf/m4/cf.m4 "${ED}"/etc/mail/sendmail.mc) \
268 + > "${ED}"/etc/mail/sendmail.cf || die "cf.m4 failed"
269
270 echo "include(\`/usr/share/sendmail-cf/m4/cf.m4')dnl" \
271 - > "${ED}"/etc/mail/submit.mc || die "echo failed"
272 + > "${ED}"/etc/mail/submit.mc || die "submit.mc echo failed"
273
274 - cat "${ED}"/usr/share/sendmail-cf/cf/submit.mc >> "${ED}"/etc/mail/submit.mc || die "submit.mc cat failed"
275 + cat "${ED}"/usr/share/sendmail-cf/cf/submit.mc \
276 + >> "${ED}"/etc/mail/submit.mc || die "submit.mc cat failed"
277
278 echo "# local-host-names - include all aliases for your machine here" \
279 - > "${D}"/etc/mail/local-host-names || die "local-host-names echo failed"
280 + > "${ED}"/etc/mail/local-host-names || die "local-host-names echo failed"
281
282 - cat <<- EOF > "${ED}"/etc/mail/trusted-users
283 + cat <<- EOF > "${ED}"/etc/mail/trusted-users || die "trusted-users cat failed"
284 # trusted-users - users that can send mail as others without a warning
285 # apache, mailman, majordomo, uucp are good candidates
286 EOF
287
288 - cat <<- EOF > "${ED}"/etc/mail/access
289 + cat <<- EOF > "${ED}"/etc/mail/access || die "access cat failed"
290 # Check the /usr/share/doc/sendmail/README.cf file for a description
291 # of the format of this file. (search for access_db in that file)
292 # The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
293 @@ -185,7 +183,7 @@ src_install() {
294
295 EOF
296
297 - cat <<- EOF > "${ED}"/etc/conf.d/sendmail
298 + cat <<- EOF > "${ED}"/etc/conf.d/sendmail || die "sendmail cat failed"
299 # Config file for /etc/init.d/sendmail
300 # add start-up options here
301 SENDMAIL_OPTS="-bd -q30m -L sm-mta" # default daemon mode
302 @@ -196,9 +194,9 @@ src_install() {
303
304 if use sasl; then
305 dodir /etc/sasl2
306 - cat <<- EOF > "${ED}"/etc/sasl2/Sendmail.conf
307 - pwcheck_method: saslauthd
308 - mech_list: PLAIN LOGIN
309 + cat <<- EOF > "${ED}"/etc/sasl2/Sendmail.conf || die "Sendmail.conf cat ailed"
310 + pwcheck_method: saslauthd
311 + mech_list: PLAIN LOGIN
312
313 EOF
314 fi