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