1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit base eutils flag-o-matic toolchain-funcs
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"
14 KEYWORDS="alpha amd64 ~arm ~hppa ia64 ~ppc ~ppc64 sparc ~x86 ~x86-fbsd" # ~amd64-fbsd
15 IUSE="cgi ipv6 rrdtool milter"
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 ) )"
25 dcc_cgibin=/var/www/localhost/cgi-bin/dcc
28 dcc_man=/usr/share/man
29 dcc_rundir=/var/run/dcc
31 PATCHES=( "${FILESDIR}"/dcc-1.3.140-freebsd.patch )
34 tc-export CC AR RANLIB
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="
57 einfo "Using config: ${myconf}"
59 # This is NOT a normal configure script.
60 ./configure ${myconf} || die "configure failed!"
66 mv "${D}${dcc_homedir}/${i}" "${D}${into}"
67 dosym "${into}${i}" "${dcc_homedir}/${i}"
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
79 dodir /etc/cron.daily "${dcc_homedir}" /usr/bin /usr/sbin /usr/share/man/man{0,8} /etc/dcc
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
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"
102 sed -i -e "s:^[\t #]*\(DCCM_ENABLE[\t ]*=[\t ]*\).*:\1on:g" \
103 "${D}${dcc_homedir}"/dcc_conf
107 mv "${D}"/usr/sbin/cron-dccd "${D}"/etc/cron.daily/dccd || die "mv failed"
110 mv "${D}"/usr/sbin/logger "${D}"/usr/sbin/logger-dcc || die "mv failed"
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"
119 rm -f "${D}"/usr/sbin/{rcDCC,updatedcc}
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
124 newinitd "${FILESDIR}"/dcc.initd-1.3.154 dcc
125 newconfd "${FILESDIR}"/dcc.confd dcc
127 rmdir "${D}"/var/dcc/log/
129 dodoc CHANGES RESTRICTIONS