Bug#1077674: spacenavd FTCBFS: builds for the build architecture

Helmut Grohne helmut at subdivi.de
Tue Jul 30 14:13:59 BST 2024


Source: spacenavd
Version: 1.2-3
Tags: patch upstream
User: debian-cross at lists.debian.org
Usertags: ftcbfs

spacenavd fails to cross build from source, because it hard codes the
build architecture compiler. It comes with a configure script. The most
common way to communicate the architecture to a configure script is the
--host option, but this configure script does not understand this
option.

I propose doing something weaker. The configure script could consume a
CC environment variable or a --cc=... flag and use that value as
compiler. Then, it also has to write it to the generated Makefile. Once
doing so (and instructing debian/rules to pass a useful value),
spacenavd just cross builds. Please propose this patch upstream as it
will also benefit building spacenavd on other cross distributions such
as Yocto or PtxDist.

Helmut
-------------- next part --------------
diff --minimal -Nru spacenavd-1.2/debian/changelog spacenavd-1.2/debian/changelog
--- spacenavd-1.2/debian/changelog	2024-06-02 04:56:00.000000000 +0200
+++ spacenavd-1.2/debian/changelog	2024-07-30 15:01:02.000000000 +0200
@@ -1,3 +1,10 @@
+spacenavd (1.2-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Allow passing a compiler to configure. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 30 Jul 2024 15:01:02 +0200
+
 spacenavd (1.2-3) unstable; urgency=medium
 
   * Team upload.
diff --minimal -Nru spacenavd-1.2/debian/patches/cross.patch spacenavd-1.2/debian/patches/cross.patch
--- spacenavd-1.2/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ spacenavd-1.2/debian/patches/cross.patch	2024-07-30 15:01:02.000000000 +0200
@@ -0,0 +1,47 @@
+--- spacenavd-1.2.orig/Makefile.in
++++ spacenavd-1.2/Makefile.in
+@@ -7,7 +7,6 @@
+ 
+ warn = -pedantic -Wall
+ 
+-CC ?= gcc
+ CFLAGS = $(warn) $(dbg) $(opt) -fno-strict-aliasing -fcommon \
+ 		 -I$(srcdir)/src -I/usr/local/include -MMD $(add_cflags) \
+ 		 `dpkg-buildflags --get CFLAGS` `dpkg-buildflags --get CPPFLAGS`
+--- spacenavd-1.2.orig/configure
++++ spacenavd-1.2/configure
+@@ -28,7 +28,7 @@
+ check_header() {
+ 	printf "Looking for header: $1 ... " >&2
+ 	echo "#include <$1>" >.chkhdr.c
+-	if cpp -I/usr/local/include .chkhdr.c >/dev/null 2>&1; then
++	if $CC -E -I/usr/local/include .chkhdr.c >/dev/null 2>&1; then
+ 		echo found >&2
+ 		echo "#define HAVE_`basename $1 | tr '[:lower:]' '[:upper:]' | sed 's/\./_/g'`"
+ 	else
+@@ -46,6 +46,7 @@
+ XINPUT=yes
+ VER=1.2
+ CFGDIR=/etc
++: "${CC:=gcc}"
+ 
+ if [ -z "$VER" ]; then
+ 	VER=`git rev-parse --short HEAD`
+@@ -88,6 +89,9 @@
+ 		value=`echo $arg | sed 's/--cfgdir=//'`
+ 		CFGDIR=${value:-$cfgdir}
+ 		;;
++	--cc=*)
++		CC=${arg#--cc=}
++		;;
+ 	
+ 	--enable-opt)
+ 		OPT=yes;;
+@@ -159,6 +163,7 @@
+ echo "PREFIX = $PREFIX" >Makefile
+ echo "srcdir = $srcdir" >>Makefile
+ echo "ver = $VER" >>Makefile
++echo "CC = $CC" >>Makefile
+ 
+ if [ "$DBG" = 'yes' ]; then
+ 	echo 'dbg = -g' >>Makefile
diff --minimal -Nru spacenavd-1.2/debian/patches/series spacenavd-1.2/debian/patches/series
--- spacenavd-1.2/debian/patches/series	2024-06-02 04:55:47.000000000 +0200
+++ spacenavd-1.2/debian/patches/series	2024-07-30 14:57:59.000000000 +0200
@@ -2,3 +2,4 @@
 0002-Use-run-instead-of-var-run.patch
 0003-Sort-object-files-for-deterministic-linking.patch
 0004-Do-not-use-time-field-of-input_event.patch
+cross.patch
diff --minimal -Nru spacenavd-1.2/debian/rules spacenavd-1.2/debian/rules
--- spacenavd-1.2/debian/rules	2024-06-01 18:44:25.000000000 +0200
+++ spacenavd-1.2/debian/rules	2024-07-30 15:01:02.000000000 +0200
@@ -5,6 +5,8 @@
 #export DH_VERBOSE=1
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+DPKG_EXPORT_BUILDTOOLS = 1
+include /usr/share/dpkg/buildtools.mk
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
 


More information about the debian-science-maintainers mailing list