2022-07-27 23:33:53 +03:00
|
|
|
#!/usr/bin/env bash
|
2022-06-28 13:57:48 +03:00
|
|
|
set -euo pipefail
|
|
|
|
|
2022-07-18 15:42:09 +03:00
|
|
|
zigdir=out/zig-x86_64-linux-musl-x86_64_v3
|
2022-06-28 13:57:48 +03:00
|
|
|
|
|
|
|
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:"
|
2022-07-18 15:42:09 +03:00
|
|
|
>&2 echo " ./build -j\$(nproc) x86_64-linux-musl x86_64_v3"
|
2022-06-28 13:57:48 +03:00
|
|
|
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"
|
2022-07-18 15:42:09 +03:00
|
|
|
xz -vk -9 -T0 "$outdir.tar"
|
2022-06-28 13:57:48 +03:00
|
|
|
popd
|
|
|
|
|
|
|
|
echo "$zigdir/$outdir.tar.xz is ready for use"
|