2017-07-10 20:31:58 +06:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
2017-07-11 19:44:46 +06:00
|
|
|
download_dir=~/qmk_utils
|
2017-07-11 20:18:24 +06:00
|
|
|
armtools=gcc-arm-none-eabi
|
2019-07-16 01:14:27 +06:00
|
|
|
util_dir=$(dirname "$0")
|
2017-07-10 21:16:35 +06:00
|
|
|
|
2020-08-25 15:04:42 +06:00
|
|
|
echo "Installing dependencies needed for the installation"
|
2020-04-17 13:50:58 +06:00
|
|
|
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
|
2017-07-11 19:44:46 +06:00
|
|
|
|
2017-07-10 21:05:32 +06:00
|
|
|
source "$dir/win_shared_install.sh"
|
|
|
|
|
2017-07-11 19:44:46 +06:00
|
|
|
function install_avr {
|
2020-08-25 15:04:42 +06:00
|
|
|
pacman --needed --noconfirm --disable-download-timeout -S \
|
|
|
|
mingw-w64-x86_64-avr-binutils mingw-w64-x86_64-avr-gcc mingw-w64-x86_64-avr-libc \
|
|
|
|
mingw-w64-x86_64-avrdude mingw-w64-x86_64-bootloadhid mingw-w64-x86_64-dfu-programmer mingw-w64-x86_64-teensy-loader-cli
|
2017-07-11 19:44:46 +06:00
|
|
|
}
|
|
|
|
|
2017-07-11 20:18:24 +06:00
|
|
|
function install_arm {
|
2019-11-22 13:09:02 +06:00
|
|
|
rm -f -r "$armtools"
|
|
|
|
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"
|
|
|
|
echo "Extracting ARM toolchain..."
|
|
|
|
unzip -q -d gcc-arm-none-eabi gcc-arm-none-eabi-8-2019-q3-update-win32.zip
|
|
|
|
rm gcc-arm-none-eabi-8-2019-q3-update-win32.zip
|
2020-08-14 04:26:14 +06:00
|
|
|
|
|
|
|
pacman --needed --noconfirm --disable-download-timeout -S mingw-w64-x86_64-dfu-util
|
2017-07-11 20:18:24 +06:00
|
|
|
}
|
2017-07-11 19:44:46 +06:00
|
|
|
|
2017-07-11 20:18:24 +06:00
|
|
|
pushd "$download_dir"
|
2017-07-11 19:44:46 +06:00
|
|
|
|
2020-08-25 15:04:42 +06:00
|
|
|
install_avr
|
2017-07-11 20:18:24 +06:00
|
|
|
|
|
|
|
if [ ! -d "$armtools" ]; then
|
2019-11-22 13:09:02 +06:00
|
|
|
echo
|
|
|
|
echo "The ARM toolchain is not installed."
|
|
|
|
echo "This is needed for building ARM based keyboards."
|
|
|
|
install_arm
|
2017-07-11 20:18:24 +06:00
|
|
|
else
|
|
|
|
while true; do
|
|
|
|
echo
|
|
|
|
echo "The ARM toolchain is already installed"
|
|
|
|
read -p "Do you want to reinstall? (Y/N) " res
|
|
|
|
case $res in
|
|
|
|
[Yy]* ) install_arm; break;;
|
|
|
|
[Nn]* ) break;;
|
|
|
|
* ) echo "Invalid answer";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
2017-07-11 19:44:46 +06:00
|
|
|
popd
|
|
|
|
|
2020-03-15 23:15:42 +06:00
|
|
|
pip3 install -r "${util_dir}/../requirements.txt"
|
2019-07-16 01:14:27 +06:00
|
|
|
|
2017-07-11 20:55:03 +06:00
|
|
|
cp -f "$dir/activate_msys2.sh" "$download_dir/"
|
|
|
|
|
|
|
|
if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc
|
|
|
|
then
|
|
|
|
echo
|
|
|
|
echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc"
|
|
|
|
echo "Not adding it twice!"
|
|
|
|
else
|
|
|
|
echo
|
2019-11-22 13:09:02 +06:00
|
|
|
echo "Adding 'source ~/qmk_utils/activate_msys2.sh' to the end of your"
|
|
|
|
echo ".bashrc file. Without this make won't find the needed utils."
|
|
|
|
echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc;
|
2017-07-11 20:55:03 +06:00
|
|
|
fi
|
|
|
|
|
2017-07-10 21:05:32 +06:00
|
|
|
echo
|
|
|
|
echo "******************************************************************************"
|
|
|
|
echo "Installation completed!"
|
2017-07-11 20:55:03 +06:00
|
|
|
echo "Please close this Window and restart MSYS2 MinGW"
|
2018-01-04 00:00:15 +06:00
|
|
|
echo "******************************************************************************"
|