[Gd-chatter] r11548 - in trunk/fundev: . admin/builds sources/dfmc/c-run-time sources/system/file-system

agent at gwydiondylan.org agent at gwydiondylan.org
Mon Dec 17 00:18:37 CET 2007


Author: agent
Date: Mon Dec 17 00:18:35 2007
New Revision: 11548

Modified:
   trunk/fundev/Makefile.in
   trunk/fundev/OVERVIEW.txt
   trunk/fundev/README.txt
   trunk/fundev/admin/builds/fdmake.pl
   trunk/fundev/autogen.sh
   trunk/fundev/configure.ac
   trunk/fundev/sources/dfmc/c-run-time/Makefile.in
   trunk/fundev/sources/dfmc/c-run-time/ppc-darwin-build.jam
   trunk/fundev/sources/dfmc/c-run-time/x86-darwin-build.jam
   trunk/fundev/sources/system/file-system/unix-ffi.dylan
Log:
Bug: 7352 7365
Made Open Dylan bootstrappable again after 7352, and also to work on OS X.
* Changed OD build system to avoid linking in existing libraries when building
  new release.
* Changed configure.ac to properly init Mac OS X autotools.
* Documented OS X build process.
* Changed incorrect raw-as-abstract-integer to raw-as-integer in Unix FFI.
* Changed Makefile to only require root during installation and other cleanup.


Modified: trunk/fundev/Makefile.in
==============================================================================
--- trunk/fundev/Makefile.in	(original)
+++ trunk/fundev/Makefile.in	Mon Dec 17 00:18:35 2007
@@ -21,166 +21,164 @@
 
 all:	@bootstrap_target@
 
-1-stage-bootstrap: final-bootstrap
+# 2-stage bootstrap includes both stages 1 and 2.
+# Stage 2 will use compiler built in stage 1.
 
-2-stage-bootstrap: stage-1-bootstrap
-	OPEN_DYLAN_RELEASE_ROOT=$(abs_builddir)/Bootstrap.1 \
-	  $(MAKE) FDCOMPILE="$(abs_builddir)/Bootstrap.1/bin/minimal-console-compiler -build -save" final-bootstrap
-
-3-stage-bootstrap: stage-1-bootstrap stage-2-bootstrap
-	OPEN_DYLAN_RELEASE_ROOT=$(abs_builddir)/Bootstrap.2 \
-	  $(MAKE) FDCOMPILE="$(abs_builddir)/Bootstrap.2/bin/minimal-console-compiler -build -save" final-bootstrap
-
-4-stage-bootstrap: stage-1-bootstrap stage-2-bootstrap stage-3-bootstrap
-	OPEN_DYLAN_RELEASE_ROOT=$(abs_builddir)/Bootstrap.3 \
-	  $(MAKE) FDCOMPILE="$(abs_builddir)/Bootstrap.3/bin/minimal-console-compiler -build -save" final-bootstrap
-
-stage-1-bootstrap: \
-		Bootstrap.1 \
-		Bootstrap.1/lib/$(fd_build)-build.jam \
-		$(srcdir)/sources/bootstrap1-registry \
-		Bootstrap.1/bin/minimal-console-compiler
-
-Bootstrap.1:
-	mkdir Bootstrap.1
-	mkdir Bootstrap.1/build 
-	mkdir Bootstrap.1/logs
-	mkdir Bootstrap.1/bin
-	mkdir Bootstrap.1/lib
+2-stage-bootstrap: BOOTSTRAP_2_COMPILER = \
+	$(abs_builddir)/Bootstrap.1/bin/minimal-console-compiler -build
+2-stage-bootstrap: bootstrap-stage-1 bootstrap-stage-2
+
+# 1-stage bootstrap includes only stage 2.
+# Stage 2 will use existing compiler.
+
+1-stage-bootstrap: BOOTSTRAP_2_COMPILER = \
+	$(FDCOMPILE)
+1-stage-bootstrap: bootstrap-stage-2
+
+# Stage 1 builds a compiler that can understand new primitives etc. used in
+# BOOTSTRAP_1_PRIMITIVE_LIBS libraries. An existing compiler won't understand
+# the new stuff, so until new compiler is built, existing libs are used instead.
+
+BOOTSTRAP_1_PRIMITIVE_LIBS = \
+	dylan functional-extensions machine-word byte-vector \
+	threads transcendentals functional-dylan \
+        common-extensions common-dylan \
+        c-ffi bit-vector bit-set collectors plists set \
+        table-extensions collections streams standard-io \
+        print format format-out io date file-system \
+        operating-system locators settings system \
+        generic-arithmetic big-integers duim-utilities \
+        duim-geometry duim-dcs duim-sheets duim-graphics \
+        duim-layouts duim-gadgets duim-frames duim-core \
+        duim-extended-geometry duim-gadget-panes duim \
+        winsock2 sockets network midi \
+        deuce duim-deuce com ole ole-server sql odbc-ffi \
+        sql-odbc corba-dylan corba-protocol dylan-orb \
+        iop-protocol ir-protocol ir-stubs orb-connections \
+        orb-core orb-iiop orb-ir orb-poa orb-streams \
+        orb-utilities portableserver-protocol \
+        naming-protocol naming-stubs naming-client
 
-Bootstrap.1/lib/$(fd_build)-build.jam: Bootstrap.1 $(srcdir)/$(rt_build)/$(fd_build)-build.jam
+BOOTSTRAP_1_REGISTRY = $(abs_srcdir)/sources/bootstrap1-registry
+
+BOOTSTRAP_1_ENV = \
+	OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
+	OPEN_DYLAN_BUILD_LOGS=$(abs_builddir)/Bootstrap.1/build/logs \
+	OPEN_DYLAN_USER_ROOT=$(abs_builddir)/Bootstrap.1 \
+	OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.1 \
+	OPEN_DYLAN_USER_BUILD=$(abs_builddir)/Bootstrap.1/build \
+	OPEN_DYLAN_USER_REGISTRIES=$(BOOTSTRAP_1_REGISTRY):$(library_srcdir)/registry \
+	OPEN_DYLAN_USER_SOURCES=$(abs_srcdir)/sources
+
+$(abs_builddir)/Bootstrap.1:
+	mkdir $(abs_builddir)/Bootstrap.1
+	mkdir $(abs_builddir)/Bootstrap.1/bin
+	mkdir $(abs_builddir)/Bootstrap.1/lib
+	mkdir $(abs_builddir)/Bootstrap.1/build 
+	mkdir $(abs_builddir)/Bootstrap.1/build/logs
 	cp $(srcdir)/$(rt_build)/$(fd_build)-build.jam \
 	   Bootstrap.1/lib/$(fd_build)-build.jam
 
