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

Bug#843261: efivar FTCBFS: compiles build tools with the host architecture compiler



Source: efivar
Version: 30-1
Tags: patch
User: helmutg@debian.org
Usertags: rebootstrap

efivar fails to cross build from source, because it compiles the build
tool makeguids with the host architecture compiler and then fails
running it. It also runs the build architecture pkg-config. Switching
makeguids to the build architecture compiler and passing CROSS_COMPILE
to make makes both cross and native builds just work. Please consider
applying the attached patch.

Helmut
diff --minimal -Nru efivar-30/debian/changelog efivar-30/debian/changelog
--- efivar-30/debian/changelog	2016-09-23 22:00:08.000000000 +0200
+++ efivar-30/debian/changelog	2016-11-05 07:58:05.000000000 +0100
@@ -1,3 +1,12 @@
+efivar (30-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Pass CROSS_COMPILE to make
+    + cross.patch: Use CCLD_FOR_BUILD for makeguids.
+
+ -- Helmut Grohne <helmut@subdivi.de>  Sat, 05 Nov 2016 07:57:11 +0100
+
 efivar (30-1) unstable; urgency=medium
 
   * new upstream version (30)
diff --minimal -Nru efivar-30/debian/patches/cross.patch efivar-30/debian/patches/cross.patch
--- efivar-30/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ efivar-30/debian/patches/cross.patch	2016-11-05 08:04:48.000000000 +0100
@@ -0,0 +1,29 @@
+Subject: use CCLD_FOR_BUILD for makeguids
+From: Helmut Grohne <helmut@subdivi.de>
+
+Index: efivar-30/Make.defaults
+===================================================================
+--- efivar-30.orig/Make.defaults
++++ efivar-30/Make.defaults
+@@ -10,7 +10,9 @@
+ INSTALL ?= install
+ CROSS_COMPILE	?=
+ PKG_CONFIG = $(CROSS_COMPILE)pkg-config
++CC_FOR_BUILD	?= cc
+ CC	:= $(if $(filter default,$(origin CC)),$(CROSS_COMPILE)gcc,$(CC))
++CCLD_FOR_BUILD	?= $(CC_FOR_BUILD)
+ CCLD	:= $(if $(filter undefined,$(origin CCLD)),$(CC),$(CCLD))
+ OPTIMIZE ?= -O2 -flto
+ CFLAGS	?= $(OPTIMIZE) -g3
+Index: efivar-30/src/Makefile
+===================================================================
+--- efivar-30.orig/src/Makefile
++++ efivar-30/src/Makefile
+@@ -38,6 +38,7 @@
+ makeguids : CPPFLAGS+=-DEFIVAR_BUILD_ENVIRONMENT
+ makeguids : LIBS=dl
+ makeguids : $(MAKEGUIDS_SOURCES)
++makeguids : CCLD=$(CCLD_FOR_BUILD)
+ 
+ guids.o : guids.S | guids.bin names.bin
+ 
diff --minimal -Nru efivar-30/debian/patches/series efivar-30/debian/patches/series
--- efivar-30/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ efivar-30/debian/patches/series	2016-11-05 07:58:10.000000000 +0100
@@ -0,0 +1 @@
+cross.patch
diff --minimal -Nru efivar-30/debian/rules efivar-30/debian/rules
--- efivar-30/debian/rules	2016-09-23 22:00:08.000000000 +0200
+++ efivar-30/debian/rules	2016-11-05 08:00:25.000000000 +0100
@@ -6,13 +6,13 @@
 
 export DEB_CFLAGS_MAINT_APPEND= -flto
 
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+include /usr/share/dpkg/architecture.mk
 
 %:
 	dh $@ 
 
 override_dh_auto_build:
-	dh_auto_build -- libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
+	dh_auto_build -- libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
 
 override_dh_auto_install:
 	dh_auto_install -- libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)

Reply to: