--- Portfile.orig	2009-01-26 23:35:46.000000000 -0600
+++ Portfile	2009-01-26 20:10:30.000000000 -0600
@@ -1,10 +1,10 @@
-# $Id: Portfile 40682 2008-10-10 17:19:39Z nox@macports.org $
+# $Id$
 
 PortSystem      1.0
 
 name				qmail-spamcontrol
-version				2.4.18
-revision			5
+version				2.5.19
+revision			0
 categories			mail
 maintainers			yahoo.com:compconsultant
 platforms			darwin
@@ -17,11 +17,11 @@
 
 universal_variant		no
 
-variant relaymailfrom {}
-variant noreqbrackets {}
-variant noverp {}
-variant moreipme {}
-variant bigtodo {}
+variant relaymailfrom description {Relay based on sender email, not a good idea} {}
+variant noreqbrackets description {Do not require brackets in SMTP addresses} {}
+variant noverp description {Do not alow VERP addresses for recipients} {}
+variant moreipme description {Patch to account for certain NAT or load balance situations} {}
+variant bigtodo description {May make very large installations more efficient} {}
 
 homepage			http://www.fehcom.de/qmail/spamcontrol.html
 
@@ -32,26 +32,36 @@
 				http://www.qmail.org/:qmail \
 
 distfiles			qmail-1.03.tar.gz:qmail \
-				spamcontrol-2418_tgz.bin:spamcontrol \
+				spamcontrol-2519_tgz.bin:spamcontrol \
 
 checksums			qmail-1.03.tar.gz \
 					md5 622f65f982e380dbe86e6574f3abcb7c \
 					sha1 18fb960481291a0503e93a94df3f6094edb7f27a \
 					rmd160 b851f273f1d365d38efd949b1efcf35768ffa30f \
-				spamcontrol-2418_tgz.bin \
-					md5 a5502cd69e573a2753e532bce8fb6c3a \
-					sha1 b2329b412a88ca2072cfb5e430efd1dd8a410b64 \
-					rmd160 4306ff09148332f5ad4cb1a3ff3b5da74b888d79 \
+				spamcontrol-2519_tgz.bin \
+					md5 acca46cc48d8b5cfa9eb3de4d3fc90ad \
+					sha1 b259183cb9afd7a574ad598cb2399af5002226ec \
+					rmd160 8374835ade0656145ba15eded23c6f8ce0a1b936 \
 
 worksrcdir		qmail-1.03
 
 patchfiles		patch-dns.c.diff \
-			patch-strerr_sys.c.diff
+			patch-strerr_sys.c.diff \
+                        patch-qmail-lspawn.c.diff \
+                        patch-qmail-rspawn.c.diff \
+                        patch-qmail.c.diff \
+                        patch-Makefile.diff
 
 configure.cflags 	-O2 -include /usr/include/errno.h -c
 build.target		setup-patch
 destroot.cmd		./install-destroot
 
+pre-fetch {
+	if {${os.platform} == "darwin" && ${os.major} == "6"} {
+		return -code error "${name} requires Mac OS X 10.3 or newer."
+	}
+}
+
 post-extract {
 
 	# Merge Spamcontrol source with Qmail source
@@ -72,15 +82,14 @@
 		${worksrcpath}/conf-qmail
 }
 
