+export PATH="${PREFIX}/bin:${PATH}"
+
+SUMMON_DIR=$(pwd)
+SOURCES=${SUMMON_DIR}/sources
+STAMPS=${SUMMON_DIR}/stamps
+
+
+##############################################################################
+# Tool section
+##############################################################################
+TAR=tar
+
+##############################################################################
+# OS and Tooldetection section
+# Detects which tools and flags to use
+##############################################################################
+
+case "$(uname)" in
+ Linux)
+ echo "Found Linux OS."
+ ;;
+ 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}"
+ ;;
+ *)
+ 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
+ ARCHIVE=$(ls ${SOURCES}/$1.tar.*)
+ case ${ARCHIVE} in
+ *.bz2)
+ echo "archive type bz2"
+ TYPE=j
+ ;;
+ *.gz)
+ echo "archive type gz"
+ TYPE=z
+ ;;
+ *)
+ echo "Unknown archive type of $1"
+ echo ${ARCHIVE}
+ exit 1
+ ;;
+ esac
+ ${TAR} xf${TYPE}${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