On Wed, 7 Jan 2009 18:08:57 +1100
Craig Small <[email protected]> wrote:

> On Sun, Nov 18, 2007 at 06:29:20PM +0000, Neil Williams wrote:
> > The cross building support in Debian has been recently rewritten -
> > particularly in respect of how environment variables and overrides are
> > handled - so this patch is now needed to allow procps to correctly
> > identify the cross compiler.

> Is this still required? 

Yes. Is there something that made you think it was not?

http://www.emdebian.org/packages/search.php?distro=unstable&package=procps
http://buildd.emdebian.org/svn/browser/current/target/trunk/p/procps/trunk/
http://www.emdebian.org/buildd/history.php?pkg=procps
http://www.emdebian.org/buildd/index.php?log=procps-arm-1219353597.log&pkg=procps&arch=arm

(the last link is to the build log which shows the effect of $(CROSS) by
the use of arm-linux-gnu-gcc instead of just cc)

> The relevant parts of the rules file are now:
> 
> PACKAGE="procps"
> DEBROOT=$(CURDIR)/debian/procps
> 
> DEB_HOST_ARCH_OS    ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

? That changes nothing with regard to the cross-build.

The relevant changes in the rules file concern:

+DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE=$(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
+CROSS=CC=$(DEB_HOST_GNU_TYPE)-gcc
+else
+CROSS=
+endif

This change sets the cross-compiler only in situations where a
cross-build is actually taking place. It is typical of the changes
required to cross-build any package using a Makefile without
using ./configure or the rest of the autotools.

 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM += -s
 endif
@@ -25,10 +31,10 @@
 
        # Add here commands to compile the package.
        mkdir static
-       $(MAKE) lib64=lib SHARED=0 proc/libproc.a
+       $(MAKE) $(CROSS) lib64=lib SHARED=0 proc/libproc.a
        mv proc/libproc.a static
        $(MAKE) clean
-       $(MAKE) W_SHOWFROM=\-DW_SHOWFROM lib64=lib 
+       $(MAKE) $(CROSS) W_SHOWFROM=\-DW_SHOWFROM lib64=lib 


These changes merely direct make to use the cross-compiler when the
variable is set. The changes have absolutely no effect in a native
build.
 
Without these changes, it is impossible to cross-build the Debian
package because the wrong compiler is chosen and you end up with x86
binaries instead of arm etc.


-- 


Neil Williams
=============
http://www.data-freedom.org/
http://www.linux.codehelp.co.uk/
http://e-mail.is-not-s.ms/

Attachment: pgpBm93siXwIz.pgp
Description: PGP signature

Reply via email to