Source: wit
Version: 3.01a-2
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

wit fails to cross build from source, because it builds for the build
architecture. Passing the PRE variable can make it use cross tools, but
that still doesn't fix architecture detection, which needs to be
overridden entirely. Please consider applying the attached patch to make
wit cross buildable.

Helmut
--- wit-3.01a/debian/changelog
+++ wit-3.01a/debian/changelog
@@ -1,3 +1,10 @@
+wit (3.01a-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Pass cross flags to makefile. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 15 Dec 2020 15:16:08 +0100
+
 wit (3.01a-2) unstable; urgency=medium
 
   [ Chris Lamb ]
--- wit-3.01a/debian/rules
+++ wit-3.01a/debian/rules
@@ -16,9 +16,29 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
+include /usr/share/dpkg/architecture.mk
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 
+CROSS_FLAGS =
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+CROSS_FLAGS += PRE=$(DEB_HOST_GNU_TYPE)-
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+CROSS_FLAGS += SYSTEM_LINUX=1
+ifeq ($(DEB_HOST_ARCH_CPU),amd64)
+CROSS_FLAGS += SYSTEM=x86_64
+else
+ifeq ($(DEB_HOST_ARCH_CPU),i386)
+CROSS_FLAGS += SYSTEM=i386
+else
+CROSS_FLAGS += SYSTEM=linux
+endif
+endif
+else
+CROSS_FLAGS += SYSTEM=unix
+endif
+endif
+
 # The Makefile doesn’t use CPPFLAGS
 export XDEF=$(shell dpkg-buildflags --get CPPFLAGS)
 
@@ -32,7 +52,7 @@
 
 override_dh_auto_build:
        # Build targetting /usr...
-       $(MAKE) INSTALL_PATH=/usr HAVE_ZLIB=1
+       $(MAKE) INSTALL_PATH=/usr HAVE_ZLIB=1 $(CROSS_FLAGS)
        $(MAKE) INSTALL_PATH=/usr doc
 
 override_dh_auto_install:

Reply via email to