Follows on from https://github.com/zed-industries/zed/pull/37717#discussion_r2376739687 @dvdsk suggested this but I didn't get to it in the previous PR. # Tested ``` ; sudo rm /usr/local/bin/wild ; ./script/install-wild Downloading from https://github.com/davidlattimore/wild/releases/download/0.6.0/wild-linker-0.6.0-x86_64-unknown-linux-gnu.tar.gz Wild is installed to /usr/local/bin/wild To make it your default, add or merge these lines into your ~/.cargo/config.toml: [target.x86_64-unknown-linux-gnu] linker = "clang" rustflags = ["-C", "link-arg=--ld-path=wild"] [target.aarch64-unknown-linux-gnu] linker = "clang" rustflags = ["-C", "link-arg=--ld-path=wild"] ``` ``` ; sudo rm /usr/local/bin/mold ; ./script/install-mold 2.34.0 Downloading from https://github.com/rui314/mold/releases/download/v2.34.0/mold-2.34.0-x86_64-linux.tar.gz Mold is installed to /usr/local/bin/mold To make it your default, add or merge these lines into your ~/.cargo/config.toml: [target.'cfg(target_os = "linux")'] linker = "clang" rustflags = ["-C", "link-arg=-fuse-ld=mold"] ``` Release Notes: - N/A
48 lines
1.5 KiB
Bash
Executable File
48 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Install `mold` official binaries from GitHub Releases.
|
|
#
|
|
# Adapted from the official rui314/setup-mold@v1 action to:
|
|
# * use environment variables instead of action inputs
|
|
# * remove make-default support
|
|
# * use curl instead of wget
|
|
# * support doas for sudo
|
|
# * support redhat systems
|
|
# See: https://github.com/rui314/setup-mold/blob/main/action.yml
|
|
|
|
set -euo pipefail
|
|
|
|
MOLD_VERSION="${MOLD_VERSION:-${1:-}}"
|
|
if [ "$(uname -s)" != "Linux" ]; then
|
|
echo "Error: This script is intended for Linux systems only."
|
|
exit 1
|
|
elif [ -z "$MOLD_VERSION" ]; then
|
|
echo "Usage: $0 2.34.0"
|
|
exit 1
|
|
elif [ -e /usr/local/bin/mold ]; then
|
|
echo "Warning: existing mold found at /usr/local/bin/mold. Skipping installation."
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$(whoami)" = root ]; then SUDO=; else SUDO="$(command -v sudo || command -v doas || true)"; fi
|
|
|
|
MOLD_REPO="${MOLD_REPO:-https://github.com/rui314/mold}"
|
|
MOLD_URL="${MOLD_URL:-$MOLD_REPO}/releases/download/v$MOLD_VERSION/mold-$MOLD_VERSION-$(uname -m)-linux.tar.gz"
|
|
|
|
echo "Downloading from $MOLD_URL"
|
|
curl -fsSL --output - "$MOLD_URL" \
|
|
| $SUDO tar -C /usr/local --strip-components=1 --no-overwrite-dir -xzf -
|
|
|
|
# Note this binary depends on the system libatomic.so.1 which is usually
|
|
# provided as a dependency of gcc so it should be available on most systems.
|
|
|
|
cat <<EOF
|
|
Mold is installed to /usr/local/bin/mold
|
|
|
|
To make it your default, add or merge these lines into your ~/.cargo/config.toml:
|
|
|
|
[target.'cfg(target_os = "linux")']
|
|
linker = "clang"
|
|
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
|
EOF
|