Skip to content

Commit

Permalink
For build scripts, symlink zig.exe to zig on posix (#8147)
Browse files Browse the repository at this point in the history
* Add `zig.exe` as a symlink of `zig` on posix

* Update scripts/download-zig.sh

Co-authored-by: dave caruso <[email protected]>

---------

Co-authored-by: Jarred Sumner <[email protected]>
Co-authored-by: dave caruso <[email protected]>
  • Loading branch information
3 people authored Jan 13, 2024
1 parent 01453be commit 3e703c4
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions scripts/download-zig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ fi

case $(uname -ms) in
'Darwin x86_64')
target='macos'
arch='x86_64'
;;
target='macos'
arch='x86_64'
;;
'Darwin arm64')
target='macos'
arch='aarch64'
;;
target='macos'
arch='aarch64'
;;
'Linux aarch64' | 'Linux arm64')
target='linux'
arch='aarch64'
;;
target='linux'
arch='aarch64'
;;
'Linux x86_64')
target='linux'
arch='x86_64'
;;
target='linux'
arch='x86_64'
;;
*)
printf "error: cannot get platform name from '%s'\n" "${unamestr}"
exit 1
;;
printf "error: cannot get platform name from '%s'\n" "${unamestr}"
exit 1
;;
esac

url="https://ziglang.org/builds/zig-${target}-${arch}-${zig_version}.tar.xz"
dest=".cache/zig-${zig_version}.tar.xz"
extract_at=".cache/zig"
dest="$(pwd)/.cache/zig-${zig_version}.tar.xz"
extract_at="$(pwd)/.cache/zig"

mkdir -p ".cache"

Expand All @@ -50,7 +50,7 @@ update_repo_if_needed() {
Dockerfile
scripts/download-zig.ps1
.github/workflows/*
);
)

zig_version_previous=$(grep 'recommended_zig_version = "' "build.zig" | cut -d'"' -f2)

Expand All @@ -59,6 +59,12 @@ update_repo_if_needed() {
done

printf "Zig was updated to ${zig_version}. Please commit new files."

# symlink extracted zig to extracted zig.exe
# TODO: Workaround for https://github.com/ziglang/vscode-zig/issues/164
ln -sf "${extract_at}/zig" "${extract_at}/zig.exe"
chmod +x "${extract_at}/zig.exe"

fi
}

Expand Down

0 comments on commit 3e703c4

Please sign in to comment.