Mercurial > hg > aboriginal
changeset 721:f0ede6d6c952
Do canadian cross static toolchains properly, via buildall.sh.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 26 Apr 2009 15:30:26 -0500 |
parents | 74850275fe41 |
children | b5c0cf2e7f61 |
files | buildall.sh root-filesystem.sh sources/include.sh |
diffstat | 3 files changed, 80 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/buildall.sh Sun Apr 26 14:19:21 2009 -0500 +++ b/buildall.sh Sun Apr 26 15:30:26 2009 -0500 @@ -7,7 +7,13 @@ rm -rf build -BASEARCHES="$(cd sources/targets/; ls | grep -v '^hw-')" +[ -z "${ARCHES}" ] && + BASEARCHES="$(cd sources/targets/; ls | grep -v '^hw-')" +[ -z "$ALLARCHES" ] && + ALLARCHES="${ARCHES} $(cd sources/targets; ls | grep '^hw-')" + +DO_SKIP_STAGE_TARBALLS="$SKIP_STAGE_TARBALLS" +[ ! -z "$CROSS_COMPILERS_EH" ] && DO_SKIP_STAGE_TARBALLS=1 # Run command in the background or foreground, depending on $FORK @@ -15,9 +21,12 @@ { [ -z "$LOG" ] && LOG=/dev/null - [ ! -z "$FORK" ] && - ( ($*) 2>&1 | tee "$LOG" | grep '^===' &) || - ($*) 2>&1 | tee "$LOG" + if [ ! -z "$FORK" ] + then + $* 2>&1 | tee "$LOG" | grep '^===' & + else + $* 2>&1 | tee "$LOG" + fi } # Perform initial setup that doesn't parallelize well: Download source, @@ -30,61 +39,73 @@ (do_readme && cat sources/toys/README.footer) | tee build/README -# Build all the initial cross compilers +# Build all the initial cross compilers, possibly in parallel # These are dynamically linked on the host, --disable-shared, no uClibc++. -for i in $BASEARCHES +for i in ${ARCHES} do LOG=build/cross-dynamic-${i}.txt \ - SKIP_STAGE_TARBALLS=1 doforklog ./cross-compiler.sh $i + SKIP_STAGE_TARBALLS="$DO_SKIP_STAGE_TARBALLS" \ + doforklog ./cross-compiler.sh $i done -wait4background 0 +wait4background # Should we do the static compilers via canadian cross? if [ ! -z "$CROSS_COMPILERS_EH" ] then -# Build the static cross compilers -# These are statically linked against uClibc on the host (for portability), -# built --with-shared, and have uClibc++ installed. + # 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/cross-static-${i}.txt SKIP_STAGE_TARBALLS=1 BUILD_STATIC=1 \ + FROM_ARCH="$CROSS_COMPILERS_EH" NATIVE_TOOLCHAIN=only STAGE_NAME=static \ + doforklog ./root-filesystem.sh $i + done + + wait4background + + # 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 $BASEARCHES + for i in ${ARCHES} + do + mv build/{root-filesystem-$i,cross-compiler-$i} && + doforklog tar czfC build/cross-compiler-$i.tar.bz2 build cross-compiler-$i + done + + wait4background + +fi + +# Now that we have our cross compilers, use them to build root filesystems. + +for i in ${ARCHES} do - LOG=build/cross-static-${i}.txt SKIP_STAGE_TARBALLS=1 \ - BUILD_STATIC=1 FROM_ARCH=i686 NATIVE_TOOLCHAIN=only \ - doforklog ./root-filesystem.sh $i + [ -f "build/cross-compiler-$i.tar.bz2" ] ** + LOG=build/root-filesystem-$i.txt doforklog ./root-filesystem.sh $i +done + +wait4background + +# Package all targets, including hw-targets. + +for i in ${ALLARCHES} +do + LOG=build/system-image-$i.txt doforklog ./system-image.sh $i done wait4background 0 - - -# 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 $BASEARCHES -do - mv build/{root-filesystem-$i,cross-compiler-$i} && - doforklog tar czfC build/cross-compiler-$i.tar.bz2 build cross-compiler-$i -done - -wait4background 0 - -fi - -# Now build hardware targets using the static cross compilers above. -# (Smoke test, really.) - -for i in $(cd sources/targets; ls) -do - doforklog ./build.sh $i 2>&1 | tee out-$i.txt -done - -# Wait for hardware targets to complete - -wait4background 0
--- a/root-filesystem.sh Sun Apr 26 14:19:21 2009 -0500 +++ b/root-filesystem.sh Sun Apr 26 15:30:26 2009 -0500 @@ -60,6 +60,17 @@ RUNTIME_PREFIX="$UCLIBC_DLPREFIX/" DEVEL_PREFIX="$UCLIBC_DLPREFIX/" \ UCLIBC_LDSO_NAME=ld-uClibc -j $CPUS $i || dienow done + +# There's no way to specify a prefix for the uClibc utils; rename them by hand. + +if [ ! -z "$PROGRAM_PREFIX" ] +then + for i in ldd readelf + do + mv "${TOOLS}"/bin/{"$i","${PROGRAM_PREFIX}$i"} || dienow + done +fi + cd .. cleanup uClibc @@ -82,7 +93,6 @@ else -[ "$FROM_ARCH" != "$ARCH" ] && PROGRAM_PREFIX="${ARCH}-" [ -z "$BUILD_STATIC" ] || STATIC_FLAGS='--static' # Build and install native binutils @@ -133,7 +143,7 @@ ln -s lib "$TOOLS/lib64" && make -j $CPUS install-gcc && rm "$TOOLS/lib64" && -ln -s gcc "${TOOLS}/bin/cc" && +ln -s "${PROGRAM_PREFIX}gcc" "${TOOLS}/bin/${PROGRAM_PREFIX}cc" && # Now we need to beat libsupc++ out of gcc (which uClibc++ needs to build). # But don't want to build the whole of libstdc++-v3 because # A) we're using uClibc++ instead, B) the build breaks.
--- a/sources/include.sh Sun Apr 26 14:19:21 2009 -0500 +++ b/sources/include.sh Sun Apr 26 15:30:26 2009 -0500 @@ -52,7 +52,7 @@ # enable wrapping partway through its own build. Extra environment variables # don't actually affect much, it's changing $PATH that changes behavior. -STAGE_NAME=`echo $0 | sed 's@.*/\(.*\)\.sh@\1@'` +[ -z "$STAGE_NAME" ] && STAGE_NAME=`echo $0 | sed 's@.*/\(.*\)\.sh@\1@'` [ -z "$WRAPPY_LOGDIR" ] && WRAPPY_LOGDIR="$BUILD" export WRAPPY_LOGPATH="$WRAPPY_LOGDIR/cmdlines.${STAGE_NAME}.setupfor" if [ ! -z "$RECORD_COMMANDS" ] && [ -f "$BUILD/wrapdir/wrappy" ] @@ -99,7 +99,8 @@ # Override these to perform a canadian cross in root-filesystem.sh - [ -z "$FROM_ARCH" ] && FROM_ARCH="${ARCH}" + [ -z "$FROM_ARCH" ] && FROM_ARCH="${ARCH}" || + [ -z "$PROGRAM_PREFIX" ] && PROGRAM_PREFIX="${ARCH}-" [ -z "$FROM_HOST" ] && FROM_HOST="${FROM_ARCH}"-walrus-linux # Setup directories and add the cross compiler to the start of the path.