Fold install_dependencies.sh into linux_install.sh and freebsd_install.sh

This commit is contained in:
skullY 2018-10-09 09:40:10 -07:00 committed by Drashna Jaelre
parent 704a2e8d3c
commit ca56c2145f
4 changed files with 114 additions and 151 deletions

18
util/freebsd_install.sh Normal file
View file

@ -0,0 +1,18 @@
#!/bin/sh
pkg update
pkg install -y \
git \
wget \
gmake \
gcc \
zip \
unzip \
avr-binutils \
avr-gcc \
avr-libc \
dfu-programmer \
dfu-util \
arm-none-eabi-gcc \
arm-none-eabi-binutils \
arm-none-eabi-newlib \
diffutils

View file

@ -1,118 +0,0 @@
#!/usr/bin/env bash
# This script will attempt to setup the Linux dependencies for compiling QMK/TMK
# This could probably go much lower, but since we are including an Arch vagrant,
# making it the first match makes sense
if [[ -n "$(type -P pacman )" ]]; then
# Arch linux and derivatives like Apricity
# Future improvements:
# Allow user to speed up package installs using powerpill/wget tweaks
# Always run the pacman mirror update script if possible when vagrant comes up
# This will ensure that users never get stalled on a horribly slow mirror
pacman -Syyu --needed --noconfirm
pacman -S --needed --noconfirm \
base-devel \
avr-gcc \
avr-binutils \
avr-libc \
dfu-util \
arm-none-eabi-gcc \
arm-none-eabi-binutils \
arm-none-eabi-newlib \
git \
diffutils
elif [[ -n "$(type -P apt-get)" ]]; then
# Debian and derivatives
# This block performs completely non-interactive updates {{
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
echo "grub-pc hold" | dpkg --set-selections
apt-get -y update
apt-get -y --allow-unauthenticated upgrade \
-o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold"
# }}
apt-get install -y \
build-essential \
gcc \
unzip \
wget \
zip \
gcc-avr \
binutils-avr \
avr-libc \
dfu-programmer \
dfu-util \
gcc-arm-none-eabi \
binutils-arm-none-eabi \
libnewlib-arm-none-eabi \
git \
diffutils
elif [[ -n "$(type -P yum)" ]]; then
# Fedora, CentOS or RHEL and derivatives
yum -y makecache && yum -y update
yum -y install \
gcc \
glibc-headers \
kernel-devel \
kernel-headers \
make \
perl \
git \
wget \
avr-binutils \
avr-gcc \
avr-libc \
dfu-programmer \
dfu-util \
arm-none-eabi-gcc-cs \
arm-none-eabi-newlib \
git \
diffutils
# The listed eabi pacackes do unfortunately not exist for CentOS,
# But at least in Fedora they do, so try to install them anyway
# TODO: Build them from sources, if the installation fails
elif [[ -n "$(type -P zypper)" ]]; then
# openSUSE
zypper --non-interactive refresh && zypper --non-interactive update
zypper --non-interactive install \
git \
make \
gcc \
kernel-devel \
patch \
wget \
dfu-programmer \
git \
diffutils
# TODO: The avr and eabi tools are not available as default packages, so we need
# another way to install them
elif [[ -n "$(type -P pkg)" ]]; then
# FreeBSD
pkg update
pkg install -y \
git \
wget \
gmake \
gcc \
zip \
unzip \
avr-binutils \
avr-gcc \
avr-libc \
dfu-programmer \
dfu-util \
arm-none-eabi-gcc \
arm-none-eabi-binutils \
arm-none-eabi-newlib \
diffutils
elif [[ -n "$(type -P emerge)" ]]; then
echo 'Please check that your gcc is built with the multilib use flag enabled.'
emerge -vq sys-devel/crossdev
USE="-openmp -hardened -sanitize -vtv" crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
fi

View file

