+##############################################################################
+# 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
+}
+
+