-post-patch {
+pre-patch {
 		# Apply Spamcontrol patches
 		foreach file [glob ${worksrcpath}/*.patch] {
-			system "patch -p2 <${file}"
+			system "patch -d ${worksrcpath} -p2 <${file}"
 		}
+}
 
-		# Append our commands for making a destroot installer
-		# This is because Spamcontrol and us needs to patch Makefile
-		system "cat ${filespath}/append-Makefile >>${worksrcpath}/Makefile"
+post-patch {
 
 		# Handle the variants, disable via source code define change
 		foreach file [glob ${worksrcpath}/*c] {
@@ -168,54 +177,21 @@
 	
 	# Additional Spamcontrol files
 	xinstall -d ${destroot}${prefix}/var/qmail/scripts
-	xinstall -W ${worksrcpath} \
-		qmail-alias2recipients \
-		qmail-users2recipients \
-		qmail-pwd2recipients \
-		qmail-vpopmail2recipients \
-		${destroot}${prefix}/var/qmail/scripts
-	xinstall -m 644 -W ${worksrcpath} \
-		conf-spamcontrol \
-		ucspi-ssl-0.70_ucspitls-0.4.patch_ \
-		clamav-0.90.1_output.patch_ \
-		Makefile.djbdns \
-		badmailfrom \
-		badmimetypes \
-		badloadertypes \
-		badrcptto \
-		tarpitcount \
-		README_spamcontrol.html \
-		README.wildmat \
-		README.moreipme \
-		README.bigtodo \
-		README.qmailqueue \
-		README.bouncemaxbytes \
-		README.doublebouncetrim \
-		README.recipients \
-		README.djbdns \
-		INSTALL.spamcontrol \
-		HISTORY.spamcontrol \
-		FILES.spamcontrol \
-		LICENSE.spamcontrol \
-		TODO.spamcontrol \
-		RELEASE_22.spamcontrol \
-		RELEASE_23.spamcontrol \
-		RELEASE_24.spamcontrol \
-		LOGGING.spamcontrol \
-		SMTPREPLY.spamcontrol \
-		README.mav \
-		PROPOSAL.mav \
-		README.clamav \
-		${destroot}${prefix}/var/qmail/doc
-	xinstall -W ${worksrcpath} \
-		install_spamcontrol.sh \
-		${destroot}${prefix}/var/qmail/doc
+	foreach file {qmail-alias2recipients qmail-users2recipients qmail-pwd2recipients qmail-vpopmail2recipients} {
+		xinstall -W ${worksrcpath} ${file} ${destroot}${prefix}/var/qmail/scripts
+	}
+	foreach file {conf-spamcontrol ucspi-ssl-0.70_ucspitls-0.4.patch_ clamav-0.90.1_output.patch_ Makefile.djbdns badmailfrom badmimetypes badloadertypes badrcptto INSTALL.spamcontrol HISTORY.spamcontrol FILES.spamcontrol LICENSE.spamcontrol TODO.spamcontrol LOGGING.spamcontrol SMTPREPLY.spamcontrol PROPOSAL.mav install_spamcontrol.sh} {
+		xinstall -m 644 -W ${worksrcpath} ${file} ${destroot}${prefix}/var/qmail/doc
+	}
+	foreach file [glob -directory ${worksrcpath} README* RELEASE*] {
+		xinstall -m 644 ${file} ${destroot}${prefix}/var/qmail/doc
+	}
 
 	# User must run this
 	xinstall -W ${worksrcpath} config-fast ${destroot}${prefix}/var/qmail/scripts/config-fast
 
 	# Per Qmail install doc
-	xinstall ${destroot}${prefix}/var/qmail/boot/home ${destroot}${prefix}/var/qmail/rc
+	xinstall ${destroot}${prefix}/var/qmail/boot/home ${destroot}${prefix}/var/qmail/rc.sample
 }
 
 post-install {
@@ -228,6 +204,7 @@
 The fehcom site has docs for all the stuff added to the base qmail software.
 There are numerous configuration options to qmail. Please read all the docs!
 ******************************
+NEW INSTALLS ONLY
 For now, you must run ${prefix}/var/qmail/scripts/config-fast your.domain.name
 to set up some files for your mail server. your.domain.name should point
 to this machine you are installing qmail on.
@@ -237,16 +214,10 @@
 
 post-activate {
 
-	# Remove the turd files
+	# Remove the turd files, it is not know if they cause a problem but
+        # people have recommended not having them there.
 	system "cd ${prefix}/var/qmail; find . -name .turd_${name} -delete"
-	system "rm ${destroot}${prefix}/var/log/qmail/smtpd/.turd_${name}"
-}
-
-platform darwin 6 {
-	pre-fetch {
-		error "${name} requires Mac OS X 10.3 or newer."
-	}
 }
 
 livecheck.check			regex
-livecheck.regex			{Version\s+([0-9.]+)<}
+livecheck.regex			{SPAMCONTROL\sVersion\s([0-9.]+)}
