Files
bun.sh/scripts/download-zig.sh
dave caruso 441612917d windows: more windows stuff (#6938)
* fix(win/upgrade): do not show powershell expand-archive info while upgrading

* start working bun run

* experiment: `bun.new`

* you can now bun run

* Update src/install/install.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* Update src/install/install.zig

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

* stuff

* fix stuff

* fix this

* farther but not really

* sadfs

* path hell

not sure how much worse or better this makes things. its a mess. windows path handlign is a mess aaaaaaaaaaaaaaaa

* path.resolve bs

* remove old build system stuff from pr

* a

* fix some path.parse/join cases

* path closer not perfect

* normalize and join tests tests  done

* paths

* implement path.relative

* ,

* stuff

* assert

* fix compile

* hate

* the code isnt great

* stuff

* housekeeping for build system

* blah

* explain windows sitaution in docs

* some progress? not much though

* zig compiler crashes here

* fix

* yippee

* ok

* a

* ala wala

* fix builds on stuff

* clean

* the tests now run

* a

* aa

* dedupe uv event loop

* fix fs test accuracy

* stuff

* [autofix.ci] apply automated fixes

* huge updat e

* [autofix.ci] apply automated fixes

* url

* [autofix.ci] apply automated fixes

* start windows spawnSync

* [autofix.ci] apply automated fixes

* add --webkit for update submodules

* add better err message for `bun setup`

* fix unix platform build

* .

* [autofix.ci] apply automated fixes

* un-upgrade libarchive

* z

* asdfghj

* wrk

* todo -> panic

* ok

* a

* [autofix.ci] apply automated fixes

* fix build scripts l ol

* dfghj

* fa

* [autofix.ci] apply automated fixes

* aaaa

* a

* l

* [autofix.ci] apply automated fixes

* more logs

* [autofix.ci] apply automated fixes

* j

* fix init_command

* CORE DUMP HELL

* i swear im being pranked by the github actions gods

* fadsjkfdshjkhjkdfsahjkdfshjksdafjkhhjkfdsahfsdkjhfsdjkahf

* thanks IAS

* this is the correct fix

* personal review

* ddisablbe these

* revisions!

* ok

* fix submodule

* stuff

* fix libarchive

* [autofix.ci] apply automated fixes

* stuff

* [autofix.ci] apply automated fixes

* a

* fix addressToJS on windows

* make dns async again

* dx: add flag to update submodules ps1 to clone webkit

* dns error case for libuv

* dx improvements on windows

* newline

* obvious fix

* install steps

* extra note

* fix fs test

* Update building-windows.md

* fix builtins bundler to support \r\n line endnigs

* better

* some windows stuff

* a

* a

* a

* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

* [autofix.ci] apply automated fixes

* bunfile text works

* fix build on the mac

* hellooooooooooo

* install steps

* ci for baseline?

* fix

* aaa

* wow

* install script revamp

* bug

* OK

* ok

* aaaaaaaaaaaaaa

* okay

* fix the node test runner lol

* fix napi stuff

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cirospaciari <ciro.spaciai@gmail.com>
Co-authored-by: Dylan Conway <35280289+dylan-conway@users.noreply.github.com>
2023-12-14 16:56:33 -08:00

84 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
cd $(dirname $(dirname "${BASH_SOURCE[0]}"))
zig_version=""
if [ -n "$1" ]; then
zig_version="$1"
update_repo=true
if [ "$zig_version" == "master" ]; then
zig_version=$(curl -fsSL https://ziglang.org/download/index.json | jq -r .master.version)
fi
else
zig_version=$(grep 'recommended_zig_version = "' "build.zig" | cut -d'"' -f2)
fi
case $(uname -ms) in
'Darwin x86_64')
target='macos'
arch='x86_64'
;;
'Darwin arm64')
target='macos'
arch='aarch64'
;;
'Linux aarch64' | 'Linux arm64')
target='linux'
arch='aarch64'
;;
'Linux x86_64')
target='linux'
arch='x86_64'
;;
*)
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"
mkdir -p ".cache"
update_repo_if_needed() {
if [ "$update_repo" == "true" ]; then
files=(
build.zig
Dockerfile
scripts/download-zig.ps1
.github/workflows/*
);
zig_version_previous=$(grep 'recommended_zig_version = "' "build.zig" | cut -d'"' -f2)
for file in ${files[@]}; do
sed -i '' 's/'"${zig_version_previous}"'/'"${zig_version}"'/g' "$file"
done
printf "Zig was updated to ${zig_version}. Please commit new files."
fi
}
if [ -e "${extract_at}/.version" ]; then
if [ "$(cat "${extract_at}/.version")" == "${url}" ]; then
update_repo_if_needed
exit 0
fi
fi
if ! [ -e "${dest}" ]; then
printf -- "-- Downloading Zig v%s\n" "${zig_version}"
curl -o "$dest" -L "$url"
fi
rm -rf "${extract_at}"
mkdir -p "${extract_at}"
tar -xf "${dest}" -C "${extract_at}" --strip-components=1
echo "${url}" > "${extract_at}/.version"
update_repo_if_needed