]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/msys2_install.sh
Install arm toolchain
[qmk_firmware.git] / util / msys2_install.sh
1 #!/bin/bash
2
3 dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
4 download_dir=~/qmk_utils
5 avrtools=avr8-gnu-toolchain
6 armtools=gcc-arm-none-eabi
7
8 echo "Installing dependencies needed for the installation (quazip)"
9 pacman --needed -S msys/unzip msys/p7zip
10
11 source "$dir/win_shared_install.sh"
12
13 function install_avr {
14     rm -f -r "$avrtools"
15     wget "http://www.atmel.com/images/avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe"
16     7z x avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
17     rm avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe
18 }
19
20 function install_arm {
21     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"
22     unzip -d gcc-arm-none-eabi gcc-arm-none-eabi.zip
23     rm gcc-arm-none-eabi.zip
24 }
25
26 pushd "$download_dir"
27
28 if [ ! -d "$avrtools" ]; then
29     while true; do
30         echo
31         echo "The AVR toolchain is not installed."
32         echo "This is needed for building AVR based keboards."
33         read -p "Do you want to install it? (Y/N) " res
34         case $res in
35             [Yy]* ) install_avr; break;;
36             [Nn]* ) break;;
37             * ) echo "Invalid answer";;
38         esac
39     done
40 else
41     while true; do
42         echo
43         echo "The AVR toolchain is already installed"
44         read -p "Do you want to reinstall? (Y/N) " res
45         case $res in
46             [Yy]* ) install_avr; break;;
47             [Nn]* ) break;;
48             * ) echo "Invalid answer";;
49         esac
50     done
51 fi
52
53 if [ ! -d "$armtools" ]; then
54     while true; do
55         echo
56         echo "The ARM toolchain is not installed."
57         echo "This is needed for building ARM based keboards."
58         read -p "Do you want to install it? (Y/N) " res
59         case $res in
60             [Yy]* ) install_arm; break;;
61             [Nn]* ) break;;
62             * ) echo "Invalid answer";;
63         esac
64     done
65 else
66     while true; do
67         echo
68         echo "The ARM toolchain is already installed"
69         read -p "Do you want to reinstall? (Y/N) " res
70         case $res in
71             [Yy]* ) install_arm; break;;
72             [Nn]* ) break;;
73             * ) echo "Invalid answer";;
74         esac
75     done
76 fi
77 popd
78
79 echo
80 echo "******************************************************************************"
81 echo "Installation completed!"
82 echo "You need to open a new batch command prompt for all the utils to work properly"
83 echo "******************************************************************************"