Some copy-pastable commands for @matklad from the future:
I want to hack on the standard library
git clone https://github.com/ziglang/zig && cd zig
curl -L $(curl -L https://ziglang.org/download/index.json |
jq -r ".master.\"x86_64-linux\".tarball") > zig.tar.xz
mkdir stage3 && tar xf zig.tar.xz -C stage3 --strip-components 1
./stage3/zig version
./stage3/zig test lib/std/std.zig --zig-lib-dir lib
I want to hack on the compiler itself
First, check what LLVM is it. Then,
git clone https://github.com/ziglang/zig
git clone --depth 1 --branch release/18.x https://github.com/llvm/llvm-project llvm-project-18
pushd llvm-project-18
git checkout release/18.x
mkdir build-release
pushd build-release
cmake ../llvm \
-DCMAKE_INSTALL_PREFIX=../../llvm-release \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="lld;clang" \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_LIBEDIT=OFF \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_PARALLEL_LINK_JOBS=1 \
-G Ninja
ninja install # pu-erh time
popd
popd
./llvm-release/bin/llvm-config --version
pushd zig
mkdir build
pushd build
cmake .. \
-DCMAKE_PREFIX_PATH=$(realpath ../../llvm-release) \
-DCMAKE_BUILD_TYPE=Release \
-DZIG_NO_LIB=ON \
-G Ninja
ninja install
popd
popd
./zig/build/stage3/bin/zig version
cd zig
./build/stage3/bin/zig build --prefix ./stage4 -Denable-llvm -Dno-lib
./stage4/bin/zig build test -Denable-llvm