Source: xpa
Version: 2.1.18-2
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

Hi Ole,

thank you for quickly fixing #871509. That made working on the package
much more joyful. It currently fails to cross build, because it
unconditionally runs the test suite and (expectedly) fails doing so
during cross compilation. After adding the relevant guards to the
override, the build continues and fails in ./mklib. It uses the wrong
compiler and passes flags not understood by cross compilers. I've come
up with a partially upstreamable patch. After applying it, xpa cross
builds successfully. Can you apply it?

Helmut
diff --minimal -Nru xpa-2.1.18/debian/changelog xpa-2.1.18/debian/changelog
--- xpa-2.1.18/debian/changelog 2017-08-09 13:32:17.000000000 +0200
+++ xpa-2.1.18/debian/changelog 2017-08-10 09:43:42.000000000 +0200
@@ -1,3 +1,12 @@
+xpa (2.1.18-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Support DEB_BUILD_OPTIONS=nocheck.
+    + cross.patch: Make ./mklib work with cross compilers.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Thu, 10 Aug 2017 09:43:42 +0200
+
 xpa (2.1.18-2) unstable; urgency=medium
 
   * Recognise the exit status of mklibs (Closes: #871509)
diff --minimal -Nru xpa-2.1.18/debian/patches/cross.patch 
xpa-2.1.18/debian/patches/cross.patch
--- xpa-2.1.18/debian/patches/cross.patch       1970-01-01 01:00:00.000000000 
+0100
+++ xpa-2.1.18/debian/patches/cross.patch       2017-08-10 09:43:42.000000000 
+0200
@@ -0,0 +1,74 @@
+From: Helmut Grohne <hel...@subdivi.de>
+Subject: make mklib work with cross compilation
+
+The first hunk makes it use the compiler discovered by ./configure and thus
+will work with cross compilers. Since Makefile.in exports CC and CXX, it seems
+like mklib should be picking these up and not doing so is an upstream bug.
+
+Then remove insertion of -m32, because this is not universally understood by
+cross compilers. On Debian, the provided compiler will always choose the
+correct ABI, so no -m32 or -m64 is necessary. This part likely is not
+upstreamable.
+
+Index: xpa-2.1.18/mklib
+===================================================================
+--- xpa-2.1.18.orig/mklib
++++ xpa-2.1.18/mklib
+@@ -211,9 +211,9 @@
+       if [ "x$LINK" = "x" ] ; then
+           # -linker was not specified so set default link command now
+             if [ $CPLUSPLUS = 1 ] ; then
+-                LINK=g++
++                LINK=${CXX:-g++}
+             else
+-                LINK=gcc
++                LINK=${CC:-gcc}
+             fi
+       fi
+ 
+@@ -228,14 +228,6 @@
+           ;;
+           esac
+ 
+-          # Check if objects are 32-bit and we're running in 64-bit
+-          # environment.  If so, pass -m32 flag to linker.
+-          set ${OBJECTS}
+-          ABI32=`file $1 | grep 32-bit`
+-          if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
+-              OPTS="-m32 ${OPTS}"
+-          fi
+-
+             if [ "${ALTOPTS}" ] ; then
+                 OPTS=${ALTOPTS}
+             fi
+@@ -281,13 +273,6 @@
+               # exptmp is removed below
+           fi
+ 
+-          # Check if objects are 32-bit and we're running in 64-bit
+-          # environment.  If so, pass -m32 flag to linker.
+-          set ${OBJECTS}
+-          ABI32=`file $1 | grep 32-bit`
+-          if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
+-              OPTS="-m32 ${OPTS}"
+-          fi
+             if [ "${ALTOPTS}" ] ; then
+                 OPTS=${ALTOPTS}
+             fi
+@@ -355,15 +340,7 @@
+               OPTS="-G"
+           else
+               # gcc linker
+-              # Check if objects are 32-bit and we're running in 64-bit
+-              # environment.  If so, pass -m32 flag to linker.
+-              set ${OBJECTS}
+-              ABI32=`file $1 | grep 32-bit`
+-              if [ "${ABI32}" ] ; then
+-                  OPTS="-m32 -shared -Wl,-Bdynamic"
+-              else
+-                  OPTS="-m64 -shared -Wl,-Bdynamic"
+-              fi
++              OPTS="-shared -Wl,-Bdynamic"
+           fi
+ 
+           # Check if objects are SPARC v9
diff --minimal -Nru xpa-2.1.18/debian/patches/series 
xpa-2.1.18/debian/patches/series
--- xpa-2.1.18/debian/patches/series    2017-08-09 13:30:54.000000000 +0200
+++ xpa-2.1.18/debian/patches/series    2017-08-10 09:43:42.000000000 +0200
@@ -5,3 +5,4 @@
 Add-hardening-flags.patch
 Sort-.o-files.patch
 Recognise-the-exit-status-of-mklibs.patch
+cross.patch
diff --minimal -Nru xpa-2.1.18/debian/rules xpa-2.1.18/debian/rules
--- xpa-2.1.18/debian/rules     2017-02-03 17:14:31.000000000 +0100
+++ xpa-2.1.18/debian/rules     2017-08-10 09:43:42.000000000 +0200
@@ -12,8 +12,10 @@
 override_dh_auto_build:
        dh_auto_build -- All tclxpa
 
+ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
 override_dh_auto_test:
        debian/tests/xpa_test_build
+endif
 
 override_dh_installchangelogs:
        dh_installchangelogs doc/changelog.html

Reply via email to