-BOOTSTRAP1_REGISTRY = $(srcdir)/sources/bootstrap1-registry
-BOOTSTRAP1_LIBS = \
-		dylan functional-extensions machine-word byte-vector \
-		threads transcendentals functional-dylan \
-                common-extensions common-dylan \
-	        c-ffi bit-vector bit-set collectors plists set \
-	        table-extensions collections streams standard-io \
-	        print format format-out io date file-system \
-	        operating-system locators settings system \
-	        generic-arithmetic big-integers duim-utilities \
-	        duim-geometry duim-dcs duim-sheets duim-graphics \
-	        duim-layouts duim-gadgets duim-frames duim-core \
-	        duim-extended-geometry duim-gadget-panes duim \
-	        winsock2 sockets network midi \
-	        deuce duim-deuce com ole ole-server sql odbc-ffi \
-	        sql-odbc corba-dylan corba-protocol dylan-orb \
-	        iop-protocol ir-protocol ir-stubs orb-connections \
-	        orb-core orb-iiop orb-ir orb-poa orb-streams \
-	        orb-utilities portableserver-protocol \
-	        naming-protocol naming-stubs naming-client
-
-$(BOOTSTRAP1_REGISTRY):
-	mkdir $(BOOTSTRAP1_REGISTRY)
-	cp -r $(srcdir)/sources/registry/generic $(BOOTSTRAP1_REGISTRY)
-	cp -r $(srcdir)/sources/registry/$(fd_build) $(BOOTSTRAP1_REGISTRY)
-	for lib in $(BOOTSTRAP1_LIBS); do \
-	  rm -f $(BOOTSTRAP1_REGISTRY)/generic/$$lib; \
-	  rm -f $(BOOTSTRAP1_REGISTRY)/$(fd_build)/$$lib; \
+$(BOOTSTRAP_1_REGISTRY):
+	mkdir $(BOOTSTRAP_1_REGISTRY)
+	cp -r $(srcdir)/sources/registry/generic $(BOOTSTRAP_1_REGISTRY)
+	cp -r $(srcdir)/sources/registry/$(fd_build) $(BOOTSTRAP_1_REGISTRY)
+	for lib in $(BOOTSTRAP_1_PRIMITIVE_LIBS); do \
+	  rm -f $(BOOTSTRAP_1_REGISTRY)/generic/$$lib; \
+	  rm -f $(BOOTSTRAP_1_REGISTRY)/$(fd_build)/$$lib; \
 	done
 
-Bootstrap.1/bin/minimal-console-compiler:
-	@echo Building stage 1 bootstrap...
-	@OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
-	  OPEN_DYLAN_BUILD_LOGS=$(abs_builddir)/Bootstrap.1/logs \
-	  OPEN_DYLAN_USER_ROOT=$(abs_builddir)/Bootstrap.1 \
-	  OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.1 \
-	  OPEN_DYLAN_USER_REGISTRIES=$(BOOTSTRAP1_REGISTRY) \
-	  OPEN_DYLAN_USER_SOURCES=$(abs_srcdir)/sources \
-	  OPEN_DYLAN_USER_BUILD=$(abs_builddir)/Bootstrap.1/build \
+$(abs_builddir)/Bootstrap.1/bin/minimal-console-compiler:
+	@echo Building Open Dylan bootstrap stage 1...
+	@OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.1 \
+	  $(MAKE) -C $(rt_build) install
+	@$(BOOTSTRAP_1_ENV) \
 	  $(fdmake) --compiler="$(FDCOMPILE)" minimal-console-compiler
 
-stage-2-bootstrap: Bootstrap.2 Bootstrap.2/bin/minimal-console-compiler
+bootstrap-stage-1: \
+		$(abs_builddir)/Bootstrap.1 \
+		$(BOOTSTRAP_1_REGISTRY) \
+		$(abs_builddir)/Bootstrap.1/bin/minimal-console-compiler
 
-Bootstrap.2:
-	mkdir Bootstrap.2
-	mkdir Bootstrap.2/build 
-	mkdir Bootstrap.2/logs
-	mkdir Bootstrap.2/bin
-	mkdir Bootstrap.2/lib
-	mkdir Bootstrap.2/lib/runtime
+# Stage 2 bootstrap builds altered libraries and compiler and does not link to
+# any existing or stage 1 libraries.
 
-Bootstrap.2/bin/minimal-console-compiler: stage-1-bootstrap
-	@echo Building stage 2 bootstrap...
+BOOTSTRAP_2_ENV = \
+	OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
+	OPEN_DYLAN_BUILD_LOGS=$(abs_builddir)/Bootstrap.2/build/logs \
+	OPEN_DYLAN_USER_ROOT=$(abs_builddir)/Bootstrap.2 \
 	OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.2 \
+	OPEN_DYLAN_USER_BUILD=$(abs_builddir)/Bootstrap.2/build \
+	OPEN_DYLAN_USER_REGISTRIES=$(abs_srcdir)/sources/registry:$(library_srcdir)/registry \
+	OPEN_DYLAN_USER_SOURCES=$(abs_srcdir)/sources
+
+$(abs_builddir)/Bootstrap.2:
+	mkdir $(abs_builddir)/Bootstrap.2
+	mkdir $(abs_builddir)/Bootstrap.2/bin
+	mkdir $(abs_builddir)/Bootstrap.2/lib
+	mkdir $(abs_builddir)/Bootstrap.2/build 
+	mkdir $(abs_builddir)/Bootstrap.2/build/logs
+
+$(abs_builddir)/Bootstrap.2/bin/minimal-console-compiler:
+	@echo Building Open Dylan bootstrap stage 2...
+	@OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.2 \
 	  $(MAKE) -C $(rt_build) install
-	@OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
-	  OPEN_DYLAN_RELEASE_ROOT=$(abs_builddir)/Bootstrap.2 \
-	  OPEN_DYLAN_RELEASE_INSTALL=$(abs_builddir)/Bootstrap.2 \
-	  OPEN_DYLAN_BUILD_LOGS=$(abs_builddir)/Bootstrap.2/logs \
-	  OPEN_DYLAN_USER_ROOT=$(abs_builddir)/Bootstrap.2 \
-	  OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.2 \
-	  OPEN_DYLAN_USER_REGISTRIES=$(abs_srcdir)/sources/registry \
-	  OPEN_DYLAN_USER_SOURCES=$(abs_srcdir)/sources \
-	  OPEN_DYLAN_USER_BUILD=$(abs_builddir)/Bootstrap.2/build \
-	  $(fdmake) --compiler="Bootstrap.1/bin/minimal-console-compiler -build -save" \
-		    minimal-console-compiler
-
-stage-3-bootstrap: Bootstrap.3 Bootstrap.3/bin/minimal-console-compiler
-
-Bootstrap.3:
-	mkdir Bootstrap.3
-	mkdir Bootstrap.3/build 
-	mkdir Bootstrap.3/logs
-	mkdir Bootstrap.3/bin
-	mkdir Bootstrap.3/lib
-	mkdir Bootstrap.3/lib/runtime
-
-Bootstrap.3/bin/minimal-console-compiler: stage-2-bootstrap
-	@echo Building stage 3 bootstrap...
-	OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.3 \
-	  $(MAKE) -C $(rt_build) install
-	@OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
-	  OPEN_DYLAN_RELEASE_ROOT=$(abs_builddir)/Bootstrap.2 \
-	  OPEN_DYLAN_BUILD_LOGS=$(abs_builddir)/Bootstrap.3/logs \
-	  OPEN_DYLAN_USER_ROOT=$(abs_builddir)/Bootstrap.3 \
-	  OPEN_DYLAN_USER_INSTALL=$(abs_builddir)/Bootstrap.3 \
-	  OPEN_DYLAN_USER_REGISTRIES=$(abs_srcdir)/sources/registry \
-	  OPEN_DYLAN_USER_SOURCES=$(abs_srcdir)/sources \
-	  OPEN_DYLAN_USER_BUILD=$(abs_builddir)/Bootstrap.3/build \
-	  $(fdmake) --compiler="Bootstrap.2/bin/minimal-console-compiler -build -save" \
-		    minimal-console-compiler
-
-Bootstrap.final:
-	mkdir Bootstrap.final
-	mkdir Bootstrap.final/build 
-	mkdir Bootstrap.final/logs
-	-mkdir $(prefix)
-	-mkdir $(prefix)/bin
-	-mkdir $(prefix)/lib
-	-mkdir $(prefix)/lib/runtime
+	@$(BOOTSTRAP_2_ENV) \
+	  $(fdmake) --compiler="$(BOOTSTRAP_2_COMPILER)" minimal-console-compiler
+
+bootstrap-stage-2: \
+		$(abs_builddir)/Bootstrap.2 \
+		$(abs_builddir)/Bootstrap.2/bin/minimal-console-compiler
+		
+# Install stage builds libraries and compiler using stage 2 products, taking
+# advantage of any new optimizations etc. in this release.
 
