123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #!/bin/bash
- # http://www.nongnu.org/avr-libc/user-manual/install_tools.html
- # Stop on errors
- set -e
- source avr-file-names
- # Figure out which version of the patch to use
- OLD_PATCH_CUTOFF="2.32"
- OLD_PATCH_CUTOFF_MAJ=${OLD_PATCH_CUTOFF%%.*}
- OLD_PATCH_CUTOFF_MIN=${OLD_PATCH_CUTOFF#*.}
- BINUTILS_VER=${NAME_BINUTILS#binutils-}
- BINUTILS_VER_MAJ=${BINUTILS_VER%%.*}
- BINUTILS_VER_MIN_TMP=${BINUTILS_VER#*.}
- BINUTILS_VER_MIN=${BINUTILS_VER_MIN_TMP%.*}
- if [ $BINUTILS_VER_MAJ -eq "1" ]; then
- echo "ERROR: Binutils version 1.xx is too old -- use at least version 2.xx"
- exit 1;
- fi
- if [ $BINUTILS_VER_MAJ -gt $OLD_PATCH_CUTOFF_MAJ ] || \
- ( [ $BINUTILS_VER_MAJ -eq $OLD_PATCH_CUTOFF_MAJ ] && [ $BINUTILS_VER_MIN -gt $OLD_PATCH_CUTOFF_MIN ] ) ; then
- NAME_BINUTILS_SIZE_PATCH="avr-binutils-size-2.33.patch";
- else
- NAME_BINUTILS_SIZE_PATCH="avr-binutils-size-2.32.patch";
- fi
- TIME_START=$(date +%s)
- makeDir()
- {
- rm -rf "$1/"
- mkdir -p "$1"
- }
- echo "Downloading sources..."
- if [ ! -f $NAME_BINUTILS.tar.xz ]; then
- wget https://ftp.mirrorservice.org/sites/ftp.gnu.org/gnu/binutils/$NAME_BINUTILS.tar.xz
- fi
- # Make AVR-Binutils
- NAME_BINUTILS_BLD=${NAME_BINUTILS}_bld
- echo "Making Binutils in $NAME_BINUTILS_BLD..."
- echo "Extracting..."
- rm -rf $NAME_BINUTILS/
- tar xf $NAME_BINUTILS.tar.xz
- # Patch the size function
- cd $NAME_BINUTILS/binutils
- patch -p 1 < ../../$NAME_BINUTILS_SIZE_PATCH
- cd ../..
- makeDir $NAME_BINUTILS_BLD
- cd $NAME_BINUTILS_BLD
- ../$NAME_BINUTILS/configure --prefix=$PREFIX --target=avr --disable-nls
- make -j $JOBCOUNT
- sudo make install-strip
- cd ..
- TIME_END=$(date +%s)
- TIME_RUN=$(($TIME_END - $TIME_START))
- echo ""
- echo "Done in $TIME_RUN seconds"
- exit 0
|