From 44ba72df9c1291b8f6d4dc04f6a4a11175e17f12 Mon Sep 17 00:00:00 2001
From: Laurent Bigonville <bigon@bigon.be>
Date: Mon, 7 Jan 2008 04:13:01 +0100
Subject: [PATCH] Add idnkit support (Closes: #459009 #459010)

---
 debian/control             |   13 +++++++++++++
 debian/libbind-dev.files   |    4 ++--
 debian/libidnkit-dev.files |    7 +++++++
 debian/libidnkit1.files    |    4 ++++
 debian/rules               |   25 ++++++++++++++++++++-----
 5 files changed, 46 insertions(+), 7 deletions(-)
 create mode 100644 debian/libidnkit-dev.files
 create mode 100644 debian/libidnkit1.files
 mode change 100644 => 100755 debian/rules

diff --git a/debian/control b/debian/control
index c44a7e3..5069493 100644
--- a/debian/control
+++ b/debian/control
@@ -155,3 +155,16 @@ Description: Lightweight Resolver Daemon
  down, caching-only name server that answers queries using the BIND 9
  lightweight resolver protocol rather than the DNS protocol.
 
+Package: libidnkit1
+Architecture: any
+Section: libs
+Depends: ${shlibs:Depends}
+Description: Blah
+ Blah blah
+
+Package: libidnkit-dev
+Architecture: any
+Section: libdevel
+Depends: ${shlibs:Depends}
+Description: Blah
+ Blah blah
diff --git a/debian/libbind-dev.files b/debian/libbind-dev.files
index 3f027df..762f70d 100644
--- a/debian/libbind-dev.files
+++ b/debian/libbind-dev.files
@@ -1,4 +1,4 @@
-usr/include
+usr/include/{bind9,dns,dst,isc,isccc,isccfg,lwres}
 usr/lib/libbind9.a
 usr/lib/libbind9.la
 usr/lib/libbind9.so
@@ -17,5 +17,5 @@ usr/lib/libisccc.so
 usr/lib/libisccfg.a
 usr/lib/libisccfg.la
 usr/lib/libisccfg.so
-usr/share/man/man3
+usr/share/man/man3/lwres*
 usr/bin/isc-config.sh
diff --git a/debian/libidnkit-dev.files b/debian/libidnkit-dev.files
new file mode 100644
index 0000000..9af5994
--- /dev/null
+++ b/debian/libidnkit-dev.files
@@ -0,0 +1,7 @@
+usr/lib/libidnkit.so
+usr/lib/libidnkit.a
+usr/include/idn/*
+usr/share/man/man3/libidnkit.3
+usr/share/man/man5/idnrc.5
+usr/share/man/man5/idn.conf.5
+usr/share/man/man5/idnalias.conf.5
diff --git a/debian/libidnkit1.files b/debian/libidnkit1.files
new file mode 100644
index 0000000..34a6c30
--- /dev/null
+++ b/debian/libidnkit1.files
@@ -0,0 +1,4 @@
+usr/lib/libidnkit.so.*
+etc/idnalias.conf
+etc/idn.conf
+usr/share/idnkit/*
diff --git a/debian/rules b/debian/rules
old mode 100644
new mode 100755
index 9136cc1..efdffd5
--- a/debian/rules
+++ b/debian/rules
@@ -20,7 +20,7 @@ export arch = $(DEB_HOST_ARCH)
 export CFLAGS=-fno-strict-aliasing
 
 configure: configure-stamp
-configure-stamp:
+configure-stamp: idnkit
 	dh_testdir
 	./configure --prefix=/usr \
 		--mandir=\$${prefix}/share/man \
@@ -34,7 +34,8 @@ configure-stamp:
 		--with-openssl=/usr \
 		--with-gssapi=/usr \
 		--with-gnu-ld \
-		--enable-ipv6
+		--enable-ipv6 \
+		--with-idn=`pwd`/debian/bind9/usr
 	touch configure-stamp
 
 build: configure-stamp build-stamp
@@ -55,15 +56,16 @@ clean:
 	dh_testdir
 	dh_testroot
 	-$(MAKE) distclean
+	-$(MAKE) -C contrib/idn/idnkit-1.0-src distclean
 	find . -name \*.o -exec rm {} \;
-	rm -f build-stamp configure-stamp
+	rm -f build-stamp configure-stamp idnkit-stamp
 	dh_clean
 
 ETCBIND=debian/bind9/etc/bind
 install: build
 	dh_testdir
 	dh_testroot
-	dh_clean -k
+#	dh_clean -k
 	dh_installdirs
 	$(MAKE) install DESTDIR=`pwd`/debian/bind9
 	install -c -o bin -g bin -m 444 debian/db.0 ${ETCBIND}/db.0
@@ -114,13 +116,15 @@ binary-arch: build install
 	dh_movefiles --sourcedir=debian/bind9 -a
 	( cd debian/bind9/usr ; rm -fr bin include lib )
 	rm -rf debian/bind9/usr/share/man/man[13]
+	rm -rf debian/bind9/usr/share/idnkit
+	rm -f debian/bind9/etc/*.sample
 	dh_link -a
 	dh_strip -a
 	dh_compress -a
 	dh_fixperms -a
 	dh_makeshlibs -a
 	dh_installdeb -a
-	dh_shlibdeps -l"debian/libbind9-40/usr/lib:debian/libdns40/usr/lib:debian/libisc40/usr/lib:debian/libisccc40/usr/lib:debian/libisccfg40/usr/lib:debian/liblwres40/usr/lib:/usr/lib/libfakeroot" -a
+	dh_shlibdeps -l"debian/libbind9-40/usr/lib:debian/libdns40/usr/lib:debian/libisc40/usr/lib:debian/libisccc40/usr/lib:debian/libisccfg40/usr/lib:debian/liblwres40/usr/lib:/usr/lib/libfakeroot:debian/libidnkit1/usr/lib" -a
 	for i in $$(sed -n '/^Package:/s/^.* //p' debian/control); do cat debian/vars.in >> debian/$$i.substvars; done
 	cat debian/vars.in >> debian/substvars
 	dh_gencontrol -a
@@ -128,4 +132,15 @@ binary-arch: build install
 	dh_builddeb -a
 
 binary: binary-indep binary-arch
+
+idnkit: idnkit-stamp
+idnkit-stamp:
+	CURDIR=`pwd`
+	cd contrib/idn/idnkit-1.0-src/ && ./configure --prefix=/usr \
+	            --mandir=\$${prefix}/share/man \
+	            --infodir=\$${prefix}/share/info \
+	            --sysconfdir=/etc
+	cd contrib/idn/idnkit-1.0-src/ && $(MAKE) 
+	cd contrib/idn/idnkit-1.0-src/ && $(MAKE) install DESTDIR=$(CURDIR)/debian/bind9
+	touch idnkit-stamp
 .PHONY: build clean binary-indep binary-arch binary install configure
-- 
1.5.3.7


