diff -ruN dnscheckengine.orig/Makefile dnscheckengine/Makefile
--- dnscheckengine.orig/Makefile	2010-08-14 12:14:45.000000000 +0530
+++ dnscheckengine/Makefile	2010-08-14 12:08:03.000000000 +0530
@@ -18,7 +18,7 @@
 BUILD_DEPENDS=	p5-Crypt-OpenSSL-Random>=0:${PORTSDIR}/security/p5-Crypt-OpenSSL-Random \
 		p5-Digest-BubbleBabble>=0:${PORTSDIR}/security/p5-Digest-BubbleBabble \
 		p5-Digest-SHA1>=0:${PORTSDIR}/security/p5-Digest-SHA1 \
-		p5-IO-Socket-INET6>=2.51:${PORTSDIR}/net/p5-IO-INET6 \
+		p5-IO-Socket-INET6>=2.51:${PORTSDIR}/net/p5-IO-Socket-INET6 \
 		p5-Net-DNS>=0.65:${PORTSDIR}/dns/p5-Net-DNS \
 		p5-Net-DNS-SEC>=0.15:${PORTSDIR}/dns/p5-Net-DNS-SEC \
 		p5-Socket6>=0.19:${PORTSDIR}/net/p5-Socket6 \
@@ -38,10 +38,11 @@
 DOCS=	'DNSCheck Lib Descriptions.pdf' data-flow-batch.png DNSCheck.graffle data-flow-web.png call-flow.png database-schema.pdf
 DOCSDB=	indexes.sql schema.sql drop.sql
 PORTDOCS=	${DOCS} db
+SUB_FILES=	pkg-install pkg-deinstall pkg-message
 
 OPTIONS=	MYSQL "Add MySQL Support (needed for webgui)" off
 
-.include <bsd.port.pre.mk>
+.include <bsd.port.options.mk>
 
 .if defined(WITH_MYSQL)
 BUILD_DEPENDS+=	p5-DBI>=0:${PORTSDIR}/databases/p5-DBI
@@ -49,7 +50,7 @@
 USE_MYSQL=	yes
 .endif
 
-MAN1= 	dnscheck-zonediff.1 \
+MAN1=	dnscheck-zonediff.1 \
 	dnscheck-dispatcher.1 \
 	dnscheck-preflight.1 \
 	dnscheck-hostsyntax.1 \
@@ -79,16 +80,19 @@
 MANCOMPRESSED=	no
 
 post-patch:
-	@${FIND} ${WRKSRC} -name \*.orig -delete
+	@${GREP} -Rl '%%[[:alpha:]]\+%%' ${WRKSRC} |${XARGS} ${REINPLACE_CMD} \
+		-e 's,%%PREFIX%%,${PREFIX},g'
+
+pre-install:
+	-@${FIND} ${WRKSRC} -name \*.orig -delete
 
 post-install:
 .if defined(WITH_MYSQL)
 # install startup script (if WITH_MYSQL  is defined)
-	@[ -f  ${PREFIX}/etc/rc.d/dnscheck-dispatcher ] || \
-		${CP} ${WRKSRC}/contrib/dnscheck-dispatcher.sh \
+	@${INSTALL_SCRIPT} ${WRKSRC}/contrib/dnscheck-dispatcher.sh \
 		${PREFIX}/etc/rc.d/dnscheck-dispatcher
 .endif
-	@PKG_PREFIX=${PREFIX} BATCH=${BATCH} SU_CMD="${SU_CMD}" ${SH} ${PKGDIR}/pkg-install ${PKGNAME} POST-INSTALL
+	@PKG_PREFIX=${PREFIX} BATCH=${BATCH} SU_CMD="${SU_CMD}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR} ${DOCSDIR}/db
 	@${INSTALL_DATA} ${DOCS:S|^|${WRKSRC}/doc/|} ${DOCSDIR}