-FINAL_ENV = \
+INSTALL_ENV = \
 	OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
-	OPEN_DYLAN_BUILD_LOGS=$(abs_builddir)/Bootstrap.final/logs \
-	OPEN_DYLAN_USER_ROOT=$(abs_builddir)/Bootstrap.final \
+	OPEN_DYLAN_BUILD_LOGS=$(prefix)/build/logs \
+	OPEN_DYLAN_USER=$(prefix) \
+	OPEN_DYLAN_USER_ROOT=$(prefix) \
 	OPEN_DYLAN_USER_INSTALL=$(prefix) \
-	OPEN_DYLAN_USER_REGISTRIES=$(abs_srcdir)/sources/registry:$(library_srcdir)/registry \
-	OPEN_DYLAN_USER_SOURCES=$(abs_srcdir)/sources \
-	OPEN_DYLAN_USER_BUILD=$(abs_builddir)/Bootstrap.final/build
-
-FINAL_LIBRARIES = \
-	minimal-console-compiler
+	OPEN_DYLAN_USER_BUILD=$(prefix)/build \
+	OPEN_DYLAN_USER_REGISTRIES=$(prefix)/sources/registry:$(library_srcdir)/registry \
+	OPEN_DYLAN_USER_SOURCES=$(prefix)/sources
+
+INSTALL_LIBRARIES = minimal-console-compiler
+
+INSTALL_LIBRARY_PACKS = @LIBRARY_PACKS@
+
+$(prefix):
+	mkdir $(prefix)
+	mkdir $(prefix)/bin
+	mkdir $(prefix)/lib
+	mkdir $(prefix)/build
+	mkdir $(prefix)/build/logs
+	@echo Copying sources...
+	cp -R $(abs_srcdir)/sources $(prefix)
+	@echo Removing unnecessary directories...
+	find -d $(prefix)/sources -name '.*' -exec rm -r {} \;
+	-rm -r $(prefix)/sources/boostrap1-registry
 
-final-bootstrap: Bootstrap.final
-	@echo Building final stage bootstrap...
+install-stage: $(prefix)
+	@echo Building Open Dylan installation...
 	OPEN_DYLAN_USER_INSTALL=$(prefix) \
 	  $(MAKE) -C $(rt_build) install
-	@$(FINAL_ENV) $(fdmake) --compiler="$(FDCOMPILE)" \
-		$(FINAL_LIBRARIES) --library-packs="$(LIBRARY_PACKS)"
+	@$(INSTALL_ENV) \
+	  $(fdmake) \
+	  --compiler="$(abs_builddir)/Bootstrap.2/bin/minimal-console-compiler -build" \
+	  $(INSTALL_LIBRARIES) --library-packs="$(INSTALL_LIBRARY_PACKS)"
 
-install: all
+install: install-stage
 
 uninstall:
+	rm -rv $(prefix)
 
 install-strip:
 
 clean:
-	rm -rf Bootstrap.1 Bootstrap.2 Bootstrap.3 Bootstrap.final
-	rm -rf $(srcdir)/sources/bootstrap1-registry
+	rm -rf $(abs_builddir)/Bootstrap.1
+	rm -rf $(abs_builddir)/Bootstrap.2
+	rm -rf $(BOOTSTRAP_1_REGISTRY)
 
 distclean:
 
@@ -192,7 +190,7 @@
 
 dist:
 
-CHECK_STAGE = 3
+CHECK_STAGE = 2
 
 CHECK_APPS = \
 	libraries-test-suite-app \
@@ -201,7 +199,7 @@
 	deuce-test-suite-app \
 	channels-tests
 
-check:	stage-$(CHECK_STAGE)-bootstrap
+check:	bootstrap-$(CHECK_STAGE)-stage
 	@OPEN_DYLAN_PLATFORM_NAME=$(fd_build) \
 	  OPEN_DYLAN_RELEASE_ROOT=$(abs_builddir)/Bootstrap.$(CHECK_STAGE) \
 	  OPEN_DYLAN_RELEASE_INSTALL=$(abs_builddir)/Bootstrap.$(CHECK_STAGE) \

Modified: trunk/fundev/OVERVIEW.txt
==============================================================================
--- trunk/fundev/OVERVIEW.txt	(original)
+++ trunk/fundev/OVERVIEW.txt	Mon Dec 17 00:18:35 2007
@@ -11,7 +11,7 @@
 MPS  - A memory management system. When using a HARP back-end, MPS manages
        garbage collection. When using a C back-end, the Boehm GC library
        manages garbage collection.
-DFM  - Data flow model.
+DFM  - Dylan Flow Machine.
 DFMC - 
 HARP - An artificial assembly language. HARP code is transformed into the
        target processor's actual assembly language. The other back-ends are

Modified: trunk/fundev/README.txt
==============================================================================
--- trunk/fundev/README.txt	(original)
+++ trunk/fundev/README.txt	Mon Dec 17 00:18:35 2007
@@ -7,6 +7,7 @@
 Source version.
 
 
+
 WHAT WAS OPEN SOURCED
 
 Everything except for the files necessary to build Windows installers
@@ -18,6 +19,7 @@
 built separately.
 
 
+
 HOW TO BUILD ON WINDOWS
 
 First build the garbage collector.  See the section on BUILDING THE
@@ -39,19 +41,19 @@
 Install the latest binary release of Open Dylan from
 http://www.opendylan.org/downloading.phtml
 
-svn co svn://anonsvn.gwydiondylan.org/scm/svn/dylan/trunk/fundev fundev
-export SRCDIR=`pwd`/fundev        # must be absolute path!
-export BUILDDIR=<your build dir>
+  svn co svn://anonsvn.gwydiondylan.org/scm/svn/dylan/trunk/fundev fundev
+  export SRCDIR=`pwd`/fundev        # must be absolute path!
+  export BUILDDIR=<your build dir>
 
 Build the MPS and copy it into the Open Dylan source tree (see below).
 
-cd $SRCDIR
-./autogen.sh
+  cd $SRCDIR
+  ./autogen.sh
 
-cd $BUILDDIR
-$SRCDIR/configure --with-mps=/path/to/mps-kit                   [1][2]
+  cd $BUILDDIR
+  $SRCDIR/configure --with-mps=/path/to/mps-kit                   [1][2]
               # you must call configure with absolute path!
-make
+  make
 
 [1] Note that the directory --with-mps wants here is the one containing the
     "code" directory.  If you downloaded the MPS kit from Ravenbrook this
@@ -62,6 +64,44 @@
     first "sudo apt-get install libexpat-dev".  --cgay 20061104
 
 
+
+HOW TO BUILD ON DARWIN OR MAC OS X
+
+Install the latest binary release of Open Dylan from
+http://www.opendylan.org/downloads/opendylan. Ensure the release's bin
+directory is in your path.
+
+Install the expat library, followed by the XML::Parser Perl module. For the
+expat library, you can use a package manager like MacPorts or Fink. For the
+XML::Parser module, use CPAN:
+
+  sudo cpan XML::Parser
+
+Download, make, and install the Boehm garbage collection library. On the Mac,
+Open Dylan uses that instead of the MPS library. I used the following
+configure settings:
+
+  ./configure --disable-dependency-tracking --enable-parallel-mark 
+    --enable-large-config --enable-gc-debug USE_I686_PREFETCH=1
+
+Download the Open Dylan source tree, containing this file and the "sources"
+directory, from SVN as described on http://www.opendylan.org/repository.phtml.
+
+In the directory of the downloaded source tree, run these commands (set the
+prefix to whatever you want):
+
+  ./autogen.sh
+  ./configure --prefix=/usr/local/opendylan
+  make
+  sudo make install
+
+Ignore any errors printed by autogen.sh. The build process may freeze; if
+several minutes pass without any progress, cancel the build with ^C and re-run
+the last command. After installation is complete, don't forget to remove the
+binary release's bin directory from your path.
+
+
+
 GENERAL BUILD INSTRUCTIONS
 
 If you encounter problems during the build, please refer to the log

