Source: qepcad
Version: 1.74+ds-4
Tags: patch
User: [email protected]
Usertags: ftcbfs

qepcad fails to cross build from source, because it uses the build
architecture compiler. There are multiple causes at hand. For one thing,
it does not use dh_auto_build, which would have been passing CXX for the
makefile buildsystem. For another, the upstream build system does not
use the standard variable name CXX, but rather opts for CCo rendering
the use of dh_auto_build ineffective as a solution. Last, but not least
the upstream build system hard codes g++ in some places where it is not
substitutable by setting makefile variables. Beyond all of this,
debian/rules also hard codes the build architecture pkg-config. The
attached patch fixes all of the mentioned issues. Please consider
applying it.

Helmut
diff --minimal -Nru qepcad-1.74+ds/debian/changelog 
qepcad-1.74+ds/debian/changelog
--- qepcad-1.74+ds/debian/changelog     2023-08-24 13:10:46.000000000 +0200
+++ qepcad-1.74+ds/debian/changelog     2024-08-16 21:51:07.000000000 +0200
@@ -1,3 +1,10 @@
+qepcad (1.74+ds-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Use a cross toolchain. (Closes: #-1)
+
+ -- Helmut Grohne <[email protected]>  Fri, 16 Aug 2024 21:51:07 +0200
+
 qepcad (1.74+ds-4) unstable; urgency=medium
 
   * debian/clean
diff --minimal -Nru qepcad-1.74+ds/debian/patches/cross.patch 
qepcad-1.74+ds/debian/patches/cross.patch
--- qepcad-1.74+ds/debian/patches/cross.patch   1970-01-01 01:00:00.000000000 
+0100
+++ qepcad-1.74+ds/debian/patches/cross.patch   2024-08-16 21:51:07.000000000 
+0200
@@ -0,0 +1,33 @@
+--- qepcad-1.74+ds.orig/plot2d/Makefile
++++ qepcad-1.74+ds/plot2d/Makefile
+@@ -7,6 +7,8 @@
+ # your particular system.
+ ######################################################
+ 
++CCo = g++
++
+ ### X ##################################################
+ ifeq (${OSTYPE},solaris)
+ XLIBDIR = /usr/X11R6/lib
+@@ -34,4 +36,4 @@
+ 
+ ### MAKE THE PROGRAM! ##################################
+ plot: 
+-      g++ -O4 $(INCD) plot.cc -o ADJ2D_plot $(LIBS)
++      $(CCo) -O4 $(INCD) plot.cc -o ADJ2D_plot $(LIBS)
+--- qepcad-1.74+ds.orig/cad2d/Makefile
++++ qepcad-1.74+ds/cad2d/Makefile
+@@ -14,11 +14,11 @@
+ #      settings in a "make" that calls this recursively
+ # ======================================================
+ CCo        =  g++
+-linkCCo    =  g++
++linkCCo    =  $(CCo)
+ FLAGSo = -O4
+ 
+ CCd        =  g++
+-linkCCd    =  g++
++linkCCd    =  $(CCd)
+ FLAGSd = -g -DNO_SACLIB_MACROS
+ 
+ # ============================================================
diff --minimal -Nru qepcad-1.74+ds/debian/patches/series 
qepcad-1.74+ds/debian/patches/series
--- qepcad-1.74+ds/debian/patches/series        2021-12-17 03:13:36.000000000 
+0100
+++ qepcad-1.74+ds/debian/patches/series        2024-08-16 21:50:42.000000000 
+0200
@@ -12,3 +12,4 @@
 fix-typos.patch
 singular-path.patch
 signed-char-eof.patch
+cross.patch
diff --minimal -Nru qepcad-1.74+ds/debian/rules qepcad-1.74+ds/debian/rules
--- qepcad-1.74+ds/debian/rules 2022-08-03 14:41:26.000000000 +0200
+++ qepcad-1.74+ds/debian/rules 2024-08-16 21:50:38.000000000 +0200
@@ -1,10 +1,13 @@
 #!/usr/bin/make -f
 
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all optimize=-lto
+
+include /usr/share/dpkg/buildtools.mk
+
 export qe := $(CURDIR)
 export saclib := $(CURDIR)
 export SPECLFLAGS := $(LDFLAGS)
-FLAGS := "$(CPPFLAGS) $(shell pkg-config saclib --cflags) $(CXXFLAGS)"
+FLAGS := "$(CPPFLAGS) $(shell $(PKG_CONFIG) saclib --cflags) $(CXXFLAGS)"
 
 %:
        dh $@
@@ -15,7 +18,7 @@
 # so dynamic linking won't work
        mkdir -p lib
        ln -s /usr/lib/$(DEB_HOST_MULTIARCH)/libsaclib.a lib/saclibo.a
-       $(MAKE) opt FLAGSo=$(FLAGS)
-       $(MAKE) -C cad2d opt FLAGSo=$(FLAGS)
-       $(MAKE) -C plot2d INCD="$(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)"
+       $(MAKE) opt CCo='$(CXX)' FLAGSo=$(FLAGS)
+       $(MAKE) -C cad2d opt CCo='$(CXX)' FLAGSo=$(FLAGS)
+       $(MAKE) -C plot2d CCo='$(CXX)' INCD="$(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)"
        rm -rf lib

Reply via email to