Source: lshw
Version: 02.18-0.1
Tags: patch
User: [email protected]
Usertags: rebootstrap

lshw fails to cross build from source, because it uses build
architecture tools (gcc, g++, pkg-config) throughout the build. The
attached patch makes it use triplet-prefixed versions of them and with
it applied, a cross build succeeds. Please consider applying the patch.

Helmut
diff -u lshw-02.18/debian/changelog lshw-02.18/debian/changelog
--- lshw-02.18/debian/changelog
+++ lshw-02.18/debian/changelog
@@ -1,3 +1,13 @@
+lshw (02.18-0.2) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Closes: #-1.
+    + Pass triplet-prefixed CC and CXX to make.
+    + cross.patch: Make pkg-config substitutable.
+    + Use triplet-prefixed pkg-config.
+
+ -- Helmut Grohne <[email protected]>  Sat, 01 Oct 2016 15:36:21 +0200
+
 lshw (02.18-0.1) unstable; urgency=medium
 
   * Non-maintainer upload with permission of the maintainer.
diff -u lshw-02.18/debian/patches/series lshw-02.18/debian/patches/series
--- lshw-02.18/debian/patches/series
+++ lshw-02.18/debian/patches/series
@@ -13,0 +14 @@
+cross.patch
diff -u lshw-02.18/debian/rules lshw-02.18/debian/rules
--- lshw-02.18/debian/rules
+++ lshw-02.18/debian/rules
@@ -9,6 +9,14 @@
 #export DH_COMPAT=4
 
 include /usr/share/quilt/quilt.make
+include /usr/share/dpkg/architecture.mk
+ifeq ($(origin CC),default)
+CC = $(DEB_HOST_GNU_TYPE)-gcc
+endif
+ifeq ($(origin CXX),default)
+CXX = $(DEB_HOST_GNU_TYPE)-g++
+endif
+export PKG_CONFIG = $(DEB_HOST_GNU_TYPE)-pkg-config
 
 CXX_DEB_FLAGS = -Wall -g
 
@@ -43,8 +51,8 @@
        dh_testdir
 
        # Add here commands to compile the package.
-       $(MAKE) -C $(srcdir) core
-       $(MAKE) -C $(srcdir) gui
+       $(MAKE) -C $(srcdir) core CC="$(CC)" CXX="$(CXX)"
+       $(MAKE) -C $(srcdir) gui CC="$(CC)" CXX="$(CXX)"
        #/usr/bin/docbook-to-man debian/lshw.sgml > lshw.1
        touch build-stamp
 
@@ -65,8 +73,8 @@
        dh_installdirs
 
        # Add here commands to install the package into debian/lshw.
-       $(MAKE) -C $(srcdir) install DESTDIR=$(CURDIR)/debian/lshw
-       $(MAKE) -C $(srcdir) install-gui DESTDIR=$(CURDIR)/debian/lshw-gtk
+       $(MAKE) -C $(srcdir) install DESTDIR=$(CURDIR)/debian/lshw CC="$(CC)" 
CXX="$(CXX)"
+       $(MAKE) -C $(srcdir) install-gui DESTDIR=$(CURDIR)/debian/lshw-gtk 
CC="$(CC)" CXX="$(CXX)"
 
        # data files supplied by pciutils and usbutils
        rm -rf $(CURDIR)/debian/lshw/usr/share/lshw
only in patch2:
unchanged:
--- lshw-02.18.orig/debian/patches/cross.patch
+++ lshw-02.18/debian/patches/cross.patch
@@ -0,0 +1,56 @@
+From: Helmut Grohne <[email protected]>
+Subject: make pkg-config subtitutable
+
+Index: lshw-02.18/lshw-B.02.18/src/Makefile
+===================================================================
+--- lshw-02.18.orig/lshw-B.02.18/src/Makefile
++++ lshw-02.18/lshw-B.02.18/src/Makefile
+@@ -19,12 +19,13 @@
+ export SQLITE
+ 
+ CXX?=c++
++PKG_CONFIG ?= pkg-config
+ INCLUDES=-I./core/
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" 
-DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
+ #CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
+ CXXFLAGS=$(CXX_DEB_FLAGS) $(INCLUDES) $(DEFINES) 
+ ifeq ($(SQLITE), 1)
+-      CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3)
++      CXXFLAGS+= -DSQLITE $(shell $(PKG_CONFIG) --cflags sqlite3)
+ endif
+ #LDFLAGS=-L./core/ -g
+ LDFLAGS=-L./core/
+@@ -34,7 +35,7 @@
+ LDSTATIC=-static
+ LIBS=-llshw -lresolv
+ ifeq ($(SQLITE), 1)
+-      LIBS+= $(shell pkg-config --libs sqlite3)
++      LIBS+= $(shell $(PKG_CONFIG) --libs sqlite3)
+ endif
+ 
+ export CXXFLAGS
+Index: lshw-02.18/lshw-B.02.18/src/gui/Makefile
+===================================================================
+--- lshw-02.18.orig/lshw-B.02.18/src/gui/Makefile
++++ lshw-02.18/lshw-B.02.18/src/gui/Makefile
+@@ -1,17 +1,18 @@
+ PACKAGENAME?=lshw
+ 
+ CXX?=c++
++PKG_CONFIG ?= pkg-config
+ CC?=cc
+ STRIP?=strip
+ OBJCOPY?=objcopy
+ 
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" 
-DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
+-GTKINCLUDES=$(shell pkg-config gtk+-2.0 --cflags)
++GTKINCLUDES=$(shell $(PKG_CONFIG) gtk+-2.0 --cflags)
+ INCLUDES=-I../core $(GTKINCLUDES)
+ #CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
+ CXXFLAGS=$(CXX_DEB_FLAGS) $(INCLUDES) $(DEFINES)
+ CFLAGS=$(CXXFLAGS) $(DEFINES)
+-GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs)
++GTKLIBS=$(shell $(PKG_CONFIG) gtk+-2.0 gmodule-2.0 --libs)
+ LIBS=-L../core -llshw -lresolv $(GTKLIBS)
+ LDFLAGS=
+ ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )

Reply via email to