zig-repro/run

455 lines
12 KiB
Plaintext
Raw Normal View History

2024-11-01 09:33:22 +02:00
#!/usr/bin/env bash
2024-11-03 22:20:46 +02:00
HERE=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
2024-11-06 23:36:47 +02:00
fullbuild() {
rm -fr build
mkdir build
pushd build
CC=clang-15 CXX=clang++-15 cmake ..
make -j"$(nproc)" install
popd
}
2024-11-08 20:05:18 +02:00
# zig2
halfbuild() {
rm -fr build
mkdir build
pushd build
CC=clang-15 CXX=clang++-15 cmake ..
make -j"$(nproc)"
popd
}
2024-11-03 23:21:48 +02:00
# 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
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP00_A=e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118
2024-11-03 23:21:48 +02:00
# commit 3ba916584db5485c38ebf2390e8d22bc6d81bf8e
# Author: Andrew Kelley <andrew@ziglang.org>
# Date: 2022-11-05T03:47:19+02:00
#
# actually remove stage1
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP00_B=3ba916584db5485c38ebf2390e8d22bc6d81bf8e
2024-11-03 23:21:48 +02:00
# 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.
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP00_C=28514476ef8c824c3d189d98f23d0f8d23e496ea
2024-11-06 22:57:41 +02:00
step00() {
2024-11-06 23:36:47 +02:00
git checkout $STEP00_A
2024-11-03 22:20:46 +02:00
2024-11-06 23:36:47 +02:00
git revert --no-edit $STEP00_B
2024-11-03 22:20:46 +02:00
2024-11-06 23:36:47 +02:00
git revert --no-edit -X theirs $STEP00_C
2024-11-03 22:20:46 +02:00
git mv stage1/config.zig.in src
sed -i '/have_stage1/ s/false/true/' src/config.zig.in
2024-11-06 23:36:47 +02:00
git checkout $STEP00_C~1 build.zig CMakeLists.txt
2024-11-03 22:20:46 +02:00
echo "Building the C++ (stage1) implementation"
2024-11-06 15:13:57 +02:00
fullbuild
2024-11-03 19:09:11 +02:00
2024-11-03 22:20:46 +02:00
echo "C++ implementation in build/stage3/bin/zig. Will build zig1.wasm.zst."
git reset --hard
2024-11-06 23:36:47 +02:00
git checkout $STEP00_A
2024-11-03 22:20:46 +02:00
build/stage3/bin/zig build update-zig1
echo "stage1/zig1.wasm.zst built. Bootstrapping zig with it."
2024-11-06 15:13:57 +02:00
fullbuild
2024-11-03 22:20:46 +02:00
echo "Zig bootstrapped from selfhosted."
}
2024-11-06 23:36:47 +02:00
# commit 9d93b2ccf11f584320a2c5209dd2d94705167695
# Author: Veikka Tuominen <git@vexu.eu>
# Date: 2022-12-08T19:52:05+02:00
#
# Eliminate `BoundFn` type from the language
#
# Closes #9484
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP01=9d93b2ccf11f584320a2c5209dd2d94705167695
STEP01_=0.10.0-675-g9d93b2ccf1
2024-11-06 22:57:41 +02:00
step01() {
rm -fr "../zig-$STEP01_"
git archive --prefix=zig-$STEP01_/ $STEP01 | tar -C .. -x
2024-11-03 22:20:46 +02:00
{
pushd "../zig-$STEP01_"
2024-11-06 15:13:57 +02:00
cp "$OLDPWD/stage1/zig1.wasm.zst" stage1/
2024-11-03 22:20:46 +02:00
patch -p1 <"$HERE/0.10.0-675-g9d93b2ccf1-TypeOf-hack.patch"
2024-11-06 15:13:57 +02:00
fullbuild
2024-11-03 22:20:46 +02:00
build/stage3/bin/zig build update-zig1
popd
}
}
2024-11-06 23:36:47 +02:00
# commit d10fd78d4615f329141f5c19f893039d56aff425
# Author: Andrew Kelley <andrew@ziglang.org>
# Date: 2022-12-10T21:54:24+02:00
#
# update zig1.wasm
#
# This includes the latest changes from master branch with fixes to the C
# backend that affect aarch64-windows which are necessary to build from
# source on this target.
#
STEP02=d10fd78d4615f329141f5c19f893039d56aff425
STEP02_=0.10.0-722-gd10fd78d46
2024-11-06 22:57:41 +02:00
step02() {
rm -fr "../zig-$STEP02_"
git archive --prefix=zig-$STEP02_/ $STEP02 | tar -C .. -x
2024-11-03 23:21:48 +02:00
{
pushd "../zig-$STEP02_"
zstd -cd ../zig-$STEP01_/stage1/zig1.wasm.zst >stage1/zig1.wasm
2024-11-06 15:13:57 +02:00
fullbuild
2024-11-03 23:21:48 +02:00
build/stage3/bin/zig build update-zig1
popd
}
}
2024-11-06 23:36:47 +02:00
# commit 7b2a936173165002105ba5e76bed69654e132fea
# Author: Veikka Tuominen <git@vexu.eu>
# Date: 2022-12-12T15:32:37+02:00
#
# remove `stack` option from `@call`
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP03=7b2a936173165002105ba5e76bed69654e132fea
STEP03_=0.10.0-747-g7b2a936173
2024-11-06 22:57:41 +02:00
step03() {
rm -fr "../zig-$STEP03_"
git archive --prefix=zig-$STEP03_/ $STEP03 | tar -C .. -x
2024-11-03 23:21:48 +02:00
{
pushd "../zig-$STEP03_"
2024-11-06 15:13:57 +02:00
patch -p1 <"$HERE/0.10.0-747-g7b2a936173-CallOptions.patch"
"../zig-$STEP02_/build/stage3/bin/zig" build --zig-lib-dir lib update-zig1
2024-11-06 14:11:10 +02:00
popd
}
}
2024-11-06 23:36:47 +02:00
# commit 08b2d491bcd8c79c68495267cc71967661caea1e
# Author: Veikka Tuominen <git@vexu.eu>
# Date: 2022-12-12T15:32:37+02:00
#
# update usages of `@call`
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP04=08b2d491bcd8c79c68495267cc71967661caea1e
STEP04_=0.10.0-748-g08b2d491bc
2024-11-06 22:57:41 +02:00
step04() {
rm -fr "../zig-$STEP04_"
git archive --prefix=zig-$STEP04_/ $STEP04 | tar -C .. -x
2024-11-06 14:11:10 +02:00
{
pushd "../zig-$STEP04_"
cp ../zig-$STEP03_/stage1/zig1.wasm stage1/zig1.wasm
2024-11-06 15:13:57 +02:00
fullbuild
2024-11-03 23:21:48 +02:00
build/stage3/bin/zig build update-zig1
popd
}
2024-11-03 22:20:46 +02:00
}
2024-11-06 23:36:47 +02:00
# commit 35184bff75420f405cb703c9cf86b196843b9a94 (HEAD)
# Author: r00ster91 <r00ster91@proton.me>
# Date: 2022-12-13T23:30:06+02:00
#
# std.builtin: rename Type.UnionField and Type.StructField's field_type to type
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP05=aac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6
STEP05_=0.10.0-851-gaac2d6b56f
2024-11-06 22:57:41 +02:00
step05() {
rm -fr "../zig-$STEP05_"
git archive --prefix=zig-$STEP05_/ $STEP05 | tar -C .. -x
{
pushd "../zig-$STEP05_"
cp ../zig-$STEP04_/stage1/zig1.wasm stage1/zig1.wasm
fullbuild
2024-11-06 17:20:23 +02:00
popd
}
}
2024-11-06 23:36:47 +02:00
# commit 2a5e1426aa9469fadb78e837d0100d689213b034
# Author: Veikka Tuominen <git@vexu.eu>
# Date: 2022-12-16T19:44:25+02:00
#
# update zig1.wasm to builtin.Type field changes
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP06=2a5e1426aa9469fadb78e837d0100d689213b034
STEP06_=0.10.0-853-g2a5e1426aa
2024-11-06 22:57:41 +02:00
step06() {
rm -fr "../zig-$STEP06_"
git archive --prefix=zig-$STEP06_/ $STEP06 | tar -C .. -x
2024-11-06 17:20:23 +02:00
{
pushd "../zig-$STEP06_"
"../zig-$STEP05_/build/stage3/bin/zig" build update-zig1
popd
}
}
2024-11-06 23:36:47 +02:00
# commit 54160e7f6aecb4628df633ceaef4c6d956429a3d
# Author: Veikka Tuominen <git@vexu.eu>
# Date: 2022-12-21T14:33:02+02:00
#
# Sema: make overflow arithmetic builtins return tuples
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP07=54160e7f6aecb4628df633ceaef4c6d956429a3d
STEP07_=0.10.0-961-g54160e7f6a
2024-11-06 22:57:41 +02:00
step07() {
rm -fr "../zig-$STEP07_"
git archive --prefix=zig-$STEP07_/ $STEP07 | tar -C .. -x
2024-11-06 22:48:24 +02:00
{
pushd "../zig-$STEP07_"
2024-11-06 22:48:24 +02:00
patch -p1 <"$HERE/0.10.0-961-g54160e7f6a-CMakeLists.txt-remove-stage3.patch"
cp ../zig-$STEP06_/stage1/zig1.wasm stage1/zig1.wasm
2024-11-08 20:05:18 +02:00
halfbuild
2024-11-06 22:48:24 +02:00
popd
}
}
2024-11-06 23:36:47 +02:00
# commit 622311fb9ac7ee6d93dcb8cda4b608751f7e092a
# Author: Veikka Tuominen <git@vexu.eu>
# Date: 2022-12-21T16:40:30+02:00
#
# update uses of overflow arithmetic builtins
2024-11-07 00:04:53 +02:00
#
2024-11-06 23:36:47 +02:00
STEP08=622311fb9ac7ee6d93dcb8cda4b608751f7e092a
STEP08_=0.10.0-962-g622311fb9a
2024-11-06 22:57:41 +02:00
step08() {
rm -fr "../zig-$STEP08_"
git archive --prefix=zig-$STEP08_/ $STEP08 | tar -C .. -x
2024-11-06 22:48:24 +02:00
{
pushd "../zig-$STEP08_"
../zig-$STEP07_/build/zig2 build --zig-lib-dir lib update-zig1
2024-11-06 22:48:24 +02:00
popd
}
}
2024-11-06 23:36:47 +02:00
# commit a43fdc1620fa24c8c606f748505766bfd53d1049
# Author: kcbanner <kcbanner@gmail.com>
# Date: 2022-12-09T02:50:08+02:00
#
# cbe: first set of changes for msvc compatibility
2024-11-07 00:04:53 +02:00
#
2024-11-07 00:03:00 +02:00
STEP09=a43fdc1620fa24c8c606f748505766bfd53d1049
STEP09_=0.10.0-1027-ga43fdc1620
step09() {
rm -fr "../zig-$STEP09_"
git archive --prefix=zig-$STEP09_/ $STEP09 | tar -C .. -x
2024-11-07 00:03:00 +02:00
{
pushd "../zig-$STEP09_"
cp ../zig-$STEP08_/stage1/zig1.wasm stage1/zig1.wasm
2024-11-07 00:03:00 +02:00
fullbuild
popd
}
}
2024-11-06 23:36:47 +02:00
2024-11-08 16:47:27 +02:00
# commit 4c1007fc044689b8cbc20634d73debb43df8efe1
# Merge: 4172c29166 23b1544f6c
# Author: Andrew Kelley <andrew@ziglang.org>
# Date: 2023-01-02T23:11:17+02:00
#
# Merge pull request #14002 from kcbanner/cbe_msvc_compatibility
#
STEP10=4c1007fc044689b8cbc20634d73debb43df8efe1
STEP10_=0.10.0-1073-g4c1007fc04
step10() {
rm -fr "../zig-$STEP10"
git archive --prefix=zig-$STEP10_/ $STEP10 | tar -C .. -x
{
pushd "../zig-$STEP10_"
../zig-$STEP09_/build/stage3/bin/zig build --zig-lib-dir lib update-zig1
fullbuild
popd
}
2024-11-08 16:56:35 +02:00
}
2024-11-08 16:47:27 +02:00
2024-11-08 17:05:55 +02:00
#commit a9b68308b9eeb494524e2b7ab0d63cfa6b623cd0
#Author: Casey Banner <kcbanner@gmail.com>
#Date: 2023-01-26T07:45:40+02:00
2024-11-08 16:56:35 +02:00
#
2024-11-08 17:05:55 +02:00
# cbe: fixes for tls, support for not linking libc, and enabling tests
2024-11-08 16:56:35 +02:00
#
2024-11-08 17:05:55 +02:00
STEP11=a9b68308b9eeb494524e2b7ab0d63cfa6b623cd0
STEP11_=0.10.0-1497-ga9b68308b9
2024-11-08 16:56:35 +02:00
step11() {
rm -fr "../zig-$STEP11"
git archive --prefix=zig-$STEP11_/ $STEP11 | tar -C .. -x
{
pushd "../zig-$STEP11_"
../zig-$STEP10_/build/stage3/bin/zig build --zig-lib-dir lib update-zig1
fullbuild
popd
}
2024-11-08 16:47:27 +02:00
}
2024-11-08 18:32:44 +02:00
# commit f16c10a86b7183e99e54a70344f4681211cd52bb
# Author: Veikka Tuominen <git@vexu.eu>
# Date: 2023-01-27T20:25:48+02:00
#
# implement `@qualCast`
#
STEP12=f16c10a86b7183e99e54a70344f4681211cd52bb
STEP12_=0.10.0-1506-gf16c10a86b
step12() {
2024-11-08 19:22:52 +02:00
rm -fr "../zig-$STEP12"
2024-11-08 18:32:44 +02:00
# use the @qualCast implementation in src/, but remove usages in lib/
git archive --prefix=zig-$STEP12_/ $STEP12 | tar -C .. -x
git archive --prefix=zig-$STEP12_/ $STEP12~1 lib | tar -C .. -x
{
pushd "../zig-$STEP12_"
cp ../zig-$STEP11_/stage1/zig1.wasm stage1/zig1.wasm
fullbuild
2024-11-08 19:22:52 +02:00
build/stage3/bin/zig build --zig-lib-dir lib update-zig1
popd
}
}
# commit 7199d7c77715fe06606c5c89595e6852b3fa8c20
# Author: Veikka Tuominen <git@vexu.eu>
# Date: 2023-02-13T16:19:17+02:00
#
# split `@qualCast` into `@constCast` and `@volatileCast`
#
STEP13=7199d7c77715fe06606c5c89595e6852b3fa8c20
STEP13_=0.10.0-1638-g7199d7c777
step13() {
rm -fr "../zig-$STEP13"
# ditto as previous step: implementation here, usages from HEAD~1
git archive --prefix=zig-$STEP13_/ $STEP13 | tar -C .. -x
git archive --prefix=zig-$STEP13_/ $STEP13~1 lib | tar -C .. -x
{
pushd "../zig-$STEP13_"
patch -p1 <"$HERE/0.10.0-1638-g7199d7c777-re-add-qualCast.patch"
../zig-$STEP12_/build/stage3/bin/zig build --zig-lib-dir lib update-zig1
fullbuild
2024-11-08 18:32:44 +02:00
popd
}
}
2024-11-08 19:42:10 +02:00
# commit 321ccbdc525ab0f5862e42378b962c10ec54e4a1
# Author: Andrew Kelley <andrew@ziglang.org>
# Date: 2023-02-18T04:54:26+02:00
#
# Sema: implement for_len
#
STEP14=321ccbdc525ab0f5862e42378b962c10ec54e4a1
STEP14_=0.10.0-1657-g321ccbdc52
step14() {
rm -fr "../zig-$STEP14_"
git archive --prefix=zig-$STEP14_/ $STEP14 | tar -C .. -x
{
pushd "../zig-$STEP14_"
patch -p1 <"$HERE/0.10.0-1657-g321ccbdc52-CMakeLists.txt-remove-stage3.patch"
cp ../zig-$STEP13_/stage1/zig1.wasm stage1/zig1.wasm
2024-11-08 20:05:18 +02:00
halfbuild
2024-11-08 19:42:10 +02:00
popd
}
}
# commit 0bb178bbb2451238a326c6e916ecf38fbc34cab1
# Merge: 346ec15c50 5fc6bbe71e
# Author: Andrew Kelley <andrew@ziglang.org>
# Date: 2023-02-19T17:10:59+02:00
#
# Merge pull request #14671 from ziglang/multi-object-for
#
STEP15=0bb178bbb2451238a326c6e916ecf38fbc34cab1
STEP15_=0.10.0-1681-g0bb178bbb2
step15() {
rm -fr "../zig-$STEP15_"
git archive --prefix=zig-$STEP15_/ $STEP15 | tar -C .. -x
{
pushd "../zig-$STEP15_"
../zig-$STEP14_/build/zig2 build --zig-lib-dir lib update-zig1
popd
}
}
2024-11-08 20:05:18 +02:00
# commit 705d2a3c2cd94faf8e16c660b3b342d6fe900e55
# Author: mlugg <mlugg@mlugg.co.uk>
# Date: 2023-02-17T03:44:08+02:00
#
# Implement new module CLI
#
STEP16=705d2a3c2cd94faf8e16c660b3b342d6fe900e55
STEP16_=0.10.0-1712-g705d2a3c2c
step16() {
rm -fr "../zig-$STEP16"
git archive --prefix=zig-$STEP16_/ $STEP16 | tar -C .. -x
{
pushd "../zig-$STEP16_"
cp ../zig-$STEP15_/stage1/zig1.wasm stage1/zig1.wasm
patch -p1 <"$HERE/0.10.0-1657-g321ccbdc52-CMakeLists.txt-remove-stage3.patch"
halfbuild
popd
}
}
# commit 09a84c8384dffc7884528947b879f32d93c1bd90
# Author: mlugg <mlugg@mlugg.co.uk>
# Date: 2023-02-17T08:20:52+02:00
#
# Update std.Build to new module CLI, update zig1 and CMakeLists
#
STEP17=09a84c8384dffc7884528947b879f32d93c1bd90
STEP17_=0.10.0-1713-g09a84c8384
step17() {
rm -fr "../zig-$STEP17"
git archive --prefix=zig-$STEP17_/ $STEP17 | tar -C .. -x
{
pushd "../zig-$STEP17_"
../zig-$STEP16_/build/zig2 build --zig-lib-dir lib update-zig1
fullbuild
popd
}
}
2024-11-03 23:21:48 +02:00
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set -xeuo pipefail
2024-11-06 22:57:41 +02:00
step=${1:-step00}
step=${step#step}
2024-11-07 00:03:00 +02:00
step=${step#0}
2024-11-06 22:57:41 +02:00
if [[ "$step" -le 0 ]]; then step00; fi
if [[ "$step" -le 1 ]]; then step01; fi
if [[ "$step" -le 2 ]]; then step02; fi
if [[ "$step" -le 3 ]]; then step03; fi
if [[ "$step" -le 4 ]]; then step04; fi
if [[ "$step" -le 5 ]]; then step05; fi
if [[ "$step" -le 6 ]]; then step06; fi
if [[ "$step" -le 7 ]]; then step07; fi
if [[ "$step" -le 8 ]]; then step08; fi
2024-11-07 00:03:00 +02:00
if [[ "$step" -le 9 ]]; then step09; fi
2024-11-08 16:47:27 +02:00
if [[ "$step" -le 10 ]]; then step10; fi
2024-11-08 16:56:35 +02:00
if [[ "$step" -le 11 ]]; then step11; fi
2024-11-08 18:32:44 +02:00
if [[ "$step" -le 12 ]]; then step12; fi
2024-11-08 19:22:52 +02:00
if [[ "$step" -le 13 ]]; then step13; fi
2024-11-08 19:42:10 +02:00
if [[ "$step" -le 14 ]]; then step14; fi
if [[ "$step" -le 15 ]]; then step15; fi
2024-11-08 20:05:18 +02:00
if [[ "$step" -le 16 ]]; then step16; fi
if [[ "$step" -le 17 ]]; then step17; fi
2024-11-03 23:21:48 +02:00
fi