1
Fork 0

bump zig to 4301+uber1

This is a patched zig release with 13051[1]. While we are waiting for a
resolution on #13050 (which @andrewrk is working on).

[1]: https://patch-diff.githubusercontent.com/raw/ziglang/zig/pull/13051
nix
Motiejus Jakštys 2022-10-13 05:54:28 +03:00
parent e5eff0c911
commit fed463e1d0
3 changed files with 95 additions and 6 deletions

33
contrib/README-patched.md Normal file
View File

@ -0,0 +1,33 @@
Patched Zig release
-------------------
This file explains how this zig version was created. As of first writing,
0.10.0-dev.4301+uber1 + https://github.com/ziglang/zig-bootstrap/pull/131
Steps to re-create a patched zig:
```
$ wget https://github.com/ziglang/zig/pull/13051.patch
$ git clone https://github.com/ziglang/zig-bootstrap; cd zig-bootstrap
# if https://github.com/ziglang/zig-bootstrap/pull/131 is not merged: patch it.
$ git am --directory=zig ../13051.patch
$ ${EDITOR:-vi} build # replace the hash with "+uber1" and bump the last number in ZIG_VERSION
$ ./build-and-archive
```
Recent zig-bootstrap versions require cmake >= 3.19, which is available from
ubuntu 22.04 (jammy) or debian 12 (bookworm). Otherwise CMAKE will unable to
"Find the C compiler". A workaround:
docker run --privileged -v `pwd`:/x -w /x -ti --rm buildpack-deps:bookworm \
sh -c 'apt-get update && apt-get install -y cmake && exec ./build-and-archive'
(`--privileged` is necessary because of devpod nuances. You can skip it if you
don't know what is a devpod.)
`build-and-archive`, this file and 13051.patch should be in the archive where
you got your patched zig.

56
contrib/build-and-archive Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
set -xeuo pipefail
zig_version=$(awk -F'"' '/^ZIG_VERSION=/{print $2}' build)
#./build -j$(nproc) x86_64-linux-musl baseline
#./build -j$(nproc) x86_64-macos-none baseline
#./build -j$(nproc) aarch64-linux-musl baseline
#./build -j$(nproc) aarch64-macos-none apple_a14
#./build -j$(nproc) x86_64-windows-gnu baseline
rm -fr zig-linux-x86_64-${zig_version}
rm -fr zig-macos-x86_64-${zig_version}
rm -fr zig-linux-aarch64-${zig_version}
rm -fr zig-macos-aarch64-${zig_version}
rm -fr zig-windows-x86_64-${zig_version}
cp -r out/zig-x86_64-linux-musl-baseline zig-linux-x86_64-${zig_version}
cp -r out/zig-x86_64-macos-none-baseline zig-macos-x86_64-${zig_version}
cp -r out/zig-aarch64-linux-musl-baseline zig-linux-aarch64-${zig_version}
cp -r out/zig-aarch64-macos-none-apple_a14 zig-macos-aarch64-${zig_version}
cp -r out/zig-x86_64-windows-gnu-baseline zig-windows-x86_64-${zig_version}
for os_arch in linux-{x86_64,aarch64} macos-{x86_64,aarch64} windows-x86_64; do
if [[ $os_arch == windows-x86_64 ]]; then
zig=zig.exe
else
zig=zig
fi
mv zig-${os_arch}-${zig_version}/{bin/${zig},}
rmdir zig-${os_arch}-${zig_version}/bin
# copy some clarifying files for future readers
mkdir zig-${os_arch}-${zig_version}/patches
cp README-patched.md zig-${os_arch}-${zig_version}/patches/README.md
cp 13051.patch "$0" zig-${os_arch}-${zig_version}/patches/
done
# x86_64 should have libs in lib/, rather than in lib/zig/.
for os in linux macos windows; do
mv zig-${os}-x86_64-${zig_version}/{lib,lib2}
mv zig-${os}-x86_64-${zig_version}/{lib2/zig,lib}
rmdir zig-${os}-x86_64-${zig_version}/lib2
done
tar cJf zig-linux-x86_64-${zig_version}.tar.xz zig-linux-x86_64-${zig_version}/ &
tar cJf zig-macos-x86_64-${zig_version}.tar.xz zig-macos-x86_64-${zig_version}/ &
tar cJf zig-linux-aarch64-${zig_version}.tar.xz zig-linux-aarch64-${zig_version}/ &
tar cJf zig-macos-aarch64-${zig_version}.tar.xz zig-macos-aarch64-${zig_version}/ &
# 7z is the quickest, so blocking on it first. Then wait for tars to complete.
7z a zig-windows-x86_64-${zig_version}.zip zig-windows-x86_64-${zig_version}/
wait %1 %2 %3 %4
sha256sum *.tar.xz *.zip
ls -l *.tar.xz *.zip

View File

@ -39,14 +39,14 @@ URL_FORMAT_NIGHTLY = "https://ziglang.org/builds/zig-{host_platform}-{version}.{
# which, as of writing, has been quite reliable.
URL_FORMAT_JAKSTYS = "https://dl.jakstys.lt/zig/zig-{host_platform}-{version}.{_ext}"
_VERSION = "0.10.0-dev.4166+cae76d829"
_VERSION = "0.10.0-dev.4301+uber1"
_HOST_PLATFORM_SHA256 = {
"linux-aarch64": "0137b1e7225668ea41ef359ac50865b66b016d4048d0d1f082e50906a4ddcea4",
"linux-x86_64": "071aaf393bca6142e9d002f995570b9a439bc09ebfbc4ec7c995619217e6b468",
"macos-aarch64": "959564f213bab41a40ca0b0280f82e981b0c7afc0a46bf875f8a8c2e0bd776ae",
"macos-x86_64": "563ddb8c58fde5efaa32d94756fd6095b5d229abbf3d1d7e6a9e54c3fcf69bb5",
"windows-x86_64": "aa1c95e74b703a5946a168e404ce0f57e70db43e6c1c1ba89a65fab254df29c1",
"linux-aarch64": "67c81abc575e0fec27be3a49008e2d7cdf70cc8b33606ee1cf6837cc90300690",
"linux-x86_64": "e6e2e8de6c96b20470a1b9f42df54abecd33a5d5da0e33e643f410b362ed999c",
"macos-aarch64": "f553944a47ff27954acfd8cc41dc28dc71253e3598812e8b9c69e48e48ea5965",
"macos-x86_64": "7e8a54c5592566df1da25d61ee2eae1fc5a89ae4dcbbf816ce6051001e53538b",
"windows-x86_64": "f9f41cfa573db25925506ca4c96d7b23b97f4111aac322e66a23b686b63f669f",
}
_HOST_PLATFORM_EXT = {