summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-07-05 01:13:27 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2025-02-07 21:54:55 +0100
commit177aad9d77cb94cc19a52860c2f3c9add018868e (patch)
tree38db6d9b992be2429b61736854de8558e4315b69
parent962f29ba59b3b064d2e6e4d6274f4b4ff09a6412 (diff)
downloadzig-playground-177aad9d77cb94cc19a52860c2f3c9add018868e.tar.gz
zig-playground-177aad9d77cb94cc19a52860c2f3c9add018868e.zip
setup: automatically fetch latest zig
-rw-r--r--setup.fish23
1 files changed, 16 insertions, 7 deletions
diff --git a/setup.fish b/setup.fish
index e4d125d..9bb4561 100644
--- a/setup.fish
+++ b/setup.fish
@@ -1,11 +1,20 @@
-set -l BASE zig-linux-x86_64-0.14.0-dev.130+cb308ba3a
+curl -s https://ziglang.org/download/index.json -o index.json
+or exit 1
-echo "SETUP $BASE"
+set DLLINK (cat index.json | jq -r '.master ."x86_64-linux" .tarball')
+set SHASUM (cat index.json | jq -r '.master ."x86_64-linux" .shasum')
-if ! test -d $BASE
- wget --no-clobber https://ziglang.org/builds/$BASE.tar.xz
- tar xf $BASE.tar.xz
- rm -f $BASE.tar.xz
+rm -f index.json
+
+set TARBALL (echo $DLLINK | awk -F '/' '{ print $NF }')
+set ZIGDIR (echo $TARBALL | sed 's/.tar.xz//')
+
+if ! test -d $ZIGDIR
+ wget -q --show-progress --no-clobber $DLLINK
+ and shasum -a 256 -c (echo "$SHASUM $TARBALL" | psub)
+ and tar xf $TARBALL
+ or exit 2
end
-fish_add_path --path (pwd)/$BASE
+echo "SETUP $ZIGDIR"
+fish_add_path --path (pwd)/$ZIGDIR