zig-repro/run
2024-11-03 22:25:28 +02:00

116 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -xeuo pipefail
HERE=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
step00() {
# commit e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118
# Merge: 817cf6a82e 20d86d9c63
# Author: Andrew Kelley <andrew@ziglang.org>
# Date: 2022-12-07T01:52:39+02:00
#
# Merge pull request #13560 from ziglang/wasi-bootstrap
#
# Nuke the C++ implementation of Zig from orbit using WASI
local MERGE_WASI_BOOTSTRAP=0.10.0-610-ge7d28344fa
git checkout $MERGE_WASI_BOOTSTRAP
# commit 3ba916584db5485c38ebf2390e8d22bc6d81bf8e
# Author: Andrew Kelley <andrew@ziglang.org>
# Date: 2022-11-05T03:47:19+02:00
#
# actually remove stage1
local REMOVE_STAGE1=0.10.0-542-g3ba916584d
git revert --no-edit $REMOVE_STAGE1
# commit 28514476ef8c824c3d189d98f23d0f8d23e496ea
# Author: Andrew Kelley <andrew@ziglang.org>
# Date: 2022-11-01T05:29:55+02:00
#
# remove `-fstage1` option
#
# After this commit, the self-hosted compiler does not offer the option to
# use stage1 as a backend anymore.
local REMOVE_FSTAGE1=0.10.0-539-g28514476ef
git revert --no-edit -X theirs $REMOVE_FSTAGE1
git mv stage1/config.zig.in src
# removing the wasi-based stage1 just to be sure
git rm stage1/zig1.wasm.zst
sed -i '/have_stage1/ s/false/true/' src/config.zig.in
git checkout $REMOVE_FSTAGE1~1 build.zig CMakeLists.txt
echo "Building the C++ (stage1) implementation"
mkdir build
{
pushd build
CC=clang-15 CXX=clang++-15 cmake ..
make -j"$(nproc)" install
popd
}
echo "C++ implementation in build/stage3/bin/zig. Will build zig1.wasm.zst."
git reset --hard
git checkout $MERGE_WASI_BOOTSTRAP
rm stage1/zig1.wasm.zst
build/stage3/bin/zig build update-zig1
echo "stage1/zig1.wasm.zst built. Bootstrapping zig with it."
rm -fr build
mkdir build
{
pushd build
CC=clang-15 CXX=clang++-15 cmake ..
make -j"$(nproc)" install
popd
}
echo "Zig bootstrapped from selfhosted."
}
step10() {
cat <<EOF
This commit:
commit 9d93b2ccf11f584320a2c5209dd2d94705167695
Author: Veikka Tuominen <git@vexu.eu>
Date: 2022-12-08T17:52:05+00:00
Eliminate \$(BoundFn) type from the language
Closes #9484
EOF
local BOUNDFN=0.10.0-675-g9d93b2ccf1
git archive --prefix=zig-$BOUNDFN/ $BOUNDFN | tar -C .. -x --exclude="stage1/zig1.wasm*"
{
pushd "../zig-$BOUNDFN"
cp ../zig/stage1/zig1.wasm.zst stage1/
patch -p1 <"$HERE/0.10.0-675-g9d93b2ccf1-TypeOf-hack.patch"
mkdir build
{
pushd build
CC=clang-15 CXX=clang++-15 cmake ..
make -j"$(nproc)" install
popd
}
build/stage3/bin/zig build update-zig1
popd
}
echo "zig1.wasm.zst was built for BoundFn hack"
}
step20() {
true
}
step00
step10
step20