zed/script/linux

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

159 lines
2.9 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
set -ex
# install the wasm toolchain
which rustup > /dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# if sudo is not installed, define an empty alias
maysudo=$(command -v sudo || command -v doas || true)
# Ubuntu, Debian, etc.
# https://packages.ubuntu.com/
apt=$(command -v apt-get || true)
if [[ -n $apt ]]; then
deps=(
gcc
g++
libasound2-dev
libfontconfig-dev
libwayland-dev
libxkbcommon-x11-dev
libssl-dev
libstdc++-12-dev
libzstd-dev
libvulkan1
libgit2-dev
make
clang
mold
jq
gettext-base
elfutils
libsqlite3-dev
)
$maysudo "$apt" install -y "${deps[@]}"
exit 0
fi
# Fedora, CentOS, RHEL, etc.
# https://packages.fedoraproject.org/
dnf=$(command -v dnf || true)
if [[ -n $dnf ]]; then
deps=(
gcc
g++
clang
mold
alsa-lib-devel
fontconfig-devel
wayland-devel
libxkbcommon-x11-devel
Update dependencies to include openssl (#8136) Openssl is required by the `openssl-sys` crate. Trying to build zed on a Fedora 39 workstation install. This is the error I got from the compiler. ``` error: failed to run custom build command for `openssl-sys v0.9.93` Caused by: process didn't exit successfully: `/home/dionysus/git/zed/target/debug/build/openssl-sys-9f784a7979d04ba8/build-script-main` (exit status: 101) --- stdout cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_DIR OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=OPENSSL_STATIC cargo:rerun-if-env-changed=OPENSSL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR run pkg_config fail: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "openssl"` did not exit successfully: exit status: 1 error: could not find system library 'openssl' required by the 'openssl-sys' crate --- stderr Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'virtual:world', not found --- stderr thread 'main' panicked at /home/dionysus/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.93/build/find_normal.rs:190:5: Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. Make sure you also have the development packages of openssl installed. For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora. If you're in a situation where you think the directory *should* be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message. $HOST = x86_64-unknown-linux-gnu $TARGET = x86_64-unknown-linux-gnu openssl-sys = 0.9.93 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace warning: build failed, waiting for other jobs to finish...``` I didn't explicitly test this patch on arch or debian. Release Notes: - Added/Fixed/Improved ... ([#8135](https://github.com/zed-industries/zed/issues/8135)).
2024-02-22 00:57:39 +03:00
openssl-devel
libzstd-devel
# Perl dependencies are needed for openssl-sys crate see https://docs.rs/openssl/latest/openssl/
perl-FindBin
perl-IPC-Cmd
perl-File-Compare
perl-File-Copy
vulkan-loader
sqlite-devel
)
# 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
$maysudo "$dnf" install -y "${deps[@]}"
exit 0
fi
# openSUSE
# https://software.opensuse.org/
zyp=$(command -v zypper || true)
if [[ -n $zyp ]]; then
deps=(
gcc
gcc-c++
clang
make
alsa-devel
fontconfig-devel
wayland-devel
libxkbcommon-x11-devel
openssl-devel
libzstd-devel
libvulkan1
mold
sqlite3-devel
)
$maysudo "$zyp" install -y "${deps[@]}"
exit 0
fi
# Arch, Manjaro, etc.
# https://archlinux.org/packages
pacman=$(command -v pacman || true)
if [[ -n $pacman ]]; then
deps=(
gcc
clang
alsa-lib
fontconfig
wayland
libgit2
libxkbcommon-x11
Update dependencies to include openssl (#8136) Openssl is required by the `openssl-sys` crate. Trying to build zed on a Fedora 39 workstation install. This is the error I got from the compiler. ``` error: failed to run custom build command for `openssl-sys v0.9.93` Caused by: process didn't exit successfully: `/home/dionysus/git/zed/target/debug/build/openssl-sys-9f784a7979d04ba8/build-script-main` (exit status: 101) --- stdout cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_DIR OPENSSL_DIR unset cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG cargo:rerun-if-env-changed=OPENSSL_STATIC cargo:rerun-if-env-changed=OPENSSL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_PATH cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR run pkg_config fail: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "openssl"` did not exit successfully: exit status: 1 error: could not find system library 'openssl' required by the 'openssl-sys' crate --- stderr Package openssl was not found in the pkg-config search path. Perhaps you should add the directory containing `openssl.pc' to the PKG_CONFIG_PATH environment variable Package 'openssl', required by 'virtual:world', not found --- stderr thread 'main' panicked at /home/dionysus/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.93/build/find_normal.rs:190:5: Could not find directory of OpenSSL installation, and this `-sys` crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the `OPENSSL_DIR` environment variable for the compilation process. Make sure you also have the development packages of openssl installed. For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora. If you're in a situation where you think the directory *should* be found automatically, please open a bug at https://github.com/sfackler/rust-openssl and include information about your system as well as this message. $HOST = x86_64-unknown-linux-gnu $TARGET = x86_64-unknown-linux-gnu openssl-sys = 0.9.93 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace warning: build failed, waiting for other jobs to finish...``` I didn't explicitly test this patch on arch or debian. Release Notes: - Added/Fixed/Improved ... ([#8135](https://github.com/zed-industries/zed/issues/8135)).
2024-02-22 00:57:39 +03:00
openssl
zstd
pkgconf
mold
sqlite
jq
)
$maysudo "$pacman" -S --needed --noconfirm "${deps[@]}"
exit 0
fi
# Void
# https://voidlinux.org/packages/
xbps=$(command -v xbps-install || true)
if [[ -n $xbps ]]; then
deps=(
alsa-lib-devel
fontconfig-devel
libxcb-devel
libxkbcommon-devel
libzstd-devel
openssl-devel
wayland-devel
vulkan-loader
mold
sqlite-devel
)
$maysudo "$xbps" -Syu "${deps[@]}"
exit 0
fi
# 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
sys-devel/mold
dev-db/sqlite
)
$maysudo "$emerge" -u "${deps[@]}"
exit 0
fi
echo "Unsupported Linux distribution in script/linux"