diff host-tools.sh @ 744:759adf5a0fe9

Refactor so include.sh mostly just sets environment variables. Move read_arch_dir to function and call it explicitly (no more need for $NO_ARCH). Make blank_tempdir a function, called explicitly by stages when needed, with some sanity checks. Insert prerequisite tests to later stages so they can detect failure early and provide an explicit erro rmessage, and have those tests happen before blanking $WORK dir, to preserve debugging info. Make buildall.sh depend on prerequisite tests rather than trying to avoid calling later stages (and thus do flow control from asynchronous context). Add FAIL_QUIET option so buildall.sh doesn't spam the log with the new prerequisite error messages.
author Rob Landley <rob@landley.net>
date Thu, 11 Jun 2009 05:42:51 -0500
parents 20ba34b54140
children db06a8c1bfed
line wrap: on
line diff
--- a/host-tools.sh	Thu Jun 11 00:26:15 2009 -0500
+++ b/host-tools.sh	Thu Jun 11 05:42:51 2009 -0500
@@ -2,11 +2,6 @@
 
 # Get lots of predefined environment variables and shell functions.
 
-# Tell bash not to cache the $PATH to anything, so busybox/toybox utilities
-# get used immediately even if a different executable was found last lookup.
-set +h
-
-NO_ARCH=1
 source sources/include.sh || exit 1
 
 echo -e "$HOST_COLOR"
@@ -14,10 +9,11 @@
 
 export LC_ALL=C
 
+blank_tempdir "${WORK}"
 mkdir -p "${HOSTTOOLS}" || dienow
 
 # If we want to record the host command lines, so we know exactly what commands
-# the build uses.
+# the build uses, set up a wrapper that does that.
 
 if [ ! -z "$RECORD_COMMANDS" ]
 then
@@ -26,8 +22,7 @@
     echo setup wrapdir
 
     # Build the wrapper and install it into build/wrapdir/wrappy
-    rm -rf "$BUILD/wrapdir"
-    mkdir "$BUILD/wrapdir" &&
+    blank_tempdir "$BUILD/wrapdir"
     $CC -Os "$SOURCES/toys/wrappy.c" -o "$BUILD/wrapdir/wrappy"  || dienow
 
     # Loop through each $PATH element and create a symlink to the wrapper with
@@ -75,7 +70,7 @@
   # compiler for the target, but we don't build a host toolchain.  We use the
   # one that's already there.
 
-  for i in ar as nm cc gcc make ld
+  for i in ar as nm cc make ld gcc
   do
     [ ! -f "${HOSTTOOLS}/$i" ] &&
       (ln -s `PATH="$OLDPATH" which $i` "${HOSTTOOLS}/$i" || dienow)