linux

 1#!/usr/bin/bash -e
 2
 3# if sudo is not installed, define an empty alias
 4maysudo=$(command -v sudo || 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    vulkan-validationlayers*
14    libwayland-dev
15    libxkbcommon-x11-dev
16    openssl
17  )
18  $maysudo "$apt" install -y "${deps[@]}"
19  exit 0
20fi
21
22# Fedora, CentOS, RHEL, etc.
23# https://packages.fedoraproject.org/
24dnf=$(command -v dnf || true)
25if [[ -n $dnf ]]; then
26  deps=(
27    alsa-lib-devel
28    fontconfig-devel
29    vulkan-validation-layers
30    wayland-devel
31    libxkbcommon-x11-devel
32    openssl-devel
33  )
34  $maysudo "$dnf" install -y "${deps[@]}"
35  exit 0
36fi
37
38# openSuse
39# https://software.opensuse.org/
40zyp=$(command -v zypper || true)
41if [[ -n $zyp ]]; then
42  deps=(
43    alsa-devel
44    fontconfig-devel
45    vulkan-validationlayers
46    wayland-devel
47    libxkbcommon-x11-devel
48    openssl-devel
49  )
50  $maysudo "$zyp" install -y "${deps[@]}"
51  exit 0
52fi
53
54# Arch, Manjaro, etc.
55# https://archlinux.org/packages
56pacman=$(command -v pacman || true)
57if [[ -n $pacman ]]; then
58  deps=(
59    alsa-lib
60    fontconfig
61    vulkan-validation-layers
62    wayland
63    libxkbcommon-x11
64    openssl
65  )
66  $maysudo "$pacman" -S --needed --noconfirm "${deps[@]}"
67  exit 0
68fi
69
70echo "Unsupported Linux distribution in script/linux"