@ -1,26 +1,79 @@
#!/bin/sh
if grep ID /etc/os-release | grep -qE "rhel|fedora"; then
# RPM based OS
sudo dnf install gcc unzip wget zip dfu-util dfu-programmer avr-gcc \
avr-libc binutils-avr32-linux-gnu arm-none-eabi-gcc-cs \
arm-none-eabi-binutils-cs arm-none-eabi-newlib
# Note: This file uses tabs to indent. Please don't mix tabs and spaces.
GENTOO_WARNING="This script will make a USE change in order to ensure that that QMK works on your system. All changes will be sent to the the file /etc/portage/package.use/qmk_firmware -- please review it, and read Portage's output carefully before installing any packages on your system. You will also need to ensure that your kernel is compiled with support for the keyboard chip that you are using (e.g. enable Arduino for the Pro Micro). Further information can be found on the Gentoo wiki."
if grep ID /etc/os-release | grep -qE "fedora"; then
sudo dnf install \
arm-none-eabi-binutils-cs \
arm-none-eabi-gcc-cs \
arm-none-eabi-newlib
avr-binutils \
avr-gcc \
avr-libc \
binutils-avr32-linux-gnu \
dfu-util \
dfu-programmer \
diffutils \
git \
gcc \
glibc-headers \
kernel-devel \
kernel-headers \
make \
perl \
unzip \
wget \
zip
elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
sudo apt-get update
sudo apt-get install gcc unzip wget zip gcc-avr binutils-avr avr-libc \
dfu-programmer dfu-util gcc-arm-none-eabi binutils-arm-none-eabi \
libnewlib-arm-none-eabi
sudo apt-get install \
build-essential \
avr-libc \
binutils-arm-none-eabi \
binutils-avr \
dfu-programmer \
dfu-util \
diffutils \
gcc \
gcc-arm-none-eabi \
gcc-avr \
git \
libnewlib-arm-none-eabi \
unzip \
wget \
zip
elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
# install avr-gcc 8.1 until 8.3 is available. See #3657 for details of the bug.
sudo pacman -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.1.0-1-x86_64.pkg.tar.xz
sudo pacman -S gcc unzip wget zip avr-binutils avr-libc \
dfu-util arm-none-eabi-gcc arm-none-eabi-binutils \
arm-none-eabi-newlib
sudo pacman -S \
arm-none-eabi-binutils \
arm-none-eabi-gcc \
arm-none-eabi-newlib \
avr-binutils \
avr-libc \
avr-gcc \
base-devel \
dfu-util \
diff-utils \
gcc \
git \
unzip \
wget \
zip
git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer
cd /tmp/dfu-programmer
makepkg -sic
rm -rf /tmp/dfu-programmer/
elif grep ID /etc/os-release | grep -q gentoo; then
echo "This script will make a USE change in order to ensure that that QMK works on your system. All changes will be sent to the the file /etc/portage/package.use/qmk_firmware -- please review it, and read Portage's output carefully before installing any packages on your system. You will also need to ensure that your kernel is compiled with support for the keyboard chip that you are using (e.g. enable Arduino for the Pro Micro). Further information can be found on the Gentoo wiki."
echo GENTOO_WARNING | fmt
echo -n "Proceed (y/N)? "
old_stty_cfg=$(stty -g)
stty raw -echo
@ -29,12 +82,19 @@ elif grep ID /etc/os-release | grep -q gentoo; then
if echo "$answer" | grep -iq "^y" ;then
sudo touch /etc/portage/package.use/qmkfirmware
echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware > /dev/null
sudo emerge -auN sys-devel/gcc app-arch/unzip app-arch/zip net-misc/wget app-mobilephone/dfu-util sys-devel/crossdev dev-embedded/avrdude
sudo emerge -auN \
app-arch/unzip \
app-arch/zip \
app-mobilephone/dfu-util \
net-misc/wget \
sys-devel/gcc \
sys-devel/crossdev dev-embedded/avrdude
sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
echo Done!
else
echo "Quitting..."
fi
fi
else
echo "Sorry, we don't recognize your OS. Help us by contributing support!"
echo

View file

@ -10,6 +10,9 @@ case $(uname -a) in
*Linux*Microsoft*)
exec "${util_dir}/wsl_install.sh"
;;
*FreeBSD*)
exec "${util_dir}/freebsd_install.sh"
;;
*Linux*)
exec "${util_dir}/linux_install.sh"
;;