Package: klibc
Version: 1.5.22-1
Severity: wishlist
Tags: patch

Hi maks,

I'm currently working on cross-building bits of Debian and klibc fails
to build. The upstream build system already supports cross-building
via Kbuild, it just needs to be told how.

Two patches here:

1. Simply set CROSS_COMPILE appropriately if we detect that we're
   cross-building - easy.

2. Much more involved, due to the proliferation of patches and
   versions at the moment. This interacts with markos' armhf patch and
   the multi-arch work that vorlon has put in for Ubuntu, but should
   be obvious I hope!

   a. for the armhf cross-build support to work, I have to set
      ARCH=arm too

   b. multi-arch and cross build tools put headers in different
      places. A sym-link is needed for building to work. For now I've
      added a fallback so that things build either way, depending on
      what state the m-a support is in.

Cheers,
-- 
Steve McIntyre
steve.mcint...@linaro.org
--- klibc-1.5.22/debian/rules.old	2011-06-09 15:39:39.723752530 +0100
+++ klibc-1.5.22/debian/rules	2011-06-09 16:08:04.227944860 +0100
@@ -32,6 +36,13 @@
 
 DEB_MAKE_ENVVARS := INSTALLROOT=debian/tmp $(DEB_MAKE_ENVVARS)
 
+DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE  := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+    DEB_MAKE_ENVVARS += CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+endif
+
+
 # Enable this to get verbose build information
 DEB_MAKE_ENVVARS += KBUILD_VERBOSE=1
 
--- klibc-1.5.22/debian/rules.old	2011-06-09 15:39:39.723752530 +0100
+++ klibc-1.5.22/debian/rules	2011-06-09 16:08:04.227944860 +0100
@@ -4,10 +4,14 @@
 #export DH_VERBOSE=1
 
 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
 ifeq ($(DEB_HOST_ARCH),armel)
 DEB_MAKE_ENVVARS := CONFIG_AEABI=y
 endif
+ifeq ($(DEB_HOST_ARCH),armhf)
+DEB_MAKE_ENVVARS := ARCH=arm CONFIG_AEABI=y CPU_ARCH=armv7-a CPU_TUNE=cortex-a8
+endif
 ifeq ($(DEB_HOST_ARCH),ia64)
 DEB_MAKE_ENVVARS := ARCH=ia64
 endif
@@ -43,6 +54,13 @@
 		rm -rf linux/include; \
 		mkdir -p linux/include; \
 		ln -s /usr/include/linux linux/include; \
+		if [ -n "$(DEB_HOST_MULTIARCH)" ]; then \
+			if [ -d /usr/include/$(DEB_HOST_MULTIARCH)/asm ] ; then \
+				ln -s /usr/include/$(DEB_HOST_MULTIARCH)/asm linux/include; \
+			else \
+				ln -s /usr/$(DEB_HOST_MULTIARCH)/include/asm linux/include; \
+			fi; \
+		fi; \
 		for x in /usr/include/asm*; do \
 			ln -s $${x} linux/include; \
 		done \

Reply via email to