| 1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
6 |
# Note: please bump this together with mail-filter/libmilter and app-shells/smrsh
|
| 7 |
7 |
|
| 8 |
|
inherit systemd toolchain-funcs
|
|
8 |
VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/sendmail.asc"
|
|
9 |
inherit systemd toolchain-funcs verify-sig
|
| 9 |
10 |
|
| 10 |
11 |
DESCRIPTION="Widely-used Mail Transport Agent (MTA)"
|
| 11 |
12 |
HOMEPAGE="https://www.sendmail.org/"
|
| 12 |
13 |
if [[ -n $(ver_cut 4) ]] ; then
|
| 13 |
14 |
# Snapshots have an extra version component (e.g. 8.17.1 vs 8.17.1.9)
|
| 14 |
|
SRC_URI="https://ftp.sendmail.org/snapshots/${PN}.${PV}.tar.gz"
|
|
15 |
SRC_URI="
|
|
16 |
https://ftp.sendmail.org/snapshots/${PN}.${PV}.tar.gz
|
|
17 |
verify-sig? ( https://ftp.sendmail.org/snapshots/${PN}.${PV}.tar.gz.sig )
|
|
18 |
"
|
| 15 |
19 |
fi
|
| 16 |
|
SRC_URI+=" https://ftp.sendmail.org/${PN}.${PV}.tar.gz"
|
| 17 |
|
SRC_URI+=" https://ftp.sendmail.org/past-releases/${PN}.${PV}.tar.gz"
|
|
20 |
|
|
21 |
SRC_URI+="
|
|
22 |
https://ftp.sendmail.org/${PN}.${PV}.tar.gz
|
|
23 |
verify-sig? ( https://ftp.sendmail.org/${PN}.${PV}.tar.gz.sig )
|
|
24 |
"
|
|
25 |
SRC_URI+="
|
|
26 |
https://ftp.sendmail.org/past-releases/${PN}.${PV}.tar.gz
|
|
27 |
verify-sig? ( https://ftp.sendmail.org/past-releases/${PN}.${PV}.tar.gz.sig )
|
|
28 |
"
|
| 18 |
29 |
|
| 19 |
30 |
LICENSE="Sendmail GPL-2" # GPL-2 is here for initscript
|
| 20 |
31 |
SLOT="0"
|
| 21 |
|
KEYWORDS="~alpha amd64 arm ~hppa ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
|
| 22 |
|
IUSE="ipv6 ldap mbox nis sasl selinux sockets ssl tcpd"
|
|
32 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
|
33 |
IUSE="+berkdb eai fips ldap mbox nis sasl selinux ssl tcpd tinycdb"
|
|
34 |
REQUIRED_USE="
|
|
35 |
|| ( berkdb tinycdb )
|
|
36 |
fips? ( ssl )
|
|
37 |
"
|
| 23 |
38 |
|
| 24 |
39 |
DEPEND="
|
| 25 |
40 |
acct-group/smmsp
|
| 26 |
41 |
>=acct-user/smmsp-0-r2
|
| 27 |
42 |
net-mail/mailbase
|
| 28 |
|
>=sys-libs/db-3.2:=
|
|
43 |
berkdb? ( >=sys-libs/db-3.2:= )
|
|
44 |
eai? ( dev-libs/icu:= )
|
|
45 |
elibc_musl? ( virtual/libcrypt:= )
|
| 29 |
46 |
ldap? ( net-nds/openldap:= )
|
| 30 |
47 |
nis? ( net-libs/libnsl:= )
|
| 31 |
48 |
sasl? ( >=dev-libs/cyrus-sasl-2.1.10 )
|
| 32 |
|
ssl? ( dev-libs/openssl:= )
|
|
49 |
ssl? (
|
|
50 |
>=dev-libs/openssl-1.1.1:=
|
|
51 |
fips? ( >=dev-libs/openssl-3:=[fips] )
|
|
52 |
)
|
| 33 |
53 |
tcpd? ( sys-apps/tcp-wrappers )
|
|
54 |
tinycdb? ( dev-db/tinycdb )
|
| 34 |
55 |
"
|
| 35 |
56 |
RDEPEND="
|
| 36 |
57 |
${DEPEND}
|
| 37 |
58 |
>=mail-filter/libmilter-1.0.2_p2
|
|
59 |
sys-devel/m4
|
| 38 |
60 |
!mail-mta/courier
|
| 39 |
61 |
!mail-mta/esmtp
|
| 40 |
62 |
!mail-mta/exim
|
| 41 |
|
!mail-mta/mini-qmail
|
| 42 |
63 |
!mail-mta/msmtp[mta]
|
| 43 |
64 |
!mail-mta/netqmail
|
|
65 |
!mail-mta/notqmail
|
| 44 |
66 |
!mail-mta/nullmailer
|
| 45 |
67 |
!mail-mta/opensmtpd
|
| 46 |
68 |
!mail-mta/postfix
|
| 47 |
|
!mail-mta/qmail-ldap
|
| 48 |
69 |
!>=mail-mta/ssmtp-2.64-r2[mta]
|
| 49 |
|
!net-mail/vacation
|
| 50 |
70 |
selinux? ( sec-policy/selinux-sendmail )
|
| 51 |
71 |
"
|
| 52 |
72 |
BDEPEND="
|
| 53 |
73 |
sys-devel/m4
|
| 54 |
74 |
virtual/pkgconfig
|
|
75 |
verify-sig? ( ~sec-keys/openpgp-keys-sendmail-20250220 )
|
|
76 |
"
|
|
77 |
PDEPEND="
|
|
78 |
!mbox? (
|
|
79 |
|| (
|
|
80 |
mail-filter/procmail
|
|
81 |
mail-filter/maildrop
|
|
82 |
)
|
|
83 |
)
|
| 55 |
84 |
"
|
| 56 |
|
PDEPEND="!mbox? ( mail-filter/procmail )"
|
|
85 |
PATCHES=(
|
|
86 |
"${FILESDIR}"/${PN}-8.13.1-delivered_hdr.patch
|
|
87 |
"${FILESDIR}"/${PN}-8.16.1-build-system.patch
|
|
88 |
)
|
| 57 |
89 |
|
| 58 |
90 |
src_prepare() {
|
| 59 |
|
eapply "${FILESDIR}"/${PN}-8.16.1-build-system.patch
|
| 60 |
|
eapply -p0 "${FILESDIR}"/${PN}-delivered_hdr.patch
|
| 61 |
|
eapply_user
|
|
91 |
default
|
| 62 |
92 |
|
| 63 |
93 |
local confCCOPTS="${CFLAGS}"
|
| 64 |
|
# See bug #808954 for FLOCK
|
| 65 |
|
local confENVDEF="-DMAXDAEMONS=64 -DHAS_GETHOSTBYNAME2=1 -DHASFLOCK=1"
|
|
94 |
local confENVDEF="-DMAXDAEMONS=64 -DHAS_GETHOSTBYNAME2=1"
|
| 66 |
95 |
local confLDOPTS="${LDFLAGS}"
|
| 67 |
96 |
local confLIBS=
|
| 68 |
97 |
local confMAPDEF="-DMAP_REGEX"
|
| 69 |
98 |
local conf_sendmail_LIBS=
|
| 70 |
99 |
|
|
100 |
# Always enable ipv6 and sockets
|
|
101 |
confENVDEF+=" -DNETINET6 -DSOCKETMAP"
|
|
102 |
|
|
103 |
# Enable same domain/one domain features
|
|
104 |
confENVDEV+=" -D_FFR_SAMEDOMAIN -D_FFR_MF_ONEDOMAIN"
|
|
105 |
|
|
106 |
if use berkdb; then
|
|
107 |
# See bug #808954 for FLOCK
|
|
108 |
confENVDEF+=" -DHASFLOCK=1"
|
|
109 |
confMAPDEF+=" -DNEWDB"
|
|
110 |
confLIBS+=" -ldb"
|
|
111 |
else
|
|
112 |
confMAPDEF+=" -UNEWDB"
|
|
113 |
fi
|
|
114 |
|
|
115 |
if use eai; then
|
|
116 |
confCCOPTS+=" $($(tc-getPKG_CONFIG) --cflags icu-uc)"
|
|
117 |
confENVDEF+=" -DUSE_EAI"
|
|
118 |
confLIBS+=" $($(tc-getPKG_CONFIG) --libs icu-uc)"
|
|
119 |
fi
|
|
120 |
|
| 71 |
121 |
if use ldap; then
|
| 72 |
122 |
confMAPDEF+=" -DLDAPMAP"
|
| 73 |
123 |
confLIBS+=" -lldap -llber"
|
| 74 |
124 |
fi
|
| 75 |
125 |
|
|
126 |
use nis && confENVDEF+=" -DNIS"
|
|
127 |
|
| 76 |
128 |
if use sasl; then
|
| 77 |
129 |
confCCOPTS+=" $($(tc-getPKG_CONFIG) --cflags libsasl2)"
|
| 78 |
130 |
confENVDEF+=" -DSASL=2"
|
| ... | ... | |
| 84 |
136 |
confCCOPTS+=" $($(tc-getPKG_CONFIG) --cflags openssl)"
|
| 85 |
137 |
confENVDEF+=" -DSTARTTLS -D_FFR_DEAL_WITH_ERROR_SSL"
|
| 86 |
138 |
confENVDEF+=" -D_FFR_TLS_1 -D_FFR_TLS_EC"
|
|
139 |
# Bug #944822 - fix certification chain with intermediate cert file
|
|
140 |
confENVDEF+=" -D_FFR_TLS_USE_CERTIFICATE_CHAIN_FILE"
|
|
141 |
confENVDEF+=" -DDANE"
|
|
142 |
|
|
143 |
if use fips; then
|
|
144 |
confENVDEF+=" -D_FFR_FIPSMODE"
|
|
145 |
fi
|
|
146 |
|
| 87 |
147 |
conf_sendmail_LIBS+=" $($(tc-getPKG_CONFIG) --libs openssl)"
|
| 88 |
148 |
fi
|
| 89 |
149 |
|
| ... | ... | |
| 92 |
152 |
confLIBS+=" -lwrap"
|
| 93 |
153 |
fi
|
| 94 |
154 |
|
| 95 |
|
use ipv6 && confENVDEF+=" -DNETINET6"
|
| 96 |
|
use nis && confENVDEF+=" -DNIS"
|
| 97 |
|
use sockets && confENVDEF+=" -DSOCKETMAP"
|
|
155 |
if use tinycdb; then
|
|
156 |
confMAPDEF+=" -DCDB=2"
|
|
157 |
confLIBS+=" -lcdb"
|
|
158 |
else
|
|
159 |
confMAPDEF+=" -UCDB"
|
|
160 |
fi
|
|
161 |
|
|
162 |
if use elibc_musl; then
|
|
163 |
confENVDEF+=" -DHASSTRERROR -DHASRRESVPORT=0 -DNEEDSGETIPNODE"
|
|
164 |
|
|
165 |
eapply "${FILESDIR}"/${PN}-musl-stack-size.patch
|
|
166 |
eapply "${FILESDIR}"/${PN}-musl-disable-cdefs.patch
|
|
167 |
fi
|
| 98 |
168 |
|
| 99 |
169 |
sed -e "s|@@confCC@@|$(tc-getCC)|" \
|
| 100 |
170 |
-e "s|@@confCCOPTS@@|${confCCOPTS}|" \
|
| ... | ... | |
| 160 |
230 |
if use mbox; then
|
| 161 |
231 |
newins "${FILESDIR}"/sendmail.mc-r1 sendmail.mc
|
| 162 |
232 |
else
|
| 163 |
|
newins "${FILESDIR}"/sendmail-procmail.mc sendmail.mc
|
|
233 |
newins "${FILESDIR}"/sendmail-maildir.mc sendmail.mc
|
| 164 |
234 |
fi
|
| 165 |
235 |
|
| 166 |
236 |
# See discussion on bug #730890
|
| ... | ... | |
| 183 |
253 |
EOF
|
| 184 |
254 |
|
| 185 |
255 |
cat <<- EOF > "${ED}"/etc/mail/access || die "access cat failed"
|
| 186 |
|
# Check the /usr/share/doc/sendmail/README.cf file for a description
|
|
256 |
# Check the ${EPREFIX}/usr/share/sendmail-cf/README file for a description
|
| 187 |
257 |
# of the format of this file. (search for access_db in that file)
|
| 188 |
|
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
|
| 189 |
|
# package.
|
| 190 |
258 |
#
|
| 191 |
259 |
|
| 192 |
260 |
EOF
|
| ... | ... | |
| 202 |
270 |
|
| 203 |
271 |
if use sasl; then
|
| 204 |
272 |
dodir /etc/sasl2
|
| 205 |
|
cat <<- EOF > "${ED}"/etc/sasl2/Sendmail.conf || die "Sendmail.conf cat ailed"
|
|
273 |
cat <<- EOF > "${ED}"/etc/sasl2/Sendmail.conf || die "Sendmail.conf cat failed"
|
| 206 |
274 |
pwcheck_method: saslauthd
|
| 207 |
275 |
mech_list: PLAIN LOGIN
|
| 208 |
276 |
|
| ... | ... | |
| 213 |
281 |
systemd_dounit "${FILESDIR}"/sendmail.service
|
| 214 |
282 |
systemd_dounit "${FILESDIR}"/sm-client.service
|
| 215 |
283 |
}
|
|
284 |
|
|
285 |
pkg_postinst() {
|
|
286 |
if ! use berkdb; then
|
|
287 |
ewarn "If your configuration relies on userdb, you should install"
|
|
288 |
ewarn "this package with USE=berkdb."
|
|
289 |
fi
|
|
290 |
|
|
291 |
if ! use mbox; then
|
|
292 |
elog "Starting with mail-mta/sendmail-8.18.1 you could use either"
|
|
293 |
elog "procmail or maildrop to use maildir-style mailbox in user's home directory."
|
|
294 |
elog ""
|
|
295 |
elog "If you prefer procmail (default), emerge mail-filter/procmail with USE=-mbox"
|
|
296 |
elog "and include the following lines in sendmail.mc to create your sendmail.cf"
|
|
297 |
elog "configuration file:"
|
|
298 |
elog "\tFEATURE(\`local_procmail')dnl"
|
|
299 |
elog "\tMAILER(\`procmail')dnl"
|
|
300 |
elog ""
|
|
301 |
elog "If you prefer maildrop, you'll need to ensure that you configure a mail"
|
|
302 |
elog "storage location using DEFAULT in /etc/maildroprc, for example:"
|
|
303 |
elog "\tDEFAULT=\$HOME/.maildir"
|
|
304 |
elog ""
|
|
305 |
elog "and include the following line in sendmail.mc to create your sendmail.cf"
|
|
306 |
elog "configuration file:"
|
|
307 |
elog "\tFEATURE(\`local_procmail',\`/usr/bin/maildrop',\`maildrop -d $u')dnl"
|
|
308 |
fi
|
|
309 |
}
|