1#!/usr/bin/bash -e
2
3# if sudo is not installed, define an empty alias
4maysudo=$(command -v sudo || command -v doas || true)
5
6# Ubuntu, Debian, etc.
7# https://packages.ubuntu.com/
8apt=$(command -v apt-get || true)
9if [[ -n $apt ]]; then
10 deps=(
11 libasound2-dev
12 libfontconfig-dev
13 libwayland-dev
14 libxkbcommon-x11-dev
15 libssl-dev
16 libzstd-dev
17 libvulkan1
18 )
19 $maysudo "$apt" install -y "${deps[@]}"
20 exit 0
21fi
22
23# Fedora, CentOS, RHEL, etc.
24# https://packages.fedoraproject.org/
25dnf=$(command -v dnf || true)
26if [[ -n $dnf ]]; then
27 deps=(
28 alsa-lib-devel
29 fontconfig-devel
30 wayland-devel
31 libxkbcommon-x11-devel
32 openssl-devel
33 libzstd-devel
34 vulkan-loader
35 )
36 $maysudo "$dnf" install -y "${deps[@]}"
37 exit 0
38fi
39
40# openSuse
41# https://software.opensuse.org/
42zyp=$(command -v zypper || true)
43if [[ -n $zyp ]]; then
44 deps=(
45 alsa-devel
46 fontconfig-devel
47 wayland-devel
48 libxkbcommon-x11-devel
49 openssl-devel
50 libzstd-devel
51 vulkan-loader
52 )
53 $maysudo "$zyp" install -y "${deps[@]}"
54 exit 0
55fi
56
57# Arch, Manjaro, etc.
58# https://archlinux.org/packages
59pacman=$(command -v pacman || true)
60if [[ -n $pacman ]]; then
61 deps=(
62 alsa-lib
63 fontconfig
64 wayland
65 libxkbcommon-x11
66 openssl
67 zstd
68 )
69 $maysudo "$pacman" -S --needed --noconfirm "${deps[@]}"
70 exit 0
71fi
72
73# Void
74# https://voidlinux.org/packages/
75xbps=$(command -v xbps-install || true)
76if [[ -n $xbps ]]; then
77 deps=(
78 alsa-lib-devel
79 fontconfig-devel
80 libxcb-devel
81 libxkbcommon-devel
82 libzstd-devel
83 openssl-devel
84 wayland-devel
85 vulkan-loader
86 )
87 $maysudo "$xbps" -Syu "${deps[@]}"
88 exit 0
89fi
90
91echo "Unsupported Linux distribution in script/linux"