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. if [ ! -f .prereq ];then ./prerequise.sh;fi
  6. source avr-file-names
  7. TIME_START=$(date +%s)
  8. makeDir()
  9. {
  10. rm -rf "$1/"
  11. mkdir -p "$1"
  12. }
  13. echo "Downloading sources..."
  14. if [ ! -f $NAME_GCC.tar.xz ]; then
  15. wget http://wareck.free.fr/cross_compilation/avr_toolchain/$NAME_GCC.tar.xz
  16. fi
  17. # Make AVR-GCC
  18. NAME_GCC_BLD=${NAME_GCC}_bld
  19. echo "Making GCC in $NAME_GCC_BLD..."
  20. echo "Extracting..."
  21. rm -rf $NAME_GCC/
  22. tar xJf $NAME_GCC.tar.xz
  23. # Patch the download_prerequisites script
  24. cd $NAME_GCC
  25. sed -i 's/ftp/https/g' ./contrib/download_prerequisites
  26. ./contrib/download_prerequisites
  27. cd ..
  28. makeDir $NAME_GCC_BLD
  29. cd $NAME_GCC_BLD
  30. ../$NAME_GCC/configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --disable-libada --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