opensmtpd-6.0.3_p1.ebuild (2441B)
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 mandoc +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 mandoc? ( app-text/mandoc )
28 sys-libs/db:=
29 dev-libs/libevent
30 app-misc/ca-certificates
31 net-mail/mailbase
32 net-libs/libasr
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/netqmail
39 !mail-mta/nullmailer
40 !mail-mta/postfix
41 !mail-mta/qmail-ldap
42 !mail-mta/sendmail
43 !mail-mta/ssmtp[mta]
44 "
45 RDEPEND="${DEPEND}"
46
47 S=${WORKDIR}/${MY_P/_}
48
49 src_prepare() {
50 # Use /run instead of /var/run
51 sed -i -e '/pidfile_path/s:_PATH_VARRUN:"/run/":' openbsd-compat/pidfile.c || die
52 epatch_user
53 eautoreconf
54 }
55
56 src_configure() {
57 tc-export AR
58 AR="$(which "$AR")" econf \
59 --with-table-db \
60 --with-user-smtpd=smtpd \
61 --with-user-queue=smtpq \
62 --with-group-queue=smtpq \
63 --with-path-socket=/run \
64 --with-path-CAfile=/etc/ssl/certs/ca-certificates.crt \
65 --sysconfdir=/etc/opensmtpd \
66 --with-mantype=doc \
67 $(use_with pam auth-pam)
68 }
69
70 src_install() {
71 default
72 newinitd "${FILESDIR}"/smtpd.initd smtpd
73 systemd_dounit "${FILESDIR}"/smtpd.{service,socket}
74 use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd
75 dosym /usr/sbin/smtpctl /usr/sbin/makemap
76 dosym /usr/sbin/smtpctl /usr/sbin/newaliases
77 if use mta ; then
78 dodir /usr/sbin
79 dosym /usr/sbin/smtpctl /usr/sbin/sendmail
80 dosym /usr/sbin/smtpctl /usr/bin/sendmail
81 dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail
82 fi
83 }
84
85 pkg_preinst() {
86 enewgroup smtpd 25
87 enewuser smtpd 25 -1 /var/empty smtpd
88 enewgroup smtpq 252
89 enewuser smtpq 252 -1 /var/empty smtpq
90 }
91
92 pkg_postinst() {
93 einfo
94 einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps,"
95 einfo "Redis, and many other useful addons and filters are"
96 einfo "available in the mail-filter/opensmtpd-extras package."
97 einfo
98 }