opensmtpd-6.4.0_p2.ebuild (2651B)
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit multilib user flag-o-matic eutils pam toolchain-funcs autotools systemd versionator
7
8 DESCRIPTION="Lightweight but featured SMTP daemon from OpenBSD"
9 HOMEPAGE="https://www.opensmtpd.org"
10 MY_P="${P}"
11 if [ $(get_last_version_component_index) -eq 4 ]; then
12 MY_P="${PN}-$(get_version_component_range 4-)"
13 fi
14 SRC_URI="https://www.opensmtpd.org/archives/${MY_P/_}.tar.gz"
15
16 LICENSE="ISC BSD BSD-1 BSD-2 BSD-4"
17 SLOT="0"
18 KEYWORDS="~amd64"
19 IUSE="libressl pam mdoc +mta"
20
21 DEPEND="
22 !libressl? ( dev-libs/openssl:0 )
23 libressl? ( dev-libs/libressl )
24 sys-libs/zlib
25 pam? ( virtual/pam )
26 elibc_musl? ( sys-libs/fts-standalone )
27 sys-libs/db:=
28 dev-libs/libevent
29 app-misc/ca-certificates
30 net-mail/mailbase
31 net-libs/libasr
32 !mail-mta/courier
33 !mail-mta/esmtp
34 !mail-mta/exim
35 !mail-mta/mini-qmail
36 !mail-mta/msmtp[mta]
37 !mail-mta/netqmail
38 !mail-mta/nullmailer
39 !mail-mta/postfix
40 !mail-mta/qmail-ldap
41 !mail-mta/sendmail
42 !mail-mta/ssmtp[mta]
43 "
44 RDEPEND="${DEPEND}"
45
46 S=${WORKDIR}/${MY_P/_}
47
48 src_prepare() {
49 # Use /run instead of /var/run
50 sed -i -e '/pidfile_path/s:_PATH_VARRUN:"/run/":' openbsd-compat/pidfile.c || die
51 sed -i -e 's;/usr/libexec/;/usr/libexec/opensmtpd/;g' smtpd/parse.y || die
52 epatch "${FILESDIR}/opensmtpd-6.4.0_p1_missing_object_file_smtpctl.patch"
53 append-cflags "-ffunction-sections"
54 append-ldflags "-Wl,--gc-sections"
55 epatch_user
56 eautoreconf
57 }
58
59 src_configure() {
60 tc-export AR
61 AR="$(which "$AR")" econf \
62 --with-table-db \
63 --with-user-smtpd=smtpd \
64 --with-user-queue=smtpq \
65 --with-group-queue=smtpq \
66 --with-path-socket=/run \
67 --with-path-CAfile=/etc/ssl/certs/ca-certificates.crt \
68 --sysconfdir=/etc/opensmtpd \
69 --with-mantype=$(usex mdoc doc man) \
70 $(use_with pam auth-pam)
71 }
72
73 src_install() {
74 default
75 newinitd "${FILESDIR}"/smtpd.initd smtpd
76 systemd_dounit "${FILESDIR}"/smtpd.{service,socket}
77 use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd
78 dosym /usr/sbin/smtpctl /usr/sbin/makemap
79 dosym /usr/sbin/smtpctl /usr/sbin/newaliases
80 if use mta ; then
81 dodir /usr/sbin
82 dosym /usr/sbin/smtpctl /usr/sbin/sendmail
83 dosym /usr/sbin/smtpctl /usr/bin/sendmail
84 dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail
85 fi
86 }
87
88 pkg_preinst() {
89 enewgroup smtpd 25
90 enewuser smtpd 25 -1 /var/empty smtpd
91 enewgroup smtpq 252
92 enewuser smtpq 252 -1 /var/empty smtpq
93 }
94
95 pkg_postinst() {
96 einfo
97 einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps,"
98 einfo "Redis, and many other useful addons and filters are"
99 einfo "available in the mail-filter/opensmtpd-extras package."
100 einfo
101 }