mail-filter/dcc: stable 1.3.158 for sparc, bug #648242
[gentoo.git] / mail-filter / dcc / dcc-1.3.158.ebuild
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 base eutils flag-o-matic toolchain-funcs
7
8 DESCRIPTION="Distributed Checksum Clearinghouse"
9 HOMEPAGE="http://www.rhyolite.com/anti-spam/dcc/"
10 SRC_URI="http://www.rhyolite.com/anti-spam/dcc/source/old/${P}.tar.Z"
11
12 LICENSE="DCC GPL-2"
13 SLOT="0"
14 KEYWORDS="alpha amd64 ~arm ~hppa ia64 ~ppc ~ppc64 sparc ~x86 ~x86-fbsd" # ~amd64-fbsd
15 IUSE="cgi ipv6 rrdtool milter"
16
17 RDEPEND="dev-lang/perl
18         rrdtool? ( net-analyzer/rrdtool )
19         || ( net-misc/wget www-client/fetch net-misc/curl net-ftp/ftp )
20         milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )"
21 DEPEND="sys-apps/sed
22         sys-devel/gcc
23         ${RDEPEND}"
24
25 dcc_cgibin=/var/www/localhost/cgi-bin/dcc
26 dcc_homedir=/var/dcc
27 dcc_libexec=/usr/sbin
28 dcc_man=/usr/share/man
29 dcc_rundir=/var/run/dcc
30
31 PATCHES=( "${FILESDIR}"/dcc-1.3.140-freebsd.patch )
32
33 src_configure() {
34         tc-export CC AR RANLIB
35         local myconf
36         myconf="${myconf} --homedir=${dcc_homedir}"
37         myconf="${myconf} --bindir=/usr/bin"
38         myconf="${myconf} --libexecdir=${dcc_libexec}"
39         myconf="${myconf} --mandir=/usr/share/man"
40         myconf="${myconf} --with-updatedcc_pfile=${dcc_homedir}/updatecc.pfile"
41         myconf="${myconf} --with-installroot=${D}"
42         # sigh.  should be DCC-MD5 but see line 486 in the shipped configure script
43         myconf="${myconf} --with-DDC-MD5"
44         myconf="${myconf} --with-uid=root"
45         myconf="${myconf} --enable-server"
46         myconf="${myconf} --enable-dccifd"
47         myconf="${myconf} --with-rundir=${dcc_rundir}"
48         myconf="${myconf} --with-db-memory=64"
49         myconf="${myconf} --with-max-db-mem=128"
50         myconf="${myconf} --with-max-log-size=0"
51         myconf="${myconf} --with-make-cmd=${MAKE:-make}"
52         myconf="${myconf} $(use_enable ipv6 IPv6)"
53         myconf="${myconf} $(use_with cgi cgibin ${dcc_cgibin})"
54         myconf="${myconf} $(use_enable milter dccm)"
55         use milter && myconf="${myconf} --with-sendmail="
56
57         einfo "Using config: ${myconf}"
58
59         # This is NOT a normal configure script.
60         ./configure ${myconf} || die "configure failed!"
61 }
62
63 moveconf() {
64         local into=/etc/dcc/
65         for i in $@; do
66                 mv "${D}${dcc_homedir}/${i}" "${D}${into}"
67                 dosym "${into}${i}" "${dcc_homedir}/${i}"
68         done
69 }
70
71 src_install() {
72         # stolen from the RPM .spec and modified for gentoo
73         MANOWN=root MANGRP=$(id -g -n root) export MANOWN MANGRP
74         BINOWN="${MANOWN}" BINGRP="${MANGRP}" export BINOWN BINGRP
75         DCC_PROTO_HOMEDIR="${D}${dcc_homedir}" export DCC_PROTO_HOMEDIR
76         DCC_CGIBINDIR="${D}${dcc_cgibin}" export DCC_CGIBINDIR
77         DCC_SUID="${BINOWN}" DCC_OWN="${BINOWN}" DCC_GRP="${BINGRP}" export DCC_SUID DCC_OWN DCC_GRP
78
79         dodir /etc/cron.daily "${dcc_homedir}" /usr/bin /usr/sbin /usr/share/man/man{0,8} /etc/dcc
80         if use cgi ; then
81                 dodir "${dcc_cgibin}"
82         fi
83         keepdir /var/log/dcc
84
85         # This package now takes "${D}" at compile-time!
86         # make DESTDIR="${D}" DCC_BINDIR="${D}"/usr/bin MANDIR="${D}"/usr/share/man/man DCC_HOMEDIR="${D}"${dcc_homedir} install || die
87         emake install
88
89         # branding and setting reasonable defaults
90         sed -e "s/BRAND=\$/BRAND='Gentoo ${PF}'/;" \
91                 -e "s/GREY_ENABLE=\$/GREY_ENABLE=off/;" \
92                 -e "s/DCCM_LOG_AT=5\$/DCCM_LOG_AT=50/;" \
93                 -e "s,DCCM_LOGDIR=\"log\"\$,DCCM_LOGDIR=\"/var/log/dcc\",;" \
94                 -e "s/DCCM_ARGS=\$/DCCM_ARGS='-SHELO -Smail_host -SSender -SList-ID'/;" \
95                 -e "s/DCCIFD_ARGS=\$/DCCIFD_ARGS=\"\$DCCM_ARGS\"/;" \
96                 -e 's/DCCIFD_ENABLE=off/DCCIFD_ENABLE=on/' \
97                 -e 's/DBCLEAN_LOGDAYS=14/DBCLEAN_LOGDAYS=1/' \
98                 -i "${D}${dcc_homedir}/dcc_conf"
99
100         if use milter ; then
101                 # enable milter
102                 sed -i -e "s:^[\t #]*\(DCCM_ENABLE[\t ]*=[\t ]*\).*:\1on:g" \
103                         "${D}${dcc_homedir}"/dcc_conf
104         fi
105
106         # provide cronjob
107         mv "${D}"/usr/sbin/cron-dccd "${D}"/etc/cron.daily/dccd || die "mv failed"
108
109         # clean up
110         mv "${D}"/usr/sbin/logger "${D}"/usr/sbin/logger-dcc || die "mv failed"
111
112         statslist="${D}/usr/sbin/{dcc-stats-graph,dcc-stats-init,dcc-stats-collect}"
113         if ! use rrdtool; then
114                 # remove rrdtool interface scripts
115                 eval rm -f ${statslist} || die "Failed to clean up rrdtool scripts"
116         fi
117
118         # clean up
119         rm -f "${D}"/usr/sbin/{rcDCC,updatedcc}
120
121         # place configuration files into /etc instead of /var/dcc
122         moveconf dcc_conf flod grey_flod grey_whitelist ids map map.txt whiteclnt whitecommon whitelist
123
124         newinitd "${FILESDIR}"/dcc.initd-1.3.154 dcc
125         newconfd "${FILESDIR}"/dcc.confd dcc
126
127         rmdir "${D}"/var/dcc/log/
128
129         dodoc CHANGES RESTRICTIONS
130         dohtml *.html
131         doman *.{0,8}
132 }