Package: iputils
Version: 3:20101006-1
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch precise

The attached patch makes it possible to cross-build iputils given a
suitable cross-building environment.  Please see:

  https://bugs.launchpad.net/ubuntu/+source/iputils/+bug/872370

The small upstream patch should be reasonably maintainable, but I think
it should also be reasonably portable if you want to forward it on to
upstream.  As far as I can tell there is no way to cause -lfoo in a make
prerequisite to do the right thing for cross-building.

  * Support cross-building (thanks to Wookey <[email protected]> and Harry
    Liebel; LP: #872370).

diff -Nru iputils-20101006/debian/patches/cross-building.diff 
iputils-20101006/debian/patches/cross-building.diff
--- iputils-20101006/debian/patches/cross-building.diff 1970-01-01 
01:00:00.000000000 +0100
+++ iputils-20101006/debian/patches/cross-building.diff 2011-11-08 
13:15:29.000000000 +0000
@@ -0,0 +1,27 @@
+Description: Find libraries using gcc rather than make
+ make's facility of using -lfoo as a prerequisite doesn't work with
+ cross-building.  Use target-specific variables instead.
+Author: Wookey <[email protected]>
+Author: Colin Watson <[email protected]>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/872370
+Forwarded: no
+Last-Update: 2011-11-08
+
+Index: b/Makefile
+===================================================================
+--- a/Makefile
++++ b/Makefile
+@@ -27,9 +27,11 @@
+ 
+ 
+ tftpd: tftpd.o tftpsubs.o
+-arping: arping.o -lsysfs
++arping: arping.o
++arping: LDLIBS = -lsysfs
+ ping: ping.o ping_common.o
+-ping6: ping6.o ping_common.o -lresolv -lcrypto
++ping6: ping6.o ping_common.o
++ping6: LDLIBS = -lresolv -lcrypto
+ ping.o ping6.o ping_common.o: ping_common.h
+ tftpd.o tftpsubs.o: tftp.h
+ 
diff -Nru iputils-20101006/debian/patches/series 
iputils-20101006/debian/patches/series
--- iputils-20101006/debian/patches/series      2011-02-21 05:45:39.000000000 
+0000
+++ iputils-20101006/debian/patches/series      2011-11-08 13:13:21.000000000 
+0000
@@ -5,3 +5,4 @@
 targets.diff
 fix-tracepath-docs.diff
 fix-arping-timeouts.diff
+cross-building.diff
diff -Nru iputils-20101006/debian/rules iputils-20101006/debian/rules
--- iputils-20101006/debian/rules       2011-02-21 05:45:39.000000000 +0000
+++ iputils-20101006/debian/rules       2011-11-08 13:15:50.000000000 +0000
@@ -6,13 +6,21 @@
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
+DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE  := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+       CROSS :=
+else
+       CROSS := CC=$(DEB_HOST_GNU_TYPE)-gcc
+endif
+
 configure:
        dh_testdir
 
 build: configure
        dh_testdir
 
-       $(MAKE)
+       $(MAKE) $(CROSS)
        $(MAKE) -C doc man
 
 clean:

Thanks,

-- 
Colin Watson                                       [[email protected]]



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

Reply via email to