Cross Architecture Compiling

From: Michael Vale <masked_at_internode.on.net>
Date: Fri, 2 Nov 2012 14:05:12 +1100
Forwarding my latest zrouter redmine submission, where I have been working 
on updating zRouter's ports cross-arch-compilation automation system.

--------

Adding:

CONFIGURE_HOST?=        ${TARGET_ARCH}-portbld-freebsd${OSREL}
CONFIGURE_HOST:=        ${CONFIGURE_HOST:S/^/--host=/}

to /usr/ports/Mk/bsd.port.mk allows many ports to pickup a cross compiler 
simply by having the user pass TARGET_ARCH=${ARCH} at the command-line.

I've been using XDEV (/usr/src# make xdev XDEV=${ARCH} XDEV_ARCH={$ARCH}) as 
my most current cross-compiler.

CC can be overridden by specifying your CROSS_CC's PATH first in the PATH 
environment variable e.g. export PATH=/usr/mips-freebsd/usr/bin/:$PATH

I AM NOT USING DESTDIR PORTS JAILS TO COMPLETE THESE TASKS, PLEASE MAKE GOOD 
NOTE AS THERE IS SOME GREAT DIFFERENCES AND MUCH WORK TO BE DONE IN THIS 
DEPARTMENT.

Assuming above bsd.ports.mk patch one can cross compile many ports simply:

TARGET=mips TARGET_ARCH=mips make -C install CHROOTED=no 
DESTDIR=/path/to/target/rootfs PREFIX=/

this will get you started.  PREFIX MUST == / for correct pkgconfig entries 
and many much other things I do not wish to discuss in detail right now, 
please understand!

CHROOTED=no is the IMPORTANT PART HERE!  We cannot run a jail on a build 
machine with foreign binaries such as /bin/sh!  THIS IS FUNDAMENTAL.

I will continue to hack away at bsd.port.mk until my work is complete, I 
would appreciate any help as to prefixing DESTDIR transparently to PREFIX in 
order for proper installation of cross-compiled ports.  I will submit any 
following patches in a more formal manner.

I am open to questions and willing to expand muchly on the plethora of 
variables needed to be passed to build multiple ports with dependancies in 
more complicated scenarios.

Some ports with GNU Makefiles have a different means of cross-compiling, 
e.g. busybox.  I'll post those findings next.

Regards,

Michael Vale.
surfnet.co

-----Original Message----- 
From: redmine_at_zrouter.org
Sent: Friday, November 02, 2012 1:42 PM Subject: [zrouter - Bug #37] bsd 
ports


Issue #37 has been updated by Michael Vale.

File zrouter.ports.mk.diff added

you need to have xdev mips installed.

/usr/src# make xdev XDEV=mips XDEV_ARCH=mips.

you also need to add these two lines to bsd.ports.mk (I will submit this to 
the -current mailing list)

CONFIGURE_HOST?=        ${TARGET_ARCH}-portbld-freebsd${OSREL}
CONFIGURE_HOST:=        ${CONFIGURE_HOST:S/^/--host=/}

between the CONFIGURE_TARGET:=      ${CONFIGURE_TARGET:S/--build=//} and 
CONFIGURE_LOG lines.

I did make other changes to bsd.ports.mk but i don't believe they are 
required here.  Let me know if it seems there is something missing.
----------------------------------------
Bug #37: bsd ports
http://redmine.zrouter.org/issues/37#change-41

Author: Michael Vale
Status: New
Priority: Normal
Assignee: Michael Vale
Category: Project
Target version:


fixed bsd ports make building and install

this is my first attempt at any such contribution to any project.

please find the attached patch for share/mk/zrouter.ports.mk.

ALSO - zrouter/ports/www/zhttpd/distinfo was deleted due to an invalid 
SHA256 sum.



-- 
You have received this notification because you have either subscribed to 
it, or are involved in it.
To change your notification preferences, please click here: 
http://redmine.zrouter.org/my/account 
Received on Fri Nov 02 2012 - 02:05:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:31 UTC