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  )
17  $maysudo "$apt" install -y "${deps[@]}"
18  exit 0
19fi
20
21# Fedora, CentOS, RHEL, etc.
22# https://packages.fedoraproject.org/
23dnf=$(command -v dnf || true)
24if [[ -n $dnf ]]; then
25  deps=(
26    alsa-lib-devel
27    fontconfig-devel
28    vulkan-validation-layers
29    wayland-devel
30    libxkbcommon-x11-devel
31  )
32  $maysudo "$dnf" install -y "${deps[@]}"
33  exit 0
34fi
35
36# Arch, Manjaro, etc.
37# https://archlinux.org/packages
38pacman=$(command -v pacman || true)
39if [[ -n $pacman ]]; then
40  deps=(
41    alsa-lib
42    fontconfig
43    vulkan-validation-layers
44    wayland
45    libxkbcommon-x11
46  )
47  $maysudo "$pacman" -S --needed --noconfirm "${deps[@]}"
48  exit 0
49fi
50
51echo "Unsupported Linux distribution in script/linux"