+export PATH="${PREFIX}/bin:${PATH}"
+
+SUMMON_DIR=$(pwd)
+SOURCES=${SUMMON_DIR}/sources
+STAMPS=${SUMMON_DIR}/stamps
+
+##############################################################################
+# OS and Tooldetection section
+# Detects which tools to use
+##############################################################################
+
+case "$(uname)" in
+ Linux)
+ echo "Found Linux OS."
+ TAR=tar
+ ;;
+ Darwin)
+ echo "Found Darwin OS."
+ GCCFLAGS="${GCCFLAGS} \
+ --with-gmp=${DARWIN_OPT_PATH} \
+ --with-mpfr=${DARWIN_OPT_PATH} \
+ --with-mpc=${DARWIN_OPT_PATH} \
+ -with-libiconv-prefix=${DARWIN_OPT_PATH}"
+ if ! which gnutar > /dev/null ; then
+ echo "ERROR: GNU tar not found! (try 'sudo port install gnutar')"
+ exit 1
+ else
+ echo "GNU tar found!"
+ TAR=gnutar
+ fi
+ ;;
+ *)
+ echo "Found unknown OS. Aborting!"
+ exit 1
+ ;;
+esac
+
+##############################################################################
+# Building section
+# You probably don't have to touch anything after this
+##############################################################################
+
+# Fetch a versioned file from a URL
+function fetch {
+ if [ ! -e ${STAMPS}/$1.fetch ]; then
+ log "Downloading $1 sources..."
+ wget -c --no-passive-ftp $2
+ touch ${STAMPS}/$1.fetch
+ fi
+}
+
+# Log a message out to the console
+function log {
+ echo "******************************************************************"
+ echo "* $*"
+ echo "******************************************************************"
+}
+
+# Unpack an archive
+function unpack {
+ log Unpacking $*
+ # Use 'auto' mode decompression. Replace with a switch if tar doesn't support -a
+ ${TAR} xaf${TARFLAGS} ${SOURCES}/$1.tar.*
+}
+
+# Install a build
+function install {
+ log $1
+ ${SUDO} make ${MAKEFLAGS} $2 $3 $4 $5 $6 $7 $8
+}
+
+
+mkdir -p ${STAMPS} ${SOURCES}
+
+cd ${SOURCES}
+
+fetch ${BINUTILS} http://ftp.gnu.org/gnu/binutils/${BINUTILS}.tar.bz2
+fetch ${GCC} ${GCCURL}
+fetch ${NEWLIB} ftp://sources.redhat.com/pub/newlib/${NEWLIB}.tar.gz
+fetch ${GDB} http://ftp.gnu.org/gnu/gdb/${GDB}.tar.bz2
+
+if [ ${LIBSTM32_EN} != 0 ]; then