changeset 627:e6c9da01349a

Take a stab at a cron job script.
author Rob Landley <rob@landley.net>
date Tue, 24 Feb 2009 19:40:09 -0600
parents 189dc4e359ec
children 8bd1aee4209f
files build-static-toolchains.sh sources/build-all-targets.sh
diffstat 2 files changed, 64 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build-static-toolchains.sh	Tue Feb 24 19:40:09 2009 -0600
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# This script builds static toolchains linked against uClibc.
+# It boots a system image under qemu, copies the build into it, runs
+# cross-compiler.sh for each target, and copies the resulting.
+
+# The first argument is the host to build for.  (Which system-image to run
+# the build under.)
+
+# Additional arguments are the targets to build for that host.  If no
+# targets are specified, the script builds all of them.
+
+if [ $# -eq 0 ]
+then
+  echo -e "Usage: build-static-toolchains.sh HOST_ARCH [TARGET_ARCH...]\n" >&2
+
+  # Fall through to show supported architectures.
+fi
+
+source sources/include.sh || exit 1
+
+# run-from-build.sh needs things that aren't in build/host,
+# such as qemu and fsck.ext2
+PATH="$OLDPATH"
+
+STATIC_HOST="$1"
+shift
+[ -z "$@" ] &&
+  STATIC_TARGETS="$(cd sources/targets; ls)" ||
+  STATIC_TARGETS="$@"
+
+# Step 1, make sure the appropriate host files exist.
+
+./download.sh --extract || dienow
+if [ ! -f build/system-image-$STATIC_HOST.tar.bz2 ]
+then
+  ./build.sh $STATIC_HOST || dienow
+fi
+
+# Kill all the netcat instances if we exit prematurely
+
+trap "kill 0" EXIT
+
+# 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.
+
+./run-from-build.sh "$STATIC_HOST" << EOF
+          #
+export USE_UNSTABLE=$USE_UNSTABLE
+export CROSS_BUILD_STATIC=1
+rm -rf /home/firmware
+mkdir -p /home/firmware &&
+cd /home/firmware &&
+netcat 10.0.2.2 $(build/host/netcat -s 127.0.0.1 -l tar c *.sh sources build/sources) | tar xv 2>&1 | pipe_progress > /dev/null &&
+mkdir -p build/logs || exit 1
+for i in $STATIC_TARGETS
+do
+  ./cross-compiler.sh \$i | tee out-static-\$i.txt
+done
+tar c out-\*.txt build/cross-compiler-\*.tar.bz2 | netcat 10.0.2.2 \
+  $(cd build; host/netcat -s 127.0.0.1 -l tar xv)
+exit
+EOF
--- a/sources/build-all-targets.sh	Fri Feb 20 01:37:15 2009 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-# leftover things that buildall.sh doesn't do yet.
-
-exit 1
-
-# USE_STATIC_HOST=i686
-
-# Create and upload readme (requires build/sources to be extracted)
-
-(do_readme && cat sources/toys/README.footer) | tee buildall/README &
-
-# 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.
-
-./run-from-build.sh "$USE_STATIC_HOST" << EOF
-          #
-export USE_UNSTABLE=$USE_UNSTABLE
-export CROSS_BUILD_STATIC=1
-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 -p build/logs || exit 1
-for i in $(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