This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add zigup for easier zig toolchain installation (#6)
- Loading branch information
1 parent
8587a3d
commit e4e829f
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.12.0-dev.2541+894493549 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
ZIG_HOME="${ZIG_HOME:-$HOME/.zig}" | ||
ZIG_LATEST="${ZIG_HOME}/zig-latest" | ||
mkdir -p "$ZIG_HOME" | ||
|
||
VERSION=$(cat ".zig-version" | tr -d '\n ') | ||
|
||
osOut="$(uname -s)" | ||
case "${osOut}" in | ||
Linux*) OS="linux";; | ||
Darwin*) OS="macos";; | ||
esac | ||
|
||
archOut="$(uname -m)" | ||
case "${archOut}" in | ||
arm64*) ARCH="aarch64";; | ||
x86_64*) ARCH="x86_64";; | ||
esac | ||
|
||
ARCH_VERSION="zig-${OS}-${ARCH}-${VERSION}" | ||
|
||
if [ ! -d "${ZIG_HOME}/${ARCH_VERSION}" ] | ||
then | ||
echo "Downloading Zig version $VERSION" | ||
curl -s -L "https://ziglang.org/builds/${ARCH_VERSION}.tar.xz" | tar -x -J -C "${ZIG_HOME}" | ||
else | ||
echo "Zig version $VERSION already installed" | ||
fi | ||
|
||
# Always update the symlink to the requested version | ||
rm -f "$ZIG_LATEST" | ||
ln -s "${ZIG_HOME}/${ARCH_VERSION}" "$ZIG_LATEST" | ||
|
||
echo "Add ${ZIG_LATEST} to the \$PATH" |