diff build.sh @ 944:fc134a13357e

Largeish refactoring and cleanup of compiler build: Break out native-compiler.sh from root-filesystem.sh NATIVE_TOOLCHAIN=* went away now NO_NATIVE_COMPILER=1 affecting build.sh root-filesystem.sh: Much simplified No more ROOT_TOPDIR, adjust STAGE_DIR=$STAGE_DIR/usr instead. Doesn't build native-compiler, instead copies existing native-compiler else installs library binaries out of cross compiler. Only build make/bash/distcc when we have a native compiler. native-compiler.sh: No more BUILD_STATIC_NATIVE_COMPILER, now built/packaged separately by default (NO_NATIVE_COMPILER=1 to skip), then incorporated into root-filesystem. now static by default, use BUILD_STATIC=none to override This script also makes the (optional) full cross-compiler renamed STATIC_CROSS_COMPILER_HOST to STATIC_CC_HOST Rename cross-compiler stage to simple-cross-compiler
author Rob Landley <rob@landley.net>
date Sun, 03 Jan 2010 17:04:39 -0600
parents 7dd3fb4dd333
children 9840847885e8
line wrap: on
line diff
--- a/build.sh	Sun Jan 03 05:04:35 2010 -0600
+++ b/build.sh	Sun Jan 03 17:04:39 2010 -0600
@@ -12,15 +12,6 @@
 fi
 ARCH="$1"
 
-# Download source code and build host tools.
-
-time ./download.sh || exit 1
-
-# host-tools populates one directory with every command the build needs,
-# so we can ditch the old $PATH afterwards.
-
-time ./host-tools.sh || exit 1
-
 # A function to skip stages that have already been done (because the
 # tarball they create is already there).
 
@@ -35,17 +26,26 @@
   return 0
 }
 
+# Download source code and build host tools.
+
+time ./download.sh || exit 1
+
+# host-tools populates one directory with every command the build needs,
+# so we can ditch the old $PATH afterwards.
+
+time ./host-tools.sh || exit 1
+
 # Do we need to build the simple cross compiler?
 
 # This version has no thread support, no libgcc_s.so, doesn't include
 # uClibc++, and is dynamically linked against the host's shared libraries.
 
-if not_already cross-compiler
+if not_already simple-cross-compiler
 then
   # If we need to build cross compiler, assume root filesystem is stale.
 
   rm -rf "build/root-filesystem-$ARCH.tar.bz2"
-  time ./cross-compiler.sh "$ARCH" || exit 1
+  time ./simple-cross-compiler.sh "$ARCH" || exit 1
 fi
 
 # Optionally, we can build a statically linked compiler via canadian cross.
@@ -53,7 +53,7 @@
 # We don't autodetect the host because i686 is more portable (running on
 # both 64 and 32 bit hosts), but x86_64 is (slightly) faster on a 64 bit host.
 
-if [ ! -z "$STATIC_CROSS_COMPILER_HOST" ] && not_already cross-static
+if [ ! -z "$STATIC_CC_HOST" ] && not_already cross-compiler
 then
 
   # These are statically linked against uClibc on the host (for portability),
@@ -63,21 +63,20 @@
   # the host (to build the executables) and one for the target (to build
   # the libraries).
 
-  BUILD_STATIC=1 FROM_ARCH="$STATIC_CROSS_COMPILER_HOST" NATIVE_TOOLCHAIN=only \
-    ROOT_NODIRS=1 STAGE_NAME=cross-static ./root-filesystem.sh "$ARCH" || exit 1
+  BUILD_STATIC=1 FROM_ARCH="$STATIC_CC_HOST" STAGE_NAME=cross-compiler \
+    ./native-compiler.sh "$ARCH" || exit 1
 fi
 
-# Optionally, we can build a static native compiler.  (The one in
-# root-filesystem is dynamically linked against uClibc, this one can
-# presumably be untarred and run on any appropriate host system.)
+# Build a native compiler.  It's statically linked by default so it can be
+# run on an arbitrary host system.
 
-if [ ! -z "$BUILD_STATIC_NATIVE_COMPILER" ] && not_already native-compiler
+# If this compiler exists, root-filesystem will pick it up and incorpoate it.
+
+if not_already native-compiler && [ -z "$NO_NATIVE_COMPILER" ]
 then
-
-  # Build static native compilers for each target, possibly in parallel
+  rm -rf "build/root-filesystem-$ARCH.tar.bz2"
 
-  BUILD_STATIC=1 NATIVE_TOOLCHAIN=only STAGE_NAME=native-compiler \
-      ./root-filesystem.sh "$ARCH"
+  BUILD_STATIC={$BUILD_STATIC:-1} ./native-compiler.sh "$ARCH" || exit 1
 fi
 
 # Do we need to build the root filesystem?