[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#572431: busybox: add cross compilation support



Hello Michael,

2011/8/13 Michael Tokarev <mjt@tls.msk.ru>:
> 04.03.2010 10:51, Hector Oron wrote:

> Besides, can't we add something like CC=prefix-gcc to the
> upstream make arguments (or to conffile), without patching
> anything?

No need to add upstream changes, on current version I have tested this
patch and it worked for me:

--- busybox-1.18.5/debian/changelog     2011-07-25 14:25:33.000000000 +0100
+++ busybox-1.18.5/debian/changelog     2011-08-13 09:55:28.000000000 +0100
@@ -1,3 +1,9 @@
+busybox (1:1.18.5-2) UNRELEASED; urgency=low
+
+  * enable cross compilation support (Closes: #572431)
+
+ -- Hector Oron <zumbi@debian.org>  Sat, 13 Aug 2011 09:54:39 +0100
+
 busybox (1:1.18.5-1) unstable; urgency=low

   [ Loïc Minier ]
diff -Nru busybox-1.18.5/debian/rules busybox-1.18.5/debian/rules
--- busybox-1.18.5/debian/rules 2011-04-26 20:38:10.000000000 +0100
+++ busybox-1.18.5/debian/rules 2011-08-13 09:51:40.000000000 +0100
@@ -2,6 +2,8 @@

 SHELL := sh -e
 DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
+DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 SOURCE := $(shell dpkg-parsechangelog | sed -ne 's,^Source: *\(.*\)$$,\1,p')
 VERSION_DEBIAN := $(shell dpkg-parsechangelog | sed -ne 's,^Version:
*\(.*\)$$,\1,p')
 VERSION := $(shell echo "$(VERSION_DEBIAN)" | sed -e 's,^[^:]*:,,' -e
's,-[^-]*$$,,')
@@ -10,6 +12,10 @@
 BUILD_DIR = debian/build
 STAMPS_DIR = debian/stamps

+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+export CROSS_COMPILE = $(DEB_HOST_GNU_TYPE)-
+endif
+
 $(STAMPS_DIR)/dir:
        mkdir -p $(STAMPS_DIR)
        touch $@


After running on x86 system:
$ dpkg-buildpackage -aarmel -us -uc -rfakeroot

I can see
$ file debian/busybox/bin/busybox
debian/busybox/bin/busybox: ELF 32-bit LSB executable, ARM, version 1
(SYSV), dynamically linked (uses shared libs), stripped

and of course
$ dcmd ls -1 ../busybox_1.18.5-2_armel.changes
../busybox_1.18.5-2_armel.changes
../busybox_1.18.5-2_armel.deb
../busybox_1.18.5-2.debian.tar.gz
../busybox_1.18.5-2.dsc
../busybox-static_1.18.5-2_armel.deb
../busybox-syslogd_1.18.5-2_all.deb
../busybox-udeb_1.18.5-2_armel.udeb
../udhcpc_1.18.5-2_all.deb
../udhcpd_1.18.5-2_all.deb

Best regards,
-- 
 Héctor Orón  -.. . -... .. .- -.   -.. . ...- . .-.. --- .--. . .-.



Reply to: