diff --git a/patches/bind-9.11.0-P2.local.patch b/patches/bind-9.11.0-P2.local.patch
index 75e93b2..88314f8 100644
--- a/patches/bind-9.11.0-P2.local.patch
+++ b/patches/bind-9.11.0-P2.local.patch
@@ -467,3 +467,18 @@ diff -ru bind-9.11.0-P2.orig/lib/samples/Makefile.in bind-9.11.0-P2/lib/samples/
  
  SUBDIRS =
  
+--- bind-9.11.0-P2/configure.in.orig	2016-12-11 23:05:44.000000000 +0100
++++ bind-9.11.0-P2/configure.in	2017-02-04 18:47:10.437368600 +0100
+@@ -2277,9 +2277,9 @@
+ 		esac
+ 		;;
+ 	*)
+-		if test -f "$use_libxml2/bin/xml2-config" ; then
+-			libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
+-			libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
++		if test -f "$use_libxml2" ; then
++			libxml2_libs=`$use_libxml2 --libs`
++			libxml2_cflags=`$use_libxml2 --cflags`
+ 		fi
+ 		;;
+ esac
diff --git a/vars/build.vars b/vars/build.vars
index 480c846..98869a9 100644
--- a/vars/build.vars
+++ b/vars/build.vars
@@ -259,7 +259,7 @@ LIB_PACKAGES_MAKEFLAGS_INSTALL="DESTDIR=${PREFIX_NATIVE}";
 LIB_PACKAGES_PACKAGES_LEAVES="
 apr apr_util bzip2 curl expat libz libffi gdbm pcre glib gzip libarchive libatomic_ops
 libpipeline libressl libevent libfetch libgpg_error libassuan libfirm libgcrypt libksba
-lua ncurses ncursestw ncursesw npth sqlite3 xz";
+libxml2 lua ncurses ncursestw ncursesw npth sqlite3 xz";
 LIB_PACKAGES_PACKAGES_X11="
 inputproto kbproto xcb_proto xproto libXau libpthread_stubs xcb xextproto xtrans libX11
 libXext libICE libSM libXt libXmu renderproto Xrender libXpm libXaw libxkbfile";
@@ -372,6 +372,10 @@ LIB_PACKAGES_PREFIX="${PREFIX_NATIVE}";
 : ${PKG_LIBKSBA_SHA256SUM:=41444fd7a6ff73a79ad9728f985e71c9ba8cd3e5e53358e70d5f066d35c1a340};
 : ${PKG_LIBKSBA_VERSION:=1.3.5};
 : ${PKG_LIBKSBA_URL:=https://www.gnupg.org/ftp/gcrypt/libksba/libksba-${PKG_LIBKSBA_VERSION}.tar.bz2};
+: ${PKG_LIBXML2_SHA256SUM:=ffb911191e509b966deb55de705387f14156e1a56b21824357cdf0053233633c};
+: ${PKG_LIBXML2_VERSION:=2.9.4};
+: ${PKG_LIBXML2_URL:=ftp://xmlsoft.org/libxml2/libxml2-${PKG_LIBXML2_VERSION}.tar.gz};
+: ${PKG_LIBXML2_CONFIGURE_ARGS_EXTRA:="--with-python=no"};
 : ${PKG_LUA_SHA256SUM:=5113c06884f7de453ce57702abaac1d618307f33f6789fa870e87a59d772aca2};
 : ${PKG_LUA_VERSION:=5.3.3};
 : ${PKG_LUA_URL:=https://www.lua.org/ftp/lua-${PKG_LUA_VERSION}.tar.gz};
@@ -517,7 +521,7 @@ LEAF_PACKAGES_PREFIX="${PREFIX_NATIVE}";
 : ${PKG_BIND_SHA256SUM:=d651f83ce1c08c83d6ac8201685c4f2b5fdb79794f3a4f93c3948e0ef439c1e5};
 : ${PKG_BIND_VERSION:=9.11.0-P2};
 : ${PKG_BIND_URL:=https://www.isc.org/downloads/file/bind-9-11-0-p2/};
-: ${PKG_BIND_CONFIGURE_ARGS_EXTRA:="--with-libtool --with-randomdev=/dev/urandom --with-openssl=${PREFIX_NATIVE} --with-ecdsa=yes --with-gost=yes BUILD_CC=gcc"};
+: ${PKG_BIND_CONFIGURE_ARGS_EXTRA:="--with-ecdsa=yes --with-gost=yes --with-libtool --with-libxml2=${PREFIX}/bin/${TARGET}-xml2-config --with-openssl=${PREFIX_NATIVE} --with-randomdev=/dev/urandom BUILD_CC=gcc"};
 : ${PKG_BIND_FNAME:=bind-${PKG_BIND_VERSION}.tar.gz};
 : ${PKG_CHICKEN_SHA256SUM:=e3dc2b8f95b6a3cd59c85b5bb6bdb2bd9cefc45b5d536a20cad74e3c63f4ad89};
 : ${PKG_CHICKEN_VERSION:=4.11.0};
diff --git a/vars/libxml2.vars b/vars/libxml2.vars
new file mode 100644
index 0000000..f326480
--- /dev/null
+++ b/vars/libxml2.vars
@@ -0,0 +1,20 @@
+#
+# . ./build.vars and set -o errexit -o noglob are assumed.
+#
+
+pkg_libxml2_install_post() {
+	if [ -e ${PREFIX}/bin/${TARGET}-xml2-config ]; then
+		build_fileop rm ${PREFIX}/bin/${TARGET}-xml2-config;
+	fi;
+	cat > ${PREFIX}/bin/${TARGET}-xml2-config <<EOF
+#!/bin/sh
+case "\${1}" in
+--cflags)	echo -I${PREFIX_NATIVE}/include/libxml2; ;;
+--libs)		echo -L${PREFIX_NATIVE}/lib -lxml2 -lz -llzma -lpthread -lm; ;;
+esac;
+EOF
+	chmod +x ${PREFIX}/bin/${TARGET}-xml2-config;
+
+};
+
+# vim:filetype=sh