Source: openctm
Version: 1.0.3+dfsg1-2.1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

openctm fails to cross build from source, because it builds for the
build architecture. Using dh_auto_build partially fixes that, but the
upstream build system hard codes build architecture build tools in a few
occasions. Even then, it fails running bin2c, because it needs to be run
during build and thus built using the build architecture compiler.
Please consider applying the attached patch to fix all of the aspects.

Helmut
diff --minimal -Nru openctm-1.0.3+dfsg1/debian/changelog 
openctm-1.0.3+dfsg1/debian/changelog
--- openctm-1.0.3+dfsg1/debian/changelog        2019-12-19 00:54:01.000000000 
+0100
+++ openctm-1.0.3+dfsg1/debian/changelog        2020-01-02 20:25:47.000000000 
+0100
@@ -1,3 +1,13 @@
+openctm (1.0.3+dfsg1-2.2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: Make build tools substitutable.
+    + Let dh_auto_build pass cross tools to make.
+    + Build the build tool "bin2c" for the build architecture.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Thu, 02 Jan 2020 20:25:47 +0100
+
 openctm (1.0.3+dfsg1-2.1) unstable; urgency=low
 
   * Non-maintainer upload.
diff --minimal -Nru openctm-1.0.3+dfsg1/debian/patches/cross.patch 
openctm-1.0.3+dfsg1/debian/patches/cross.patch
--- openctm-1.0.3+dfsg1/debian/patches/cross.patch      1970-01-01 
01:00:00.000000000 +0100
+++ openctm-1.0.3+dfsg1/debian/patches/cross.patch      2020-01-02 
20:25:47.000000000 +0100
@@ -0,0 +1,32 @@
+--- openctm-1.0.3+dfsg1.orig/lib/Makefile.linux
++++ openctm-1.0.3+dfsg1/lib/Makefile.linux
+@@ -72,7 +72,7 @@
+       $(RM) $(DYNAMICLIB) $(SONAME) $(LIBNAME) $(OBJS) $(LZMA_OBJS)
+ 
+ $(DYNAMICLIB): $(OBJS) $(LZMA_OBJS)
+-      gcc $(LDFLAGS) -shared -s -Wl,-soname,$(SONAME) -o $@ $(OBJS) 
$(LZMA_OBJS) -lm
++      $(CC) $(LDFLAGS) -shared -s -Wl,-soname,$(SONAME) -o $@ $(OBJS) 
$(LZMA_OBJS) -lm
+       ln -s $(DYNAMICLIB) $(SONAME)
+       ln -s $(DYNAMICLIB) $(LIBNAME)
+ 
+--- openctm-1.0.3+dfsg1.orig/tools/Makefile.linux
++++ openctm-1.0.3+dfsg1/tools/Makefile.linux
+@@ -38,7 +38,8 @@
+ #PNGLITEDIR = pnglite
+ 
+ CXX = g++
+-CXXFLAGS += -W -Wall `pkg-config --cflags gtk+-2.0` -I$(OPENCTMDIR) 
-I$(RPLYDIR) -I$(GLEWDIR)
++PKG_CONFIG ?= pkg-config
++CXXFLAGS += -W -Wall `$(PKG_CONFIG) --cflags gtk+-2.0` -I$(OPENCTMDIR) 
-I$(RPLYDIR) -I$(GLEWDIR)
+ 
+ MESHOBJS = mesh.o meshio.o ctm.o ply.o rply.o stl.o 3ds.o dae.o obj.o lwo.o 
off.o wrl.o
+ CTMCONVOBJS = ctmconv.o common.o systimer.o convoptions.o $(MESHOBJS)
+@@ -109,7 +110,7 @@
+ #     gcc -c -Os -W -I$(GLEWDIR) -o $@ $<
+ 
+ rply.o: $(RPLYDIR)/rply.c
+-      gcc $(CPPFLAGS) $(CFLAGS) -c -O2 -W -I$(RPLYDIR) -o $@ $<
++      $(CC) $(CPPFLAGS) $(CFLAGS) -c -O2 -W -I$(RPLYDIR) -o $@ $<
+ 
+ #pnglite.o: $(PNGLITEDIR)/pnglite.c
+ #     gcc -c -O2 -W -I$(PNGLITEDIR) -o $@ $<
diff --minimal -Nru openctm-1.0.3+dfsg1/debian/patches/series 
openctm-1.0.3+dfsg1/debian/patches/series
--- openctm-1.0.3+dfsg1/debian/patches/series   2018-03-24 18:01:59.000000000 
+0100
+++ openctm-1.0.3+dfsg1/debian/patches/series   2020-01-02 20:25:47.000000000 
+0100
@@ -1,2 +1,3 @@
 makefiles
 escape-hyphens-in-man
+cross.patch
diff --minimal -Nru openctm-1.0.3+dfsg1/debian/rules 
openctm-1.0.3+dfsg1/debian/rules
--- openctm-1.0.3+dfsg1/debian/rules    2019-12-19 00:51:25.000000000 +0100
+++ openctm-1.0.3+dfsg1/debian/rules    2020-01-02 20:25:47.000000000 +0100
@@ -3,7 +3,7 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+include /usr/share/dpkg/architecture.mk
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk
@@ -25,6 +25,10 @@
        rm -rf $(TDIR)/tools/zlib
        tar -jcf openctm_$(DEBVERSION).orig.tar.bz2 $(TDIR)
 
+override_dh_auto_build:
+       dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_build 
--buildsystem=makefile --sourcedirectory=tools -- -f Makefile.linux bin2c
+       dh_auto_build
+
 override_dh_compress:
        dh_compress -X.pdf
 

Reply via email to