changeset 941:7dd3fb4dd333

Minor cleanups and comments, introduce check_prerequisite function.
author Rob Landley <rob@landley.net>
date Tue, 22 Dec 2009 11:51:52 -0600
parents ae8c6e0831ee
children a0b0e2a7d475
files build.sh root-filesystem.sh sources/utility_functions.sh
diffstat 3 files changed, 21 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Sun Dec 20 19:56:21 2009 -0600
+++ b/build.sh	Tue Dec 22 11:51:52 2009 -0600
@@ -4,26 +4,26 @@
 
 # If run with no arguments, list architectures.
 
-ARCH="$1"
-
 if [ $# -ne 1 ]
 then
   echo "Usage: $0 ARCH"
   . sources/include.sh
   read_arch_dir
-  
-  exit 1
 fi
+ARCH="$1"
 
 # Download source code and build host tools.
 
-./download.sh || exit 1
+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).
+
 not_already()
 {
   if [ -f "build/$1-$ARCH.tar.bz2" ]
@@ -35,12 +35,10 @@
   return 0
 }
 
-echo "=== Building ARCH $1"
+# Do we need to build the simple cross compiler?
 
-# Do we need to build the cross compiler?
-
-# This version is --disable shared, doesn't include uClibc++, and is
-# dynamically linked against the host's shared libraries.
+# 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
 then
--- a/root-filesystem.sh	Sun Dec 20 19:56:21 2009 -0600
+++ b/root-filesystem.sh	Tue Dec 22 11:51:52 2009 -0600
@@ -2,33 +2,16 @@
 
 # Build a root filesystem for a given target.
 
-# Get lots of predefined environment variables and shell functions.
-
 source sources/include.sh || exit 1
-
-# Parse the sources/targets/$1 directory
-
 read_arch_dir "$1"
-
-# If this target has a base architecture that's already been built, use that.
-
 check_for_base_arch || exit 0
+check_prerequisite "${ARCH}-cc"
+check_prerequisite "${FROM_ARCH}-cc"
 
 # Announce start of stage.
 
 echo "=== Building $STAGE_NAME"
 
-# Die if our prerequisite isn't there.
-
-for i in "$ARCH" "$FROM_ARCH"
-do
-  if [ -z "$(which "${i}-cc")" ]
-  then
-    [ -z "$FAIL_QUIET" ] && echo No "${i}-cc" in '$PATH'. >&2
-    exit 1
-  fi
-done
-
 # Determine which directory layout we're using
 
 if [ -z "$ROOT_NODIRS" ]
@@ -57,7 +40,7 @@
 	# and example source code.
 
     rm -rf "$ROOT_TOPDIR"/include &&
-    rm -rf "$ROOT_TOPDIR"/lib/*.a &&
+    rm -rf "$ROOT_TOPDIR"/lib/*.[ao] &&
     rm -rf "$ROOT_TOPDIR/src" || dienow
 
 elif [ "$NATIVE_TOOLCHAIN" == "headers" ]
--- a/sources/utility_functions.sh	Sun Dec 20 19:56:21 2009 -0600
+++ b/sources/utility_functions.sh	Tue Dec 22 11:51:52 2009 -0600
@@ -130,3 +130,13 @@
     done
   done
 }
+
+check_prerequisite()
+{
+  if [ -z "$(which "$1")" ]
+  then
+    [ -z "$FAIL_QUIET" ] && echo No "$i" in '$PATH'. >&2
+    exit 1
+  fi
+}
+