update -latest bins
[clinton/Smoothieware.git] / mac_install
dissimilarity index 65%
index 66b75c0..064b0dd 100755 (executable)
-#! /usr/bin/env bash
-# Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# Logs the command to be run and then executes the command while logging the results.
-RunAndLog () {
-    echo `date` Executing $@>>$LOGFILE
-    $@ 1>>$LOGFILE 2>$ERRORFILE
-    if [ "$?" != "0" ] ; then
-        cat $ERRORFILE >>$LOGFILE
-        echo `date` Failure forced early exit>>$LOGFILE
-        cat $LOGFILE
-        rm -f $ERRORFILE
-        popd >/dev/null
-        read -n 1 -sp "Press any key to continue..." dummy ; echo
-        exit 1
-    fi
-}
-
-
-# Setup script variables.
-ROOTDIR=$0
-ROOTDIR=${ROOTDIR%/*}
-pushd $ROOTDIR
-ROOTDIR=$PWD
-LOGFILE=$ROOTDIR/mac_install.log
-ERRORFILE=$ROOTDIR/mac_install.err
-GCC4ARM_VERSION=gcc-arm-none-eabi-4_6-2012q1
-GCC4ARM_FILENAME=gcc-arm-none-eabi-4_6-2012q1-20120316.tar.bz2
-GCC4ARM_URL=https://launchpad.net/gcc-arm-embedded/4.6/4.6-2012-q1-update/+download/$GCC4ARM_FILENAME
-GCC4ARM_TAR=$ROOTDIR/$GCC4ARM_FILENAME
-GCC4ARM_MD5=3999e0ce25ecd97b3138f3b0dc13c76f
-GCC4ARM_EXTRACT=$ROOTDIR/$GCC4ARM_VERSION
-GCC4ARM_DIR=$ROOTDIR/gcc-arm-none-eabi
-GCC4ARM_BINDIR=$GCC4ARM_DIR/bin
-GCC4ARM_LIBEXEC=$GCC4ARM_DIR/libexec/gcc/arm-none-eabi/4.6.2
-MACBIN_URL=https://github.com/adamgreen/GCC-ARM-Embedded-20120316/tarball/master
-MACBIN_TAR=$ROOTDIR/GCC-ARM-Embedded-20120316.tar.gz
-MACBIN_MD5=ab3e32a3418a38121eceb267e4366848
-MACBIN_BASEDIR=$ROOTDIR/GCC-ARM-Embedded
-MACBIN_DIR=$MACBIN_BASEDIR/osx64
-OUR_MAKE=$ROOTDIR/external/osx64/make
-BUILDSHELL_CMD=$ROOTDIR/BuildShell
-BUILDSHELL_DEBUG_CMD=$ROOTDIR/BuildShellDebug
-
-
-echo Logging install results to $LOGFILE
-echo `date` Starting $0 $*>$LOGFILE
-
-echo Downloading GNU Tools for ARM Embedded Processors...
-echo `date` Executing curl -L0 $GCC4ARM_URL>>$LOGFILE
-curl -L0 $GCC4ARM_URL >$GCC4ARM_FILENAME
-
-echo Validating md5 signature of GNU Tools for ARM Embedded Processors...
-echo `date` Validating md5 signature of GNU Tools for ARM Embedded Processors>>$LOGFILE
-archive_match=`md5 -q $GCC4ARM_FILENAME | grep -c $GCC4ARM_MD5`
-if [ "$archive_match" != "1" ] ; then
-    echo $GCC4ARM_FILENAME failed MD5 signature check.>>$LOGFILE
-    echo `date` Failure forced early exit>>$LOGFILE
-    cat $LOGFILE
-    rm -f $ERRORFILE
-    popd >/dev/null
-    read -n 1 -sp "Press any key to continue..." dummy ; echo
-    exit 1
-fi
-
-echo Downloading Mac OS X GCC binaries from github...
-echo `date` Executing curl -L0 $MACBIN_URL>>$LOGFILE
-curl -L0 $MACBIN_URL >$MACBIN_TAR
-
-echo Validating md5 signature of Mac OS X GCC binaries...
-echo `date` Validating md5 signature of csgcc4mac project>>$LOGFILE
-archive_match=`md5 -q $MACBIN_TAR | grep -c $MACBIN_MD5`
-if [ "$archive_match" != "1" ] ; then
-    echo $MACBIN_TAR failed MD5 signature check.>>$LOGFILE
-    echo `date` Failure forced early exit>>$LOGFILE
-    cat $LOGFILE
-    rm -f $ERRORFILE
-    popd >/dev/null
-    read -n 1 -sp "Press any key to continue..." dummy ; echo
-    exit 1
-fi
-
-echo Extracting GNU Tools for ARM Embedded Processors...
-rm -r $GCC4ARM_DIR >/dev/null 2>/dev/null
-RunAndLog tar xf $GCC4ARM_TAR
-RunAndLog mv $GCC4ARM_EXTRACT $GCC4ARM_DIR
-
-echo Extracting Mac OS X GCC binaries...
-RunAndLog tar -x -s /adamgreen-GCC-ARM-Embedded-[0-9]*-[a-f0-9]*/GCC-ARM-Embedded/ -f $MACBIN_TAR
-
-echo Installing 64-bit Intel Mac OS X binaries...
-RunAndLog rm -f $GCC4ARM_BINDIR/*
-RunAndLog cp $MACBIN_DIR/arm-none-eabi-* $GCC4ARM_BINDIR/
-files_to_link=(as g++ ld objcopy ranlib ar c++ gcc nm objdump strip)
-for file_item in ${files_to_link[*]} ; do
-    RunAndLog rm -f $GCC4ARM_DIR/arm-none-eabi/bin/$file_item
-    RunAndLog cp $GCC4ARM_BINDIR/arm-none-eabi-$file_item $GCC4ARM_DIR/arm-none-eabi/bin/$file_item
-done
-RunAndLog rm -rf $GCC4ARM_LIBEXEC/
-RunAndLog mkdir $GCC4ARM_LIBEXEC/
-RunAndLog cp -R $MACBIN_DIR/libexec/ $GCC4ARM_LIBEXEC/
-
-echo Creating helper scripts...
-echo "#! /usr/bin/env bash">$BUILDSHELL_CMD
-echo "# Modify next line and set destination drive to match mbed device">>$BUILDSHELL_CMD
-echo "export LPC_DEPLOY='cp PROJECT.bin /Volumes/MBED/'">>$BUILDSHELL_CMD
-echo>>$BUILDSHELL_CMD
-echo "SCRIPT_PATH=\$0">>$BUILDSHELL_CMD
-echo "SCRIPT_PATH=\${SCRIPT_PATH%/*}">>$BUILDSHELL_CMD
-echo "cd \$SCRIPT_PATH">>$BUILDSHELL_CMD
-echo "SCRIPT_PATH=\$PWD">>$BUILDSHELL_CMD
-echo "export PATH=\$SCRIPT_PATH/gcc-arm-none-eabi/bin:\$SCRIPT_PATH/external/osx64:\$PATH">>$BUILDSHELL_CMD
-echo "exec bash">>$BUILDSHELL_CMD
-chmod +x $BUILDSHELL_CMD
-
-echo "#! /usr/bin/env bash">$BUILDSHELL_DEBUG_CMD
-echo "# Modify next line and set destination drive to match mbed device">>$BUILDSHELL_DEBUG_CMD
-echo "export LPC_DEPLOY='cp PROJECT.bin /Volumes/MBED/'">>$BUILDSHELL_DEBUG_CMD
-echo>>$BUILDSHELL_DEBUG_CMD
-echo "SCRIPT_PATH=\$0">>$BUILDSHELL_DEBUG_CMD
-echo "SCRIPT_PATH=\${SCRIPT_PATH%/*}">>$BUILDSHELL_DEBUG_CMD
-echo "cd \$SCRIPT_PATH">>$BUILDSHELL_DEBUG_CMD
-echo "SCRIPT_PATH=\$PWD">>$BUILDSHELL_DEBUG_CMD
-echo "export PATH=\$SCRIPT_PATH/gcc-arm-none-eabi/bin:\$PATH">>$BUILDSHELL_DEBUG_CMD
-echo "export GCC4MBED_TYPE=Debug">>$BUILDSHELL_DEBUG_CMD
-echo "exec bash">>$BUILDSHELL_DEBUG_CMD
-chmod +x $BUILDSHELL_DEBUG_CMD
-
-# Place arm-none-eabi-* tools in the path before building gcc4mbed code.
-PATH=$GCC4ARM_BINDIR:$PATH
-
-echo Performing a clean build of the gcc4mbed samples...
-RunAndLog $OUR_MAKE clean
-RunAndLog $OUR_MAKE
-
-echo Cleaning up intermediate files...
-RunAndLog rm -r $MACBIN_BASEDIR
-RunAndLog rm $MACBIN_TAR
-RunAndLog rm $GCC4ARM_TAR
-
-echo
-echo To build gcc4mbed samples, you will first need to run the following script
-echo so that your environment variables are set correctly:
-echo  $BUILDSHELL_CMD
-echo You will want to run this each time you start a new Terminal.  You
-echo can simply double-click on this script file from Finder to launch a
-echo bash Terminal that has been properly initialized for building gcc4mbed
-echo based code.  Feel free to customize it as you desire.
-echo
-echo You can also just edit your existing setup script such as \~/.profile
-echo to update the PATH environment variable to include:
-echo  $GCC4ARM_BINDIR
-
-
-# Restore current directory and exit script on success.
-echo `date` Finished successfully>>$LOGFILE
-echo Finished successfully
-rm -f $ERRORFILE
-popd >/dev/null
-read -n 1 -sp "Press any key to continue..." dummy ; echo
+#! /usr/bin/env bash
+# Copyright 2012 Adam Green (http://mbed.org/users/AdamGreen/)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# Logs the command to be run and then executes the command while logging the results.
+RunAndLog () {
+    echo `date` Executing "$@">>"$LOGFILE"
+    "$@" 1>>"$LOGFILE" 2>"$ERRORFILE"
+    if [ "$?" != "0" ] ; then
+        cat "$ERRORFILE" >>"$LOGFILE"
+        echo `date` Failure forced early exit>>"$LOGFILE"
+        cat "$LOGFILE"
+        rm -f "$ERRORFILE"
+        popd >/dev/null
+        read -n 1 -sp "Press any key to continue..." dummy ; echo
+        exit 1
+    fi
+}
+
+
+# Setup script variables.
+ROOTDIR=$0
+ROOTDIR=${ROOTDIR%/*}
+pushd $ROOTDIR
+ROOTDIR=$PWD
+LOGFILE="$ROOTDIR"/mac_install.log
+ERRORFILE="$ROOTDIR"/mac_install.err
+GCC4ARM_VERSION=gcc-arm-none-eabi-4_8-2014q1
+GCC4ARM_FILENAME=gcc-arm-none-eabi-4_8-2014q1-20140314-mac.tar.bz2
+GCC4ARM_URL=https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q1-update/+download/$GCC4ARM_FILENAME
+GCC4ARM_TAR="$ROOTDIR"/$GCC4ARM_FILENAME
+GCC4ARM_MD5=5d34d95a53ba545f1585b9136cbb6805
+GCC4ARM_EXTRACT="$ROOTDIR"/$GCC4ARM_VERSION
+GCC4ARM_DIR="$ROOTDIR"/gcc-arm-none-eabi
+GCC4ARM_BINDIR=$GCC4ARM_DIR/bin
+MACBIN_DIR="$ROOTDIR"/build/osx64
+BUILDSHELL_CMD="$ROOTDIR"/BuildShell
+
+
+echo Logging install results to "$LOGFILE"
+echo `date` Starting $0 $*>"$LOGFILE"
+
+echo Downloading GNU Tools for ARM Embedded Processors...
+echo `date` Executing curl -L0 $GCC4ARM_URL>>"$LOGFILE"
+curl -L0 $GCC4ARM_URL >$GCC4ARM_FILENAME
+
+echo Validating md5 signature of GNU Tools for ARM Embedded Processors...
+echo `date` Validating md5 signature of GNU Tools for ARM Embedded Processors>>"$LOGFILE"
+archive_match=`md5 -q $GCC4ARM_FILENAME | grep -c $GCC4ARM_MD5`
+if [ "$archive_match" != "1" ] ; then
+    echo $GCC4ARM_FILENAME failed MD5 signature check.>>"$LOGFILE"
+    echo `date` Failure forced early exit>>"$LOGFILE"
+    cat "$LOGFILE"
+    rm -f "$ERRORFILE"
+    popd >/dev/null
+    read -n 1 -sp "Press any key to continue..." dummy ; echo
+    exit 1
+fi
+
+echo Extracting GNU Tools for ARM Embedded Processors...
+rm -r "$GCC4ARM_DIR" >/dev/null 2>/dev/null
+echo $GCC4ARM_TAR
+RunAndLog tar xf "$GCC4ARM_TAR"
+RunAndLog mv "$GCC4ARM_EXTRACT" "$GCC4ARM_DIR"
+
+echo Installing patched 64-bit Intel Mac OS X GDB binaries...
+RunAndLog cp "$MACBIN_DIR"/arm-none-eabi-gdb* "$GCC4ARM_BINDIR/"
+
+echo Creating helper scripts...
+echo "#! /usr/bin/env bash">"$BUILDSHELL_CMD"
+echo "# Modify next line and set destination drive to match mbed device">>"$BUILDSHELL_CMD"
+echo "export LPC_DEPLOY='cp PROJECT.bin /Volumes/MBED/ ; sync'">>"$BUILDSHELL_CMD"
+echo>>"$BUILDSHELL_CMD"
+echo "SCRIPT_PATH=\$0">>"$BUILDSHELL_CMD"
+echo "SCRIPT_PATH=\${SCRIPT_PATH%/*}">>"$BUILDSHELL_CMD"
+echo "cd \$SCRIPT_PATH">>"$BUILDSHELL_CMD"
+echo "SCRIPT_PATH=\$PWD">>"$BUILDSHELL_CMD"
+echo "export PATH=\$SCRIPT_PATH/gcc-arm-none-eabi/bin:\$SCRIPT_PATH/build/osx64:\$PATH">>"$BUILDSHELL_CMD"
+echo "exec bash">>"$BUILDSHELL_CMD"
+chmod +x "$BUILDSHELL_CMD"
+
+echo Cleaning up intermediate files...
+RunAndLog rm "$GCC4ARM_TAR"
+
+echo
+echo To build Smoothie, you will first need to run the following script
+echo so that your environment variables are set correctly:
+echo  $BUILDSHELL_CMD
+echo You will want to run this each time you start a new Terminal.  You
+echo can simply double-click on this script file from Finder to launch a
+echo bash Terminal that has been properly initialized for building. Feel
+echo free to customize it as you desire.
+echo
+echo You can also just edit your existing setup script such as \~/.profile
+echo to update the PATH environment variable to include:
+echo  $GCC4ARM_BINDIR
+
+
+# Restore current directory and exit script on success.
+echo `date` Finished successfully>>"$LOGFILE"
+echo Finished successfully
+rm -f "$ERRORFILE"
+popd >/dev/null
+read -n 1 -sp "Press any key to continue..." dummy ; echo