Source: gpw
Version: 0.0.19940601-9
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

gpw fails to cross build from source, because it uses the build
architecture compiler. Fixing that is not that simple. The program
loadtris is only run during build and not installed. As such it actually
needs to use the build architecture compiler. More precisely, the
makefile needs to handle two compilers. The attached patch implements
that and makes gpw cross build. Please consider applying the attached
patch.

Helmut
diff --minimal -Nru gpw-0.0.19940601/debian/changelog 
gpw-0.0.19940601/debian/changelog
--- gpw-0.0.19940601/debian/changelog   2016-03-06 13:18:53.000000000 +0100
+++ gpw-0.0.19940601/debian/changelog   2018-06-06 19:26:29.000000000 +0200
@@ -1,3 +1,13 @@
+gpw (0.0.19940601-9.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: use a build architecture compiler for loadtris
+    + Let dh_auto_build pass cross compilers to make.
+    + export CC_FOR_BUILD
+
+ -- Helmut Grohne <hel...@subdivi.de>  Wed, 06 Jun 2018 19:26:29 +0200
+
 gpw (0.0.19940601-9) unstable; urgency=medium
 
   * Package revamped for current times.
diff --minimal -Nru gpw-0.0.19940601/debian/patches/cross.patch 
gpw-0.0.19940601/debian/patches/cross.patch
--- gpw-0.0.19940601/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 
+0100
+++ gpw-0.0.19940601/debian/patches/cross.patch 2018-06-06 19:26:29.000000000 
+0200
@@ -0,0 +1,23 @@
+--- gpw-0.0.19940601.orig/Makefile.Debian
++++ gpw-0.0.19940601/Makefile.Debian
+@@ -6,6 +6,7 @@
+ 
+ DEBUGARGS = -g 
+ COMPILER = $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
++CC_FOR_BUILD ?= $(CC)
+ 
+ # Edited for Debian GNU/Linux
+ DESTDIR=
+@@ -24,10 +25,10 @@
+       $(COMPILER) $(DEBUGARGS) -o gpw.o -c gpw.c
+ 
+ loadtris : loadtris.o
+-      $(COMPILER) $(DEBUGARGS) -o loadtris loadtris.o
++      $(CC_FOR_BUILD) $(DEBUGARGS) -o loadtris loadtris.o
+ 
+ loadtris.o : loadtris.c
+-      $(COMPILER) $(DEBUGARGS) -o loadtris.o -c loadtris.c
++      $(CC_FOR_BUILD) $(DEBUGARGS) -o loadtris.o -c loadtris.c
+ 
+ clean : 
+       rm -f gpw loadtris loadtris.o gpw.o trigram.h
diff --minimal -Nru gpw-0.0.19940601/debian/patches/series 
gpw-0.0.19940601/debian/patches/series
--- gpw-0.0.19940601/debian/patches/series      2016-03-06 13:08:22.000000000 
+0100
+++ gpw-0.0.19940601/debian/patches/series      2018-06-06 19:26:29.000000000 
+0200
@@ -1,2 +1,3 @@
 makefile
 loadtris
+cross.patch
diff --minimal -Nru gpw-0.0.19940601/debian/rules gpw-0.0.19940601/debian/rules
--- gpw-0.0.19940601/debian/rules       2016-03-06 12:09:16.000000000 +0100
+++ gpw-0.0.19940601/debian/rules       2018-06-06 19:26:29.000000000 +0200
@@ -11,6 +11,9 @@
 # package maintainers to append LDFLAGS
 #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
+-include /usr/share/dpkg/buildtools.mk
+export CC_FOR_BUILD ?= cc
+
 
 %:
        dh $@ 
@@ -21,7 +24,7 @@
        $(MAKE) -f Makefile.Debian clean
 
 override_dh_auto_build:
-       $(MAKE) -f Makefile.Debian
+       dh_auto_build -- -f Makefile.Debian
 
 override_dh_auto_install:
        $(MAKE) -f Makefile.Debian install DESTDIR=debian/gpw

Reply via email to