*/*: [QA] Remove redundant --docdir/--htmldir
[gentoo.git] / mail-filter / opendmarc / opendmarc-1.3.2-r3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit user multilib systemd
7
8 DESCRIPTION="Open source DMARC implementation "
9 HOMEPAGE="http://www.trusteddomain.org/opendmarc/"
10 SRC_URI="mirror://sourceforge/opendmarc/${P}.tar.gz"
11
12 LICENSE="BSD"
13 SLOT="0"
14 KEYWORDS="~alpha amd64 arm hppa ia64 ppc ppc64 sparc x86"
15 IUSE="spf +reports static-libs"
16
17 DEPEND="reports? ( dev-perl/DBI )
18         || ( mail-filter/libmilter mail-mta/sendmail )"
19 RDEPEND="${DEPEND}
20         reports? (
21                 dev-perl/DBD-mysql
22                 dev-perl/HTTP-Message
23                 dev-perl/Switch
24         )
25         spf? ( mail-filter/libspf2 )"
26
27 PATCHES=(
28         "${FILESDIR}"/${P}-multiple-From.patch
29 )
30
31 pkg_setup() {
32         enewgroup milter
33         enewuser milter -1 -1 /var/lib/milter milter
34 }
35
36 src_prepare() {
37         default
38         if use !reports ; then
39                 sed -i -e '/^SUBDIRS =/s/reports//' Makefile.in || die
40         fi
41 }
42
43 src_configure() {
44         econf \
45                 $(use_with spf) \
46                 $(use_with spf spf2-include "${EPREFIX}"/usr/include/spf2) \
47                 $(use_with spf spf2-lib "${EPREFIX}"/usr/$(get_libdir)) \
48                 $(use_enable static-libs static)
49 }
50
51 src_install() {
52         default
53
54         use static-libs || rm -f "${ED}"/usr/$(get_libdir)/*.la
55
56         newinitd "${FILESDIR}"/opendmarc.initd opendmarc
57         newconfd "${FILESDIR}"/opendmarc.confd opendmarc
58         systemd_dounit "${FILESDIR}/${PN}.service"
59
60         dodir /etc/opendmarc
61
62         # create config file
63         sed \
64                 -e 's:^# UserID .*$:UserID milter:' \
65                 -e "s:^# PidFile .*:PidFile ${EPREFIX}/var/run/opendmarc/opendmarc.pid:" \
66                 -e '/^# Socket /s:^# ::' \
67                 "${S}"/opendmarc/opendmarc.conf.sample \
68                 > "${ED}"/etc/opendmarc/opendmarc.conf \
69                 || die
70 }