Subject: Re: fortune makefiles incorrect ?
To: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
From: Chris G. Demetriou <cgd@netbsd.org>
List: current-users
Date: 09/06/1999 18:21:31
Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us> writes:
> > The host system has bmake, right? So presumably, if its a non-netbsd
> > system, it has Zoularis or the equivalent, and thus, has sys/endian.h
> 
> Uhh, no.
> 
> There's a big difference between being able to build our version of
> make and being able to build enough of NetBSD to make a Zoularis-like
> environment possible..

Right.  In fact, forcing people to install what amounts to, oh, call
it "many" megabytes of crap just to try to do a cross build is silly.

To do a basic cross-build of various chunks of the linux system, you
need:

	* gnu make

	* bash (mostly for the kernel config, as far as I can tell)
	  installed and usable on the host.

	* cross-tools.

	* cross-built glibc for the target (and other special libs,
	  e.g. ncurses, if you want to build programs that want it).
	  (don't need this if you just want to do kernel build.)

	* headers for the target (again, don't need this if you just
	  want to do kernel build).

With this, if you can convince various bits of linux to cross-build at
all, you've got all that you need to build lots of linux programs.
(init, bash (with a bit of hacking) and a config.cache from the
target), mount, network tools, etc.)

Note that, of course, many people will already have gmake and bash
installed.  On the other side of that, note that you do _not_ for
instance need glibc or some gigantic number of headers/libraries
compiled for the host system.

No matter how you cut it at this point, getting a cross-build
environment out of NetBSD is harder than it is out of linux.  (The
integration of so much functionality into glibc means that it's one
stop shopping for all but your kernel includes.  it provides libc,
csu, ld.so, user-land headers for functions it provides, etc.)
However, you still shouldn't need more than:

	* BSD make

	* 'config' which can run on the host

	* a POSIX shell (we shouldn't be assuming custom features of
	  our shells, because we right portable software, right?)

	* cross-tools

	* headers for the target

	* csu, ld.so of choice, libc, libutil, maybe one or two more
	  libraries cross-built for the target.

Note that for _none_ of those, or for anything else required to do
cross-builds, should substantial installation of 'stuff' on the host
system be necessary.  If BSD make isn't portable, then, uh, the right
thing to do is make it portable.  same with config, and the other host
tools we need.


NetBSD has (and other BSD systems have) a real potential advantage
over Linux in the cross-build arena, because the BSDs provide a whole
system.  It's plausible that, with one of the BSDs, you can sit down
and say 'make' and end up with an entire cross-built system with only
the stuff outlined above, some more libaries built for the target
system, and some portable host tools that were built along the way.
Linux can't do that because of the package-here-package-there nature
of the system.

This kind of cross-build "technology" is also the right thing to get
you sane builds of version X+1 from version X of NetBSD itself.  If
the host tools are particularly portable at all, then they're going to
build fine on old versions of NetBSD or other operating systems that
don't have the latest greatest NetBSD-specific features.

Zoularis is a cute hack, but as far as i'm concerned it's just not the
right tool for the job as far as anything related to cross-building is
concerned, including building the host tools.



cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.