Mercurial > hg > aboriginal
changeset 489:c65c82d85fea
Add BUILD_STATIC_HOST option, and put output in rsyncable buildall directory.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 17 Nov 2008 03:59:25 -0600 |
parents | 2a028ba323bb |
children | 004f9509349b |
files | sources/build-all-targets.sh |
diffstat | 1 files changed, 81 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/sources/build-all-targets.sh Mon Nov 17 03:01:53 2008 -0600 +++ b/sources/build-all-targets.sh Mon Nov 17 03:59:25 2008 -0600 @@ -3,9 +3,8 @@ # Nightly snapshot build script. # Wrapper can set: -# -# UPLOAD_TO=busybox.net:public_html/fwlnew # USE_UNSTABLE=busybox,toybox,uClibc +# USE_STATIC_HOST=i686 [ -z "$NICE" ] && NICE="nice -n 20" @@ -13,7 +12,7 @@ # Parse command line arguments -FORKCOUNT=0 +FORKCOUNT=1 while [ ! -z "$1" ] do if [ "$1" == "--fork" ] @@ -27,84 +26,111 @@ fi done -SERVER="$(echo "$UPLOAD_TO" | sed 's/:.*//')" -SERVERDIR="$(echo "$UPLOAD_TO" | sed 's/[^:]*://')" - # Define functions function build_this_target() { if [ ! -e build/cross-compiler-$1/bin/$1-gcc ] then - $NICE ./cross-compiler.sh $1 || return 1 + $NICE ./cross-compiler.sh $1 && + ln cross-compiler-$1.tar.bz2 buildall || return 1 fi - $NICE ./mini-native.sh $1 || return 1 - $NICE ./package-mini-native.sh $1 || return 1 -} -function upload_stuff() -{ - [ -z "$SERVER" ] && return - scp build/{cross-compiler,mini-native,system-image}-$1.tar.bz2 \ - build/buildlog-$1.txt.bz2 ${SERVER}:${SERVERDIR} + $NICE ./mini-native.sh $1 && + ln mini-native-$1.tar.bz2 buildall || return 1 + + $NICE ./package-mini-native.sh $1 && + ln system-image-$1.tar.bz2 buildall || return 1 } function build_and_log() { - { build_this_target $1 2>&1 || return 1 - } | tee out-$1.txt + { build_this_target $ARCH 2>&1 || return 1 + } | tee >(bzip2 > buildall/logs/$1-$ARCH.txt.bz2) } -function build_log_upload() -{ - build_and_log "$1" | tee >(bzip2 > build/buildlog-$1.txt.bz2) +# Iterate through architectures, either sequentially or in parallel. +# Run "$1 $ARCH", in parallel if necessary. - if [ -z "$2" ] - then - upload_stuff "$1" - else - upload_stuff "$1" >/dev/null & - fi +function for_each_arch() +{ + for ARCH in $(cd sources/targets; ls); + do + echo Launching $ARCH + if [ "$FORKCOUNT" -eq 1 ] + then + "$@" "$ARCH" || dienow + else + ("$@" $ARCH 2>&1 </dev/null | + grep "^==="; echo Completed $i ) & + [ "$FORKCOUNT" -gt 0 ] && wait4background $[${FORKCOUNT}-1] "ssh " + fi + done + + wait4background 0 } # Clean up old builds, fetch fresh packages. +rm -rf build/host (hg pull -u; ./download.sh || dienow) & -rm -rf build out-*.txt & +rm -rf build buildall & wait4background 0 +mkdir -p buildall/logs || dienow + # Build host tools, extract packages (not asynchronous). -($NICE ./host-tools.sh && $NICE ./download.sh --extract || dienow) | tee out.txt +($NICE ./host-tools.sh && $NICE ./download.sh --extract || dienow) | + tee >(bzip2 > buildall/logs/host-tools.txt.bz2) + +# Create and upload readme (requires build/sources to be extracted) + +do_readme | tee buildall/README.txt & -# Create and upload readme (in background) +# If we need to create static cross compilers, build a version of mini-native +# to act as the host system. (That way they're statically linked against +# uClibc, not whatever the host's library is.) + +if [ ! -z "$USE_STATIC_HOST" ] +then + ($NICE ./build.sh "$USE_STATIC_HOST" || dienow) | + tee >(bzip2 > buildall/logs/static-host-$USE_STATIC_HOST.txt.bz2) + +# Feed a script into qemu. Pass data back and forth via netcat. +# This intentionally _doesn't_ use $NICE, so the distcc master node is higher +# priority than the distccd slave nodes. -do_readme | tee build/README.txt | \ - ( [ -z "$SERVER" ] && \ - cat || ssh ${SERVER} "cd ${SERVERDIR}; cat > README.txt" - ) & +./emulator-build.sh "$USE_STATIC_HOST" << EOF + # +cd /home && +netcat 10.0.2.2 $(build/host/netcat -s 127.0.0.1 -l hg archive -t tgz -) | tar xvz && +cd firmware-* && +netcat 10.0.2.2 $(build/host/netcat -s 127.0.0.1 -l tar c sources/packages) | tar xv && +./download.sh --extract && +mkdir build/logs || exit 1 + +for i in armv4l # \$(cd sources/targets; ls) +do + ./cross-compiler.sh \$i | tee build/logs/cross-static-\$i.txt + bzip2 build/logs/cross-static-$i.txt +done +cd build +tar c logs/* cross-compiler-*.tar.bz2 | netcat 10.0.2.2 \ + $(cd buildall; ../build/host/netcat -s 127.0.0.1 -l tar xv) +sync +exit +EOF + + # Extract the cross compilers + + for i in buildall/cross-compiler-*.tar.bz2 + do + echo Extracting $i + tar -xj -f $i -C build || dienow + done +fi # Build each architecture -for i in $(cd sources/targets; ls); -do - if [ "$FORKCOUNT" -gt 0 ] - then - echo Launching $i - if [ "$FORKCOUNT" -eq 1 ] - then - build_log_upload "$i" "1" || dienow - else - (build_log_upload $i 2>&1 </dev/null | grep "^==="; echo Completed $i ) & - [ "$FORKCOUNT" -gt 0 ] && wait4background $[${FORKCOUNT}-1] "ssh " - fi - else - build_log_upload $i || dienow - fi -done - -# Wait for ssh/scp invocations to finish. - -echo Waiting for background tasks... - -wait4background 0 +for_each_arch build_and_log native