Index: net/bind9/files/patch-contrib-dlz-config.dlz.in
===================================================================
--- net/bind9/files/patch-contrib-dlz-config.dlz.in	(revision 93519)
+++ net/bind9/files/patch-contrib-dlz-config.dlz.in	(working copy)
@@ -1,26 +0,0 @@
---- contrib/dlz/config.dlz.in.orig	2009-01-29 14:42:22.000000000 -0800
-+++ contrib/dlz/config.dlz.in	2009-01-29 14:42:34.000000000 -0800
-@@ -155,6 +155,14 @@
- 			break
- 		fi
- 	done
-+elif test -f `$use_dlz_mysql --include | awk '{print substr($1,3)}'`/mysql.h
-+then
-+	mysql_include=`$use_dlz_mysql --include | awk '{print substr($1,3)}'`
-+	if test -d `$use_dlz_mysql --libs | awk '{print substr($2,3)}'`
-+	then
-+		mysql_lib=`$use_dlz_mysql --libs | awk '{print substr($2,3)}'`
-+	fi
-+elif test "$use_dlz_mysql" != "no"
- elif test "$use_dlz_mysql" != "no"
- then
- 	d=$use_dlz_mysql
-@@ -193,7 +201,7 @@
- 	*)
- 		DLZ_ADD_DRIVER(MYSQL, dlz_mysql_driver,
- 				[-I${mysql_include}],
--				[-L${mysql_lib} -lmysqlclient -lz -lcrypt -lm])
-+				[-L${mysql_lib} -lmysqlclient -lz -lm])
- 
- 		AC_MSG_RESULT(
- [using mysql from ${mysql_lib} and ${mysql_include}])
Index: net/bind9/files/patch-configure.diff
===================================================================
--- net/bind9/files/patch-configure.diff	(revision 0)
+++ net/bind9/files/patch-configure.diff	(working copy)
@@ -0,0 +1,36 @@
+--- a/configure	2012-05-29 19:45:36.000000000 -0700
++++ b/configure	2012-05-29 19:55:16.000000000 -0700
+@@ -21919,6 +21919,7 @@
+ 		# problems start to show up.
+ 		saved_libs="$LIBS"
+ 		for TRY_LIBS in \
++		    "-lgssapi -lkrb5 -lcrypto -lasn1 -lroken -lcom_err" \
+ 		    "-lgssapi_krb5" \
+ 		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
+ 		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
+@@ -27205,6 +27206,13 @@
+ 			break
+ 		fi
+ 	done
++elif test -f `$use_dlz_mysql --include | awk '{print substr($1,3)}'`/mysql.h
++then
++	mysql_include=`$use_dlz_mysql --include | awk '{print substr($1,3)}'`
++	if test -d `$use_dlz_mysql --libs | awk '{print substr($2,3)}'`
++	then
++		mysql_lib=`$use_dlz_mysql --libs | awk '{print substr($2,3)}'`
++	fi
+ elif test "$use_dlz_mysql" != "no"
+ then
+ 	d=$use_dlz_mysql
+@@ -27253,9 +27261,9 @@
+ 	then
+ 		DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES -I${mysql_include}"
+ 	fi
+-	if test -n "-L${mysql_lib} -lmysqlclient -lz -lcrypt -lm"
++	if test -n "-L${mysql_lib} -lmysqlclient -lz -lm"
+ 	then
+-		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L${mysql_lib} -lmysqlclient -lz -lcrypt -lm"
++		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L${mysql_lib} -lmysqlclient -lz -lm"
+ 	fi
+ 
+ 
Index: net/bind9/files/patch-contrib-dlz-config.dlz.in.diff
===================================================================
--- net/bind9/files/patch-contrib-dlz-config.dlz.in.diff	(revision 0)
+++ net/bind9/files/patch-contrib-dlz-config.dlz.in.diff	(working copy)
@@ -0,0 +1,26 @@
+--- a/contrib/dlz/config.dlz.in	2012-05-29 19:45:36.000000000 -0700
++++ b/contrib/dlz/config.dlz.in	2012-05-29 19:55:16.000000000 -0700
+@@ -155,6 +155,14 @@
+ 			break
+ 		fi
+ 	done
++elif test -f `$use_dlz_mysql --include | awk '{print substr($1,3)}'`/mysql.h
++then
++	mysql_include=`$use_dlz_mysql --include | awk '{print substr($1,3)}'`
++	if test -d `$use_dlz_mysql --libs | awk '{print substr($2,3)}'`
++	then
++		mysql_lib=`$use_dlz_mysql --libs | awk '{print substr($2,3)}'`
++	fi
++elif test "$use_dlz_mysql" != "no"
+ elif test "$use_dlz_mysql" != "no"
+ then
+ 	d=$use_dlz_mysql
+@@ -193,7 +201,7 @@
+ 	*)
+ 		DLZ_ADD_DRIVER(MYSQL, dlz_mysql_driver,
+ 				[-I${mysql_include}],
+-				[-L${mysql_lib} -lmysqlclient -lz -lcrypt -lm])
++				[-L${mysql_lib} -lmysqlclient -lz -lm])
+ 
+ 		AC_MSG_RESULT(
+ [using mysql from ${mysql_lib} and ${mysql_include}])
Index: net/bind9/files/patch-configure
===================================================================
--- net/bind9/files/patch-configure	(revision 93519)
+++ net/bind9/files/patch-configure	(working copy)
@@ -1,39 +0,0 @@
---- configure.orig	2009-01-29 14:42:07.000000000 -0800
-+++ configure	2009-01-29 14:42:34.000000000 -0800
-@@ -6623,8 +6623,8 @@
- 		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \
- 		    "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \
- 		    "-lgssapi" \
--		    "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \
--		    "-lgssapi -lkrb5 -lcrypto -lcrypt -lasn1 -lroken -lcom_err" \
-+		    "-lgssapi -lkrb5 -ldes -lasn1 -lroken -lcom_err" \
-+		    "-lgssapi -lkrb5 -lcrypto -lasn1 -lroken -lcom_err" \
- 		    "-lgss"
- 		do
- 		    # Note that this does not include $saved_libs, because
-@@ -31094,6 +31094,13 @@
- 			break
- 		fi
- 	done
-+elif test -f `$use_dlz_mysql --include | awk '{print substr($1,3)}'`/mysql.h
-+then
-+	mysql_include=`$use_dlz_mysql --include | awk '{print substr($1,3)}'`
-+	if test -d `$use_dlz_mysql --libs | awk '{print substr($2,3)}'`
-+	then
-+		mysql_lib=`$use_dlz_mysql --libs | awk '{print substr($2,3)}'`
-+	fi
- elif test "$use_dlz_mysql" != "no"
- then
- 	d=$use_dlz_mysql
-@@ -31144,9 +31151,9 @@
- 	then
- 		DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES -I${mysql_include}"
- 	fi
--	if test -n "-L${mysql_lib} -lmysqlclient -lz -lcrypt -lm"
-+	if test -n "-L${mysql_lib} -lmysqlclient -lz -lm"
- 	then
--		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L${mysql_lib} -lmysqlclient -lz -lcrypt -lm"
-+		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L${mysql_lib} -lmysqlclient -lz -lm"
- 	fi
- 
- 
Index: net/bind9/Portfile
===================================================================
--- net/bind9/Portfile	(revision 93519)
+++ net/bind9/Portfile	(working copy)
@@ -44,6 +44,8 @@
 startupitem.netchange	yes
 startupitem.executable	${prefix}/sbin/named -f
 
+patch.pre_args      -p1
+
 configure.env		STD_CDEFINES=-DDIG_SIGCHASE=1
 
 configure.args		--mandir=${prefix}/share/man \
@@ -97,8 +99,8 @@
 variant dlz_mysql5 description {Dynamically Loaded Zones (dlz) stored in MySQL 5.x} {
 	depends_lib-append \
 		path:bin/mysql_config5:mysql5
-	patchfiles-append patch-configure
-	patchfiles-append patch-contrib-dlz-config.dlz.in
+patchfiles          patch-configure.diff \
+                    patch-contrib-dlz-config.dlz.in.diff
 	# Threads are not safe when bind9 is compiled with dlz
 	configure.args-delete \
 		--enable-threads