@@ -96,4 +100,4 @@
 
 .endif
 	@${SED} -e 's#PREFIX#${PREFIX}#' ${PKGMESSAGE}
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff -ruN dnscheckengine.orig/files/patch-contrib-dnscheck-dispatcher.sh dnscheckengine/files/patch-contrib-dnscheck-dispatcher.sh
--- dnscheckengine.orig/files/patch-contrib-dnscheck-dispatcher.sh	2010-08-14 12:14:45.000000000 +0530
+++ dnscheckengine/files/patch-contrib-dnscheck-dispatcher.sh	1970-01-01 05:30:00.000000000 +0530
@@ -1,19 +0,0 @@
-*** contrib/dnscheck-dispatcher.sh	Tue Jun 29 04:15:59 2010
---- contrib/dnscheck-dispatcher.sh	Mon Jul 26 21:17:51 2010
-***************
-*** 20,26 ****
-  
-  name="dnscheck_dispatcher"
-  rcvar=`set_rcvar`
-! command="/usr/local/bin/dnscheck-dispatcher"
-  
-  pidfile="${utility_pidfile}"
-  
---- 20,26 ----
-  
-  name="dnscheck_dispatcher"
-  rcvar=`set_rcvar`
-! command="/usr/local/libexec/dnscheck/dnscheck-dispatcher"
-  
-  pidfile="${utility_pidfile}"
-  
diff -ruN dnscheckengine.orig/files/patch-contrib_dnscheck-dispatcher.sh dnscheckengine/files/patch-contrib_dnscheck-dispatcher.sh
--- dnscheckengine.orig/files/patch-contrib_dnscheck-dispatcher.sh	1970-01-01 05:30:00.000000000 +0530
+++ dnscheckengine/files/patch-contrib_dnscheck-dispatcher.sh	2010-08-14 11:56:58.000000000 +0530
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- contrib/dnscheck-dispatcher.sh.orig
++++ contrib/dnscheck-dispatcher.sh
+@@ -20,7 +20,7 @@
+ 
+ name="dnscheck_dispatcher"
+ rcvar=`set_rcvar`
+-command="/usr/local/bin/dnscheck-dispatcher"
++command="%%PREFIX%%/libexec/dnscheck/dnscheck-dispatcher"
+ 
+ pidfile="${utility_pidfile}"
+ 
diff -ruN dnscheckengine.orig/files/pkg-deinstall.in dnscheckengine/files/pkg-deinstall.in
--- dnscheckengine.orig/files/pkg-deinstall.in	1970-01-01 05:30:00.000000000 +0530
+++ dnscheckengine/files/pkg-deinstall.in	2010-08-14 11:31:47.000000000 +0530
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PKG_PREFIX=${PKG_PREFIX:-%%PREFIX%%}
+
+
+if [ "$2" != "DEINSTALL" ]; then
+    exit 0
+fi
+if [ -f ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher ]; then
+    echo '===>   Stopping dnscheck dispatcher if it is running'
+    ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher stop >/dev/null 2>/dev/null
+    echo '===>   Removing startup script for dnscheck dispatcher'
+    rm -f ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher stop
+fi
+
+
+exit 0
diff -ruN dnscheckengine.orig/files/pkg-install.in dnscheckengine/files/pkg-install.in
--- dnscheckengine.orig/files/pkg-install.in	1970-01-01 05:30:00.000000000 +0530
+++ dnscheckengine/files/pkg-install.in	2010-08-14 11:31:25.000000000 +0530
@@ -0,0 +1,18 @@
+#!/bin/sh
+# $FreeBSD$ 
+#
+
+PKG_PREFIX=${PKG_PREFIX:-%%PREFIX%%}
+
+if [ "$2" = "POST-INSTALL" ];then
+
+if [ -f ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher  ]; then
+    echo '***Please add dns_dispatcher_enable="YES" to /etc/rc.conf to enable dnscheck-se-dispatcher to run at startup.***'
+    chmod +x ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher
+    fi
+# install a link to put the dnscheck engine into the regular $PATH for more users
+
+ln -s ${PKG_PREFIX}/libexec/dnscheck/dnscheck ${PKG_PREFIX}/bin/dnscheckengine
+
+fi
+exit 0
diff -ruN dnscheckengine.orig/files/pkg-message.in dnscheckengine/files/pkg-message.in
--- dnscheckengine.orig/files/pkg-message.in	1970-01-01 05:30:00.000000000 +0530
+++ dnscheckengine/files/pkg-message.in	2010-08-14 10:36:48.000000000 +0530
@@ -0,0 +1,34 @@
+*************************************************************************
+*	    _  _____ _____ _____ _   _ _____ ___ ___  _   _ 		*
+*	   / \|_   _|_   _| ____| \ | |_   _|_ _/ _ \| \ | |		*
+*	  / _ \ | |   | | |  _| |  \| | | |  | | | | |  \| |		*
+*	 / ___ \| |   | | | |___| |\  | | |  | | |_| | |\  |		*
+*	/_/   \_\_|   |_| |_____|_| \_| |_| |___\___/|_| \_|		*
+*                                                                       *
+*************************************************************************
+
+The DNSCheck software included in the port is the PERL-based engine and 
+includes a command line utility that uses that engine in %%PREFIX%%/bin
+called dnscheckengine. There is some other software that is included 
+that the developers at the .SE registry use to manage the process by
+which they do domain delegation. These generally require MYSQL support 
+to work and are disabled by default. If you want to learn more about them, 
+they are all PERL-based and have integrated perldoc information. However, 
+I have not tested them extensively and can't advise on their suitability as of
+this writing. All the scripts install into %%PREFIX%%/libexec/dnscheck. 
+
+This port also installs some documentation in %%DOCSDIR%%
+that may prove useful. 
+
+There is also a webui that is available as an alternative frontend. I hope
+to include it in a future port. 
+
+If you have questions about the basic software, please see the developer's
+web site at http://opensource.iis.se/dnscheck. If there is a problem with 
+the port, please let me know at dnscheckengine-port@academ.com.
+
+Stan Barber
+Academ Consulting Services
+http://www.stanbarber.com
+http://www.academ.com
+
diff -ruN dnscheckengine.orig/pkg-deinstall dnscheckengine/pkg-deinstall
--- dnscheckengine.orig/pkg-deinstall	2010-08-14 12:14:45.000000000 +0530
+++ dnscheckengine/pkg-deinstall	1970-01-01 05:30:00.000000000 +0530
@@ -1,20 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-
-PKG_PREFIX=${PKG_PREFIX:-/usr/local}
-
-
-if [ "$2" != "DEINSTALL" ]; then
-    exit 0
-fi
-if [ -f ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher ]; then
-    echo '===>   Stopping dnscheck dispatcher if it is running'
-    ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher stop >/dev/null 2>/dev/null
-    echo '===>   Removing startup script for dnscheck dispatcher'
-    rm -f ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher stop
-fi
-
-
-exit 0
diff -ruN dnscheckengine.orig/pkg-install dnscheckengine/pkg-install
--- dnscheckengine.orig/pkg-install	2010-08-14 12:14:45.000000000 +0530
+++ dnscheckengine/pkg-install	1970-01-01 05:30:00.000000000 +0530
@@ -1,18 +0,0 @@
-#!/bin/sh
-# $FreeBSD$ 
-#
-
-PKG_PREFIX=${PKG_PREFIX:-/usr/local}
-
-if [ "$2" = "POST-INSTALL" ];then
-
-if [ -f ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher  ]; then
-    echo '***Please add dns_dispatcher_enable="YES" to /etc/rc.conf to enable dnscheck-se-dispatcher to run at startup.***'
-    chmod +x ${PKG_PREFIX}/etc/rc.d/dnscheck-dispatcher
-    fi
-# install a link to put the dnscheck engine into the regular $PATH for more users
-
-ln -s ${PKG_PREFIX}/libexec/dnscheck/dnscheck ${PKG_PREFIX}/bin/dnscheckengine
-
-fi
-exit 0
diff -ruN dnscheckengine.orig/pkg-message dnscheckengine/pkg-message
--- dnscheckengine.orig/pkg-message	2010-08-14 12:14:45.000000000 +0530
+++ dnscheckengine/pkg-message	1970-01-01 05:30:00.000000000 +0530
@@ -1,34 +0,0 @@
-*************************************************************************
-*	    _  _____ _____ _____ _   _ _____ ___ ___  _   _ 		*
-*	   / \|_   _|_   _| ____| \ | |_   _|_ _/ _ \| \ | |		*
-*	  / _ \ | |   | | |  _| |  \| | | |  | | | | |  \| |		*
-*	 / ___ \| |   | | | |___| |\  | | |  | | |_| | |\  |		*
-*	/_/   \_\_|   |_| |_____|_| \_| |_| |___\___/|_| \_|		*
-*                                                                       *
-*************************************************************************
-
-The DNSCheck software included in the port is the PERL-based engine and 
-includes a command line utility that uses that engine in /usr/local/bin
-called dnscheckengine. There is some other software that is included 
-that the developers at the .SE registry use to manage the process by
-which they do domain delegation. These generally require MYSQL support 
-to work and are disabled by default. If you want to learn more about them, 
-they are all PERL-based and have integrated perldoc information. However, 
-I have not tested them extensively and can't advise on their suitability as of
-this writing. All the scripts install into PREFIX/libexec/dnscheck. 
-
-This port also installs some documentation in PREFIX/share/doc/DNSCheck
-that may prove useful. 
-
-There is also a webui that is available as an alternative frontend. I hope
-to include it in a future port. 
-
-If you have questions about the basic software, please see the developer's
-web site at http://opensource.iis.se/dnscheck. If there is a problem with 
-the port, please let me know at dnscheckengine-port@academ.com.
-
-Stan Barber
-Academ Consulting Services
-http://www.stanbarber.com
-http://www.academ.com
-
diff -ruN dnscheckengine.orig/pkg-plist dnscheckengine/pkg-plist
--- dnscheckengine.orig/pkg-plist	2010-08-14 12:14:45.000000000 +0530
+++ dnscheckengine/pkg-plist	2010-08-14 10:31:49.000000000 +0530
@@ -8,27 +8,27 @@
 bin/dnscheckengine
 %%SITE_PERL%%/DNSCheck.pm
 %%SITE_PERL%%/DNSCheck/Test/Address.pm
