mail-mta/postfix: bump to 3.6_pre20200416
[gentoo.git] / mail-mta / ssmtp / ssmtp-2.64-r3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 PATCHSET=4
7
8 WANT_AUTOMAKE=none
9
10 inherit eutils autotools user
11
12 DESCRIPTION="Extremely simple MTA to get mail off the system to a Mailhub"
13 HOMEPAGE="ftp://ftp.debian.org/debian/pool/main/s/ssmtp/"
14 SRC_URI="mirror://debian/pool/main/s/ssmtp/${P/-/_}.orig.tar.bz2
15         https://dev.gentoo.org/~pinkbyte/distfiles/patches/${P}-patches-${PATCHSET}.tar.xz"
16
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 m68k ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
20 IUSE="ipv6 libressl +ssl gnutls +mta"
21
22 DEPEND="ssl? (
23                 gnutls? ( net-libs/gnutls[openssl] )
24                 !gnutls? (
25                         !libressl? ( dev-libs/openssl:0= )
26                         libressl? ( dev-libs/libressl:0= )
27                 )
28         )"
29 RDEPEND="${DEPEND}
30         net-mail/mailbase
31         mta? (
32                 !net-mail/mailwrapper
33                 !mail-mta/courier
34                 !mail-mta/esmtp
35                 !mail-mta/exim
36                 !mail-mta/mini-qmail
37                 !mail-mta/msmtp[mta]
38                 !mail-mta/nbsmtp
39                 !mail-mta/netqmail
40                 !mail-mta/nullmailer
41                 !mail-mta/postfix
42                 !mail-mta/qmail-ldap
43                 !mail-mta/sendmail
44                 !mail-mta/opensmtpd
45         )"
46
47 REQUIRED_USE="gnutls? ( ssl )"
48
49 pkg_setup() {
50         if ! use prefix; then
51                 enewgroup ssmtp
52         fi
53 }
54
55 src_prepare() {
56         EPATCH_SUFFIX="patch" EPATCH_SOURCE="${WORKDIR}/patches" \
57                 epatch
58         epatch_user
59
60         # let's start by not using configure.in anymore as future autoconf
61         # versions will not support it.
62         mv configure.in configure.ac || die
63
64         eautoconf
65 }
66
67 src_configure() {
68         econf \
69                 --sysconfdir="${EPREFIX}"/etc/ssmtp \
70                 $(use_enable ssl) $(use_with gnutls) \
71                 $(use_enable ipv6 inet6) \
72                 --enable-md5auth
73 }
74
75 src_compile() {
76         emake etcdir="${EPREFIX}"/etc
77 }
78
79 src_install() {
80         dosbin ssmtp
81
82         doman ssmtp.8 ssmtp.conf.5
83         dodoc ChangeLog CHANGELOG_OLD INSTALL README TLS
84         newdoc ssmtp.lsm DESC
85
86         insinto /etc/ssmtp
87         doins ssmtp.conf revaliases
88
89         local conffile="${ED}etc/ssmtp/ssmtp.conf"
90
91         # Sorry about the weird indentation, I couldn't figure out a cleverer way
92         # to do this without having horribly >80 char lines.
93         sed -i -e "s:^hostname=:\n# Gentoo bug #47562\\
94 # Commenting the following line will force ssmtp to figure\\
95 # out the hostname itself.\n\\
96 # hostname=:" \
97                 "${conffile}" || die "sed failed"
98
99         # Comment rewriteDomain (bug #243364)
100         sed -i -e "s:^rewriteDomain=:#rewriteDomain=:" "${conffile}"
101
102         # Set restrictive perms on ssmtp.conf as per #187841, #239197
103         # Protect the ssmtp configfile from being readable by regular users as it
104         # may contain login/password data to auth against a the mailhub used.
105         if ! use prefix; then
106                 fowners root:ssmtp /etc/ssmtp/ssmtp.conf
107                 fperms 640 /etc/ssmtp/ssmtp.conf
108                 fowners root:ssmtp /usr/sbin/ssmtp
109                 fperms 2711 /usr/sbin/ssmtp
110         fi
111
112         if use mta; then
113                 dosym ../sbin/ssmtp /usr/lib/sendmail
114                 dosym ../sbin/ssmtp /usr/bin/sendmail
115                 dosym ssmtp /usr/sbin/sendmail
116                 dosym ../sbin/ssmtp /usr/bin/mailq
117                 dosym ../sbin/ssmtp /usr/bin/newaliases
118         fi
119 }