2022-10-13 12:48:43 +03:00
|
|
|
#!/usr/bin/env bash
|
2022-10-13 05:54:28 +03:00
|
|
|
set -xeuo pipefail
|
|
|
|
|
|
|
|
zig_version=$(awk -F'"' '/^ZIG_VERSION=/{print $2}' build)
|
|
|
|
|
2022-10-13 12:48:43 +03:00
|
|
|
./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
|
2022-10-13 05:54:28 +03:00
|
|
|
|
2022-10-13 12:48:43 +03:00
|
|
|
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}"
|
2022-10-13 05:54:28 +03:00
|
|
|
|
2022-10-13 12:48:43 +03:00
|
|
|
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}"
|
2022-10-13 05:54:28 +03:00
|
|
|
|
|
|
|
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
|
2022-10-13 12:48:43 +03:00
|
|
|
mv zig-${os_arch}-"${zig_version}"/{bin/${zig},}
|
|
|
|
rmdir zig-${os_arch}-"${zig_version}"/bin
|
2022-10-13 05:54:28 +03:00
|
|
|
|
|
|
|
# copy some clarifying files for future readers
|
2022-10-13 12:48:43 +03:00
|
|
|
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/
|
2022-10-13 05:54:28 +03:00
|
|
|
done
|
|
|
|
|
|
|
|
# x86_64 should have libs in lib/, rather than in lib/zig/.
|
|
|
|
for os in linux macos windows; do
|
2022-10-13 12:48:43 +03:00
|
|
|
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
|
2022-10-13 05:54:28 +03:00
|
|
|
done
|
|
|
|
|
2022-10-13 12:48:43 +03:00
|
|
|
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}"/ &
|
2022-10-13 05:54:28 +03:00
|
|
|
|
|
|
|
# 7z is the quickest, so blocking on it first. Then wait for tars to complete.
|
2022-10-13 12:48:43 +03:00
|
|
|
7z a zig-windows-x86_64-"${zig_version}".zip zig-windows-x86_64-"${zig_version}"/
|
2022-10-13 05:54:28 +03:00
|
|
|
wait %1 %2 %3 %4
|
|
|
|
|
2022-10-13 12:48:43 +03:00
|
|
|
sha256sum ./*.tar.xz ./*.zip
|
|
|
|
ls -l ./*.tar.xz ./*.zip
|