-%%SITE_PERL%%/DNSCheck/Test/Consistency.pm  
-%%SITE_PERL%%/DNSCheck/Test/Host.pm         
+%%SITE_PERL%%/DNSCheck/Test/Consistency.pm
+%%SITE_PERL%%/DNSCheck/Test/Host.pm
 %%SITE_PERL%%/DNSCheck/Test/SMTP.pm
-%%SITE_PERL%%/DNSCheck/Test/Common.pm       
-%%SITE_PERL%%/DNSCheck/Test/DNSSEC.pm       
-%%SITE_PERL%%/DNSCheck/Test/Mail.pm         
+%%SITE_PERL%%/DNSCheck/Test/Common.pm
+%%SITE_PERL%%/DNSCheck/Test/DNSSEC.pm
+%%SITE_PERL%%/DNSCheck/Test/Mail.pm
 %%SITE_PERL%%/DNSCheck/Test/SOA.pm
-%%SITE_PERL%%/DNSCheck/Test/Connectivity.pm 
-%%SITE_PERL%%/DNSCheck/Test/Delegation.pm   
-%%SITE_PERL%%/DNSCheck/Test/Nameserver.pm   
+%%SITE_PERL%%/DNSCheck/Test/Connectivity.pm
+%%SITE_PERL%%/DNSCheck/Test/Delegation.pm
+%%SITE_PERL%%/DNSCheck/Test/Nameserver.pm
 %%SITE_PERL%%/DNSCheck/Test/Zone.pm