Modified: trunk/fundev/admin/builds/fdmake.pl
==============================================================================
--- trunk/fundev/admin/builds/fdmake.pl	(original)
+++ trunk/fundev/admin/builds/fdmake.pl	Mon Dec 17 00:18:35 2007
@@ -29,107 +29,220 @@
 my $compiler = 'fdcompile';
 my @library_packs;
 &GetOptions('verbose' => \$verbose,
-	    'debugger' => \$debugger,
-	    'compiler=s' => \$compiler,
-	    'library-pack=s' => \@library_packs,
-	    'library-packs=s' => sub {
-		push @library_packs, split(/\W+/, $_[1]);
-	    });
+            'debugger' => \$debugger,
+            'compiler=s' => \$compiler,
+            'library-pack=s' => \@library_packs,
+            'library-packs=s' => sub {
+                push @library_packs, split(/\W+/, $_[1]);
+            });
+
+# When a library is loaded for use, it opens dependent libraries. These are
+# the libraries used in its build. We want to make a new release's libraries
+# depend only on other new release libraries.
+#
+# To do this, evaluate dependencies. Build the library that depends on no
+# others first, followed by other libraries that depend only on it in turn.
+#
+# Bootstrap stage 1 removes a bunch of registry entries, forcing those libs to
+# fill their dependencies with older libraries. Because the registry entries
+# are missing, their dependencies can't be found. This is expected, so those
+# STDERRs are only printed in verbose mode.
 
 my %built;
 my %deps;
+my %lidfiles;
+my %lidfile_dirs;
 
