[contrib/] zig sdk test instructions
This commit is contained in:
parent
db2f187aa9
commit
956711690f
28
contrib/makerel
Normal file
28
contrib/makerel
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
zigdir=out/zig-x86_64-linux-musl-baseline
|
||||||
|
|
||||||
|
if [[ ! "$PWD" =~ /zig-bootstrap$ ]]; then
|
||||||
|
>&2 echo "expected to be in zig-bootstrap directory. Bailing"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [[ ! -f "$zigdir/bin/zig" ]]; then
|
||||||
|
>&2 echo "$zigdir/bin/zig not found. Please run:"
|
||||||
|
>&2 echo " ./build -j\$(nproc) x86_64-linux-musl baseline"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd "$zigdir"
|
||||||
|
vsn=$(bin/zig version)
|
||||||
|
outdir="zig-linux-x86_64-$vsn"
|
||||||
|
mkdir -p "$outdir"
|
||||||
|
cp -r "bin/zig" "$outdir"
|
||||||
|
cp -r "lib/zig" "$outdir/lib"
|
||||||
|
tar -cf "$outdir.tar" "$outdir"
|
||||||
|
xz -vk --fast "$outdir.tar"
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo "$zigdir/$outdir.tar.xz is ready for use"
|
@ -3,23 +3,37 @@ How to test a different version of zig
|
|||||||
|
|
||||||
Assume you want to test an unreleased version of zig. Here's how:
|
Assume you want to test an unreleased version of zig. Here's how:
|
||||||
|
|
||||||
- build zig in `build/` directory, following the official instructions.
|
1. Clone zig-bootstrap:
|
||||||
- pack it to something that looks like a release using this script:
|
|
||||||
|
|
||||||
```bash
|
$ git clone https://github.com/ziglang/zig-bootstrap
|
||||||
#!/bin/bash
|
$ cd zig-bootstrap
|
||||||
set -xeuo pipefail
|
|
||||||
|
|
||||||
archversion="zig-linux-x86_64-$(git describe)"
|
2. Copy over zig/ from ~/zig:
|
||||||
dst="$HOME/rel/$archversion/"
|
|
||||||
rm -fr "$dst"
|
|
||||||
mkdir -p "$dst"/docs
|
|
||||||
cp zig "$dst"
|
|
||||||
cp -r ../lib "$dst"
|
|
||||||
tar -C "$HOME/rel" -cJf "$HOME/$archversion.tar.xz" .
|
|
||||||
```
|
|
||||||
|
|
||||||
- send it to jakstys.lt or your mirror.
|
$ rm -fr zig
|
||||||
- point toolchain/defs.bzl to the new version.
|
$ tar -C ~/zig archive --format=tar --prefix=zig/ master | tar -xv
|
||||||
- run tests (probably locally, where zig was built).
|
|
||||||
- running this on sr.ht is left as an exercise for further tests.
|
3. Build it (assuming `x86_64-linux`):
|
||||||
|
|
||||||
|
$ vim build # edit ZIG_VERSION
|
||||||
|
$ ./build -j$(nproc) x86_64-linux-musl baseline
|
||||||
|
|
||||||
|
4. Pack the release tarball:
|
||||||
|
|
||||||
|
$ ~/code/bazel-zig-cc/makerel
|
||||||
|
|
||||||
|
This gives us a usable Zig SDK. Now:
|
||||||
|
|
||||||
|
- Send the .tar.gz it to your mirror.
|
||||||
|
- Point toolchain/defs.bzl to the new version.
|
||||||
|
- Run tests.
|
||||||
|
|
||||||
|
Links
|
||||||
|
-----
|
||||||
|
|
||||||
|
- [ziglang/release-cutter][1], a script that creates binaries for [ziglang.org/download][2].
|
||||||
|
- [ziglang/zig-bootstrap][3], a set of scripts that compile a static Zig.
|
||||||
|
|
||||||
|
[1]: https://github.com/ziglang/release-cutter/blob/master/script
|
||||||
|
[2]: https://ziglang.org/download
|
||||||
|
[3]: https://github.com/ziglang/zig-bootstrap
|
||||||
|
Loading…
Reference in New Issue
Block a user