Package: libpaper
Version: 1.1.24+nmu2
Severity: normal
Tags: patch
User: [email protected]
Usertags: cross

libpaper fails to cross-build because it tries to use the cross-built
paperconf to build debian/libpaper1.config.  This only works if the
build environment is set up such that it can execute the cross-built
binaries, either directly or via an emulator; however, this is unlikely
to be the case at least for early stages of the upcoming arm64
bootstrap, and it's not something we want to rely on in general.

The usual remedy for this problem is to perform two build passes when
cross-building.  The following patch implements this.

  * When cross-building, run a separate native build pass so that we have a
    native version of paperconf to build debian/libpaper1.config.  This
    requires running the primary build pass out-of-tree as well.

diff -Nru libpaper-1.1.24+nmu2/debian/rules 
libpaper-1.1.24+nmu2ubuntu1/debian/rules
--- libpaper-1.1.24+nmu2/debian/rules   2012-05-03 20:05:12.000000000 +0100
+++ libpaper-1.1.24+nmu2ubuntu1/debian/rules    2012-11-22 12:18:47.000000000 
+0000
@@ -16,8 +16,12 @@
        --mandir=$(share)/man \
        --infodir=$(share)/info \
        --build=$(DEB_BUILD_GNU_TYPE)
-ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
-config_flags   += --host=$(DEB_HOST_GNU_TYPE)
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+cross_config_flags     :=
+native_paperconf       := debian/build/src/paperconf
+else
+cross_config_flags     := --host=$(DEB_HOST_GNU_TYPE)
+native_paperconf       := debian/build-native/src/paperconf
 endif
 
 cflags := -g -Wall
@@ -49,24 +53,34 @@
        autoconf
        $(update_config_sub)
        $(update_config_guess)
-       $(SHELL) ./configure $(config_flags)
+       mkdir -p debian/build
+       cd debian/build && \
+               $(SHELL) ../../configure $(config_flags) $(cross_config_flags)
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+       mkdir -p debian/build-native
+       cd debian/build-native && $(SHELL) ../../configure $(config_flags)
+endif
        touch $@
 
 build: config build-stamp debian/libpaper1.config
 build-stamp:
-       $(MAKE)
+       $(MAKE) -C debian/build
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+       $(MAKE) -C debian/build-native
+endif
        touch $@
 
 debian/libpaper1.config: build-stamp
        exec > [email protected] \
                && sed -n '1,/^__BEGIN_PAPERSPECS__/p' $@ \
-               && src/paperconf -amns \
+               && $(native_paperconf) -amns \
                && sed -n '/^__END_PAPERSPECS__/,$$p' $@
        mv [email protected] $@
 
 clean: checkroot
        rm -f *-stamp
        [ ! -f Makefile ] || $(MAKE) distclean
+       rm -rf debian/build debian/build-native
        dh_clean
        exec > /tmp/libpaper1.new \
                && sed -n '1,/^__BEGIN_PAPERSPECS__/p' debian/libpaper1.config \
@@ -90,7 +104,7 @@
        dh_prep
        dh_installdirs
 
-       $(MAKE) install DESTDIR=$(prefix)
+       $(MAKE) -C debian/build install DESTDIR=$(prefix)
 
        dh_install
 

Thanks,

-- 
Colin Watson                                       [[email protected]]


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to