qmk-keychron-q3-colemak-dh/util/msys2_install.sh
Drashna Jaelre 66d4734371 Improve and streamline MSYS2 installation (#7232)
* Make MSYS force install

* Cleanup msys script

* Update to gcc 8.3 for arm and avr

And cleanup install scripts for both

* Fix path and scripts

* Fix links

* No confirmation for msys

* Tweak arm function since file structure changed

* Fix spacing and wording

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Only use MSYS2's make binary

Co-Authored-By: fauxpark <fauxpark@gmail.com>

* Some wordsmithing

Co-Authored-By: Mikkel Jeppesen <2756925+Duckle29@users.noreply.github.com>

* Add "disable download timeout" for download issues in MSYS

Co-Authored-By: Mikkel Jeppesen <2756925+Duckle29@users.noreply.github.com>

* Clean up URL for arm gcc download

Co-Authored-By: Joel Challis <git@zvecr.com>

* add pip

Co-Authored-By: fauxpark <fauxpark@gmail.com>
2019-11-22 18:09:02 +11:00

105 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
download_dir=~/qmk_utils
avrtools=avr8-gnu-toolchain
armtools=gcc-arm-none-eabi
installflip=false
util_dir=$(dirname "$0")
echo "Installing dependencies needed for the installation (quazip)"
pacman --needed --noconfirm --disable-download-timeout -Sy base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang msys/git msys/p7zip mingw-w64-x86_64-python3-pip msys/unzip
source "$dir/win_shared_install.sh"
function install_avr {
rm -f -r "$avrtools"
wget "https://blog.zakkemble.net/download/avr-gcc-8.3.0-x86-mingw.zip"
echo "Extracting AVR toolchain..."
unzip -q -d . avr-gcc-8.3.0-x86-mingw.zip
mv avr-gcc-8.3.0-x86-mingw avr8-gnu-toolchain
rm avr8-gnu-toolchain/bin/make.exe
rm avr-gcc-8.3.0-x86-mingw.zip
pacman --needed --disable-download-timeout -S mingw-w64-x86_64-avrdude
}
function install_arm {
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
}
function extract_flip {
rm -f -r flip
7z -oflip x FlipInstaller.exe
}
pushd "$download_dir"
if [ -f "FlipInstaller.exe" ]; then
echo
echo "Extracting flip"
extract_flip
fi
if [ ! -d "$avrtools" ]; then
echo
echo "The AVR toolchain is not installed."
echo "This is needed for building AVR based keyboards."
install_avr
else
while true; do
echo
echo "The AVR toolchain is already installed"
read -p "Do you want to reinstall? (Y/N) " res
case $res in
[Yy]* ) install_avr; break;;
[Nn]* ) break;;
* ) echo "Invalid answer";;
esac
done
fi
if [ ! -d "$armtools" ]; then
echo
echo "The ARM toolchain is not installed."
echo "This is needed for building ARM based keyboards."
install_arm
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
popd
pip3 install -r ${util_dir}/../requirements.txt
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
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;
fi
echo
echo "******************************************************************************"
echo "Installation completed!"
echo "Please close this Window and restart MSYS2 MinGW"
echo "******************************************************************************"