-%%SITE_PERL%%/DNSCheck/Config.pm       
-%%SITE_PERL%%/DNSCheck/Logger.pm       
-%%SITE_PERL%%/DNSCheck/Locale.pm       
+%%SITE_PERL%%/DNSCheck/Config.pm
+%%SITE_PERL%%/DNSCheck/Logger.pm
+%%SITE_PERL%%/DNSCheck/Locale.pm
 %%SITE_PERL%%/DNSCheck/Overview.pod
-%%SITE_PERL%%/DNSCheck/Lookup/ASN.pm          
-%%SITE_PERL%%/DNSCheck/Lookup/DNS.pm          
+%%SITE_PERL%%/DNSCheck/Lookup/ASN.pm
+%%SITE_PERL%%/DNSCheck/Lookup/DNS.pm
 %%SITE_PERL%%/DNSCheck/Lookup/Resolver.pm
 %%SITE_PERL%%/%%PERL_ARCH%%/auto/DNSCheck/.packlist
 @dirrm %%SITE_PERL%%/DNSCheck/Test
-@dirrm %%SITE_PERL%%/DNSCheck/Lookup          
+@dirrm %%SITE_PERL%%/DNSCheck/Lookup
 @dirrm %%SITE_PERL%%/DNSCheck
 @dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/DNSCheck
 share/dnscheck/locale/en.yaml