Bug#861422: fbreader FTCBFS: uses build architecture build tools

2017-04-29 Thread Eugene V. Lyubimkin
Hello Helmut,

On 28.04.2017 22:03, Helmut Grohne wrote:
> fbreader fails to cross build from source, because it uses build
> architecture build tools (g++, pkg-config) where host architecture ones
> should be used. Indirecting the $(MAKE) invocations through
> dh_auto_build supplies CC and CXX, but the build system has a nother
> copy of plain "g++" in LD, so that needs to be set as well. Furthermore,
> pkg-config invocations need to be prefixed as well. After applying the
> attached patch, fbreader successfully cross builds. Please consider
> applying it after stretch is released.

Thanks, the patch looks good. Feel free to ping me after Stretch if it blocks 
you for too long.


-- 
Eugene V. Lyubimkin aka JackYF
C++ GNU/Linux userspace developer, Debian Developer



Bug#861422: fbreader FTCBFS: uses build architecture build tools

2017-04-28 Thread Helmut Grohne
Source: fbreader
Version: 0.12.10dfsg2-2
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

fbreader fails to cross build from source, because it uses build
architecture build tools (g++, pkg-config) where host architecture ones
should be used. Indirecting the $(MAKE) invocations through
dh_auto_build supplies CC and CXX, but the build system has a nother
copy of plain "g++" in LD, so that needs to be set as well. Furthermore,
pkg-config invocations need to be prefixed as well. After applying the
attached patch, fbreader successfully cross builds. Please consider
applying it after stretch is released.

Helmut
diff -u fbreader-0.12.10dfsg2/debian/changelog 
fbreader-0.12.10dfsg2/debian/changelog
--- fbreader-0.12.10dfsg2/debian/changelog
+++ fbreader-0.12.10dfsg2/debian/changelog
@@ -1,3 +1,13 @@
+fbreader (0.12.10dfsg2-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
++ Let dh_auto_build pass cross compilers.
++ Also put cross compilers into LD.
++ Use a triplet-prefixed pkg-config.
+
+ -- Helmut Grohne   Fri, 28 Apr 2017 20:05:08 +0200
+
 fbreader (0.12.10dfsg2-2) unstable; urgency=medium
 
   * debian/patches:
diff -u fbreader-0.12.10dfsg2/debian/patches/series 
fbreader-0.12.10dfsg2/debian/patches/series
--- fbreader-0.12.10dfsg2/debian/patches/series
+++ fbreader-0.12.10dfsg2/debian/patches/series
@@ -1,3 +1,4 @@
+0011-cross.patch
 0001-110-use-sensible-browser.patch
 0002-400-fix-building-with-gcc46.patch
 0003-600-fix-ftell-crash.patch
diff -u fbreader-0.12.10dfsg2/debian/rules fbreader-0.12.10dfsg2/debian/rules
--- fbreader-0.12.10dfsg2/debian/rules
+++ fbreader-0.12.10dfsg2/debian/rules
@@ -6,20 +6,23 @@
 endif
 
 DPKG_EXPORT_BUILDFLAGS=1
+include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/buildflags.mk
 
 DEB_DIR = $(CURDIR)/debian
 
+export PKG_CONFIG=$(DEB_HOST_GNU_TYPE)-pkg-config
+AUXMAKEFLAGS += 'LD=$$(CXX)'
 
 %:
dh $@ --with quilt
 
 override_dh_auto_build:
-   $(MAKE) $(AUXMAKEFLAGS) -C zlibrary/core TARGET_ARCH=desktop 
UI_TYPE=dummy
-   $(MAKE) $(AUXMAKEFLAGS) -C zlibrary/text TARGET_ARCH=desktop 
UI_TYPE=dummy
-   $(MAKE) $(AUXMAKEFLAGS) -C zlibrary/ui TARGET_ARCH=desktop UI_TYPE=gtk
-   $(MAKE) $(AUXMAKEFLAGS) -C zlibrary/ui TARGET_ARCH=desktop UI_TYPE=qt4
-   $(MAKE) $(AUXMAKEFLAGS) -C fbreader TARGET_ARCH=desktop UI_TYPE=dummy
+   dh_auto_build -- $(AUXMAKEFLAGS) -C zlibrary/core TARGET_ARCH=desktop 
UI_TYPE=dummy
+   dh_auto_build -- $(AUXMAKEFLAGS) -C zlibrary/text TARGET_ARCH=desktop 
UI_TYPE=dummy
+   dh_auto_build -- $(AUXMAKEFLAGS) -C zlibrary/ui TARGET_ARCH=desktop 
UI_TYPE=gtk
+   dh_auto_build -- $(AUXMAKEFLAGS) -C zlibrary/ui TARGET_ARCH=desktop 
UI_TYPE=qt4
+   dh_auto_build -- $(AUXMAKEFLAGS) -C fbreader TARGET_ARCH=desktop 
UI_TYPE=dummy
 
 install-common:
$(MAKE) -C zlibrary/core TARGET_ARCH=desktop UI_TYPE=dummy 
DESTDIR=$(DEB_DIR)/tmp/zlcore do_install
only in patch2:
unchanged:
--- fbreader-0.12.10dfsg2.orig/debian/patches/0011-cross.patch
+++ fbreader-0.12.10dfsg2/debian/patches/0011-cross.patch
@@ -0,0 +1,33 @@
+From: Helmut Grohne 
+Subject: make pkg-config substitutable to add a triplet prefix
+
+Index: fbreader-0.12.10dfsg2/makefiles/arch/desktop.mk
+===
+--- fbreader-0.12.10dfsg2.orig/makefiles/arch/desktop.mk
 fbreader-0.12.10dfsg2/makefiles/arch/desktop.mk
+@@ -9,6 +9,7 @@
+ CC = gcc
+ AR = ar rsu
+ LD = g++
++PKG_CONFIG ?= pkg-config
+ 
+ CFLAGS = -pipe -fno-exceptions -Wall -Wno-ctor-dtor-privacy -W -DLIBICONV_PLUG
+ LDFLAGS =
+@@ -21,7 +22,7 @@
+   QTINCLUDE = -I /usr/include/qt4
+ endif
+ 
+-GTKINCLUDE = $(shell pkg-config --cflags gtk+-2.0 libpng xft)
++GTKINCLUDE = $(shell $(PKG_CONFIG) --cflags gtk+-2.0 libpng xft)
+ 
+ ifeq "$(UI_TYPE)" "qt"
+   UILIBS = -lqt-mt
+@@ -32,7 +33,7 @@
+ endif
+ 
+ ifeq "$(UI_TYPE)" "gtk"
+-  UILIBS = $(shell pkg-config --libs gtk+-2.0) -lpng -ljpeg
++  UILIBS = $(shell $(PKG_CONFIG) --libs gtk+-2.0) -lpng -ljpeg
+ endif
+ 
+ RM = rm -rvf