# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # To avoid a collision between mail-mta/ssmtp and mail-mta/sendmail, do the following: # emerge -C mail-mta/ssmtp # echo mail-mta/ssmtp >> /etc/portage/package.mask # see http://bugs.gentoo.org/167952 inherit eutils DESCRIPTION="milter-greylist is a stand-alone milter written in C that implements the greylist filtering method" SRC_URI="ftp://ftp.espci.fr/pub/milter-greylist/${P}.tgz" HOMEPAGE="http://hcpnet.free.fr/milter-greylist" DEPEND="virtual/libc mail-mta/sendmail spf? ( >=mail-filter/libspf2-1.2.5-r1 ) curl? ( net-misc/curl ) geoip? ( dev-libs/geoip )" SLOT="0" LICENSE="BSD" KEYWORDS="~x86 ~amd64" IUSE="spf dnsrbl geoip curl" pkg_setup() { if [ ! -e /usr/lib/libmilter.a ] ; then ewarn "Sendmail must be compiled with milter support -" ewarn "recompile sendmail with milter USE flag enabled" die "need milter-enabled sendmail" fi } src_compile() { local myconf use spf && { myconf="${myconf} --with-libspf2=/usr/lib" } use dnsrbl && { myconf="${myconf} --enable-dnsrbl" } use geoip && { myconf="${myconf} --with-libGeoIP=/usr/lib" } use curl && { myconf="${myconf} --with-libcurl=/usr/lib" } sed "18s/^/DESC\=\"milter-greylist\"\n/; \ s|DAEMON=/usr/local/bin/$NAME|DAEMON=@BINDIR@/$NAME|; \ s|DOPTIONS=\"-p \$SOCKET -u \$USER -P \$PIDFILE\"|DOPTIONS=\"-p \$SOCKET -u \$USER -P \$PIDFILE \$GREYLIST_OPTS\"|; \ s|start-stop-daemon --stop --name \$NAME|start-stop-daemon --stop --name \$NAME --pidfile \$PIDFILE|; \ " rc-gentoo.sh.in > rc-gentoo.sh.in.tmp mv rc-gentoo.sh.in.tmp rc-gentoo.sh.in econf ${myconf} --with-user=smmsp || die emake || die "build error" } src_install () { newinitd rc-gentoo.sh milter-greylist cat > milter-greylist.conf.in <<-EOF # GREYLIST_OPTS: Extra options for milter-greylist daemon" # eg -L 24 GREYLIST_OPTS="" EOF newconfd milter-greylist.conf.in milter-greylist emake DESTDIR=${D} install || die "install error" dodoc ChangeLog README diropts "-o smmsp -m 755" into / keepdir /var/milter-greylist } pkg_postinst() { echo einfo "Read instructions at /usr/share/doc/${P}/README.gz" einfo "to configure milter-greylist." einfo "Insert the following into your sendmail.mc file:" einfo "INPUT_MAIL_FILTER(\`greylist',\`S=local:/var/milter-greylist/milter-greylist.sock,F=, T=S:4m;R:4m')" einfo "define(\`confMILTER_MACROS_CONNECT', \`j, {if_addr}')" einfo "define(\`confMILTER_MACROS_HELO', \`{verify}, {cert_subject}')" einfo "define(\`confMILTER_MACROS_ENVFROM', \`i, {auth_authen}')" einfo "define(\`confMILTER_MACROS_ENVRCPT', \`{greylist}')" }