]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/linux_install.sh
Make python a required build dependency (#5784)
[qmk_firmware.git] / util / linux_install.sh
1 #!/bin/sh
2
3 # Note: This file uses tabs to indent. Please don't mix tabs and spaces.
4
5 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."
6
7 SLACKWARE_WARNING="You will need the following packages from slackbuilds.org:\n\tarm-binutils\n\tarm-gcc\n\tavr-binutils\n\tavr-gcc\n\tavr-libc\n\tavrdude\n\tdfu-programmer\n\tdfu-util\n\tnewlib\nThese packages will be installed with sudo and sboinstall, so ensure that your user is added to sudoers and that sboinstall is configured."
8
9 if grep ID /etc/os-release | grep -qE "fedora"; then
10         sudo dnf install \
11                 arm-none-eabi-binutils-cs \
12                 arm-none-eabi-gcc-cs \
13                 arm-none-eabi-newlib \
14                 avr-binutils \
15                 avr-gcc \
16                 avr-libc \
17                 binutils-avr32-linux-gnu \
18                 dfu-util \
19                 dfu-programmer \
20                 diffutils \
21                 git \
22                 gcc \
23                 glibc-headers \
24                 kernel-devel \
25                 kernel-headers \
26                 make \
27                 perl \
28                 python3 \
29                 unzip \
30                 wget \
31                 zip
32
33 elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
34         DEBIAN_FRONTEND=noninteractive
35         DEBCONF_NONINTERACTIVE_SEEN=true
36         export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
37         sudo apt-get update
38         sudo apt-get -yq install \
39                 build-essential \
40                 avr-libc \
41                 binutils-arm-none-eabi \
42                 binutils-avr \
43                 dfu-programmer \
44                 dfu-util \
45                 diffutils \
46                 gcc \
47                 gcc-arm-none-eabi \
48                 gcc-avr \
49                 git \
50                 libnewlib-arm-none-eabi \
51                 python3 \
52                 unzip \
53                 wget \
54                 zip
55
56 elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
57         # install avr-gcc 8.1 until 8.3 is available. See #3657 for details of the bug.
58         sudo pacman -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.1.0-1-x86_64.pkg.tar.xz
59         sudo pacman -S \
60                 arm-none-eabi-binutils \
61                 arm-none-eabi-gcc \
62                 arm-none-eabi-newlib \
63                 avr-binutils \
64                 avr-libc \
65                 avr-gcc \
66                 base-devel \
67                 dfu-util \
68                 diffutils \
69                 gcc \
70                 git \
71                 python \
72                 unzip \
73                 wget \
74                 zip
75         git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer
76         cd /tmp/dfu-programmer || exit 1
77         makepkg -sic
78         rm -rf /tmp/dfu-programmer/
79
80 elif grep ID /etc/os-release | grep -q gentoo; then
81         echo "$GENTOO_WARNING" | fmt
82         printf "\nProceed (y/N)? "
83         read -r answer
84         if echo "$answer" | grep -iq "^y"; then
85                 sudo touch /etc/portage/package.use/qmkfirmware
86                 # tee is used here since sudo doesn't apply to >>
87                 echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null
88                 sudo emerge -auN \
89                         app-arch/unzip \
90                         app-arch/zip \
91                         app-mobilephone/dfu-util \
92                         dev-embedded/avrdude \
93                         dev-lang/python:3.5 \
94                         net-misc/wget \
95                         sys-devel/gcc \
96                         sys-devel/crossdev
97                 sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
98                 echo "Done!"
99         else
100                 echo "Quitting..."
101         fi
102
103 elif grep ID /etc/os-release | grep -q sabayon; then
104         sudo equo install \
105                 app-arch/unzip \
106                 app-arch/zip \
107                 app-mobilephone/dfu-util \
108                 dev-embedded/avrdude \
109                 dev-lang/python \
110                 net-misc/wget \
111                 sys-devel/gcc \
112                 sys-devel/crossdev
113         sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
114         echo "Done!"
115
116 elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then
117         CROSS_AVR_GCC=cross-avr-gcc8
118         CROSS_ARM_GCC=cross-arm-none-gcc8
119         if grep ID /etc/os-release | grep -q "15.0"; then
120                 CROSS_AVR_GCC=cross-avr-gcc7
121                 CROSS_ARM_GCC=cross-arm-none-gcc7
122         fi
123         sudo zypper install \
124                 avr-libc \
125                 $CROSS_AVR_GCC \
126                 $CROSS_ARM_GCC \
127                 cross-avr-binutils \
128                 cross-arm-none-newlib-devel \
129                 cross-arm-binutils cross-arm-none-newlib-devel \
130                 dfu-tool \
131                 dfu-programmer \
132                 gcc \
133                 python3 \
134                 unzip \
135                 wget \
136                 zip
137
138 elif grep ID /etc/os-release | grep -q slackware; then
139         printf "$SLACKWARE_WARNING\n"
140         printf "\nProceed (y/N)? "
141         read -r answer
142         if echo "$answer" | grep -iq "^y" ;then
143                 sudo sboinstall \
144                         avr-binutils \
145                         avr-gcc \
146                         avr-libc \
147                         avrdude \
148                         dfu-programmer \
149                         dfu-util \
150                         arm-binutils \
151                         arm-gcc \
152                         newlib \
153                         python3
154                 echo "Done!"
155         else
156                 echo "Quitting..."
157         fi
158
159 else
160         echo "Sorry, we don't recognize your OS. Help us by contributing support!"
161         echo
162         echo "https://docs.qmk.fm/#/contributing"
163 fi