You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.4 KiB

7 years ago
  1. #!/bin/bash
  2. dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  3. download_dir=~/qmk_utils
  4. armtools=gcc-arm-none-eabi
  5. util_dir=$(dirname "$0")
  6. echo "Installing dependencies needed for the installation"
  7. pacman --needed --noconfirm --disable-download-timeout -Sy base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang git mingw-w64-x86_64-python3-pip unzip
  8. source "$dir/win_shared_install.sh"
  9. function install_avr {
  10. pacman --needed --noconfirm --disable-download-timeout -S \
  11. mingw-w64-x86_64-avr-binutils mingw-w64-x86_64-avr-gcc mingw-w64-x86_64-avr-libc \
  12. mingw-w64-x86_64-avrdude mingw-w64-x86_64-bootloadhid mingw-w64-x86_64-dfu-programmer mingw-w64-x86_64-teensy-loader-cli
  13. }
  14. function install_arm {
  15. rm -f -r "$armtools"
  16. wget -O gcc-arm-none-eabi-8-2019-q3-update-win32.zip "https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-win32.zip"
  17. echo "Extracting ARM toolchain..."
  18. unzip -q -d gcc-arm-none-eabi gcc-arm-none-eabi-8-2019-q3-update-win32.zip
  19. rm gcc-arm-none-eabi-8-2019-q3-update-win32.zip
  20. pacman --needed --noconfirm --disable-download-timeout -S mingw-w64-x86_64-dfu-util
  21. }
  22. pushd "$download_dir"
  23. install_avr
  24. if [ ! -d "$armtools" ]; then
  25. echo
  26. echo "The ARM toolchain is not installed."
  27. echo "This is needed for building ARM based keyboards."
  28. install_arm
  29. else
  30. while true; do
  31. echo
  32. echo "The ARM toolchain is already installed"
  33. read -p "Do you want to reinstall? (Y/N) " res
  34. case $res in
  35. [Yy]* ) install_arm; break;;
  36. [Nn]* ) break;;
  37. * ) echo "Invalid answer";;
  38. esac
  39. done
  40. fi
  41. popd
  42. pip3 install -r "${util_dir}/../requirements.txt"
  43. cp -f "$dir/activate_msys2.sh" "$download_dir/"
  44. if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc
  45. then
  46. echo
  47. echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc"
  48. echo "Not adding it twice!"
  49. else
  50. echo
  51. echo "Adding 'source ~/qmk_utils/activate_msys2.sh' to the end of your"
  52. echo ".bashrc file. Without this make won't find the needed utils."
  53. echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc;
  54. fi
  55. echo
  56. echo "******************************************************************************"
  57. echo "Installation completed!"
  58. echo "Please close this Window and restart MSYS2 MinGW"
  59. echo "******************************************************************************"