Dev setup - check if Zig/jemalloc are already installed before downloading (#2899)

* Check if Zig/jemalloc are already installed before downloading

* reformat
pull/2908/head
OBarronCS 8 months ago committed by GitHub
parent a0a626bfdb
commit 18755282e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -92,6 +92,10 @@ download_zig_binary() {
# Install zig to current directory # Install zig to current directory
# We use zig to compile some test binaries as it is much easier than with gcc # We use zig to compile some test binaries as it is much easier than with gcc
if command -v "${ZIGPATH}"/zig &> /dev/null; then
echo "Zig is already installed. Skipping build and install."
else
echo "Downloading and installing Zig..."
ZIG_TAR_URL="https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz" ZIG_TAR_URL="https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz"
ZIG_TAR_SHA256="6699f0e7293081b42428f32c9d9c983854094bd15fee5489f12c4cf4518cc380" ZIG_TAR_SHA256="6699f0e7293081b42428f32c9d9c983854094bd15fee5489f12c4cf4518cc380"
curl --output /tmp/zig.tar.xz "${ZIG_TAR_URL}" curl --output /tmp/zig.tar.xz "${ZIG_TAR_URL}"
@ -107,6 +111,7 @@ download_zig_binary() {
mv /tmp/zig-linux-x86_64-* ${ZIGPATH} &> /dev/null || true mv /tmp/zig-linux-x86_64-* ${ZIGPATH} &> /dev/null || true
echo "Zig installed to ${ZIGPATH}" echo "Zig installed to ${ZIGPATH}"
fi
} }
install_apt() { install_apt() {
@ -221,6 +226,12 @@ install_dnf() {
install_jemalloc() { install_jemalloc() {
# Check if jemalloc is already installed
if command -v jemalloc-config &> /dev/null; then
echo "Jemalloc already installed. Skipping build and install."
else
echo "Jemalloc not found in system. Downloading, configuring, building, and installing..."
# Install jemalloc version 5.3.0 # Install jemalloc version 5.3.0
JEMALLOC_TAR_URL="https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2" JEMALLOC_TAR_URL="https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2"
JEMALLOC_TAR_SHA256="2db82d1e7119df3e71b7640219b6dfe84789bc0537983c3b7ac4f7189aecfeaa" JEMALLOC_TAR_SHA256="2db82d1e7119df3e71b7640219b6dfe84789bc0537983c3b7ac4f7189aecfeaa"
@ -263,19 +274,14 @@ install_jemalloc() {
tar -C /tmp -xf "${JEMALLOC_TAR_PATH}" tar -C /tmp -xf "${JEMALLOC_TAR_PATH}"
fi fi
# Check if jemalloc is already installed
if ! command -v jemalloc-config &> /dev/null; then
echo "Jemalloc not found in system. Configuring, building, and installing..."
pushd "${JEMALLOC_EXTRACT_PATH}" pushd "${JEMALLOC_EXTRACT_PATH}"
./configure ./configure
make make
sudo make install sudo make install
popd popd
else
echo "Jemalloc already installed. Skipping build and install."
fi
echo "Jemalloc installation complete." echo "Jemalloc installation complete."
fi
# TODO: autoconf needs to be installed with script as well? # TODO: autoconf needs to be installed with script as well?
} }
@ -323,7 +329,7 @@ if linux; then
. /etc/os-release . /etc/os-release
echo ${VERSION_ID} version echo ${VERSION_ID} version
) )
install_dnf $fedora_verion install_dnf $fedora_version
;; ;;
*) # we can add more install command for each distros. *) # we can add more install command for each distros.
echo "\"$distro\" is not supported distro. Will search for 'apt' or 'pacman' package managers." echo "\"$distro\" is not supported distro. Will search for 'apt' or 'pacman' package managers."

Loading…
Cancel
Save