From 4e03b34da75b4bab7404031b058ce15aa7965376 Mon Sep 17 00:00:00 2001 From: Michael Hope Date: Sat, 11 Sep 2010 21:38:55 +1200 Subject: Pulled all logging out into a function --- summon-arm-toolchain | 171 +++++++++++++++------------------------------------ 1 file changed, 48 insertions(+), 123 deletions(-) diff --git a/summon-arm-toolchain b/summon-arm-toolchain index 6e2748f..a8da63f 100755 --- a/summon-arm-toolchain +++ b/summon-arm-toolchain @@ -44,6 +44,13 @@ function fetch { fi } +# Log a message out to the console +function log { + echo "******************************************************************" + echo "* $*" + echo "******************************************************************" +} + case "$(uname)" in Linux) echo "Found Linux OS." @@ -121,14 +128,10 @@ if [ ! -e build ]; then fi if [ ! -e ${STAMPS}/${BINUTILS}.build ]; then - echo "******************************************************************" - echo "* Unpacking ${BINUTILS}" - echo "******************************************************************" + log "Unpacking ${BINUTILS}" tar xfvj ${SOURCES}/${BINUTILS}.tar.bz2 cd build - echo "******************************************************************" - echo "* Configuring ${BINUTILS}" - echo "******************************************************************" + log "Configuring ${BINUTILS}" ../${BINUTILS}/configure --target=${TARGET} \ --prefix=${PREFIX} \ --enable-interwork \ @@ -138,31 +141,21 @@ if [ ! -e ${STAMPS}/${BINUTILS}.build ]; then --disable-nls \ --disable-werror \ ${BINUTILFLAGS} || exit - echo "******************************************************************" - echo "* Building ${BINUTILS}" - echo "******************************************************************" + log "Building ${BINUTILS}" make ${PARALLEL} || exit - echo "******************************************************************" - echo "* Installing ${BINUTILS}" - echo "******************************************************************" + log "Installing ${BINUTILS}" make install || exit cd .. - echo "******************************************************************" - echo "* Cleaning up ${BINUTILS}" - echo "******************************************************************" + log "Cleaning up ${BINUTILS}" touch ${STAMPS}/${BINUTILS}.build rm -rf build/* ${BINUTILS} fi if [ ! -e ${STAMPS}/${GCC}-boot.build ]; then - echo "******************************************************************" - echo "* Unpacking ${GCC}-boot" - echo "******************************************************************" + log "Unpacking ${GCC}-boot" tar xfvj ${SOURCES}/${GCC}.tar.bz2 cd build - echo "******************************************************************" - echo "* Configuring ${GCC}-boot" - echo "******************************************************************" + log "Configuring ${GCC}-boot" ../${GCC}/configure --target=${TARGET} \ --prefix=${PREFIX} \ --enable-interwork \ @@ -176,31 +169,21 @@ if [ ! -e ${STAMPS}/${GCC}-boot.build ]; then --disable-nls \ --disable-werror \ ${GCCFLAGS} || exit - echo "******************************************************************" - echo "* Building ${GCC}-boot" - echo "******************************************************************" + log "Building ${GCC}-boot" make ${PARALLEL} all-gcc || exit - echo "******************************************************************" - echo "* Installing ${GCC}-boot" - echo "******************************************************************" + log "Installing ${GCC}-boot" make install-gcc || exit cd .. - echo "******************************************************************" - echo "* Cleaning up ${GCC}-boot" - echo "******************************************************************" + log "Cleaning up ${GCC}-boot" touch ${STAMPS}/${GCC}-boot.build rm -rf build/* ${GCC} fi if [ ! -e ${STAMPS}/${NEWLIB}.build ]; then - echo "******************************************************************" - echo "* Unpacking ${NEWLIB}" - echo "******************************************************************" + log "Unpacking ${NEWLIB}" tar xfvz ${SOURCES}/${NEWLIB}.tar.gz cd build - echo "******************************************************************" - echo "* Configuring ${NEWLIB}" - echo "******************************************************************" + log "Configuring ${NEWLIB}" ../${NEWLIB}/configure --target=${TARGET} \ --prefix=${PREFIX} \ --enable-interwork \ @@ -210,32 +193,22 @@ if [ ! -e ${STAMPS}/${NEWLIB}.build ]; then --disable-nls \ --disable-werror \ --disable-newlib-supplied-syscalls || exit - echo "******************************************************************" - echo "* Building ${NEWLIB}" - echo "******************************************************************" + log "Building ${NEWLIB}" make ${PARALLEL} || exit - echo "******************************************************************" - echo "* Installing ${NEWLIB}" - echo "******************************************************************" + log "Installing ${NEWLIB}" make install || exit cd .. - echo "******************************************************************" - echo "* Cleaning up ${NEWLIB}" - echo "******************************************************************" + log "Cleaning up ${NEWLIB}" touch ${STAMPS}/${NEWLIB}.build rm -rf build/* ${NEWLIB} fi # Yes, you need to build gcc again! if [ ! -e ${STAMPS}/${GCC}.build ]; then - echo "******************************************************************" - echo "* Unpacking ${GCC}" - echo "******************************************************************" + log "Unpacking ${GCC}" tar xfvj ${SOURCES}/${GCC}.tar.bz2 cd build - echo "******************************************************************" - echo "* Configuring ${GCC}" - echo "******************************************************************" + log "Configuring ${GCC}" ../${GCC}/configure --target=${TARGET} \ --prefix=${PREFIX} \ --enable-interwork \ @@ -248,139 +221,91 @@ if [ ! -e ${STAMPS}/${GCC}.build ]; then --disable-nls \ --disable-werror \ ${GCCFLAGS} || exit - echo "******************************************************************" - echo "* Building ${GCC}" - echo "******************************************************************" + log "Building ${GCC}" make ${PARALLEL} || exit - echo "******************************************************************" - echo "* Installing ${GCC}" - echo "******************************************************************" + log "Installing ${GCC}" make install || exit cd .. - echo "******************************************************************" - echo "* Cleaning up ${GCC}" - echo "******************************************************************" + log "Cleaning up ${GCC}" touch ${STAMPS}/${GCC}.build rm -rf build/* ${GCC} fi if [ ! -e ${STAMPS}/${GDB}.build ]; then - echo "******************************************************************" - echo "* Unpacking ${GDB}" - echo "******************************************************************" + log "Unpacking ${GDB}" tar xfvj ${SOURCES}/${GDB}.tar.bz2 cd build - echo "******************************************************************" - echo "* Configuring ${GDB}" - echo "******************************************************************" + log "Configuring ${GDB}" ../${GDB}/configure --target=${TARGET} \ --prefix=${PREFIX} \ --enable-interwork \ --enable-multilib \ --disable-werror \ ${GDBFLAGS} || exit - echo "******************************************************************" - echo "* Building ${GDB}" - echo "******************************************************************" + log "Building ${GDB}" make ${PARALLEL} || exit - echo "******************************************************************" - echo "* Installing ${GDB}" - echo "******************************************************************" + log "Installing ${GDB}" make install || exit cd .. - echo "******************************************************************" - echo "* Cleaning up ${GDB}" - echo "******************************************************************" + log "Cleaning up ${GDB}" touch ${STAMPS}/${GDB}.build rm -rf build/* ${GDB} fi if [ ${LIBSTM32_EN} != 0 ]; then if [ ! -e .libcmsis-${LIBCMSIS}.build ]; then - echo "******************************************************************" - echo "* Unpacking libcmsis-${LIBCMSIS}" - echo "******************************************************************" + log "Unpacking libcmsis-${LIBCMSIS}" tar xfvj ${SOURCES}/libcmsis-${LIBCMSIS}.tar.bz2 cd libcmsis-${LIBCMSIS} - echo "******************************************************************" - echo "* Building libcmsis-${LIBCMSIS}" - echo "******************************************************************" + log "Building libcmsis-${LIBCMSIS}" make arch_prefix=${TARGET} prefix=${PREFIX} || exit - echo "******************************************************************" - echo "* Installing libcmsis-${LIBCMSIS}" - echo "******************************************************************" + log "Installing libcmsis-${LIBCMSIS}" make arch_prefix=${TARGET} prefix=${PREFIX} install || exit cd .. - echo "******************************************************************" - echo "* Cleaning up libcmsis-${LIBCMSIS}" - echo "******************************************************************" + log "Cleaning up libcmsis-${LIBCMSIS}" touch .libcmsis-${LIBCMSIS}.build rm -rf libcmsis-${LIBCMSIS} fi if [ ! -e .libstm32-${LIBSTM32}.build ]; then - echo "******************************************************************" - echo "* Unpacking libstm32-${LIBSTM32}" - echo "******************************************************************" + log "Unpacking libstm32-${LIBSTM32}" tar xfvj ${SOURCES}/libstm32-${LIBSTM32}.tar.bz2 cd libstm32-${LIBSTM32} - echo "******************************************************************" - echo "* Building libstm32-${LIBSTM32}" - echo "******************************************************************" + log "Building libstm32-${LIBSTM32}" make arch_prefix=${TARGET} prefix=${PREFIX} || exit - echo "******************************************************************" - echo "* Installing libstm32-${LIBSTM32}" - echo "******************************************************************" + log "Installing libstm32-${LIBSTM32}" make arch_prefix=${TARGET} prefix=${PREFIX} install || exit cd .. - echo "******************************************************************" - echo "* Cleaning up libstm32-${LIBSTM32}" - echo "******************************************************************" + log "Cleaning up libstm32-${LIBSTM32}" touch .libstm32-${LIBSTM32}.build rm -rf libstm32-${LIBSTM32} fi if [ ! -e .libstm32usb-${LIBSTM32USB}.build ]; then - echo "******************************************************************" - echo "* Unpacking libstm32usb-${LIBSTM32USB}" - echo "******************************************************************" + log "Unpacking libstm32usb-${LIBSTM32USB}" tar xfvj ${SOURCES}/libstm32usb-${LIBSTM32USB}.tar.bz2 cd libstm32usb-${LIBSTM32USB} - echo "******************************************************************" - echo "* Building libstm32usb-${LIBSTM32USB}" - echo "******************************************************************" + log "Building libstm32usb-${LIBSTM32USB}" make arch_prefix=${TARGET} prefix=${PREFIX} || exit - echo "******************************************************************" - echo "* Installing libstm32usb-${LIBSTM32USB}" - echo "******************************************************************" + log "Installing libstm32usb-${LIBSTM32USB}" make arch_prefix=${TARGET} prefix=${PREFIX} install || exit cd .. - echo "******************************************************************" - echo "* Cleaning up libstm32usb-${LIBSTM32USB}" - echo "******************************************************************" + log "Cleaning up libstm32usb-${LIBSTM32USB}" touch .libstm32usb-${LIBSTM32USB}.build rm -rf libstm32usb-${LIBSTM32USB} fi fi if [ $LIBOPENSTM32_EN != 0 ]; then - echo "******************************************************************" - echo "* Unpacking libopenstm32-${LIBOPENSTM32}" - echo "******************************************************************" + log "Unpacking libopenstm32-${LIBOPENSTM32}" tar xfvj ${SOURCES}/libopenstm32-${LIBOPENSTM32}.tar.bz2 cd libopenstm32-${LIBOPENSTM32} - echo "******************************************************************" - echo "* Building libopenstm32-${LIBOPENSTM32}" - echo "******************************************************************" + log "Building libopenstm32-${LIBOPENSTM32}" make PREFIX=${TARGET} DESTDIR=${PREFIX} || exit - echo "******************************************************************" - echo "* Installing libopenstm32-${LIBOPENSTM32}" - echo "******************************************************************" + log "Installing libopenstm32-${LIBOPENSTM32}" make PREFIX=${TARGET} DESTDIR=${PREFIX} install || exit cd .. - echo "******************************************************************" - echo "* Cleaning up libopenstm32-${LIBOPENSTM32}" - echo "******************************************************************" + log "Cleaning up libopenstm32-${LIBOPENSTM32}" touch .libopenstm32-${LIBOPENSTM32}.build rm -rf libopenstm32-${LIBOPENSTM32} fi -- cgit v1.2.3