Source: openal-soft
Version: 1:1.17.2-1
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

openal-soft fails to cross build from source, because it does not pass
cross tools to cmake and thus uses the build architecture compiler. In
the end, dh_strip fails operating on the generated objects with host
architecture tools.

I am attaching a patch that makes openal-soft cross buildable. I added
the --builddirectory flag to dh to be able to use dh_auto_configure,
which knows the required cross flags. That allows removing the
dh_auto_build override, which in turn makes parallel builds actually
work. I also had to replace the explicit cc invocations with
triplet-prefixed versions. In the end, the patch turned out simplifying
the build. I hope you can apply it as is.

Helmut
diff --minimal -Nru openal-soft-1.17.2/debian/changelog 
openal-soft-1.17.2/debian/changelog
--- openal-soft-1.17.2/debian/changelog 2016-03-21 09:04:11.000000000 +0100
+++ openal-soft-1.17.2/debian/changelog 2016-09-04 08:04:18.000000000 +0200
@@ -1,3 +1,13 @@
+openal-soft (1:1.17.2-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Invoke cmake via dh_auto_configure
+    + Pass --builddirectory to dh
+    + Invoke triplet-prefixed CC from d/rules
+
+ -- Helmut Grohne <hel...@subdivi.de>  Sun, 04 Sep 2016 07:59:01 +0200
+
 openal-soft (1:1.17.2-1) unstable; urgency=medium
 
   * Team upload
diff --minimal -Nru openal-soft-1.17.2/debian/rules 
openal-soft-1.17.2/debian/rules
--- openal-soft-1.17.2/debian/rules     2016-03-21 09:04:11.000000000 +0100
+++ openal-soft-1.17.2/debian/rules     2016-09-04 14:16:52.000000000 +0200
@@ -10,14 +10,13 @@
 CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)
 LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
 
-DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
-
-# For multiarch
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+include /usr/share/dpkg/architecture.mk
+ifeq ($(origin CC),default)
+       CC = $(DEB_HOST_GNU_TYPE)-gcc
+endif
 
 # Use this variable to allow options passed to cmake to be overridable
 DEB_CMAKE_OPTIONS ?= -DCMAKE_VERBOSE_MAKEFILE=ON \
-               -DCMAKE_INSTALL_PREFIX="/usr" \
                -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" \
                -DEXAMPLES=OFF \
                ..
@@ -32,18 +31,13 @@
 
 .PHONY: build
 %:
-       dh $@ --parallel
-
-build:
-       dh $@ --parallel
+       dh $@ --builddirectory=$(BUILD_TREE) --parallel
 
 override_dh_auto_clean:
        rm -rf $(BUILD_TREE)
 
 override_dh_auto_configure:
-       mkdir -p $(BUILD_TREE)
-       cd $(BUILD_TREE) && \
-               cmake $(DEB_CMAKE_OPTIONS)
+       dh_auto_configure -- $(DEB_CMAKE_OPTIONS)
 
 override_dh_installchangelogs:
        dh_installchangelogs ChangeLog 
@@ -56,11 +50,8 @@
        ${MAKE} -f /usr/share/cdbs/1/rules/utils.mk debian/stamp-copyright-check
        rm debian/stamp-copyright-check
 
-override_dh_auto_build:
-       $(MAKE) --directory=$(BUILD_TREE)
-
 override_dh_auto_install:
-       $(MAKE) --directory=$(BUILD_TREE) install DESTDIR=$(CURDIR)/debian/tmp
+       dh_auto_install
        install -d debian/tmp/etc/openal
        install -m644 \
                debian/tmp/usr/share/openal/alsoftrc.sample \
@@ -75,11 +66,11 @@
 
 debian/tmp/openal-soft-Recommends-dummy.so:
        mkdir -p debian/tmp
-       cc -xc -shared -Wl,--no-as-needed -o $@ /dev/null 
$(DLOPENED_RECOMMENDS_LIBS)
+       $(CC) -xc -shared -Wl,--no-as-needed -o $@ /dev/null 
$(DLOPENED_RECOMMENDS_LIBS)
 
 debian/tmp/openal-soft-Suggests-dummy.so:
        mkdir -p debian/tmp
-       cc -xc -shared -Wl,--no-as-needed -o $@ /dev/null 
$(DLOPENED_SUGGESTS_LIBS)
+       $(CC) -xc -shared -Wl,--no-as-needed -o $@ /dev/null 
$(DLOPENED_SUGGESTS_LIBS)
 
 get-orig-source:
        $(dir $_)openal-soft-get-orig-source

Reply via email to