Source: swish-e
Version: 2.4.7-7.1
Tags: patch
User: [email protected]
Usertags: ftcbfs

swish-e fails to cross build from source, because the packaging does not
consider cross compilation and the way it performs the build manually
ends up building it for the build architecture. This manifests in three
areas:

1. Use of bare "gcc". For cross compilation, a triplet-prefixed tool
   should be used. An easy way to get the right one is including
   /usr/share/dpkg/buildtools.mk.
2. Failure to pass --build/--host flags to configure. The easiest way of
   doing so is using dh_auto_configure. That would mean refactoring
   debian/rules, so instead my patch suggests providing those flags
   explicitly.
3. Failure to export a cross PERL5LIB for building a Perl extension.
   Again dh_auto_configure would handle this automatically. Instead of
   refactoring debian/rules, my patch provides the variable explicitly.

Consider applying the attached patch and/or modernizing debian/rules.

Helmut
diff -Nru swish-e-2.4.7/debian/changelog swish-e-2.4.7/debian/changelog
--- swish-e-2.4.7/debian/changelog      2025-11-15 17:38:30.000000000 +0100
+++ swish-e-2.4.7/debian/changelog      2026-01-26 17:33:46.000000000 +0100
@@ -1,3 +1,13 @@
+swish-e (2.4.7-7.2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Let dpkg's buildtools.mk supply a triplet-prefixed CC.
+    + Pass --build/--host to configure.
+    + Export a cross PERL5LIB for Makefile.PL.
+
+ -- Helmut Grohne <[email protected]>  Mon, 26 Jan 2026 17:33:46 +0100
+
 swish-e (2.4.7-7.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru swish-e-2.4.7/debian/rules swish-e-2.4.7/debian/rules
--- swish-e-2.4.7/debian/rules  2025-01-01 12:50:35.000000000 +0100
+++ swish-e-2.4.7/debian/rules  2026-01-26 17:33:37.000000000 +0100
@@ -5,12 +5,20 @@
 
 
 DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/buildtools.mk
 include /usr/share/dpkg/buildflags.mk
 
 ifndef PERL
     PERL = /usr/bin/perl
 endif
 
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+PERLVER := $(shell $(PERL) -MConfig -e 'print $$Config{version}')
+PERL5LIB := /usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config-$(PERLVER)$(if 
$(PERL5LIB),:$(PERL5LIB))
+export PERL5LIB
+endif
+
 DEST=$(CURDIR)/debian/swish-e
 DOCDIR=$(DEST)/usr/share/doc/swish-e
 
@@ -35,12 +43,12 @@
 build.stamp:
        dh_testdir
        dh_update_autotools_config
-       env CC=gcc CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure 
--mandir=\$${prefix}/share/man --with-libxml2 --prefix=/usr
+       env CC='$(CC)' CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure 
--mandir=\$${prefix}/share/man --with-libxml2 --prefix=/usr 
--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
        $(MAKE)
        #$(MAKE) docs
        #(cd doc;$(MAKE) man)
        (chmod 755 swish-config;cd perl; env PATH=..:$$PATH SWISHSKIPTEST=1 
SWISHIGNOREVER=1 $(PERL) Makefile.PL INSTALLDIRS=vendor LDDLFLAGS="$(LDFLAGS) 
-shared" < /dev/null \
-               && $(MAKE) OPTIMIZE="$(CFLAGS) -I../src/" CC=gcc LD=gcc 
LD_RUN_PATH=)
+               && $(MAKE) OPTIMIZE="$(CFLAGS) -I../src/" CC='$(CC)' LD='$(CC)' 
LD_RUN_PATH=)
        > $@
 
 binary: binary-arch binary-indep

Reply via email to