| ... | ... | @@ -54,7 +54,7 @@ Ensure you have the required dependencies: |
| 54 | 54 | |
| 55 | 55 | Then it is the standard CMake build process: |
| 56 | 56 | |
| 57 | | ``` |
| 57 | ```sh |
| 58 | 58 | mkdir build |
| 59 | 59 | cd build |
| 60 | 60 | cmake .. |
| ... | ... | @@ -69,7 +69,7 @@ This produces `stage3/bin/zig` which is the Zig compiler built by itself. |
| 69 | 69 | |
| 70 | 70 | In this case, the only system dependency is a C compiler. |
| 71 | 71 | |
| 72 | | ``` |
| 72 | ```sh |
| 73 | 73 | cc -o bootstrap bootstrap.c |
| 74 | 74 | ./bootstrap |
| 75 | 75 | ``` |
| ... | ... | @@ -95,7 +95,7 @@ installed C compiler toolchain. |
| 95 | 95 | From here you can tinker with `zig2` or you can proceed to installation using |
| 96 | 96 | the build system as usual: |
| 97 | 97 | |
| 98 | | ``` |
| 98 | ```sh |
| 99 | 99 | ./zig2 build |
| 100 | 100 | ``` |
| 101 | 101 | |
| ... | ... | @@ -118,7 +118,7 @@ The easiest way to obtain both of these artifacts is to use |
| 118 | 118 | directory `out/zig-$target-$cpu` and `out/$target-$cpu`, to be used as |
| 119 | 119 | `$ZIG_PREFIX` and `$LLVM_PREFIX`, respectively, in the following command: |
| 120 | 120 | |
| 121 | | ``` |
| 121 | ```sh |
| 122 | 122 | "$ZIG_PREFIX/zig" build \ |
| 123 | 123 | -p stage3 \ |
| 124 | 124 | --search-prefix "$LLVM_PREFIX" \ |
| ... | ... | @@ -369,7 +369,7 @@ directory instead of a global installation. |
| 369 | 369 | |
| 370 | 370 | This is the generally recommended approach. |
| 371 | 371 | |
| 372 | | ``` |
| 372 | ```sh |
| 373 | 373 | cd ~/Downloads |
| 374 | 374 | git clone --depth 1 --branch release/21.x https://github.com/llvm/llvm-project llvm-project-21 |
| 375 | 375 | cd llvm-project-21 |
| ... | ... | @@ -396,7 +396,7 @@ This is occasionally needed when debugging Zig's LLVM backend. Here we build |
| 396 | 396 | the three projects separately so that LLVM can be in Debug mode while the |
| 397 | 397 | others are in Release mode. |
| 398 | 398 | |
| 399 | | ``` |
| 399 | ```sh |
| 400 | 400 | cd ~/Downloads |
| 401 | 401 | git clone --depth 1 --branch release/21.x https://github.com/llvm/llvm-project llvm-project-21 |
| 402 | 402 | cd llvm-project-21 |
| ... | ... | @@ -552,7 +552,7 @@ To reduce time spent waiting for the compiler to build, try these techniques: |
| 552 | 552 | |
| 553 | 553 | ### Testing |
| 554 | 554 | |
| 555 | | ``` |
| 555 | ```sh |
| 556 | 556 | stage4/bin/zig build test |
| 557 | 557 | ``` |
| 558 | 558 | |
| ... | ... | @@ -572,7 +572,7 @@ Another example is choosing a different set of things to test. For example, |
| 572 | 572 | not the other ones. Combining this suggestion with the previous one, you could |
| 573 | 573 | do this: |
| 574 | 574 | |
| 575 | | ``` |
| 575 | ```sh |
| 576 | 576 | stage4/bin/zig build test-std -Dskip-release |
| 577 | 577 | ``` |
| 578 | 578 | |
| ... | ... | @@ -588,13 +588,13 @@ this information and more in the `zig build --help` menu. |
| 588 | 588 | This command will run the standard library tests with only the native target |
| 589 | 589 | configuration and is estimated to complete in 3 minutes: |
| 590 | 590 | |
| 591 | | ``` |
| 591 | ```sh |
| 592 | 592 | zig build test-std -Dno-matrix |
| 593 | 593 | ``` |
| 594 | 594 | |
| 595 | 595 | However, one may also use `zig test` directly. From inside the `ziglang/zig` repo root: |
| 596 | 596 | |
| 597 | | ``` |
| 597 | ```sh |
| 598 | 598 | zig test lib/std/std.zig --zig-lib-dir lib |
| 599 | 599 | ``` |
| 600 | 600 | |
| ... | ... | @@ -605,14 +605,14 @@ you're trying to test in practice.) |
| 605 | 605 | |
| 606 | 606 | Note that `--test-filter` filters on fully qualified names, so e.g. it's possible to run only the `std.json` tests with: |
| 607 | 607 | |
| 608 | | ``` |
| 608 | ```sh |
| 609 | 609 | zig test lib/std/std.zig --zig-lib-dir lib --test-filter "json." |
| 610 | 610 | ``` |
| 611 | 611 | |
| 612 | 612 | If you used `-Dno-lib` and you are in a `build/` subdirectory, you can omit the |
| 613 | 613 | `--zig-lib-dir` argument: |
| 614 | 614 | |
| 615 | | ``` |
| 615 | ```sh |
| 616 | 616 | stage3/bin/zig test ../lib/std/std.zig |
| 617 | 617 | ``` |
| 618 | 618 | |
| ... | ... | @@ -771,7 +771,7 @@ To build the LLDB fork, make sure you have |
| 771 | 771 | [prerequisites](https://lldb.llvm.org/resources/build.html#preliminaries) |
| 772 | 772 | installed, and then do something like: |
| 773 | 773 | |
| 774 | | ``` |
| 774 | ```sh |
| 775 | 775 | $ cmake llvm -G Ninja -B build -DLLVM_ENABLE_PROJECTS="clang;lldb" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_ASSERTIONS=ON -DLLDB_ENABLE_LIBEDIT=ON -DLLDB_ENABLE_PYTHON=ON |
| 776 | 776 | $ cmake --build build --target lldb --target lldb-server |
| 777 | 777 | ``` |