changeset 784:037488e9889d

New build.sh that actually uses the new infrastructure, if STATIC_CROSS_COMPILER_HOST or BUILD_STATIC_NATIVE_COMPILER are set.
author Rob Landley <rob@landley.net>
date Sun, 05 Jul 2009 17:51:54 -0500
parents db06a8c1bfed
children 5ed920fc2ea5
files build.sh
diffstat 1 files changed, 40 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Sun Jul 05 17:50:44 2009 -0500
+++ b/build.sh	Sun Jul 05 17:51:54 2009 -0500
@@ -34,6 +34,46 @@
   time ./cross-compiler.sh $1 || exit 1
 fi
 
+# Optionally, we can build a static compiler via canadian cross.  This is
+# built to run on the host system, but statically linked against uClibc
+# instead of the host's libraries.  This makes it more portable, and smaller
+# than statically linking against glibc would make it.
+
+# 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" ]
+then
+
+  # These are statically linked against uClibc on the host (for portability),
+  # built --with-shared, and have uClibc++ installed.
+
+  # To build each of these we need two existing cross compilers: one for
+  # the host (to build the executables) and one for the target (to build
+  # the libraries).
+
+  BUILD_STATIC=1 FROM_ARCH="$STATIC_CROSS_HOST" NATIVE_TOOLCHAIN=only \
+    STAGE_NAME=cross-static ./root-filesystem.sh $1
+
+  # Replace the dynamic cross compiler with the static one.
+
+  rm -rf "build/cross-compiler-$1" &&
+  ln -s "cross-static-$1" "build/cross-compiler-$1" || 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.)
+
+if [ ! -z "$BUILD_STATIC_NATIVE_COMPILER" ]
+then
+
+  # Build static native compilers for each target, possibly in parallel
+
+  BUILD_STATIC=1 NATIVE_TOOLCHAIN=only STAGE_NAME=native-compiler \
+      ./root-filesystem.sh $1
+fi
+
 # Do we need to build the root filesystem?
 
 if [ -f "build/root-filesystem-$1.tar.bz2" ]