Source: lz4
Version: 0.0~r131-1
Tags: patch
User: [email protected]
Usertags: rebootstrap

Since apt now requires lz4, I looked into cross compiling lz4 and
figured that it wouldn't work out of the box. You can find a failing
build log at:

http://subdivi.de/~helmut/debomatic-logs/lz4_0.0~r131-1_ppc64el.build

There are two issues at hand, both of which can be seen in the log
above.

1) The build uses the build architecture compiler instead of the cross
   compiler. Thus the binaries produced are for the wrong architecture
   and ultimately dh_strip makes the build fail hard.

2) The test suite is run despite being passed DEB_BUILD_OPTIONS=nocheck.
   Once fixing the first issue, this becomes a hard failure as host
   architecture executables cannot be run in a typical cross setting.

I am attaching a patch that addresses both of these issues.

Helmut
--- a/debian/rules
+++ b/debian/rules
@@ -7,9 +7,13 @@
 CXXFLAGS:= $(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
 LDFLAGS:= $(shell dpkg-buildflags --get LDFLAGS)
 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
-DEB_HOST_ARCH_BITS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 PREFIX:= /usr
 
+ifeq ($(origin CC),default)
+CC := $(DEB_HOST_GNU_TYPE)-gcc
+endif
+
 export CFLAGS
 export CPPFLAGS
 export LDFLAGS
@@ -21,12 +25,21 @@
 ifneq (,$(findstring $(DEB_HOST_ARCH),sparc))
 disable_test=1
 endif
+ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+disable_test=1
+endif
 
 %:
 	dh $@
 
+override_dh_auto_build:
+	dh_auto_build -- CC=$(CC)
+
+override_dh_auto_install:
+	dh_auto_install -- CC=$(CC)
+
 override_dh_install:
-	make install DESTDIR=$$(pwd)/debian/tmp LIBDIR=$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)
+	make install DESTDIR=$$(pwd)/debian/tmp LIBDIR=$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) CC=$(CC)
 	dh_install
 
 override_dh_auto_test:

Reply via email to