build-avr-gcc 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # http://www.nongnu.org/avr-libc/user-manual/install_tools.html
  3. # Stop on errors
  4. set -e
  5. source avr-file-names
  6. TIME_START=$(date +%s)
  7. makeDir()
  8. {
  9. rm -rf "$1/"
  10. mkdir -p "$1"
  11. }
  12. echo "Downloading sources..."
  13. if [ ! -f $NAME_GCC.tar.xz ]; then
  14. wget https://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/$NAME_GCC/$NAME_GCC.tar.xz
  15. fi
  16. # Make AVR-GCC
  17. NAME_GCC_BLD=${NAME_GCC}_bld
  18. echo "Making GCC in $NAME_GCC_BLD..."
  19. echo "Extracting..."
  20. rm -rf $NAME_GCC/
  21. tar xf $NAME_GCC.tar.xz
  22. # Patch the download_prerequisites script
  23. cd $NAME_GCC
  24. sed -i 's/ftp/https/g' ./contrib/download_prerequisites
  25. ./contrib/download_prerequisites
  26. cd ..
  27. makeDir $NAME_GCC_BLD
  28. cd $NAME_GCC_BLD
  29. ../$NAME_GCC/configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --disable-libada \
  30. --with-dwarf2 --disable-shared --enable-static
  31. make -j $JOBCOUNT
  32. sudo make install-strip
  33. cd ..
  34. TIME_END=$(date +%s)
  35. TIME_RUN=$(($TIME_END - $TIME_START))
  36. echo ""
  37. echo "Done in $TIME_RUN seconds"
  38. exit 0