Subject: Re: Bootstrapping...
To: John Franklin <franklin@elfie.bevc.blacksburg.va.us>
From: Greg A. Woods <woods@kuma.web.net>
List: current-users
Date: 03/05/1997 23:51:10
[ On Tue, March 4, 1997 at 16:43:24 (-0500), John Franklin wrote: ]
> Subject: Re: Bootstrapping...
>
> Basically, rebuilding a system should require a very bare minimum from the 
> currently installed system.  NetBSD should be able to build itself without
> needing to patch itself.

Yes!

I think we went through this discussion many moons ago....

Something akin to the GNU makefile's $(top_srcdir) should represent the
top of the source tree and *nothing* in the "make build" should refer to
anything outside of this tree.

I think where my plan partly falls down is some folks think you should
be able to go into /usr/src/usr.bin/systat (to pick on a good example),
type 'make install', and have a new copy installed into the current
running system, even without having first built the necessary bits of
/usr/src/lib.  I agree with them 100%, and I don't think there need be
any conflict.  This could work in one of two ways:

    - if 'make build' is careful to control the setting of -nostdinc -I
    and -nostdlib -L flags as necessary to point into directories of
    dependents the current tree, perhaps through the setting of a single
    variable like $(BUILD_IN_PLACE).

    - to do intermediate installs either to $(DESTDIR) or even a
    set of include and lib build directories within the tree, and then
    set only one over-all default "-nostdinc -I$(DESTDIR)/usr/include"
    and similar for libraries.

The former method should imply that the "build-in-place" flag could be
set by the user at any time to build any sub-system and its dependencies
entirely within the current source tree thus making it possible to have
recursive makes wander about and manage dependencies themselves, albiet
expensively.

The latter requires the top-level 'make build' get the over-all
dependencies right the first time around.  The latter also avoids having
to edit all the makefiles in the tree since it means only adjusting the
default place the build looks for include files and libraries.

My preference is the former though, since it's far more elegant and
enjoys the possibility of being far more *correct*.  It should also be
much easier to maintain since dependency information is localised.

So, yes, I think there should be a happy medium between the "self-
hosting operating system for the sake of the OS alone" P.O.V, and "the
totally encapsulated product" P.O.V.  It may require a bit of makefile
magic that's not yet implemented, but I don't see why it can't be done.
I've devised build systems of similar complexity with just the wimpy old
Augmented Make!  Something akin to 'lint' for makefiles that could check
for cyclic dependencies among a number of interlinked sub-directories
would indeed be an advantage though.

Think of the benefits -- not only would NetBSD be self-hosting, it could
also be built on any other system on which its compiler toolchain either
already existed, or could be installed.  In the best case there could be
a "build-tools" script that would use any capable compiler to build a
locally executable version of make, cc, et al. which could then be used
to re-build itself and the rest of the OS, all within the tree.

I think the current philosophy of self-hosted-only construction is
self-defeating!  ;-)

-- 
							Greg A. Woods

+1 416 443-1734			VE3TCP			robohack!woods
Planix, Inc. <woods@planix.com>; Secrets Of The Weird <woods@weird.com>