Package: hello
Version: 2.4-1
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch karmic

When setting up a cross-build environment, the first package I reached
for as a test case was naturally 'hello' - but unfortunately I found
that it isn't set up for cross-building! I think it would serve hello's
purpose as an example well to fix this.

There are two problems:

  1) doesn't follow the recommendations in
     /usr/share/doc/autotools-dev/README.Debian.gz for configure
     arguments

  2) always forces CC=gcc, rather than just letting configure take care
     of it

The following patch fixes both, and then hello cross-builds fine. I left
the comment about autoconf versioning from the autotools-dev
documentation in place by way of documentation.

diff -u hello-2.4/debian/rules hello-2.4/debian/rules
--- hello-2.4/debian/rules
+++ hello-2.4/debian/rules
@@ -10,7 +10,6 @@
 package = hello
 docdir = debian/tmp/usr/share/doc/$(package)
 
-CC = gcc
 CFLAGS = -g -Wall
 INSTALL_PROGRAM = install
 
@@ -24,9 +23,19 @@
   STRIP = strip --remove-section=.comment --remove-section=.note
 endif
 
+export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+# FOR AUTOCONF 2.52 AND NEWER ONLY
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+  confflags += --build $(DEB_HOST_GNU_TYPE)
+else
+  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+endif
+
 build:
-       ./configure --prefix=/usr
-       $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)"
+       ./configure $(confflags) --prefix=/usr
+       $(MAKE) CFLAGS="$(CFLAGS)"
        touch build
 
 clean:

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to