Mercurial > hg > aboriginal
changeset 786:8b5ea56e7507
Teach build.sh not to rebuild static compilers if they're already there.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 05 Jul 2009 23:38:49 -0500 |
parents | 5ed920fc2ea5 |
children | 23bff7aa79eb |
files | build.sh |
diffstat | 1 files changed, 34 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/build.sh Sun Jul 05 21:34:12 2009 -0500 +++ b/build.sh Sun Jul 05 23:38:49 2009 -0500 @@ -2,6 +2,8 @@ # If run with no arguments, list architectures. +ARCH="$1" + if [ $# -ne 1 ] then echo "Usage: $0 ARCH" @@ -20,29 +22,38 @@ time ./host-tools.sh || exit 1 +not_already() +{ + if [ -f "build/$1-$ARCH.tar.bz2" ] + then + echo "=== Skipping $1-$ARCH (already there)" + return 1 + fi + + return 0 +} + echo "=== Building ARCH $1" # Do we need to build the cross compiler? -if [ -f "build/cross-compiler-$1.tar.bz2" ] +# This version is --disable shared, doesn't include uClibc++, and is +# dynamically linked against the host's shared libraries. + +if not_already cross-compiler then - echo "=== Skipping cross-compiler-$1 (already there)" -else # If we need to build cross compiler, assume root filesystem is stale. - rm -rf "build/root-filesystem-$1.tar.bz2" - time ./cross-compiler.sh $1 || exit 1 + rm -rf "build/root-filesystem-$ARCH.tar.bz2" + time ./cross-compiler.sh "$ARCH" || 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. +# Optionally, we can build a statically linked compiler via canadian cross. # 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" ] +if [ ! -z "$STATIC_CROSS_COMPILER_HOST" ] && not_already cross-static then # These are statically linked against uClibc on the host (for portability), @@ -53,42 +64,41 @@ # the libraries). BUILD_STATIC=1 FROM_ARCH="$STATIC_CROSS_COMPILER_HOST" NATIVE_TOOLCHAIN=only \ - STAGE_NAME=cross-static ./root-filesystem.sh $1 + STAGE_NAME=cross-static ./root-filesystem.sh "$ARCH" - # Replace the dynamic cross compiler with the static one. + # Replace the dynamic cross compiler with the static one so the rest of + # the build uses the new one. - rm -rf "build/cross-compiler-$1" && - ln -s "cross-static-$1" "build/cross-compiler-$1" || exit 1 + rm -rf "build/cross-compiler-$ARCH" && + ln -s "cross-static-$ARCH" "build/cross-compiler-$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.) -if [ ! -z "$BUILD_STATIC_NATIVE_COMPILER" ] +if [ ! -z "$BUILD_STATIC_NATIVE_COMPILER" ] && not_already 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 + ./root-filesystem.sh "$ARCH" fi # Do we need to build the root filesystem? -if [ -f "build/root-filesystem-$1.tar.bz2" ] +if not_already root-filesystem then - echo "=== Skipping root-filesystem-$1 (already there)" -else + # If we need to build root filesystem, assume system image is stale. - rm -rf "build/system-image-$1.tar.bz2" - time ./root-filesystem.sh $1 || exit 1 + rm -rf "build/system-image-$ARCH.tar.bz2" + time ./root-filesystem.sh "$ARCH" || exit 1 fi -if [ -f "build/system-image-$1.tar.bz2" ] +if not_already system-image then - echo "=== Skipping system-image-$1 (already there)" -else time ./system-image.sh $1 || exit 1 fi +