Merge media-sound/spotify: Fix homepage URL
[gentoo.git] / mail-mta / opensmtpd / opensmtpd-5.7.1_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="pam +mta"
21
22 DEPEND="dev-libs/openssl:0
23                 sys-libs/zlib
24                 pam? ( virtual/pam )
25                 sys-libs/db:=
26                 dev-libs/libevent
27                 app-misc/ca-certificates
28                 net-mail/mailbase
29                 net-libs/libasr
30                 !mail-mta/courier
31                 !mail-mta/esmtp
32                 !mail-mta/exim
33                 !mail-mta/mini-qmail
34                 !mail-mta/msmtp[mta]
35                 !mail-mta/netqmail
36                 !mail-mta/nullmailer
37                 !mail-mta/postfix
38                 !mail-mta/qmail-ldap
39                 !mail-mta/sendmail
40                 !mail-mta/ssmtp[mta]
41 "
42 RDEPEND="${DEPEND}"
43
44 S=${WORKDIR}/${MY_P/_}
45
46 src_prepare() {
47         # Use /run instead of /var/run
48         sed -i -e '/pidfile_path/s:_PATH_VARRUN:"/run/":' openbsd-compat/pidfile.c || die
49
50         epatch_user
51         eautoreconf
52 }
53
54 src_configure() {
55         tc-export AR
56         AR="$(which "$AR")" econf \
57                 --enable-table-db \
58                 --with-privsep-user=smtpd \
59                 --with-queue-user=smtpq \
60                 --with-privsep-path=/var/empty \
61                 --with-sock-dir=/run \
62                 --sysconfdir=/etc/opensmtpd \
63                 --with-ca-file=/etc/ssl/certs/ca-certificates.crt \
64                 $(use_with pam)
65 }
66
67 src_install() {
68         default
69         newinitd "${FILESDIR}"/smtpd.initd smtpd
70         systemd_dounit "${FILESDIR}"/smtpd.{service,socket}
71         use pam && newpamd "${FILESDIR}"/smtpd.pam smtpd
72         if use mta ; then
73                 dodir /usr/sbin
74                 dosym /usr/sbin/smtpctl /usr/sbin/sendmail
75                 dosym /usr/sbin/smtpctl /usr/bin/sendmail
76                 dosym /usr/sbin/smtpctl /usr/$(get_libdir)/sendmail
77         fi
78 }
79
80 pkg_preinst() {
81         enewgroup smtpd 25
82         enewuser smtpd 25 -1 /var/empty smtpd
83         enewgroup smtpq 252
84         enewuser smtpq 252 -1 /var/empty smtpq
85 }
86
87 pkg_postinst() {
88         einfo
89         einfo "Plugins for SQLite, MySQL, PostgreSQL, LDAP, socketmaps,"
90         einfo "Redis, and many other useful addons and filters are"
91         einfo "available in the mail-filter/opensmtpd-extras package."
92         einfo
93 }