Mercurial > hg > aboriginal
changeset 787:23bff7aa79eb
Teach buildall.sh to use new build.sh infrastructure, and replace doforklog with orthogonal maybe_fork and maybe_quiet functions.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 05 Jul 2009 23:41:01 -0500 |
parents | 8b5ea56e7507 |
children | fb3484d9764d |
files | buildall.sh smoketest-all.sh sources/functions.sh |
diffstat | 3 files changed, 39 insertions(+), 112 deletions(-) [+] |
line wrap: on
line diff
--- a/buildall.sh Sun Jul 05 23:38:49 2009 -0500 +++ b/buildall.sh Sun Jul 05 23:41:01 2009 -0500 @@ -5,129 +5,52 @@ . sources/functions.sh || exit 1 +[ -z "$STATIC_CROSS_COMPILER_HOST" ] && export STATIC_CROSS_COMPILER_HOST=i686 +export BUILD_STATIC_NATIVE_COMPILER=1 +export FAIL_QUIET=1 + [ -z "${ARCHES}" ] && ARCHES="$(cd sources/targets/; ls | grep -v '^hw-')" -[ -z "$ALLARCHES" ] && - ALLARCHES="${ARCHES} $(cd sources/targets; ls | grep '^hw-')" -export FAIL_QUIET=1 -DO_SKIP_STAGE_TARBALLS="$SKIP_STAGE_TARBALLS" -[ ! -z "$CROSS_COMPILERS_EH" ] && DO_SKIP_STAGE_TARBALLS=1 +[ -z "$HWARCHES" ] && + HWARCHES="$(cd sources/targets; ls | grep '^hw-')" -[ ! -z "$FORK" ] && QUIET='| grep "^==="' +[ ! -z "$FORK" ] && QUIET=1 trap "killtree $$" EXIT -# Perform initial setup that doesn't parallelize well: Download source, -# build host tools, extract source. +# Build the host architecture. This has to be built first so the other +# architectures can canadian cross static compilers to run on the host using +# this toolchain to link against a host version of uClibc. + +# This also performs the download.sh and host-tools.sh steps, which don't +# parallelize well if many build.sh instances try to call them at once. + +# If this fails, don't bother trying to build the other targets. blank_tempdir build -mkdir -p build/logs -(./download.sh && ./host-tools.sh && ./download.sh --extract || dienow ) 2>&1 | - tee build/logs/out-host.txt - -# Create README file (requires build/sources to be extracted) - -cat packages/MANIFEST sources/toys/README.footer > build/README || exit 1 +mkdir -p build/logs && +ln -s out-"$STATIC_CROSS_COMPILER_HOST".txt build/logs/out-host.txt && +(./build.sh 2>&1 "$STATIC_CROSS_COMPILER_HOST" || dienow) \ + | tee build/logs/build-"$STATIC_CROSS_COMPILER_HOST".txt | maybe_quiet -# Build all the initial cross compilers, possibly in parallel - -# These are dynamically linked on the host, --disable-shared, no uClibc++. +# Build all the remaining cross compilers, possibly in parallel -for i in ${ARCHES} +for i in ${ARCHES} ${HWARCHES} do - LOG=build/logs/cross-dynamic-${i}.txt \ - SKIP_STAGE_TARBALLS="$DO_SKIP_STAGE_TARBALLS" \ - doforklog ./cross-compiler.sh $i + [ "$i" != "$STATIC_CROSS_COMPILER_HOST" ] && + maybe_fork "./build.sh $i 2>&1 | tee build/logs/build-${i}.txt | maybe_quiet" done wait -# Should we do the static compilers via canadian cross? - -if [ ! -z "$CROSS_COMPILERS_EH" ] -then - - # Build the static cross compilers, possibly in parallel - - # 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). - - for i in ${ARCHES} - do - LOG=build/logs/cross-static-${i}.txt SKIP_STAGE_TARBALLS=1 BUILD_STATIC=1 \ - FROM_ARCH="$CROSS_COMPILERS_EH" NATIVE_TOOLCHAIN=only \ - STAGE_NAME=cross-static doforklog ./root-filesystem.sh $i - done - - wait - - # Replace the dynamic cross compilers with the static ones, and tar 'em up. - - rm -rf build/dynamic && - mkdir -p build/dynamic && - mv build/cross-compiler-* build/dynamic || exit 1 - - for i in ${ARCHES} - do - mv build/{root-filesystem-$i,cross-compiler-$i} 2>/dev/null && - doforklog tar cjfC build/cross-compiler-$i.tar.bz2 build cross-compiler-$i - done - - wait - -fi - -if [ ! -z "$NATIVE_COMPILERS_EH" ] -then - - # Build static native compilers for each target, possibly in parallel - - for i in ${ARCHES} - do - LOG=build/logs/native-static-${i}.txt SKIP_STAGE_TARBALLS=1 BUILD_STATIC=1 \ - NATIVE_TOOLCHAIN=only STAGE_NAME=native-static \ - doforklog ./root-filesystem.sh $i - done - - wait - - for i in ${ARCHES} - do - mv build/{root-filesystem-$i,natemp-$i} 2>/dev/null && - doforklog tar cjfC build/native-compiler-$i.tar.bz2 build/natemp-"$i" . - done - - wait - - rm -rf build/natemp-* & -fi - -# Now that we have our cross compilers, use them to build root filesystems. - -for i in ${ARCHES} -do - LOG=build/logs/root-filesystem-$i.txt doforklog ./root-filesystem.sh $i -done - -wait - -# Package all targets, including hw-targets. - -for i in ${ALLARCHES} -do - LOG=build/logs/system-image-$i.txt doforklog ./system-image.sh $i -done - # Run smoketest.sh for each non-hw target. for i in ${ARCHES} do - LOG=build/logs/smoketest-$i.txt doforklog ./smoketest.sh $i + maybe_fork "./smoketest.sh $i 2>&1 | tee build/logs/smoketest-$i.txt | maybe_quiet" done wait + +./smoketest-all.sh --logs
--- a/smoketest-all.sh Sun Jul 05 23:38:49 2009 -0500 +++ b/smoketest-all.sh Sun Jul 05 23:41:01 2009 -0500 @@ -30,7 +30,7 @@ for i in $(ls -pd build/system-image-* | sed -n 's@.*/system-image-\(.*\)/@\1@p' | grep -v "^hw-") do - doforklog dotest $i + maybe_fork "dotest $i" done wait
--- a/sources/functions.sh Sun Jul 05 23:38:49 2009 -0500 +++ b/sources/functions.sh Sun Jul 05 23:41:01 2009 -0500 @@ -477,7 +477,7 @@ # Grab FWL version number [ -z "$FWL_VERS" ] && - FWL_VERS="mercurial rev $(cd "$TOP"; hg tip | sed -n 's/changeset: *\([0-9]*\).*/\1/p')" + FWL_VERS="mercurial rev $(cd "$TOP"; hg tip 2>/dev/null | sed -n 's/changeset: *\([0-9]*\).*/\1/p')" cat << EOF Built on $(date +%F) from: @@ -552,18 +552,22 @@ fi } -# Run a command either in foreground or background, depending on $FORK -# Log to the file $LOG +# Filter out unnecessary noise -doforklog() +maybe_quiet() { - [ -z "$LOG" ] && LOG=/dev/null + [ -z "$QUIET" ] && cat || grep "^===" +} - if [ ! -z "$FORK" ] +# Run a command either in foreground or background, depending on $FORK + +maybe_fork() +{ + if [ -z "$FORK" ] then - $* 2>&1 | eval "tee \"$LOG\" $QUIET" & + eval "$*" else - $* 2>&1 | eval "tee \"$LOG\" $QUIET" + eval "$*" & fi }