X-Git-Url: https://git.gag.com/?p=fw%2Fcortex-toolchain;a=blobdiff_plain;f=summon-arm-toolchain;h=afbcbe4a3485db4683a1e63f392fa1b3bd51ce19;hp=0d6385d3761f456d32b94bd5796af9965f2b88f7;hb=7df1edb6a20980d0069d5fff5d119d7498259c8f;hpb=d6c345c10750661f5002441db6378f14b3a19df5 diff --git a/summon-arm-toolchain b/summon-arm-toolchain index 0d6385d..afbcbe4 100755 --- a/summon-arm-toolchain +++ b/summon-arm-toolchain @@ -91,15 +91,20 @@ SUMMON_DIR=$(pwd) SOURCES=${SUMMON_DIR}/sources STAMPS=${SUMMON_DIR}/stamps + +############################################################################## +# Tool section +############################################################################## +TAR=tar + ############################################################################## # OS and Tooldetection section -# Detects which tools to use +# Detects which tools and flags to use ############################################################################## case "$(uname)" in Linux) echo "Found Linux OS." - TAR=tar ;; Darwin) echo "Found Darwin OS." @@ -108,13 +113,6 @@ case "$(uname)" in --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!" @@ -147,7 +145,23 @@ function log { function unpack { log Unpacking $* # Use 'auto' mode decompression. Replace with a switch if tar doesn't support -a - ${TAR} xaf${TARFLAGS} ${SOURCES}/$1.tar.* + 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 @@ -334,7 +348,7 @@ if [ ! -e ${STAMPS}/${GDB}.build ]; then fi if [ ${LIBSTM32_EN} != 0 ]; then -if [ ! -e .libcmsis-${LIBCMSIS}.build ]; then +if [ ! -e ${STAMPS}/libcmsis-${LIBCMSIS}.build ]; then unpack libcmsis-${LIBCMSIS} cd libcmsis-${LIBCMSIS} log "Building libcmsis-${LIBCMSIS}" @@ -342,11 +356,11 @@ if [ ! -e .libcmsis-${LIBCMSIS}.build ]; then install libcmsis-${LIBCMSIS} arch_prefix=${TARGET} prefix=${PREFIX} install cd .. log "Cleaning up libcmsis-${LIBCMSIS}" - touch .libcmsis-${LIBCMSIS}.build + touch ${STAMPS}/libcmsis-${LIBCMSIS}.build rm -rf libcmsis-${LIBCMSIS} fi -if [ ! -e .libstm32-${LIBSTM32}.build ]; then +if [ ! -e ${STAMPS}/libstm32-${LIBSTM32}.build ]; then unpack libstm32-${LIBSTM32} cd libstm32-${LIBSTM32} log "Building libstm32-${LIBSTM32}" @@ -354,11 +368,11 @@ if [ ! -e .libstm32-${LIBSTM32}.build ]; then install libstm32-${LIBSTM32} arch_prefix=${TARGET} prefix=${PREFIX} install cd .. log "Cleaning up libstm32-${LIBSTM32}" - touch .libstm32-${LIBSTM32}.build + touch ${STAMPS}/libstm32-${LIBSTM32}.build rm -rf libstm32-${LIBSTM32} fi -if [ ! -e .libstm32usb-${LIBSTM32USB}.build ]; then +if [ ! -e ${STAMPS}/libstm32usb-${LIBSTM32USB}.build ]; then unpack libstm32usb-${LIBSTM32USB} cd libstm32usb-${LIBSTM32USB} log "Building libstm32usb-${LIBSTM32USB}" @@ -366,12 +380,13 @@ if [ ! -e .libstm32usb-${LIBSTM32USB}.build ]; then install libstm32usb-${LIBSTM32USB} arch_prefix=${TARGET} prefix=${PREFIX} install cd .. log "Cleaning up libstm32usb-${LIBSTM32USB}" - touch .libstm32usb-${LIBSTM32USB}.build + touch ${STAMPS}/libstm32usb-${LIBSTM32USB}.build rm -rf libstm32usb-${LIBSTM32USB} fi fi if [ $LIBOPENSTM32_EN != 0 ]; then +if [ ! -e ${STAMPS}/libopenstm32-${LIBOPENSTM32}.build ]; then unpack libopenstm32-${LIBOPENSTM32} cd libopenstm32-${LIBOPENSTM32} log "Building libopenstm32-${LIBOPENSTM32}" @@ -379,6 +394,7 @@ if [ $LIBOPENSTM32_EN != 0 ]; then install libopenstm32-${LIBOPENSTM32} PREFIX=${TARGET} DESTDIR=${PREFIX} install cd .. log "Cleaning up libopenstm32-${LIBOPENSTM32}" - touch .libopenstm32-${LIBOPENSTM32}.build + touch ${STAMPS}/libopenstm32-${LIBOPENSTM32}.build rm -rf libopenstm32-${LIBOPENSTM32} fi +fi