From 660e9467851978016db6c39157315b832c94f8fd Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Fri, 5 Jul 2024 01:13:27 +0200 Subject: setup: automatically fetch latest zig --- setup.fish | 23 ++++++++++++++++------- 1 file 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 -- cgit v1.2.3