dev-env/zig/setup_zig.sh
2025-04-04 17:04:45 +01:00

20 lines
575 B
Bash
Executable file

#!/bin/sh
echo "Requires curl, jq, wget, git and tar."
echo "Getting Zig Master"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
if [ "$OS" = "linux" ]; then
OS="x86_64-linux"
elif [ "$OS" = "darwin" ]; then
OS="x86_64-macos"
elif [ "$OS" = "mingw64_nt" ] || [ "$OS" = "cygwin" ]; then
OS="x86_64-windows"
fi
curl https://ziglang.org/download/index.json | jq -r ".master.[\"$OS\"].tarball" | wget -O zig-master.tar.xz -i -
tar xvf ./zig-master.tar.xz
source ~/.bashrc
echo "Getting ZLS"
git clone https://github.com/zigtools/zls
cd zls
zig build -Doptimize=ReleaseSafe