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-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-06 15:00:51 +02:00
|
|
|
MERGE_WASI_BOOTSTRAP=e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118
|
2024-11-06 15:13:57 +02:00
|
|
|
MERGE_WASI_BOOTSTRAP_=0.10.0-610-ge7d28344fa
|
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-06 15:00:51 +02:00
|
|
|
REMOVE_STAGE1=3ba916584db5485c38ebf2390e8d22bc6d81bf8e
|
2024-11-06 15:13:57 +02:00
|
|
|
REMOVE_STAGE1_=0.10.0-542-g3ba916584d
|
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-06 15:00:51 +02:00
|
|
|
REMOVE_FSTAGE1=28514476ef8c824c3d189d98f23d0f8d23e496ea
|
2024-11-06 15:13:57 +02:00
|
|
|
REMOVE_FSTAGE1_=0.10.0-539-g28514476ef
|
2024-11-03 23:21:48 +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-06 15:00:51 +02:00
|
|
|
BOUNDFN=9d93b2ccf11f584320a2c5209dd2d94705167695
|
2024-11-06 15:13:57 +02:00
|
|
|
BOUNDFN_=0.10.0-675-g9d93b2ccf1
|
2024-11-03 23:21:48 +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.
|
|
|
|
#
|
|
|
|
# stage1/zig1.wasm | Bin 2315523 -> 2315899 bytes
|
|
|
|
# 1 file changed, 0 insertions(+), 0 deletions(-)
|
2024-11-06 15:00:51 +02:00
|
|
|
C_AARCH64=d10fd78d4615f329141f5c19f893039d56aff425
|
2024-11-06 15:13:57 +02:00
|
|
|
C_AARCH64_=0.10.0-722-gd10fd78d46
|
2024-11-03 23:21:48 +02:00
|
|
|
|
2024-11-06 14:11:10 +02:00
|
|
|
# commit 7b2a936173165002105ba5e76bed69654e132fea
|
2024-11-03 23:21:48 +02:00
|
|
|
# Author: Veikka Tuominen <git@vexu.eu>
|
2024-11-06 14:11:10 +02:00
|
|
|
# Date: 2022-12-12T15:32:37+02:00
|
2024-11-03 23:21:48 +02:00
|
|
|
#
|
2024-11-06 14:11:10 +02:00
|
|
|
# remove `stack` option from `@call`
|
2024-11-06 15:00:51 +02:00
|
|
|
CALL_OPTIONS=7b2a936173165002105ba5e76bed69654e132fea
|
2024-11-06 15:13:57 +02:00
|
|
|
CALL_OPTIONS_=0.10.0-747-g7b2a936173
|
2024-11-06 14:11:10 +02:00
|
|
|
|
|
|
|
# commit 08b2d491bcd8c79c68495267cc71967661caea1e
|
|
|
|
# Author: Veikka Tuominen <git@vexu.eu>
|
|
|
|
# Date: 2022-12-12T15:32:37+02:00
|
|
|
|
#
|
|
|
|
# update usages of `@call`
|
2024-11-06 15:00:51 +02:00
|
|
|
CALL_USAGES=08b2d491bcd8c79c68495267cc71967661caea1e
|
2024-11-06 15:13:57 +02:00
|
|
|
CALL_USAGES_=0.10.0-748-g08b2d491bc
|
2024-11-03 23:21:48 +02:00
|
|
|
|
2024-11-06 17:20:23 +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
|
|
|
|
BUILTIN_TYPE=aac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6
|
|
|
|
BUILTIN_TYPE_=0.10.0-851-gaac2d6b56f
|
|
|
|
|
2024-11-03 23:21:48 +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-06 17:20:23 +02:00
|
|
|
REMOVE_BUILTIN_TYPE=2a5e1426aa9469fadb78e837d0100d689213b034
|
|
|
|
REMOVE_BUILTIN_TYPE_=0.10.0-853-g2a5e1426aa
|
2024-11-06 15:13:57 +02:00
|
|
|
|
|
|
|
fullbuild() {
|
|
|
|
rm -fr build
|
|
|
|
mkdir build
|
|
|
|
pushd build
|
|
|
|
CC=clang-15 CXX=clang++-15 cmake ..
|
|
|
|
make -j"$(nproc)" install
|
|
|
|
popd
|
|
|
|
}
|
2024-11-03 23:21:48 +02:00
|
|
|
|
2024-11-06 19:50:17 +02:00
|
|
|
step0() {
|
2024-11-03 22:20:46 +02:00
|
|
|
git checkout $MERGE_WASI_BOOTSTRAP
|
|
|
|
|
|
|
|
git revert --no-edit $REMOVE_STAGE1
|
|
|
|
|
|
|
|
git revert --no-edit -X theirs $REMOVE_FSTAGE1
|
|
|
|
|
|
|
|
git mv stage1/config.zig.in src
|
|
|
|
|
|
|
|
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"
|
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
|
|
|
|
git checkout $MERGE_WASI_BOOTSTRAP
|
|
|
|
|
|
|
|
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 19:50:17 +02:00
|
|
|
step1() {
|
2024-11-06 15:13:57 +02:00
|
|
|
local TO="$BOUNDFN"
|
|
|
|
local TO_="$BOUNDFN_"
|
|
|
|
echo "Generating zig1.wasm.zst for $TO_"
|
|
|
|
rm -fr "../zig-$TO_"
|
2024-11-06 15:46:07 +02:00
|
|
|
git archive --prefix=zig-$TO_/ $TO | tar -C .. -x
|
2024-11-03 22:20:46 +02:00
|
|
|
|
|
|
|
{
|
2024-11-06 15:27:19 +02:00
|
|
|
pushd "../zig-$TO_"
|
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
|
|
|
|
}
|
|
|
|
echo "zig1.wasm.zst was built for BoundFn hack"
|
|
|
|
}
|
|
|
|
|
2024-11-06 19:50:17 +02:00
|
|
|
step2() {
|
2024-11-06 15:13:57 +02:00
|
|
|
local FROM="$BOUNDFN"
|
|
|
|
local FROM_="$BOUNDFN_"
|
|
|
|
local TO="$C_AARCH64"
|
|
|
|
local TO_="$C_AARCH64_"
|
|
|
|
echo "Generating zig1.wasm.zst for $C_AARCH64_"
|
|
|
|
rm -fr "../zig-$TO_"
|
2024-11-06 15:46:07 +02:00
|
|
|
git archive --prefix=zig-$TO_/ $TO | tar -C .. -x
|
2024-11-03 23:21:48 +02:00
|
|
|
|
|
|
|
{
|
2024-11-06 15:13:57 +02:00
|
|
|
pushd "../zig-$TO_"
|
|
|
|
zstd -cd ../zig-$FROM_/stage1/zig1.wasm.zst >stage1/zig1.wasm
|
|
|
|
fullbuild
|
2024-11-03 23:21:48 +02:00
|
|
|
build/stage3/bin/zig build update-zig1
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
echo "zig1.wasm.zst was built for C-aarch64 backend"
|
|
|
|
}
|
|
|
|
|
2024-11-06 19:50:17 +02:00
|
|
|
step3() {
|
2024-11-06 14:11:10 +02:00
|
|
|
local FROM="$C_AARCH64"
|
2024-11-06 15:13:57 +02:00
|
|
|
local FROM_="$C_AARCH64_"
|
2024-11-06 14:11:10 +02:00
|
|
|
local TO="$CALL_OPTIONS"
|
2024-11-06 15:13:57 +02:00
|
|
|
local TO_="$CALL_OPTIONS_"
|
2024-11-03 23:21:48 +02:00
|
|
|
|
2024-11-06 15:13:57 +02:00
|
|
|
echo "Updating zig1.wasm from $FROM_ -> $TO_ in ../zig-$TO_"
|
|
|
|
rm -fr "../zig-$TO_"
|
2024-11-06 15:46:07 +02:00
|
|
|
git archive --prefix=zig-$TO_/ $TO | tar -C .. -x
|
2024-11-03 23:21:48 +02:00
|
|
|
|
|
|
|
{
|
2024-11-06 15:13:57 +02:00
|
|
|
pushd "../zig-$TO_"
|
|
|
|
patch -p1 <"$HERE/0.10.0-747-g7b2a936173-CallOptions.patch"
|
|
|
|
"../zig-$FROM_/build/stage3/bin/zig" build --zig-lib-dir lib update-zig1
|
2024-11-06 14:11:10 +02:00
|
|
|
popd
|
|
|
|
}
|
|
|
|
echo "zig1.wasm updated for $TO"
|
|
|
|
}
|
|
|
|
|
2024-11-06 19:50:17 +02:00
|
|
|
step4() {
|
2024-11-06 14:11:10 +02:00
|
|
|
local FROM="$CALL_OPTIONS"
|
2024-11-06 15:13:57 +02:00
|
|
|
local FROM_="$CALL_OPTIONS_"
|
2024-11-06 14:11:10 +02:00
|
|
|
local TO="$CALL_USAGES"
|
2024-11-06 15:13:57 +02:00
|
|
|
local TO_="$CALL_USAGES_"
|
|
|
|
|
|
|
|
echo "Updating zig1.wasm from $FROM_ -> $TO_ in ../zig-$TO_"
|
|
|
|
rm -fr "../zig-$TO_"
|
2024-11-06 15:46:07 +02:00
|
|
|
git archive --prefix=zig-$TO_/ $TO | tar -C .. -x
|
2024-11-06 14:11:10 +02:00
|
|
|
|
|
|
|
{
|
2024-11-06 15:13:57 +02:00
|
|
|
pushd "../zig-$TO_"
|
|
|
|
cp ../zig-$FROM_/stage1/zig1.wasm stage1/zig1.wasm
|
|
|
|
fullbuild
|
2024-11-03 23:21:48 +02:00
|
|
|
build/stage3/bin/zig build update-zig1
|
|
|
|
popd
|
|
|
|
}
|
2024-11-06 15:13:57 +02:00
|
|
|
echo "zig1.wasm updated for $TO_"
|
2024-11-03 22:20:46 +02:00
|
|
|
}
|
|
|
|
|
2024-11-06 19:50:17 +02:00
|
|
|
step5() {
|
2024-11-06 17:02:45 +02:00
|
|
|
local FROM="$CALL_USAGES"
|
|
|
|
local FROM_="$CALL_USAGES_"
|
|
|
|
local TO="$BUILTIN_TYPE"
|
|
|
|
local TO_="$BUILTIN_TYPE_"
|
|
|
|
|
|
|
|
echo "Updating zig1.wasm from $FROM_ -> $TO_ in ../zig-$TO_"
|
|
|
|
rm -fr "../zig-$TO_"
|
|
|
|
git archive --prefix=zig-$TO_/ $TO | tar -C .. -x
|
|
|
|
{
|
|
|
|
pushd "../zig-$TO_"
|
|
|
|
cp ../zig-$FROM_/stage1/zig1.wasm stage1/zig1.wasm
|
|
|
|
fullbuild
|
2024-11-06 17:20:23 +02:00
|
|
|
popd
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-11-06 19:50:17 +02:00
|
|
|
step6() {
|
2024-11-06 17:20:23 +02:00
|
|
|
local FROM="$BUILTIN_TYPE"
|
|
|
|
local FROM_="$BUILTIN_TYPE_"
|
|
|
|
local TO="$REMOVE_BUILTIN_TYPE"
|
|
|
|
local TO_="$REMOVE_BUILTIN_TYPE_"
|
|
|
|
|
|
|
|
echo "Updating zig1.wasm from $FROM_ -> $TO_ in ../zig-$TO_"
|
|
|
|
rm -fr "../zig-$TO_"
|
|
|
|
git archive --prefix=zig-$TO_/ $TO | tar -C .. -x
|
|
|
|
{
|
|
|
|
pushd "../zig-$TO_"
|
2024-11-06 17:24:49 +02:00
|
|
|
"../zig-$FROM_/build/stage3/bin/zig" build update-zig1
|
2024-11-06 17:02:45 +02:00
|
|
|
popd
|
|
|
|
}
|
|
|
|
echo "zig1.wasm updated for $TO_"
|
|
|
|
}
|
|
|
|
|
2024-11-03 23:21:48 +02:00
|
|
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
|
|
set -xeuo pipefail
|
2024-11-06 19:50:17 +02:00
|
|
|
step=${1:-step0}
|
2024-11-06 17:02:45 +02:00
|
|
|
step=${step#step}
|
|
|
|
|
|
|
|
# works:
|
2024-11-06 19:50:17 +02:00
|
|
|
if [[ "$step" -le 00 ]] ; then step0; fi
|
|
|
|
if [[ "$step" -le 10 ]] ; then step1; fi
|
|
|
|
if [[ "$step" -le 20 ]] ; then step2; fi
|
|
|
|
if [[ "$step" -le 30 ]] ; then step3; fi
|
|
|
|
if [[ "$step" -le 40 ]] ; then step4; fi
|
|
|
|
if [[ "$step" -le 50 ]] ; then step5; fi
|
|
|
|
if [[ "$step" -le 60 ]] ; then step6; fi
|
2024-11-03 23:21:48 +02:00
|
|
|
fi
|