[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#883489: fwupdate FTCBFS: multiple reasons



Source: fwupdate
Version: 9-3
Tags: patch
User: helmutg@debian.org
Usertags: rebootstrap

fwupdate fails to cross build from source for a number of reasons:
 1. It uses the build architecture objcopy, because dh_auto_build passes
    neither OBJCOPY nor CROSS_COMPILE. While the CROSS_COMPILE variable
    is somewhat general, it's not as widely adopted. dh_auto_build
    explicitly sets tools such as CC or PKG_CONFIG. Explicitly passing
    CROSS_COMPILE makes this part work.
 2. The upstream build system hard codes the use of the build
    architecture pkg-config. While it considers CROSS_COMPILE for other
    tools (including CC, LD and OBJCOPY) it fails to do so for
    pkg-config. I think this is an upstream bug and it should allow
    substituting pkg-config just like the other tools.
 3. It derives FWUP in efi/Makefile from ARCH and ARCH from CC.
    Unfortunately, dh_auto_install doesn't pass CC (only dh_auto_build
    does). Thus FWUP differs between build and install and thus tries to
    build more stuff. An easy way to solve this is to simply pass
    CROSS_COMPILE to make install as well.
After fixing all of the above, fwupdate cross builds successfully.
Please consider applying the attached patch.

Helmut
diff --minimal -Nru fwupdate-9/debian/changelog fwupdate-9/debian/changelog
--- fwupdate-9/debian/changelog	2017-11-06 16:17:16.000000000 +0100
+++ fwupdate-9/debian/changelog	2017-12-04 17:10:48.000000000 +0100
@@ -1,3 +1,12 @@
+fwupdate (9-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Pass CROSS_COMPILE to make.
+    + Make pkg-config substitutable.
+
+ -- Helmut Grohne <helmut@subdivi.de>  Mon, 04 Dec 2017 17:10:48 +0100
+
 fwupdate (9-3) unstable; urgency=medium
 
   * Disable "Linux Firmware Updater" boot entry after installation
diff --minimal -Nru fwupdate-9/debian/patches/0003-cross.patch fwupdate-9/debian/patches/0003-cross.patch
--- fwupdate-9/debian/patches/0003-cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ fwupdate-9/debian/patches/0003-cross.patch	2017-12-04 17:10:48.000000000 +0100
@@ -0,0 +1,39 @@
+Index: fwupdate-9/Make.defaults
+===================================================================
+--- fwupdate-9.orig/Make.defaults
++++ fwupdate-9/Make.defaults
+@@ -3,6 +3,7 @@
+ CC		= $(CROSS_COMPILE)gcc
+ LD		= $(CROSS_COMPILE)ld
+ OBJCOPY		= $(CROSS_COMPILE)objcopy
++PKG_CONFIG	= $(CROSS_COMPILE)pkg-config
+ READELF		= eu-readelf
+ XGETTEXT	= xgettext
+ prefix		?= /usr/
+Index: fwupdate-9/linux/Makefile
+===================================================================
+--- fwupdate-9.orig/linux/Makefile
++++ fwupdate-9/linux/Makefile
+@@ -18,11 +18,11 @@
+ PJONES  =
+ BIN_CCLDFLAGS = $(foreach lib,$(BIN_LIBS),-l$(lib)) \
+ 	$(foreach pklib,$(PKLIBS), \
+-		$(shell pkg-config --libs-only-l --libs-only-other $(pklib))) \
++		$(shell $(PKG_CONFIG) --libs-only-l --libs-only-other $(pklib))) \
+ 	$(LDFLAGS) -pie -fPIE -Wl,-z,relro,-z,now -L.
+ LIB_CCLDFLAGS = $(foreach lib,$(LIB_LIBS),-l$(lib)) \
+ 	$(foreach pklib,$(PKLIBS), \
+-		$(shell pkg-config --libs-only-l --libs-only-other $(pklib))) \
++		$(shell $(PKG_CONFIG) --libs-only-l --libs-only-other $(pklib))) \
+ 	$(LDFLAGS) -shared -fPIC -Wl,-z,relro,-z,now
+ 
+ ifeq ($(HAVE_LIBSMBIOS),yes)
+@@ -36,7 +36,7 @@
+ 	-DLOCALEDIR=\"$(localedir)\" -D_GNU_SOURCE \
+ 	-DFWUP_EFI_DIR_NAME=\"$(EFIDIR)\"  \
+ 	-I$(TOPDIR)/linux/include -iquote$(TOPDIR)/include/ \
+-	$(foreach pklib,$(PKLIBS), $(shell pkg-config --cflags $(pklib))) \
++	$(foreach pklib,$(PKLIBS), $(shell $(PKG_CONFIG) --cflags $(pklib))) \
+ 	$(PJONES)
+ 
+ BINTARGETS=fwupdate
diff --minimal -Nru fwupdate-9/debian/patches/series fwupdate-9/debian/patches/series
--- fwupdate-9/debian/patches/series	2017-11-06 16:09:37.000000000 +0100
+++ fwupdate-9/debian/patches/series	2017-12-04 17:10:48.000000000 +0100
@@ -2,3 +2,4 @@
 0001-Fix-sprintf-formatting-for-Boot.patch
 0001-efi-delete-boot-entry-before-apply-capsule.patch
 0002-efi-delete-the-boot-path-from-the-BootOrder-list.patch
+0003-cross.patch
diff --minimal -Nru fwupdate-9/debian/rules fwupdate-9/debian/rules
--- fwupdate-9/debian/rules	2017-11-06 16:13:23.000000000 +0100
+++ fwupdate-9/debian/rules	2017-12-04 17:10:48.000000000 +0100
@@ -1,7 +1,7 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+include /usr/share/dpkg/architecture.mk
 EFIDIR ?= $(shell dpkg-vendor --query vendor | awk '{ print tolower($$0) }')
 PODATE := $(shell dpkg-parsechangelog --show-field Date | xargs -0 date --utc "+%Y-%m-%d %H:%M%z" --date)
 
@@ -24,7 +24,8 @@
 			 datadir=/var/cache/ \
 			 localedir=/usr/share/locale/ \
 			 GNUEFIDIR=\$${prefix}/lib \
-			 EFIDIR=$(EFIDIR)
+			 EFIDIR=$(EFIDIR) \
+			 CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
 	sed 's,#EFIDIR#,$(EFIDIR),' \
 		debian/fwupdate.postrm.in > debian/fwupdate.postrm
 	sed 's,#EFIDIR#,$(EFIDIR),' \
@@ -42,7 +43,8 @@
 			   datadir=/var/cache/ \
 			   localedir=/usr/share/locale/ \
 			   GNUEFIDIR=\$${prefix}/lib \
-			   EFIDIR=$(EFIDIR)
+			   EFIDIR=$(EFIDIR) \
+			   CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
 	chmod -x ${buildroot}/boot/efi/EFI/$(EFIDIR)/*.efi
 	cp debian/scripts/install.in   ${buildroot}/usr/lib/fwupdate/install
 	sed -i 's,#EFIDIR#,$(EFIDIR),' ${buildroot}/usr/lib/fwupdate/install

Reply to: