1
Fork 0

run: what works and what doesn't

This commit is contained in:
Motiejus Jakštys 2024-11-06 22:57:41 +02:00
parent e516351ba5
commit 1b12bab360
1 changed files with 25 additions and 26 deletions

49
run
View File

@ -114,7 +114,7 @@ fullbuild() {
popd
}
step0() {
step00() {
git checkout $MERGE_WASI_BOOTSTRAP
git revert --no-edit $REMOVE_STAGE1
@ -144,7 +144,7 @@ step0() {
echo "Zig bootstrapped from selfhosted."
}
step1() {
step01() {
local TO="$BOUNDFN"
local TO_="$BOUNDFN_"
echo "Generating zig1.wasm.zst for $TO_"
@ -162,7 +162,7 @@ step1() {
echo "zig1.wasm.zst was built for BoundFn hack"
}
step2() {
step02() {
local FROM_="$BOUNDFN_"
local TO="$C_AARCH64"
local TO_="$C_AARCH64_"
@ -180,7 +180,7 @@ step2() {
echo "zig1.wasm.zst was built for C-aarch64 backend"
}
step3() {
step03() {
local FROM_="$C_AARCH64_"
local TO="$CALL_OPTIONS"
local TO_="$CALL_OPTIONS_"
@ -198,7 +198,7 @@ step3() {
echo "zig1.wasm updated for $TO"
}
step4() {
step04() {
local FROM_="$CALL_OPTIONS_"
local TO="$CALL_USAGES"
local TO_="$CALL_USAGES_"
@ -217,7 +217,7 @@ step4() {
echo "zig1.wasm updated for $TO_"
}
step5() {
step05() {
local FROM_="$CALL_USAGES_"
local TO="$BUILTIN_TYPE"
local TO_="$BUILTIN_TYPE_"
@ -233,7 +233,7 @@ step5() {
}
}
step6() {
step06() {
local FROM_="$BUILTIN_TYPE_"
local TO="$REMOVE_BUILTIN_TYPE"
local TO_="$REMOVE_BUILTIN_TYPE_"
@ -249,12 +249,12 @@ step6() {
echo "zig1.wasm updated for $TO_"
}
step7() {
step07() {
local FROM_="$REMOVE_BUILTIN_TYPE_"
local TO="$BUILTINS_4TO2"
local TO_="$BUILTINS_4TO2_"
echo "Updating zig1.wasm from $FROM_ -> $TO_ in ../zig-$TO_"
echo "Building zig2 from $FROM_ -> $TO_ in ../zig-$TO_"
rm -fr "../zig-$TO_"
git archive --prefix=zig-$TO_/ $TO | tar -C .. -x
{
@ -263,20 +263,19 @@ step7() {
cp ../zig-$FROM_/stage1/zig1.wasm stage1/zig1.wasm
# same as "fullbuild", except the make target does not have "install"
{
rm -fr build
mkdir build
{
pushd build
CC=clang-15 CXX=clang++-15 cmake ..
make -j"$(nproc)"
popd
}
build/zig2 build update-zig1
popd
}
}
step8() {
step08() {
local FROM_="$BUILTINS_4TO2_"
local TO="$BUILTINS_4TO2_USES"
local TO_="$BUILTINS_4TO2_USES_"
@ -286,26 +285,26 @@ step8() {
git archive --prefix=zig-$TO_/ $TO | tar -C .. -x
{
pushd "../zig-$TO_"
cp ../zig-$FROM_/stage1/zig1.wasm stage1/zig1.wasm
fullbuild
build/stage3/bin/zig build update-zig1
../zig-$FROM_/build/zig2 build update-zig1
popd
}
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set -xeuo pipefail
step=${1:-step0}
step=${1:-step00}
step=${step#step}
# works:
if [[ "$step" -le 0 ]]; then step0; fi
if [[ "$step" -le 1 ]]; then step1; fi
if [[ "$step" -le 2 ]]; then step2; fi
if [[ "$step" -le 3 ]]; then step3; fi
if [[ "$step" -le 4 ]]; then step4; fi
if [[ "$step" -le 5 ]]; then step5; fi
if [[ "$step" -le 6 ]]; then step6; fi
if [[ "$step" -le 7 ]]; then step7; fi
if [[ "$step" -le 8 ]]; then step8; fi
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
# not:
if [[ "$step" -le 8 ]]; then step08; fi
fi