+print "Evaluating dependencies... ";
 foreach my $library (@ARGV) {
-    if(!&build_library($library)) {
-	print STDERR "fdmake: Unable to build library $library\n";
-	exit 1;
+    if(!&find_library_deps($library)) {
+        print STDERR "\nfdmake: Unable to evaluate dependencies for library " .
+            "$library\n";
+        exit 1;
     }
 }
 foreach my $pack (@library_packs) {
-    &build_library_pack($pack);
+    &find_library_pack_deps($pack);
+}
+foreach my $lib (keys(%deps)) {
+    &expand_library_deps($lib);
+}
+print "done\n";
+
+my @build_order = sort { @{$deps{$a}} <=> @{$deps{$b}} } keys(%deps);
+if ($verbose) {
+    foreach my $lib (@build_order) {
+        print "$lib : ";
+        foreach my $deplib ( $deps{$lib} ) {
+            print "@{$deplib}";
+        }
+        print "\n";
+    }
+}
+
+foreach my $library (@build_order) {
+    if(!&build_library($library)) {
+        print STDERR "\nfdmake: Unable to build library $library\n";
+        exit 1;
+    }
 }
+
 exit 0;
 
-# build_library($library)
+# find_library_deps($library)
 #
-# Builds the given libraries from source
+# Find dependent libraries and put in %deps.
 #
-sub build_library {
+# Returns 0 if could not evaluate.
+#
+sub find_library_deps {
     my ($library) = @_;
 
-    return $built{$library} if exists $built{$library};
-
+    # Find the lid file for this library.
     my $separator = quotemeta(($Config{'osname'} eq 'MSWin32') ? ';' : ':');
     my $lidfile;
     my $dir;
   REGISTRY:
     foreach my $registry (split /$separator/, $user_registries) {
-	open(REGISTRY, '<', "$registry/$platform_name/$library")
-	    || open(REGISTRY, '<', "$registry/generic/$library")
-	    || next REGISTRY;
-	my $line = <REGISTRY>;
-	close(REGISTRY);
-
-	my ($volume, $directories, undef) = File::Spec->splitpath($registry, 1);
-	my @directories = File::Spec->splitdir($directories);
-
-	lc(pop(@directories)) eq 'registry' or die;
-
-	# abstract://dylan/environment/console/minimal-console-compiler.lid
-	$line =~ s|^abstract://dylan/||;
-	($dir, $lidfile) = ($line =~ m|(.*)/(.*)|);
-	push @directories, File::Spec::Unix->splitdir($dir);
-	$dir = File::Spec->catpath($volume,
-				   File::Spec->catdir(@directories), '');
-	$lidfile = File::Spec->catfile($dir, $lidfile);
-	last REGISTRY;
+        if (!open(REGISTRY, '<', "$registry/$platform_name/$library")
+            && !open(REGISTRY, '<', "$registry/generic/$library")) {
+            print STDERR "fdmake: No registry entry for $library in " .
+                "$registry/$platform_name or $registry/generic\n" if $verbose;
+            next REGISTRY;
+        }
+        my $line = <REGISTRY>;
+        close(REGISTRY);
+
+        my ($volume, $directories, undef) = File::Spec->splitpath($registry, 1);
+        my @directories = File::Spec->splitdir($directories);
+
+        lc(pop(@directories)) =~ /(bootstrap1-)?registry/ or die;
+
+        # abstract://dylan/environment/console/minimal-console-compiler.lid
+        $line =~ s|^abstract://dylan/||;
+        ($dir, $lidfile) = ($line =~ m|(.*)/(.*)|);
+        push @directories, File::Spec::Unix->splitdir($dir);
+        $dir = File::Spec->catpath($volume,
+                                   File::Spec->catdir(@directories), '');
+        $lidfile = File::Spec->catfile($dir, $lidfile);
+        last REGISTRY;
     }
 
     if (!defined $lidfile) {
-	return 0;
+        return 0;
     }
 
+    $lidfiles{$library} = $lidfile;
+    $lidfile_dirs{$library} = $dir;
     my $header = &parse_lid_file($lidfile);
-    
+
+    # Scan the source code files and populate %deps for each defined library.
+    if (!exists $deps{$library}) {
+        $deps{$library} = [];
+    }
     &scan_lidfile($lidfile, $header, $dir);
 
-    my $needs_rebuild = !-f "$user_root/lib/lib${library}.${library_extension}";
+    # Now do library's dependecies.
+    foreach my $dep (@{$deps{$library}}) {
+        next if exists $deps{$dep};
+        if (&find_library_deps($dep) == 0) {
+            print STDERR "fdmake: Unable to evaluate dependencies of ".
+                "library $dep, which $library depends on\n" if $verbose;
+        }
+    }
+
+    return 1;
+}
+
+# expand_library_deps
+# 
+# With a complete list of libraries' dependencies, expand recursively.
+#
+sub expand_library_deps {
+    my ($library) = @_;
+    my $deplist = $deps{$library};
+    my $addl_dep;
+
+    do {
+        # Get dependencies of library's dependencies.
+        my @deps_of_deps = ();
+        foreach my $dep (@$deplist) {
+            # Skip if no dependencies of dependencies found.
+            next if !exists $deps{$dep};
+            push @deps_of_deps, @{$deps{$dep}};
+        }
+        
+        # Add to library's dependencies if not already listed.
+        $addl_dep = 0;
+      DEP_OF_DEPS:
+        foreach my $dep (@deps_of_deps) {
+            foreach my $curr_dep (@$deplist) {
+                next DEP_OF_DEPS if $dep eq $curr_dep;
+            }
+            push @$deplist, $dep;
+            $addl_dep = 1;
+        }
+    } while $addl_dep;  # Loop until all dependents-of-dependents are listed.
+}
+
+# build_library($library)
+#
+# Builds the given libraries from source
+#
+# Returns 0 if could not build, 1 if already built, 2 if build succeeded.
+#
+sub build_library {
+    my ($library) = @_;
 
+    return $built{$library} if exists $built{$library};
+    return 0 if !exists $lidfiles{$library};
+
+    my $lidfile = $lidfiles{$library};
+    my $dir = $lidfile_dirs{$library};
+    my $header = &parse_lid_file($lidfile);
+
+    # This library needs to be built if it doesn't exist.
+    my $needs_rebuild = !-f "$user_install/lib/lib${library}.${library_extension}";
+
+    # If it does exist, try to rebuild prereq. libraries. If any of them are
+    # rebuilt, this library also needs to be rebuilt.
     if(defined $deps{$library}) {
-	foreach my $dep (@{$deps{$library}}) {
-	    if(&build_library($dep) > 1) {
-		$needs_rebuild = 1;
-	    }
-	}
+        foreach my $dep (@{$deps{$library}}) {
+            if(&build_library($dep) > 1) {
+                $needs_rebuild = 1;
+            }
+        }
     }
 
+    # Double-check date and return if this library still doesn't need rebuild.
     if(!$needs_rebuild) {
-	my $libdate = (stat "$user_root/lib/lib${library}.${library_extension}")[9];
-	foreach my $source (split /\s+/, $$header{'files'}) {
-	    unless($source =~ /\.dylan$/) {
-		$source = "$source.dylan";
-	    }
-	    $source = File::Spec->catfile($dir, $source);
-	    my $srcdate = (stat $source)[9]
-		|| die "Library $library source file '$source' does not exist";
-	    if($srcdate > $libdate) {
-		print "$source causes rebuild of $library\n";
-		$needs_rebuild = 1;
-	    }
-	}
-	if(!$needs_rebuild) {
-	    $built{$library} = 1;
-	    return 1;
-	}
+        my $libdate = (stat "$user_install/lib/lib${library}.${library_extension}")[9];
+        foreach my $source (split /\s+/, $$header{'files'}) {
+            unless($source =~ /\.dylan$/) {
+                $source = "$source.dylan";
+            }
+            $source = File::Spec->catfile($dir, $source);
+            my $srcdate = (stat $source)[9]
+                || die "Library $library source file '$source' does not exist";
+            if($srcdate > $libdate) {
+                print "$source causes rebuild of $library\n";
+                $needs_rebuild = 1;
+            }
+        }
+        if(!$needs_rebuild) {
+            $built{$library} = 1;
+            return 1;
+        }
     }
 
+    # Process any *.spec files.
     my $other_files = $$header{'other-files'};
     if(defined $other_files) {
-	foreach my $spec (split /\s+/, $other_files) {
-	    if($spec =~ /\.spec$/) {
-		&invoke_tool($library, $dir, File::Spec->catfile($dir, $spec));
-	    }
-	}
+        foreach my $spec (split /\s+/, $other_files) {
+            if($spec =~ /\.spec$/) {
+                &invoke_tool($library, $dir, File::Spec->catfile($dir, $spec));
+            }
+        }
     }
 
     print "Building $library... ";
@@ -139,43 +252,55 @@
     $command .= " $library";
 
     if(defined $build_logs && !$debugger) {
-	$command .= " >$build_logs/compile-$library.txt";
+        $command .= " >$build_logs/compile-$library.txt";
     }
 
+    # Compile and check compilation.
     system $command || die "Couldn't execute $compiler";
-    if($? != 0
-       || !(-f "$user_root/lib/lib${library}.${library_extension}"
-	    || -f "$user_root/bin/$library")) {
-	print "\n";
-	if(defined $build_logs && !$debugger) {
-	    print STDERR
-		"fdmake: compile failed ($?), see ",
-		"$build_logs/compile-$library.txt\n";
-	}
-	else {
-	    print STDERR "fdmake: compile failed\n";
-	}
-	exit 1;
+
+    if($? != 0) {
+        print "\n";
+        if(defined $build_logs && !$debugger) {
+            print STDERR
+                "fdmake: compile failed ($?), see " .
+                "$build_logs/compile-$library.txt\n";
+        }
+        else {
+            print STDERR "fdmake: compile failed\n";
+        }
+        exit 1;
     }
+    
+    if(!-f "$user_install/lib/lib$library.$library_extension"
+       && !-f "$user_install/bin/$library") {
+        print "\n";
+        print STDERR
+                "fdmake: build succeeded but library not found under " .
+                "$user_install/lib/lib$library.$library_extension " . 
+                "or $user_install/bin/$library\n";
+        exit 1;
+    }
+    
     $built{$library} = 2;
 
+    # Print warnings, serious warnings, errors found.
     if(defined $build_logs && !$debugger) {
-	my $warnings = 0;
-	my $serious_warnings = 0;
-	my $errors = 0;
-	open(LOGFILE, '<', "$build_logs/compile-$library.txt")
-	    || die "Couldn't open logfile: $!";
-	while(<LOGFILE>) {
-	    if(m|There were (\d+) warnings, (\d+) serious warnings and (\d+) errors|) {
-		$warnings += $1;
-		$serious_warnings += $2;
-		$errors += $3;
-	    }
-	}
-	close(LOGFILE);
-	print "${warnings} W, ${serious_warnings} SW, ${errors} E\n";
+        my $warnings = 0;
+        my $serious_warnings = 0;
+        my $errors = 0;
+        open(LOGFILE, '<', "$build_logs/compile-$library.txt")
+            || die "Couldn't open logfile: $!";
+        while(<LOGFILE>) {
+            if(m|There were (\d+) warnings, (\d+) serious warnings and (\d+) errors|) {
+                $warnings += $1;
+                $serious_warnings += $2;
+                $errors += $3;
+            }
+        }
+        close(LOGFILE);
+        print "${warnings} W, ${serious_warnings} SW, ${errors} E\n";
     } else {
-	print "\n";
+        print "\n";
     }
 
     return 2;
@@ -197,27 +322,28 @@
     print "Invoking the $origin tool for the $library library\n";
 
     if($origin =~ /\s*parser\s*/i) {
-	&build_library('parser-compiler') || die "Can't build parser-compiler";
+        &build_library('parser-compiler') || die "Can't build parser-compiler";
 
-	my $source = File::Spec->catfile($dir, $$header{'parser'});
-	my $output = File::Spec->catfile($dir, $$header{'output'});
-	
-	system "$user_root/bin/parser-compiler $source $output";
-	if($? !=0 || ! -f $output) {
-	    print STDERR "\nfdmake: Unable to build parser file\n";
-	    exit 1;
-	}
+        my $source = File::Spec->catfile($dir, $$header{'parser'});
+        my $output = File::Spec->catfile($dir, $$header{'output'});
+        
+        system "$user_install/bin/parser-compiler $source $output";
+        if($? !=0 || ! -f $output) {
+            print STDERR "\nfdmake: Unable to build parser file\n";
+            exit 1;
+        }
     } else {
-	print STDERR "\nfdmake: unknown tool: $origin\n";
-	exit 1;
+        print STDERR "\nfdmake: unknown tool: $origin\n";
+        exit 1;
     }
 }
 
-# build_library_pack($pack)
+# find_library_pack_deps($pack)
 #
-# Builds the libraries that constitute the given library pack
+# Find dependencies of libraries that constitute the given library pack and
+# put in %deps.
 #
-sub build_library_pack {
+sub find_library_pack_deps {
     my ($lp) = @_;
 
     my $lclp = lc($lp);
@@ -225,8 +351,8 @@
     my $dlpfile = "$user_sources/Library-Packs/$lp/$lclp.dlp";
 
     if(! -f $dlpfile) {
-	print STDERR "fdmake: There is no library pack named $lp\n";
-	exit 1;
+        print STDERR "fdmake: There is no library pack named $lp\n";
+        exit 1;
     }
 
     my $parser = new XML::Parser(Handlers => {Start => \&handle_dlp_start});
@@ -236,21 +362,23 @@
 my $category = 'none';
 sub handle_dlp_start {
     my ($parser, $element, %attributes) = @_;
-
+    my $libpack;
+    
     if($element eq 'library-pack') {
-	print "Building $attributes{'title'} library-pack...\n";
+        $libpack = $attributes{'title'};
     } elsif($element eq 'libraries'
-	    || $element eq 'examples'
-	    || $element eq 'test-suites') {
-	$category = $element;
+            || $element eq 'examples'
+            || $element eq 'test-suites') {
+        $category = $element;
     } elsif($element eq 'library') {
-	if($category eq 'libraries') {
-	    if(!&build_library($attributes{'name'})) {
-		print STDERR
-		    "fdmake: Unable to build library $attributes{'name'}\n";
-		exit 1;
-	    }
-	}
+        if($category eq 'libraries') {
+            if(!&find_library_deps($attributes{'name'})) {
+                print STDERR
+                    "fdmake: Unable to evaluate dependecies of library ".
+                    "$attributes{'name'} of library-pack $libpack\n" if $verbose;
+                exit 1;
+            }
+        }
     }
 }
 
@@ -266,22 +394,22 @@
     my $library = lc($$header{'library'});
 
     if(!defined $library) {
-	print STDERR "$lidfile: no `library:' keyword\n";
-	return;
+        print STDERR "$lidfile: no `library:' keyword\n";
+        return;
     }
 
     if($library eq 'dylan' || !defined $$header{'files'}) {
-	return;
+        return;
     }
 
     foreach my $source (split /\s+/, $$header{'files'}) {
-	if($source !~ /.*\.dylan$/i) {
-	    $source .= ".dylan";
-	}
-	$source = File::Spec->catfile($dir, $source);
-	if(!&scan_dylan_user($source, $dir, $library)) {
-	    return;
-	}
+        if($source !~ /.*\.dylan$/i) {
+            $source .= ".dylan";
+        }
+        $source = File::Spec->catfile($dir, $source);
+        if(!&scan_dylan_user($source, $dir, $library)) {
+            return;
+        }
     }
 }
 
@@ -298,66 +426,66 @@
     my @useds;
 
     unless(open(SOURCE, '<', $source)) {
-	print STDERR "can't open $source";
-	return 0;
+        print STDERR "can't open $source";
+        return 0;
     }
 
     my $header = &parse_header(\*SOURCE, $source);
     my $module = $$header{'module'};
     if(!defined $module || $module !~ /dylan-user/i) {
-	close(SOURCE);
-	return 0;
+        close(SOURCE);
+        return 0;
     }
     #print STDERR "Scanning Dylan-user: $source\n";
     $_ = '';
 
     while(my $token = &dylan_token(\*SOURCE)) {
-	if($token !~ /^define$/i) {
-	    print STDERR "$source: didn't expect '$token' here\n";
-	    close(SOURCE);
-	    return 0;
-	}
-	$token = &dylan_token(\*SOURCE);
-	if($token =~ /^module$/i) {
-	    while(($token = &dylan_token(\*SOURCE)) && $token !~ /^end$/i) {
-	    }
-	    while(($token = &dylan_token(\*SOURCE)) && $token ne ';') {
-	    }
-	    next;
-	} elsif($token !~ /^library$/i) {
-	    print STDERR "$source: didn't expect 'define $token' here\n";
-	    close(SOURCE);
-	    return 0;
-	}
-	my $deflibrary = &dylan_token(\*SOURCE);
-	$deflibrary =~ y/A-Z/a-z/;
-	if($deflibrary ne $library) {
-	    print STDERR $source, ": did not expect ";
-	    print STDERR "define library $deflibrary ";
-	    print STDERR "in library $library\n";
-	    close(SOURCE);
-	    return 0;
-	}
-
-	CLAUSE:
-	while(($token = &dylan_token(\*SOURCE)) && $token !~ /^end$/i) {
-	    if($token =~ /^use$/i) {
-		my $used = &dylan_token(\*SOURCE);
-		$used =~ y/A-Z/a-z/;
-		&use_library($used, $dir, $library);
-	    } elsif($token !~ /^export$/i) {
-		print STDERR "$source: didn't expect '$token' here\n";
-		close(SOURCE);
-		return 0;
-	    }
-	    while(($token = &dylan_token(\*SOURCE)) && $token ne ';') {
-		if($token =~ /^end$/i) {
-		    last CLAUSE;
-		}
-	    }
-	}
-	close(SOURCE);
-	return 0;
+        if($token !~ /^define$/i) {
+            print STDERR "$source: didn't expect '$token' here\n";
+            close(SOURCE);
+            return 0;
+        }
+        $token = &dylan_token(\*SOURCE);
+        if($token =~ /^module$/i) {
+            while(($token = &dylan_token(\*SOURCE)) && $token !~ /^end$/i) {
+            }
+            while(($token = &dylan_token(\*SOURCE)) && $token ne ';') {
+            }
+            next;
+        } elsif($token !~ /^library$/i) {
+            print STDERR "$source: didn't expect 'define $token' here\n";
+            close(SOURCE);
+            return 0;
+        }
+        my $deflibrary = &dylan_token(\*SOURCE);
+        $deflibrary =~ y/A-Z/a-z/;
+        if($deflibrary ne $library) {
+            print STDERR $source, ": did not expect ";
+            print STDERR "define library $deflibrary ";
+            print STDERR "in library $library\n";
+            close(SOURCE);
+            return 0;
+        }
+
+        CLAUSE:
+        while(($token = &dylan_token(\*SOURCE)) && $token !~ /^end$/i) {
+            if($token =~ /^use$/i) {
+                my $used = &dylan_token(\*SOURCE);
+                $used =~ y/A-Z/a-z/;
+                &use_library($used, $dir, $library);
+            } elsif($token !~ /^export$/i) {
+                print STDERR "$source: didn't expect '$token' here\n";
+                close(SOURCE);
+                return 0;
+            }
+            while(($token = &dylan_token(\*SOURCE)) && $token ne ';') {
+                if($token =~ /^end$/i) {
+                    last CLAUSE;
+                }
+            }
+        }
+        close(SOURCE);
+        return 0;
     }
 
     close(SOURCE);
@@ -372,49 +500,49 @@
 sub dylan_token {
     my ($fh) = @_;
     while(1) {
-	s|^\s+||;
-	if($_ eq '') {
-	    defined($_ = <$fh>) || return undef;
-	    chop;
-	    next;
-	} elsif(s|^//.*||) {
-	    next;
-	} elsif(s|^/\*||) {
-	    my $level = 1;
-	    while($level > 0) {
-		if($_ eq '') {
-		    defined($_ = <$fh>) || return undef;
-		    chop;
-		    next;
-		}
-		s%^([^/*]|/[^*]|\*[^/])*%%;
-		s%^[/*]$%%;
-		if(s%\*/%%) {
-		    --$level;
-		} elsif(s%/\*%%) {
-		    ++$level;
-		}
-	    }
-	    next;
-	} elsif(s|^([,;{}])||) {
-	    return $1;
-	} elsif(s|^(=>)||) {
-	    return $1;
-	} elsif(s|^\\?(([!&*<>;\|^\$%\@_][-0-9~&*<>\|^\$%\@_+~?/=]*)?[a-zA-Z][-a-zA-Z0-9~&!*<>\|^\$%\@_+~?/=]*:?)||) {
-	    return $1;
-	} elsif(s|^\\?([0-9][-0-9~&*<>\|^\$%\@_+~?/=]*([a-zA-Z][-0-9~&*<>\|^\$%\@_+~?/=]+)*[a-zA-Z][a-zA-Z][-a-zA-Z0-9~&!*<>\|^\$%\@_+~?/=]*:?)||) {
-	    return $1;
-	} elsif(s/^\#if\s*\(mindy\)//) {
-	    while(!s/^\s*\#endif//) {
-		defined($_ = <$fh>) || return undef;
-		chop;
-	    }
-	    next;
-	} elsif(s/^\#if\s*\(~mindy\)// || s/^\#endif//) {
-	    next;
-	} else {
-	    die "Unrecognized token '$_'";
-	}
+        s|^\s+||;
+        if($_ eq '') {
+            defined($_ = <$fh>) || return undef;
+            chop;
+            next;
+        } elsif(s|^//.*||) {
+            next;
+        } elsif(s|^/\*||) {
+            my $level = 1;
+            while($level > 0) {
+                if($_ eq '') {
+                    defined($_ = <$fh>) || return undef;
+                    chop;
+                    next;
+                }
+                s%^([^/*]|/[^*]|\*[^/])*%%;
+                s%^[/*]$%%;
+                if(s%\*/%%) {
+                    --$level;
+                } elsif(s%/\*%%) {
+                    ++$level;
+                }
+            }
+            next;
+        } elsif(s|^([,;{}])||) {
+            return $1;
+        } elsif(s|^(=>)||) {
+            return $1;
+        } elsif(s|^\\?(([!&*<>;\|^\$%\@_][-0-9~&*<>\|^\$%\@_+~?/=]*)?[a-zA-Z][-a-zA-Z0-9~&!*<>\|^\$%\@_+~?/=]*:?)||) {
+            return $1;
+        } elsif(s|^\\?([0-9][-0-9~&*<>\|^\$%\@_+~?/=]*([a-zA-Z][-0-9~&*<>\|^\$%\@_+~?/=]+)*[a-zA-Z][a-zA-Z][-a-zA-Z0-9~&!*<>\|^\$%\@_+~?/=]*:?)||) {
+            return $1;
+        } elsif(s/^\#if\s*\(mindy\)//) {
+            while(!s/^\s*\#endif//) {
+                defined($_ = <$fh>) || return undef;
+                chop;
+            }
+            next;
+        } elsif(s/^\#if\s*\(~mindy\)// || s/^\#endif//) {
+            next;
+        } else {
+            die "Unrecognized token '$_'";
+        }
     }
 }
 
@@ -429,7 +557,7 @@
     print "$library => $used\n" if($verbose);
 
     if(!exists $deps{$library}) {
-	$deps{$library} = [];
+        $deps{$library} = [];
     }
     push @{$deps{$library}}, $used;
 }
@@ -449,24 +577,15 @@
 
     my $contents = &parse_header(\*LIDFILE, $lidfile);
 
-    
-#   # Read filenames
-#     while (<LIDFILE>) {
-#         $lidfile_line = $lidfile_line + 1;
-#
-# 	s/\r//g;		# Get rid of cross carriage returns
-# 	chop;			# kill newline
-# 	$$contents{'files'} .= " $_";
-#     }
     close(LIDFILE);
 
     if(defined $$contents{'files'}) {
-	# replace multiple spaces with single spaces
-	$$contents{'files'} =~ s/\s+/ /g;
-	
-	# strip leading whitespace, which tends to screw up other parts of
-	# gen-makefile
-	$$contents{'files'} =~ s/^\s+//;
+        # replace multiple spaces with single spaces
+        $$contents{'files'} =~ s/\s+/ /g;
+        
+        # strip leading whitespace, which tends to screw up other parts of
+        # gen-makefile
+        $$contents{'files'} =~ s/^\s+//;
     }
 
     return $contents;
@@ -486,13 +605,13 @@
     my ($fh, $file) = @_;
 
     my %contents;
-    my $last_keyword;		# for multi-line values
+    my $last_keyword;           # for multi-line values
 
     while (<$fh>) {
         $lidfile_line = $lidfile_line + 1;
-	s/\r//g;		# Get rid of bogus carriage returns
-	
-        if (/^\s*$/) {		# if blank line, break out of loop
+        s/\r//g;                # Get rid of bogus carriage returns
+        
+        if (/^\s*$/) {          # if blank line, break out of loop
             return \%contents;
         } elsif (m|^//.*$|) {
             # comment line, ignore
@@ -501,10 +620,10 @@
             $contents{$last_keyword} .= ' ' . $1;
         } else {
             if(!/^([-A-Za-z0-9_!&*<>|^\$\%\@\?]+):\s*(.*)\s*$/) {
-		print STDERR "$file:$lidfile_line: Warning: ",
-		             "bad keyword line\n";
-		next;
-	    }
+                print STDERR "$file:$lidfile_line: Warning: ",
+                             "bad keyword line\n";
+                next;
+            }
             my $keyword = lc($1);
             my $value = $2;
             $contents{$keyword} = $value;

Modified: trunk/fundev/autogen.sh
==============================================================================
--- trunk/fundev/autogen.sh	(original)
+++ trunk/fundev/autogen.sh	Mon Dec 17 00:18:35 2007
@@ -43,6 +43,6 @@
 echo "processing (ignore errors and warnings from automake and libtoolize)..."
 
 ( cd $srcdir
-  libtoolize --force --copy
+  $LIBTOOLIZE --force --copy
   automake --foreign --add-missing
   autoconf )

Modified: trunk/fundev/configure.ac
==============================================================================
--- trunk/fundev/configure.ac	(original)
+++ trunk/fundev/configure.ac	Mon Dec 17 00:18:35 2007
@@ -1,6 +1,9 @@
 AC_INIT([Open Dylan], [1.0 beta 5])
 AC_PREREQ(2.50)
 
+# Directory for config.guess etc.
+AC_CONFIG_AUX_DIR(build-aux)
+
 #---------------------
 # Make srcdir absolute
 #---------------------
@@ -33,8 +36,11 @@
 AC_SUBST(fd_target)
 AC_SUBST(rt_target)
 
+AM_INIT_AUTOMAKE
+
 AC_PROG_INSTALL
 AC_PROG_LN_S
+AC_PROG_LIBTOOL
 
 AC_PATH_PROG(PERL, perl, no)
 test "$PERL" = no && AC_MSG_ERROR([
@@ -58,7 +64,7 @@
 AC_SUBST(FDCOMPILE)
 
 # TODO: figure out the bootstrap type given the fdcompile version
-bootstrap_target=3-stage-bootstrap
+bootstrap_target=1-stage-bootstrap
 AC_SUBST(bootstrap_target)
 
 AC_ARG_WITH(mps,

Modified: trunk/fundev/sources/dfmc/c-run-time/Makefile.in
==============================================================================
--- trunk/fundev/sources/dfmc/c-run-time/Makefile.in	(original)
+++ trunk/fundev/sources/dfmc/c-run-time/Makefile.in	Mon Dec 17 00:18:35 2007
@@ -12,7 +12,7 @@
 
 LIBDEST         = $(OPEN_DYLAN_USER_INSTALL)/lib
 BINDEST         = $(OPEN_DYLAN_USER_INSTALL)/bin
-INCDEST			= $(OPEN_DYLAN_USER_INSTALL)/include
+INCDEST		= $(OPEN_DYLAN_USER_INSTALL)/include
 
 EXPIRATION	= -1
 
@@ -45,11 +45,13 @@
 $(RUNTIMELIBDEST):
 	mkdir -p $(RUNTIMELIBDEST)
 
+# mini-jambase.jam has to be present, but do not require all platform-specific
+# files to be present; only one will be used, so the others can be missing.
 install-build:
 	cp -fp $(top_srcdir)/sources/lib/run-time/mini-jambase.jam $(LIBDEST)
-	cp -fp $(runtime_srcdir)/x86-linux-build.jam $(LIBDEST)
-	cp -fp $(runtime_srcdir)/x86-darwin-build.jam $(LIBDEST)
-	cp -fp $(runtime_srcdir)/ppc-darwin-build.jam $(LIBDEST)
+	-cp -fp $(runtime_srcdir)/x86-linux-build.jam $(LIBDEST)
+	-cp -fp $(runtime_srcdir)/x86-darwin-build.jam $(LIBDEST)
+	-cp -fp $(runtime_srcdir)/ppc-darwin-build.jam $(LIBDEST)
 
 install-header:	$(runtime_srcdir)/run-time.h $(INCDEST)
 	cp -fp $(runtime_srcdir)/run-time.h $(INCDEST)

Modified: trunk/fundev/sources/dfmc/c-run-time/ppc-darwin-build.jam
==============================================================================
--- trunk/fundev/sources/dfmc/c-run-time/ppc-darwin-build.jam	(original)
+++ trunk/fundev/sources/dfmc/c-run-time/ppc-darwin-build.jam	Mon Dec 17 00:18:35 2007
@@ -2,15 +2,15 @@
 # Configuration variables
 #
 
-CC	?= gcc ;
+CC      ?= gcc ;
 
-MKF	?= dylanmakefile.mkf ;
+MKF     ?= dylanmakefile.mkf ;
 
-SUFOBJ	?= .o ;			# object files suffix
-SUFASM	?= .s ;			# assembly source files suffix
-SUFLIB	?= .a ;			# static library suffix
-SUFDLL	?= .dylib ;	# shared library suffix
-SUFMKF	?= .mkf ;   # build-system files
+SUFOBJ  ?= .o ;                 # object files suffix
+SUFASM  ?= .s ;                 # assembly source files suffix
+SUFLIB  ?= .a ;                 # static library suffix
+SUFDLL  ?= .dylib ;     # shared library suffix
+SUFMKF  ?= .mkf ;   # build-system files
 
 {
   local _lib = lib ;
@@ -32,15 +32,21 @@
   HDRS ?= $(SYSTEM_INCDIR) ;
 }
 
-CCFLAGS ?= -fdefer-pop -fguess-branch-probability -fcprop-registers -floop-optimize -fif-conversion -fif-conversion2 -ftree-ccp -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs -ftree-sra -ftree-copyrename -ftree-fre -ftree-ch -fmerge-constants -fomit-frame-pointer -fPIC -fno-common -g0 ;
+CCFLAGS ?= -fdefer-pop -fguess-branch-probability -fcprop-registers
+           -floop-optimize -fif-conversion -fif-conversion2 -ftree-ccp
+           -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs
+           -ftree-sra -ftree-copyrename -ftree-fre -ftree-ch -fmerge-constants
+           -fomit-frame-pointer -fPIC -g ;
+
+DEFINES += _POSIX_C_SOURCE ;
 
 #
 # Runtime
 #
 
 RTOBJS ?= posix-threads.o
-	  debug-print.o
-	  run-time.o ;
+          debug-print.o
+          run-time.o ;
 
 rtlibs ?= $(SYSTEM_LIBDIR)/runtime/$(RTOBJS) -lgc -lpthread -ldl -lm ;
 
@@ -203,9 +209,9 @@
       case -L* : LINKLIBS on $(_dll) += $(lib) ;
       case -l* : LINKLIBS on $(_dll) += $(lib) ;
       case *.a : lib = [ FGristFiles $(lib) ] ;
-		 SEARCH on $(lib) = $(SEARCH_SOURCE) ;
-		 Depends $(_dll) : $(lib) ;
-		 NEEDLIBS on $(_dll) += $(lib) ;
+                 SEARCH on $(lib) = $(SEARCH_SOURCE) ;
+                 Depends $(_dll) : $(lib) ;
+                 NEEDLIBS on $(_dll) += $(lib) ;
       case * :   Exit Unknown C library $(lib) ;
     }
   }
@@ -294,18 +300,18 @@
     }
     else {
       # Another personal library; read its mkf from its build directory.
-	
+        
       local SEARCH_SOURCE LOCATE_SOURCE LOCATE_TARGET
         = $(dir:R=$(LOCATE_TARGET:E=$(DOT))) ;
       local SOURCE_GRIST ;
 
       local LIBDIR BINDIR ;
       {
-	local _lib = lib ;
-	local _bin = bin ;
+        local _lib = lib ;
+        local _bin = bin ;
 
-	LIBDIR = $(_lib:P=$(PERSONAL_ROOT:E=$(LOCATE_TARGET:P))) ;
-	BINDIR = $(_bin:P=$(PERSONAL_ROOT:E=$(LOCATE_TARGET:P))) ;
+        LIBDIR = $(_lib:P=$(PERSONAL_ROOT:E=$(LOCATE_TARGET:P))) ;
+        BINDIR = $(_bin:P=$(PERSONAL_ROOT:E=$(LOCATE_TARGET:P))) ;
       }
 
       local _mkf = $(MKF:G=$(library:L)) ;

Modified: trunk/fundev/sources/dfmc/c-run-time/x86-darwin-build.jam
==============================================================================
--- trunk/fundev/sources/dfmc/c-run-time/x86-darwin-build.jam	(original)
+++ trunk/fundev/sources/dfmc/c-run-time/x86-darwin-build.jam	Mon Dec 17 00:18:35 2007
@@ -32,7 +32,13 @@
   HDRS ?= $(SYSTEM_INCDIR) ;
 }
 
-CCFLAGS ?= -fdefer-pop -fguess-branch-probability -fcprop-registers -floop-optimize -fif-conversion -fif-conversion2 -ftree-ccp -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs -ftree-sra -ftree-copyrename -ftree-fre -ftree-ch -fmerge-constants -fomit-frame-pointer -fPIC -fno-common -g0 ;
+CCFLAGS ?= -fdefer-pop -fguess-branch-probability -fcprop-registers
+           -floop-optimize -fif-conversion -fif-conversion2 -ftree-ccp
+           -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-ter -ftree-lrs
+           -ftree-sra -ftree-copyrename -ftree-fre -ftree-ch -fmerge-constants
+           -fomit-frame-pointer -fPIC -g ;
+
+DEFINES += _POSIX_C_SOURCE ;
 
 #
 # Runtime

Modified: trunk/fundev/sources/system/file-system/unix-ffi.dylan
==============================================================================
--- trunk/fundev/sources/system/file-system/unix-ffi.dylan	(original)
+++ trunk/fundev/sources/system/file-system/unix-ffi.dylan	Mon Dec 17 00:18:35 2007
@@ -84,22 +84,22 @@
        end }
 end macro with-stack-stat;
 
-define inline-only function st-mode (st :: <machine-word>) => (mode :: <abstract-integer>)
-  raw-as-abstract-integer
+define inline-only function st-mode (st :: <machine-word>) => (mode :: <integer>)
+  raw-as-integer
   (primitive-c-unsigned-int-at(primitive-unwrap-machine-word(st),
 			       integer-as-raw($st-mode-offset),
 			       integer-as-raw(0)))
 end function st-mode;
 
-define inline-only function st-uid (st :: <machine-word>) => (uid :: <abstract-integer>)
-  raw-as-abstract-integer
+define inline-only function st-uid (st :: <machine-word>) => (uid :: <integer>)
+  raw-as-integer
   (primitive-c-unsigned-int-at(primitive-unwrap-machine-word(st),
 			       integer-as-raw($st-uid-offset),
 			       integer-as-raw(0)))
 end function st-uid;
 
-define inline-only function st-gid (st :: <machine-word>) => (gid :: <abstract-integer>)
-  raw-as-abstract-integer
+define inline-only function st-gid (st :: <machine-word>) => (gid :: <integer>)
+  raw-as-integer
   (primitive-c-unsigned-int-at(primitive-unwrap-machine-word(st),
 			       integer-as-raw($st-gid-offset),
 			       integer-as-raw(0)))



More information about the chatter mailing list