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