2024-05-10 00:44:31 +03:00
|
|
|
#!/usr/bin/env bash
|
2024-03-19 21:22:26 +03:00
|
|
|
|
2024-05-10 00:44:31 +03:00
|
|
|
set -ex
|
2024-01-30 05:04:15 +03:00
|
|
|
|
2024-03-21 06:00:02 +03:00
|
|
|
# install the wasm toolchain
|
2024-05-10 00:44:31 +03:00
|
|
|
which rustup > /dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
2024-03-21 06:00:02 +03:00
|
|
|
|
2024-01-30 05:04:15 +03:00
|
|
|
# if sudo is not installed, define an empty alias
|
2024-03-04 00:44:39 +03:00
|
|
|
maysudo=$(command -v sudo || command -v doas || true)
|
2024-01-30 05:04:15 +03:00
|
|
|
|
|
|
|
# Ubuntu, Debian, etc.
|
2024-02-05 10:08:05 +03:00
|
|
|
# https://packages.ubuntu.com/
|
2024-01-30 05:04:15 +03:00
|
|
|
apt=$(command -v apt-get || true)
|
|
|
|
if [[ -n $apt ]]; then
|
2024-02-05 10:08:05 +03:00
|
|
|
deps=(
|
2024-05-01 01:01:07 +03:00
|
|
|
gcc
|
|
|
|
g++
|
2024-02-05 10:08:05 +03:00
|
|
|
libasound2-dev
|
|
|
|
libfontconfig-dev
|
2024-02-15 01:50:11 +03:00
|
|
|
libwayland-dev
|
2024-02-15 22:58:47 +03:00
|
|
|
libxkbcommon-x11-dev
|
2024-02-29 02:06:11 +03:00
|
|
|
libssl-dev
|
2024-06-13 22:39:58 +03:00
|
|
|
libstdc++-12-dev
|
2024-03-03 22:21:36 +03:00
|
|
|
libzstd-dev
|
2024-03-11 18:29:06 +03:00
|
|
|
libvulkan1
|
2024-04-22 22:05:12 +03:00
|
|
|
libgit2-dev
|
2024-06-06 06:58:37 +03:00
|
|
|
make
|
2024-06-13 00:16:05 +03:00
|
|
|
clang
|
|
|
|
mold
|
2024-06-13 17:36:18 +03:00
|
|
|
jq
|
|
|
|
gettext-base
|
2024-02-05 10:08:05 +03:00
|
|
|
)
|
2024-01-30 05:04:15 +03:00
|
|
|
$maysudo "$apt" install -y "${deps[@]}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Fedora, CentOS, RHEL, etc.
|
2024-02-05 10:08:05 +03:00
|
|
|
# https://packages.fedoraproject.org/
|
2024-01-30 05:04:15 +03:00
|
|
|
dnf=$(command -v dnf || true)
|
|
|
|
if [[ -n $dnf ]]; then
|
2024-02-05 10:08:05 +03:00
|
|
|
deps=(
|
2024-03-21 06:00:02 +03:00
|
|
|
gcc
|
|
|
|
g++
|
2024-06-13 00:16:05 +03:00
|
|
|
clang
|
|
|
|
mold
|
2024-02-05 10:08:05 +03:00
|
|
|
alsa-lib-devel
|
|
|
|
fontconfig-devel
|
2024-02-15 01:50:11 +03:00
|
|
|
wayland-devel
|
2024-02-15 22:58:47 +03:00
|
|
|
libxkbcommon-x11-devel
|
2024-02-22 00:57:39 +03:00
|
|
|
openssl-devel
|
2024-03-03 22:21:36 +03:00
|
|
|
libzstd-devel
|
2024-05-17 20:38:16 +03:00
|
|
|
# Perl dependencies are needed for openssl-sys crate see https://docs.rs/openssl/latest/openssl/
|
2024-05-15 20:17:59 +03:00
|
|
|
perl-FindBin
|
|
|
|
perl-IPC-Cmd
|
2024-05-17 20:38:16 +03:00
|
|
|
perl-File-Compare
|
|
|
|
perl-File-Copy
|
2024-03-11 18:29:06 +03:00
|
|
|
vulkan-loader
|
2024-02-05 10:08:05 +03:00
|
|
|
)
|
2024-03-25 21:14:11 +03:00
|
|
|
|
|
|
|
# libxkbcommon-x11-devel is in the crb repo on RHEL and CentOS, not needed for Fedora
|
|
|
|
if ! grep -q "Fedora" /etc/redhat-release; then
|
|
|
|
$maysudo "$dnf" config-manager --set-enabled crb
|
|
|
|
fi
|
2024-03-21 06:00:02 +03:00
|
|
|
|
2024-01-30 05:04:15 +03:00
|
|
|
$maysudo "$dnf" install -y "${deps[@]}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-05-27 03:14:09 +03:00
|
|
|
# openSUSE
|
2024-02-22 02:01:33 +03:00
|
|
|
# https://software.opensuse.org/
|
|
|
|
zyp=$(command -v zypper || true)
|
|
|
|
if [[ -n $zyp ]]; then
|
|
|
|
deps=(
|
2024-06-13 20:45:39 +03:00
|
|
|
gcc
|
|
|
|
gcc-c++
|
|
|
|
clang
|
|
|
|
make
|
2024-02-22 02:01:33 +03:00
|
|
|
alsa-devel
|
|
|
|
fontconfig-devel
|
|
|
|
wayland-devel
|
|
|
|
libxkbcommon-x11-devel
|
|
|
|
openssl-devel
|
2024-03-03 22:21:36 +03:00
|
|
|
libzstd-devel
|
2024-05-27 03:14:09 +03:00
|
|
|
libvulkan1
|
2024-06-13 10:47:37 +03:00
|
|
|
mold
|
2024-02-22 02:01:33 +03:00
|
|
|
)
|
|
|
|
$maysudo "$zyp" install -y "${deps[@]}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-01-30 05:04:15 +03:00
|
|
|
# Arch, Manjaro, etc.
|
2024-02-05 10:08:05 +03:00
|
|
|
# https://archlinux.org/packages
|
2024-01-30 05:04:15 +03:00
|
|
|
pacman=$(command -v pacman || true)
|
|
|
|
if [[ -n $pacman ]]; then
|
2024-02-05 10:08:05 +03:00
|
|
|
deps=(
|
2024-06-13 20:45:39 +03:00
|
|
|
gcc
|
|
|
|
clang
|
2024-02-05 10:08:05 +03:00
|
|
|
alsa-lib
|
|
|
|
fontconfig
|
2024-02-15 01:50:11 +03:00
|
|
|
wayland
|
2024-06-12 23:16:27 +03:00
|
|
|
libgit2
|
2024-02-15 22:58:47 +03:00
|
|
|
libxkbcommon-x11
|
2024-02-22 00:57:39 +03:00
|
|
|
openssl
|
2024-03-04 00:26:09 +03:00
|
|
|
zstd
|
2024-05-06 23:21:54 +03:00
|
|
|
pkgconf
|
2024-06-13 10:47:37 +03:00
|
|
|
mold
|
2024-02-05 10:08:05 +03:00
|
|
|
)
|
2024-02-15 01:28:29 +03:00
|
|
|
$maysudo "$pacman" -S --needed --noconfirm "${deps[@]}"
|
2024-01-30 05:04:15 +03:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-03-02 03:47:59 +03:00
|
|
|
# Void
|
|
|
|
# https://voidlinux.org/packages/
|
|
|
|
xbps=$(command -v xbps-install || true)
|
|
|
|
if [[ -n $xbps ]]; then
|
|
|
|
deps=(
|
|
|
|
alsa-lib-devel
|
|
|
|
fontconfig-devel
|
2024-03-05 20:16:08 +03:00
|
|
|
libxcb-devel
|
2024-03-02 03:47:59 +03:00
|
|
|
libxkbcommon-devel
|
2024-03-03 22:21:36 +03:00
|
|
|
libzstd-devel
|
2024-03-05 20:16:08 +03:00
|
|
|
openssl-devel
|
|
|
|
wayland-devel
|
2024-03-11 18:29:06 +03:00
|
|
|
vulkan-loader
|
2024-06-13 10:47:37 +03:00
|
|
|
mold
|
2024-03-02 03:47:59 +03:00
|
|
|
)
|
|
|
|
$maysudo "$xbps" -Syu "${deps[@]}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-04-30 02:08:22 +03:00
|
|
|
# Gentoo
|
|
|
|
# https://packages.gentoo.org/
|
|
|
|
emerge=$(command -v emerge || true)
|
|
|
|
if [[ -n $emerge ]]; then
|
|
|
|
deps=(
|
|
|
|
app-arch/zstd
|
|
|
|
dev-libs/openssl
|
|
|
|
dev-libs/wayland
|
|
|
|
media-libs/alsa-lib
|
|
|
|
media-libs/fontconfig
|
|
|
|
media-libs/vulkan-loader
|
|
|
|
x11-libs/libxcb
|
|
|
|
x11-libs/libxkbcommon
|
2024-06-13 10:47:37 +03:00
|
|
|
sys-devel/mold
|
2024-04-30 02:08:22 +03:00
|
|
|
)
|
|
|
|
$maysudo "$emerge" -u "${deps[@]}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-01-30 05:04:15 +03:00
|
|
|
echo "Unsupported Linux distribution in script/linux"
|