Source: elfutils
Version: 0.165-3
Severity: normal
Tags: patch

Dear elfutils maintainers,

elfutils currently fails to cross build from source as can be seen in
http://subdivi.de/~helmut/debomatic-logs/elfutils_0.165-3_ppc64el.build.
During build, the tool i386_gendis is compiled using the host
architecture compiler and then run. Unfortunately, we cannot simply
change it to use the host architecture compiler, because it links
libeu.a which is also needed for the host architecture. Thus libeu.a
needs to be built twice somehow. The crucial insight here is that the
output of i386_gendis is architecture independent and that it is only
run in maintainer mode. So we can simply build elfutils once natively in
maintainer mode and the build it again disabling maintainer mode while
reusing some artifacts from the previous build. This sounds complex, but
it actually works. Unless you have a better idea to achieve cross
building, please consider applying the attached patch.

Helmut
--- a/debian/rules
+++ b/debian/rules
@@ -20,7 +20,7 @@
 DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
-        confflags += --build=$(DEB_HOST_GNU_TYPE)
+        confflags += --build=$(DEB_HOST_GNU_TYPE) --enable-maintainer-mode
         make_check = yes
 else
 	confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
@@ -41,10 +41,14 @@
 config.status: configure.ac
 	dh_testdir
 	autoreconf -fis
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+	./configure --enable-maintainer-mode
+	$(MAKE) $(MAKEFLAGS)
+	$(MAKE) clean
+endif
 	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \
 		./configure $(confflags) --prefix=/usr \
 		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
-		--enable-maintainer-mode \
 		--program-prefix=eu-
 
 build: build-stamp

Reply via email to