Example of cross compiling a package

debian/control

Source: anna
Section: debian-installer
Build-Depends: debhelper (>= 5.0.22), dpkg-dev (>= 1.7.0), libdebconfclient0-dev (>= 0.46), libdebian-installer4-dev (>= 0.41)

Fetch and install cross compiling libraries (XXX Need to test mrvn tool)

sudo apt-cross -a armel -f -i libdebconfclient0
sudo apt-cross -a armel -f -i libdebconfclient0-dev
sudo apt-cross -a armel -x libdebian-installer4 -x libdebian-installer-extra4 -f -i libdebian-installer4-dev
sudo apt-cross -a armel -f -x libc-bin -x libc-dev-bin -i libc6-dev
sudo apt-cross -a armel -f -x libc-bin -i libc6
E: sudo apt-cross -a armel -f -x libc-bin -x libc-dev-bin -i dpkg-dev
( I do not think you really need dpkg-dev to be able to cross-compile the package )

Patch debian/rules, Makefiles or needed stuff

diff -urN anna-1.34/debian/rules anna-1.34.cross//debian/rules
--- anna-1.34/debian/rules      2006-03-16 01:25:42.000000000 +0100
+++ anna-1.34.cross//debian/rules       2010-03-03 19:35:33.000000000 +0100
@@ -1,4 +1,10 @@
 #!/usr/bin/make -f
+export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+export CC=$(DEB_HOST_GNU_TYPE)-gcc
+endif

 build: build-stamp
 build-stamp:

Build the package

Send patch to the BTS

Make sure to report the bug against the buildd.emdebian.org package

$ reportbug buildd.emdebian.org