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.

118 lines
3.6 KiB

7 years ago
7 years ago
7 years ago
7 years ago
  1. #!/bin/bash
  2. dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
  3. download_dir=~/qmk_utils
  4. avrtools=avr8-gnu-toolchain
  5. armtools=gcc-arm-none-eabi
  6. installflip=false
  7. echo "Installing dependencies needed for the installation (quazip)"
  8. pacman --needed -S msys/unzip msys/p7zip base-devel msys/git mingw-w64-x86_64-toolchain
  9. source "$dir/win_shared_install.sh"
  10. function install_avr {
  11. rm -f -r "$avrtools"
  12. wget "http://ww1.microchip.com/downloads/en/DeviceDoc/avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe"
  13. 7z x avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
  14. rm avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
  15. pacman --needed -S mingw-w64-x86_64-avrdude
  16. }
  17. function install_arm {
  18. wget -O gcc-arm-none-eabi.zip "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-win32.zip?product=GNU%20ARM%20Embedded%20Toolchain,ZIP,,Windows,6-2017-q2-update"
  19. unzip -d gcc-arm-none-eabi gcc-arm-none-eabi.zip
  20. rm gcc-arm-none-eabi.zip
  21. }
  22. function extract_flip {
  23. rm -f -r flip
  24. 7z -oflip x FlipInstaller.exe
  25. }
  26. pushd "$download_dir"
  27. if [ -f "FlipInstaller.exe" ]; then
  28. echo
  29. echo "Extracting flip"
  30. extract_flip
  31. fi
  32. if [ ! -d "$avrtools" ]; then
  33. while true; do
  34. echo
  35. echo "The AVR toolchain is not installed."
  36. echo "This is needed for building AVR based keboards."
  37. read -p "Do you want to install it? (Y/N) " res
  38. case $res in
  39. [Yy]* ) install_avr; break;;
  40. [Nn]* ) break;;
  41. * ) echo "Invalid answer";;
  42. esac
  43. done
  44. else
  45. while true; do
  46. echo
  47. echo "The AVR toolchain is already installed"
  48. read -p "Do you want to reinstall? (Y/N) " res
  49. case $res in
  50. [Yy]* ) install_avr; break;;
  51. [Nn]* ) break;;
  52. * ) echo "Invalid answer";;
  53. esac
  54. done
  55. fi
  56. if [ ! -d "$armtools" ]; then
  57. while true; do
  58. echo
  59. echo "The ARM toolchain is not installed."
  60. echo "This is needed for building ARM based keyboards."
  61. read -p "Do you want to install it? (Y/N) " res
  62. case $res in
  63. [Yy]* ) install_arm; break;;
  64. [Nn]* ) break;;
  65. * ) echo "Invalid answer";;
  66. esac
  67. done
  68. else
  69. while true; do
  70. echo
  71. echo "The ARM toolchain is already installed"
  72. read -p "Do you want to reinstall? (Y/N) " res
  73. case $res in
  74. [Yy]* ) install_arm; break;;
  75. [Nn]* ) break;;
  76. * ) echo "Invalid answer";;
  77. esac
  78. done
  79. fi
  80. popd
  81. cp -f "$dir/activate_msys2.sh" "$download_dir/"
  82. if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc
  83. then
  84. echo
  85. echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc"
  86. echo "Not adding it twice!"
  87. else
  88. while true; do
  89. echo
  90. echo "Do you want to add 'source ~/qmk_utils/activate_msys2.sh' to the end of your"
  91. echo ".bashrc file? Without this make won't find the needed utils, so if you don't"
  92. echo "want to do it automatically, then you have to do it manually later."
  93. read -p "(Y/N)? " res
  94. case $res in
  95. [Yy]* ) echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc; break;;
  96. [Nn]* ) break;;
  97. * ) echo "Invalid answer";;
  98. esac
  99. done
  100. fi
  101. echo
  102. echo "******************************************************************************"
  103. echo "Installation completed!"
  104. echo "Please close this Window and restart MSYS2 MinGW"
  105. echo "******************************************************************************"