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