Source: bind9
Version: 1:9.10.3.dfsg.P4-10.1
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

bind9 fails to cross build from source for lots of different reasons. It
starts out with trying to execute the host architecture python3 (which
is not installable as its postinst fails for too foreign architectures).
Then there are lots of fiddly things that go wrong in ./configure and
finally gost wasn't busted consistently leading to conflicting
declarations. Please consider applying the attached patch or taking
parts of it and requesting more information on why the rest is
necessary. You can test cross compiling bind9 in unstable with the
following sbuild invocation:

export ac_cv_file__dev_random=yes
sbuild -d sid --host=$DEB_HOST_ARCH --add-depends="libc-dev, libstdc++-dev" 
something.dsc

The environment variable is needed (with the patch) for linux, kfreebsd
and hurd and needs to be allowed in sbuild's environment_filter. It
should transition to whatever replaces dpkg-cross. The --add-depends is
necessary to work around #815172.

Helmut
diff --minimal -Nru bind9-9.10.3.dfsg.P4/debian/changelog 
bind9-9.10.3.dfsg.P4/debian/changelog
--- bind9-9.10.3.dfsg.P4/debian/changelog       2016-07-02 14:34:12.000000000 
+0200
+++ bind9-9.10.3.dfsg.P4/debian/changelog       2016-10-14 06:59:35.000000000 
+0200
@@ -1,3 +1,16 @@
+bind9 (1:9.10.3.dfsg.P4-10.2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Annotate python3 dependency with :any
+    + Let dh_auto_configure pass cross flags such as --host
+    + 80_cross.diff: Enable cross compiling without --random-dev
+    + Tell ./configure about openssl's features
+    + export BUILD_CC
+    + Consistently bust gost
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 14 Oct 2016 06:59:28 +0200
+
 bind9 (1:9.10.3.dfsg.P4-10.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --minimal -Nru bind9-9.10.3.dfsg.P4/debian/control 
bind9-9.10.3.dfsg.P4/debian/control
--- bind9-9.10.3.dfsg.P4/debian/control 2016-05-04 01:40:36.000000000 +0200
+++ bind9-9.10.3.dfsg.P4/debian/control 2016-10-14 06:59:26.000000000 +0200
@@ -14,7 +14,7 @@
   libcap2-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386],
   libgeoip-dev (>= 1.4.6.dfsg-5),
   dpkg-dev (>= 1.16.1~),
-  python3,
+  python3:any,
   dh-systemd,
   autotools-dev,
   dh-autoreconf
diff --minimal -Nru bind9-9.10.3.dfsg.P4/debian/patches/80_cross.diff 
bind9-9.10.3.dfsg.P4/debian/patches/80_cross.diff
--- bind9-9.10.3.dfsg.P4/debian/patches/80_cross.diff   1970-01-01 
01:00:00.000000000 +0100
+++ bind9-9.10.3.dfsg.P4/debian/patches/80_cross.diff   2016-10-14 
07:20:49.000000000 +0200
@@ -0,0 +1,24 @@
+From: Helmut Grohne <hel...@subdivi.de>
+Subject: improve configure's cross build support
+
+configure explicitly fails cross compilation when not passing --with-randomdev
+even though it could just continue. In the non-cross case, it uses
+AC_CHECK_FILE, which can be preseeded with a config cache. There is no reason
+to fail here.
+
+Index: bind9-9.10.3.dfsg.P4/configure.in
+===================================================================
+--- bind9-9.10.3.dfsg.P4.orig/configure.in
++++ bind9-9.10.3.dfsg.P4/configure.in
+@@ -1009,11 +1009,6 @@
+ 
+ case "$use_randomdev" in
+       unspec)
+-              case "$cross_compiling" in
+-              yes)
+-                      AC_MSG_RESULT(unspecified)
+-                      AC_MSG_ERROR([ need --with-randomdev=PATH or 
--with-randomdev=no])
+-              esac
+               case "$host" in
+                       *-openbsd*)
+                               devrandom=/dev/arandom
diff --minimal -Nru bind9-9.10.3.dfsg.P4/debian/patches/series 
bind9-9.10.3.dfsg.P4/debian/patches/series
--- bind9-9.10.3.dfsg.P4/debian/patches/series  2016-05-04 01:40:36.000000000 
+0200
+++ bind9-9.10.3.dfsg.P4/debian/patches/series  2016-10-14 07:16:46.000000000 
+0200
@@ -10,3 +10,4 @@
 34_prepare_native_pkcs11.diff
 70_precise_time.diff
 75_ctxstart_no_sighandling.diff
+80_cross.diff
diff --minimal -Nru bind9-9.10.3.dfsg.P4/debian/rules 
bind9-9.10.3.dfsg.P4/debian/rules
--- bind9-9.10.3.dfsg.P4/debian/rules   2016-05-04 01:40:36.000000000 +0200
+++ bind9-9.10.3.dfsg.P4/debian/rules   2016-10-14 07:49:37.000000000 +0200
@@ -27,6 +27,10 @@
 ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
 EXTRA_FEATURES=--disable-linux-caps --disable-threads
 endif
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+EXTRA_FEATURES += --with-ecdsa=yes --with-gost=yes
+export BUILD_CC ?= cc
+endif
 
 stamps/prepare:
        dh_testdir
@@ -40,7 +44,7 @@
        cp -r lib/dns lib/dns-pkcs11
        patch -p1 < debian/patches/extra-add_native_pkcs11.diff
        # disable GOST, can't use openssl with native pkcs11 anyway
-       sed -i 's/HAVE_OPENSSL_GOST/GOSTBUSTERS/' lib/dns-pkcs11/*.[ch]
+       sed -i 's/HAVE_OPENSSL_GOST/GOSTBUSTERS/' lib/dns-pkcs11/*.[ch] 
lib/dns/dst_gost.h
        dh_autotools-dev_updateconfig
        dh_autoreconf
        @mkdir -p stamps
@@ -50,10 +54,7 @@
        dh_testdir
        rm -rf build
        mkdir -p build
-       cd build && ../configure --prefix=/usr \
-               --mandir=\$${prefix}/share/man \
-               --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
-               --infodir=\$${prefix}/share/info \
+       dh_auto_configure --builddirectory=build -- \
                --sysconfdir=/etc/bind \
                --with-python=python3 \
                --localstatedir=/ \
@@ -80,8 +81,7 @@
        dh_testdir
        rm -rf build-udeb
        mkdir -p build-udeb
-       cd build-udeb && ../configure \
-               --prefix=/usr \
+       dh_auto_configure --builddirectory=build-udeb -- \
                --sysconfdir=/etc/bind \
                --with-python=python3 \
                --localstatedir=/ \

Reply via email to