1
Fork 0

getting there

This commit is contained in:
Motiejus Jakštys 2024-11-03 19:09:11 +02:00
parent b108429dd4
commit 9bf4432623
3 changed files with 67 additions and 10 deletions

View File

@ -7,7 +7,7 @@ ADD llvm-snapshot.gpg.key /etc/apt/trusted.gpg.d/apt.llvm.org.asc
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
zstd binaryen cmake git make zlib1g-dev \
zstd binaryen cmake git make zlib1g-dev less tmux \
llvm-15 llvm-15-dev liblld-15-dev lld-15 clang-15 libclang-15-dev \
llvm-16 llvm-16-dev liblld-16-dev lld-16 clang-16 libclang-16-dev \
llvm-17 llvm-17-dev liblld-17-dev lld-17 clang-17 libclang-17-dev \

1
README.md Normal file
View File

@ -0,0 +1 @@
docker run -ti --rm -v ~/code:/x -w /x zig-repro sh -c 'useradd -ms /bin/bash motiejus && cd zig && tmux new-session su motiejus'

72
run Normal file → Executable file
View File

@ -9,19 +9,75 @@ set -xeuo pipefail
# Merge pull request #13560 from ziglang/wasi-bootstrap
#
# Nuke the C++ implementation of Zig from orbit using WASI
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
REMOVE_STAGE1=0.10.0-542-g3ba916584d
git revert --no-edit $REMOVE_STAGE1
# Merge pull request #13560 from ziglang/wasi-bootstrap
git checkout 0.10.0-610-ge7d28344fa
# 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.
REMOVE_FSTAGE1=0.10.0-539-g28514476ef
git revert --no-edit -X theirs $REMOVE_FSTAGE1
# parent of "remove `-fstage1` option"
git checkout 0.10.0-538-gbf316e5506 CMakeLists.txt build.zig lib/build_runner.zig lib/std/build.zig lib/std/build/TranslateCStep.zig src deps
git mv stage1/config.zig.in src
mkdir build
cd build
# removing the wasi-based stage1 just to be sure
git rm stage1/zig1.wasm.zst
sed -i '/have_stage1/ s/true/false/' 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
make -j"$(nproc)" install
popd
echo "stage1 complete. Building zig1.wasm.zst"
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 "Done"
true && exit
# commit 89d1ccc477c1dbc8bb8d13ad2598ef0190c25898
# Author: Veikka Tuominen <git@vexu.eu>
# Date: Fri Dec 9 18:40:01 2022 +0200
#
# replace zig1.wasm to the removal of BoundFn
REPLACE_ZIG1_WASM=0.10.0-677-g89d1ccc477
git archive --prefix=zig-$REPLACE_ZIG1_WASM/ $REPLACE_ZIG1_WASM | tar -C .. -x --exclude="stage1/zig1.wasm*"
pushd ../zig-$REPLACE_ZIG1_WASM
../zig/build/stage3/bin/zig update-zig1
mkdir build; pushd build
CC=clang-15 CXX=clang++-15 cmake ..
make -j"$(nproc)" install
popd
popd