]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/install_dependencies.sh
convert to unix line-endings [skip ci]
[qmk_firmware.git] / util / install_dependencies.sh
1 #!/usr/bin/env bash
2 # This script will attempt to setup the Linux dependencies for compiling QMK/TMK
3
4 # This could probably go much lower, but since we are including an Arch vagrant,
5 # making it the first match makes sense
6
7 if [[ -n "$(type -P pacman )" ]]; then
8   # Arch linux and derivatives like Apricity
9   # Future improvements:
10   # Allow user to speed up package installs using powerpill/wget tweaks
11   # Always run the pacman mirror update script if possible when vagrant comes up
12   # This will ensure that users never get stalled on a horribly slow mirror
13   pacman -Syyu --needed --noconfirm
14   pacman -S --needed --noconfirm \
15     base-devel \
16     avr-gcc \
17     avr-binutils \
18     avr-libc \
19     dfu-util \
20     arm-none-eabi-gcc \
21     arm-none-eabi-binutils \
22     arm-none-eabi-newlib \
23     git \
24     diffutils
25
26 elif [[ -n "$(type -P apt-get)" ]]; then
27   # Debian and derivatives
28   # This block performs completely non-interactive updates {{
29   export DEBIAN_FRONTEND=noninteractive
30   export DEBCONF_NONINTERACTIVE_SEEN=true
31   echo "grub-pc hold" | dpkg --set-selections
32   apt-get -y update
33   apt-get -y --allow-unauthenticated upgrade \
34           -o Dpkg::Options::="--force-confdef" \
35           -o Dpkg::Options::="--force-confold"
36   # }}
37   apt-get install -y \
38     build-essential \
39     gcc \
40     unzip \
41     wget \
42     zip \
43     gcc-avr \
44     binutils-avr \
45     avr-libc \
46     dfu-programmer \
47     dfu-util \
48     gcc-arm-none-eabi \
49     binutils-arm-none-eabi \
50     libnewlib-arm-none-eabi \
51     git \
52     diffutils
53
54 elif [[ -n "$(type -P yum)" ]]; then
55   # Fedora, CentOS or RHEL and derivatives
56   yum -y makecache && yum -y update
57   yum -y install \
58     gcc \
59     glibc-headers \
60     kernel-devel \
61     kernel-headers \
62     make \
63     perl \
64     git \
65     wget \
66     avr-binutils \
67     avr-gcc \
68     avr-libc \
69     dfu-programmer \
70     dfu-util \
71     arm-none-eabi-gcc-cs \
72     arm-none-eabi-newlib \
73     git \
74     diffutils
75   # The listed eabi pacackes do unfortunately not exist for CentOS,
76   # But at least in Fedora they do, so try to install them anyway
77   # TODO: Build them from sources, if the installation fails
78
79 elif [[ -n "$(type -P zypper)" ]]; then
80   # openSUSE
81   zypper --non-interactive refresh  && zypper --non-interactive update
82   zypper --non-interactive install \
83     git \
84     make \
85     gcc \
86     kernel-devel \
87     patch \
88     wget \
89     dfu-programmer \
90     git \
91     diffutils
92   # TODO: The avr and eabi tools are not available as default packages, so we need 
93   # another way to install them
94
95 elif [[ -n "$(type -P pkg)" ]]; then
96   # FreeBSD
97   pkg update
98   pkg install -y \
99     git \
100     wget \
101     gmake \
102     gcc \
103     zip \
104     unzip \
105     avr-binutils \
106     avr-gcc \
107     avr-libc \
108     dfu-programmer \
109     dfu-util \
110     arm-none-eabi-gcc \
111     arm-none-eabi-binutils \
112     arm-none-eabi-newlib \
113     diffutils
114 elif [[ -n "$(type -P emerge)" ]]; then
115     echo 'Please check that your gcc is built with the multilib use flag enabled.'
116     emerge -vq sys-devel/crossdev
117     USE="-openmp -hardened -sanitize -vtv" crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
118 fi