changeset 915:a541c5a96ff3

Don't actually replace cross-compiler with cross-static, when you build both use $PATH to select which one to use.
author Rob Landley <rob@landley.net>
date Thu, 03 Dec 2009 01:18:39 -0600
parents 8a698351f241
children 991a74436235
files build.sh sources/functions.sh
diffstat 2 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Thu Dec 03 01:17:39 2009 -0600
+++ b/build.sh	Thu Dec 03 01:18:39 2009 -0600
@@ -66,13 +66,7 @@
   # 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" &&
-
-  # Replace the dynamic cross compiler with the static one so the rest of
-  # the build uses the new one.
-
-  rm -rf "build/cross-compiler-$ARCH" &&
-  ln -s "cross-static-$ARCH" "build/cross-compiler-$ARCH" || exit 1
+    ROOT_NODIRS=1 STAGE_NAME=cross-static ./root-filesystem.sh "$ARCH" || exit 1
 fi
 
 # Optionally, we can build a static native compiler.  (The one in
--- a/sources/functions.sh	Thu Dec 03 01:17:39 2009 -0600
+++ b/sources/functions.sh	Thu Dec 03 01:18:39 2009 -0600
@@ -2,6 +2,19 @@
 
 # Lots of reusable functions.  This file is sourced, not run.
 
+# Output the first cross compiler (static or basic) that's installed.
+
+cc_path()
+{
+  local i
+
+  for i in "$BUILD"/cross-{static,compiler}-"$1/bin"
+  do
+    [ -e "$i/$1-cc" ] && break
+  done
+  echo -n "$i:"
+}
+
 function read_arch_dir()
 {
   # Get target platform from first command line argument.
@@ -52,9 +65,8 @@
 
   STAGE_DIR="$BUILD/${STAGE_NAME}-${ARCH_NAME}"
 
-  export PATH="${BUILD}/cross-compiler-$ARCH/bin:$PATH"
-  [ "$FROM_ARCH" != "$ARCH" ] &&
-    PATH="${BUILD}/cross-compiler-${FROM_ARCH}/bin:$PATH"
+  export PATH="$(cc_path "$ARCH")$PATH"
+  [ "$FROM_ARCH" != "$ARCH" ] && PATH="$(cc_path "$FROM_ARCH")$PATH"
 
   # Check this here because it could be set in "settings"
 
@@ -560,8 +572,7 @@
     Linux (http://kernel.org/pub/linux/kernel) $(identify_release linux)
 
   Toolchain packages:
-    Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils
-)
+    Binutils (http://www.gnu.org/software/binutils/) $(identify_release binutils)
     GCC (http://gcc.gnu.org) $(identify_release gcc-core)
     gmake (http://www.gnu.org/software/make) $(identify_release make)
     bash (ftp://ftp.gnu.org/gnu/bash) $(identify_release bash)
@@ -584,7 +595,7 @@
 }
 
 # Check if this target has a base architecture that's already been built.
-# If so, just tar it up and exit now.
+# If so, link to it and exit now.
 
 function check_for_base_arch()
 {