build-avr-libc 905 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_LIBC.tar.xz ]; then
  15. wget http://wareck.free.fr/cross_compilation/avr_toolchain/$NAME_LIBC.tar.xz
  16. fi
  17. # Make AVR-libc
  18. NAME_LIBC_BLD=${NAME_LIBC}_bld
  19. echo "Making AVR-LIBC in $NAME_LIBC_BLD..."
  20. echo "Extracting..."
  21. rm -rf $NAME_LIBC/
  22. tar xJf $NAME_LIBC.tar.xz
  23. makeDir $NAME_LIBC_BLD
  24. AR='avr-ar'
  25. AS='avr-as'
  26. CC='avr-gcc'
  27. CCAS='gcc'
  28. cd $NAME_LIBC_BLD
  29. ../$NAME_LIBC/configure --prefix=$PREFIX --build=$(../$NAME_LIBC/config.guess) --host=avr
  30. make -j $JOBCOUNT
  31. sudo env "PATH=$PATH" make install-strip
  32. cd ..
  33. TIME_END=$(date +%s)
  34. TIME_RUN=$(($TIME_END - $TIME_START))
  35. echo ""
  36. echo "Done in $TIME_RUN seconds"
  37. exit 0