X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=summon-arm-toolchain.git;a=blobdiff_plain;f=summon-arm-toolchain;h=77bf6d84bb526b7614de2928beeae06364e6d961;hp=4b901249e49cd735c74cc2a7768c62a1e190babd;hb=HEAD;hpb=8408f8c62513442801d056d4058f86e1cc895b8f diff --git a/summon-arm-toolchain b/summon-arm-toolchain index 4b90124..77bf6d8 100755 --- a/summon-arm-toolchain +++ b/summon-arm-toolchain @@ -51,19 +51,31 @@ else GCCURL=http://launchpad.net/gcc-linaro/4.6/${GCCRELEASE}/+download/gcc-linaro-${GCCRELEASE}.tar.bz2 fi -BINUTILS=binutils-2.21 +BINUTILS=binutils-2.21.1 NEWLIB=newlib-1.19.0 -GDB=gdb-7.3 +GDB=gdb-7.3.1 GMP=gmp-5.0.2 MPFR=mpfr-3.0.1 MPC=mpc-0.9 +SHA1SUMS="525255ca6874b872540c9967a1d26acfbc7c8230 binutils-2.21.1.tar.bz2 +8bf66f7a71534ba564563a0ba0b2517aead8ac30 gcc-4.6.1.tar.bz2 +9b766705f051ffb7321de58f247688b0ae661b98 gcc-core-4.6.1.tar.bz2 +828d99a63e0578879150f5681d234763cff69313 gcc-linaro-4.6-2011.07.tar.bz2 +e57f2c7f93536ef54fab728eb733bf2c36550718 gdb-7.3.1.tar.bz2 +2968220e1988eabb61f921d11e5d2db5431e0a35 gmp-5.0.2.tar.bz2 +229722d553030734d49731844abfef7617b64f1a mpc-0.9.tar.gz +fbf402fc196724ae60ef01eb6ca8490b1ea4db69 mpfr-3.0.1.tar.bz2 +b2269d30ce7b93b7c714b90ef2f40221c2df0fcd newlib-1.19.0.tar.gz" + ############################################################################## # Flags section ############################################################################## -if which getconf > /dev/null; then +if which getconf > /dev/null 2> /dev/null && getconf _NPROCESSORS_ONLN > /dev/null 2> /dev/null; then CPUS=$(getconf _NPROCESSORS_ONLN) +elif which sysctl > /dev/null 2> /dev/null && sysctl hw.ncpu 2> /dev/null > /dev/null; then + CPUS=$(sysctl hw.ncpu | sed -E -e 's/^hw\.ncpu(: | = )//') else CPUS=1 fi @@ -85,12 +97,13 @@ if [ -f local.sh ]; then . ./local.sh fi -MAKEFLAGS=${PARALLEL} +MAKEFLAGS=${PARALLEL} ${MAKESILENT} TARFLAGS=v +MAKESILENT= if [ ${QUIET} != 0 ]; then TARFLAGS= - MAKEFLAGS="${MAKEFLAGS} -s" + MAKESILENT="-s" fi export PATH="${PREFIX}/bin:${PATH}" @@ -100,43 +113,43 @@ 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." - - # darwin dependencies - DARWINDEPS="wget" - - echo "Installing dependencies ..." - if ! which brew > /dev/null; then - echo "Homebrew not installed." - else - brew install ${DARWINDEPS} | (grep -v '^Warning: Formula already installed: ' || true) - fi +# normalized fetching with whatever we can find +if which fetch > /dev/null; then + FETCHCMD="fetch -p" +elif which wget > /dev/null; then + FETCHCMD="wget -c" +elif which curl > /dev/null; then + FETCHCMD="curl -C - -O -L" +else + FETCHCMD=ftp # the only HTTP client on some BSD +fi +if [ USE_LINARO = 1 ]; then + if which gnutar > /dev/null; then TAR=gnutar - ;; - CYGWIN*) - echo "Found CygWin that means Windows most likely." - ;; - *) - echo "Found unknown OS. Aborting!" - exit 1 - ;; -esac + elif which gtar > /dev/null; then + TAR=gtar + else # hopefully it understands the GNU format + TAR=tar + fi +else + TAR=tar # use the system tar +fi + +if [ -z ${MAKE} ]; then + if which gnumake > /dev/null; then + export MAKE=gnumake + elif which gmake > /dev/null; then + export MAKE=gmake + else + export MAKE=make # should be GNU make + fi +fi ############################################################################## # Building section @@ -144,10 +157,10 @@ esac ############################################################################## # Fetch a versioned file from a URL -fetch() { +dofetch() { if [ ! -e ${STAMPS}/$1.fetch ]; then log "Downloading $1 sources..." - wget -c $2 + ${FETCHCMD} $2 touch ${STAMPS}/$1.fetch fi } @@ -183,9 +196,9 @@ unpack() { } # Install a build -install() { +doinstall() { log $1 - ${SUDO} make ${MAKEFLAGS} $2 $3 $4 $5 $6 $7 $8 + ${SUDO} ${MAKE} ${MAKESILENT} $2 $3 $4 $5 $6 $7 $8 } if [ ! -d $SUMMON_DIR ]; then @@ -198,13 +211,21 @@ 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 -fetch ${GMP} ftp://ftp.gmplib.org/pub/${GMP}/${GMP}.tar.bz2 -fetch ${MPFR} http://www.mpfr.org/${MPFR}/${MPFR}.tar.bz2 -fetch ${MPC} http://www.multiprecision.org/mpc/download/${MPC}.tar.gz +dofetch ${BINUTILS} http://ftp.gnu.org/gnu/binutils/${BINUTILS}.tar.bz2 +dofetch ${GCC} ${GCCURL} +dofetch ${NEWLIB} ftp://sources.redhat.com/pub/newlib/${NEWLIB}.tar.gz +dofetch ${GDB} http://ftp.gnu.org/gnu/gdb/${GDB}.tar.bz2 +dofetch ${GMP} ftp://ftp.gmplib.org/pub/${GMP}/${GMP}.tar.bz2 +dofetch ${MPFR} http://www.mpfr.org/${MPFR}/${MPFR}.tar.bz2 +dofetch ${MPC} http://www.multiprecision.org/mpc/download/${MPC}.tar.gz + +if which sha1sum > /dev/null; then + for f in ${BINUTILS} ${GCC} ${NEWLIB} ${GDB} ${GMP} ${MPFR} ${MPC}; do + ( echo "$SHA1SUMS" | grep -F $f | sha1sum -c - ) || ( log 'ERROR: Checksum fail!'; exit 1 ) + done +else + log "WARING: skipping checksum checks due to missing sha1sum" +fi cd ${SUMMON_DIR} @@ -226,8 +247,8 @@ if [ ! -e ${STAMPS}/${BINUTILS}.build ]; then --disable-werror \ ${BINUTILFLAGS} log "Building ${BINUTILS}" - make ${MAKEFLAGS} - install ${BINUTILS} install + ${MAKE} ${MAKEFLAGS} + doinstall ${BINUTILS} install cd .. log "Cleaning up ${BINUTILS}" touch ${STAMPS}/${BINUTILS}.build @@ -259,8 +280,8 @@ if [ ! -e ${STAMPS}/${GCC}-boot.build ]; then --with-system-zlib \ ${GCCFLAGS} log "Building ${GCC}-boot" - make ${MAKEFLAGS} all-gcc - install ${GCC}-boot install-gcc + ${MAKE} ${MAKEFLAGS} all-gcc + doinstall ${GCC}-boot install-gcc cd .. log "Cleaning up ${GCC}-boot" touch ${STAMPS}/${GCC}-boot.build @@ -288,8 +309,8 @@ if [ ! -e ${STAMPS}/${NEWLIB}.build ]; then --with-float=soft log "Building ${NEWLIB}" NEWLIB_FLAGS="-ffunction-sections -fdata-sections -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fomit-frame-pointer -fno-unroll-loops -D__BUFSIZ__=256 -mabi=aapcs" - make ${MAKEFLAGS} CFLAGS_FOR_TARGET="${NEWLIB_FLAGS}" CCASFLAGS="${NEWLIB_FLAGS}" - install ${NEWLIB} install + ${MAKE} ${MAKEFLAGS} CFLAGS_FOR_TARGET="${NEWLIB_FLAGS}" CCASFLAGS="${NEWLIB_FLAGS}" + doinstall ${NEWLIB} install cd .. log "Cleaning up ${NEWLIB}" touch ${STAMPS}/${NEWLIB}.build @@ -321,8 +342,8 @@ if [ ! -e ${STAMPS}/${GCC}.build ]; then --with-system-zlib \ ${GCCFLAGS} log "Building ${GCC}" - make ${MAKEFLAGS} - install ${GCC} install + ${MAKE} ${MAKEFLAGS} + doinstall ${GCC} install cd .. log "Cleaning up ${GCC}" touch ${STAMPS}/${GCC}.build @@ -340,8 +361,8 @@ if [ ! -e ${STAMPS}/${GDB}.build ]; then --disable-werror \ ${GDBFLAGS} log "Building ${GDB}" - make ${MAKEFLAGS} - install ${GDB} install + ${MAKE} ${MAKEFLAGS} + doinstall ${GDB} install cd .. log "Cleaning up ${GDB}" touch ${STAMPS}/${GDB}.build