Source: botan
Version: 2.17.3+dfsg-2
Tags: patch
User: [email protected]
Usertags: cross-satisfiability ftcbfs

botan cannot be cross built from source for a number of reasons. For
starters, it build depends on python3-all-dev, which means that it
requires a host architecture python interpreter, which cannot be
installed. It really needs python for running configure.py, so the
development files are entirely unused. python3-all is more than
sufficient. Beyond that, it doesn't need all python interpreters, just
one. So we can further reduce that to just python3. And then it can be
annotated :any to get a build architecture one.

At that point, a cross build can be attempted. Given that botan uses an
idiosyncratic build system, it is not covered by debhelper. A look into
the documentation reveals that one should pass --cpu, --os, --cc-bin and
--ar-command.

And then it fails running tests despite DEB_BUILD_OPTIONS containing
nocheck. Unless bumped to compat level 13 or higher, the override needs
to be conditionalized.

The attached patch fixes all of that. Please consider applying it.

Helmut
diff --minimal -Nru botan-2.17.3+dfsg/debian/changelog 
botan-2.17.3+dfsg/debian/changelog
--- botan-2.17.3+dfsg/debian/changelog  2021-02-18 19:22:10.000000000 +0100
+++ botan-2.17.3+dfsg/debian/changelog  2021-03-06 20:38:25.000000000 +0100
@@ -1,3 +1,13 @@
+botan (2.17.3+dfsg-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Reduce Build-Depends: python3-all-dev to python3:any.
+    + Pass the right flags to ./configure.py.
+    + Honour DEB_BUILD_OPTIONS=nocheck.
+
+ -- Helmut Grohne <[email protected]>  Sat, 06 Mar 2021 20:38:25 +0100
+
 botan (2.17.3+dfsg-2) unstable; urgency=medium
 
   * Update watch file.
diff --minimal -Nru botan-2.17.3+dfsg/debian/control 
botan-2.17.3+dfsg/debian/control
--- botan-2.17.3+dfsg/debian/control    2021-02-18 19:22:10.000000000 +0100
+++ botan-2.17.3+dfsg/debian/control    2021-03-06 20:38:25.000000000 +0100
@@ -11,7 +11,7 @@
  libsqlite3-dev,
  libtspi-dev,
  zlib1g-dev,
- python3-all-dev,
+ python3:any,
  python3-docutils,
 Build-Depends-Indep:
  python3-sphinx,
diff --minimal -Nru botan-2.17.3+dfsg/debian/rules 
botan-2.17.3+dfsg/debian/rules
--- botan-2.17.3+dfsg/debian/rules      2019-07-16 01:40:14.000000000 +0200
+++ botan-2.17.3+dfsg/debian/rules      2021-03-06 20:38:25.000000000 +0100
@@ -5,16 +5,38 @@
 #export DH_VERBOSE=1
 
 include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/buildtools.mk
 
 DEVPKG = $(CURDIR)/debian/libbotan-2-dev
 DOCPKG = $(CURDIR)/debian/libbotan-2-doc
 
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+OS_MAP_hurd = gnu
+OS_MAP_kfreebsd = gnu/kfreebsd
+CROSS_FLAGS += --os=$(or $(OS_MAP_$(DEB_HOST_ARCH_OS)),$(DEB_HOST_ARCH_OS))
+CPU_MAP_aarch64 = arm64
+CPU_MAP_arm = arm32
+CPU_MAP_i686 = x86_32
+CPU_MAP_mips64el = mips64
+CPU_MAP_mips = mips32
+CPU_MAP_mipsel = mips32
+CPU_MAP_powerpc = ppc32
+CPU_MAP_powerp64 = ppc64
+CPU_MAP_powerpc64le = ppc64
+CPU_MAP_sh4 = superh
+ifeq (,$(filter $(DEB_HOST_ARCH),armhf hurd-i386))
+CROSS_FLAGS +=--cpu=$(or $(CPU_MAP_$(DEB_HOST_GNU_CPU)),$(DEB_HOST_GNU_CPU))
+endif
+CROSS_FLAGS += --cc-bin=$(CXX) --ar-command=$(AR)
+endif
+
 override_dh_clean:
        dh_clean
        rm -f $(CURDIR)/Certificate\ Store*.db
 
 override_dh_auto_configure:
        $(CURDIR)/configure.py \
+               $(CROSS_FLAGS) \
                --prefix=/usr/ \
                --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
                $(if $(filter $(DEB_HOST_ARCH), armel armhf),--disable-neon) \
@@ -31,7 +53,9 @@
                --distribution-info=$(shell dpkg-vendor --query Vendor)
 
 override_dh_auto_test:
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
        LD_LIBRARY_PATH=. $(CURDIR)/botan-test
+endif
 
 override_dh_install-arch:
        dh_install -a

Reply via email to