Open-Source Wikis

/

Zig

/

How to contribute

/

Tooling

ziglang/zig

Tooling

This page lists the build, lint, generation, and maintenance scripts shipped in the repository.

Build system

  • build.zig (~57 KB) — the top-level build(b: *std.Build) entry. Exposes options and constructs every test-* step.
  • build.zig.zon — the package manifest. Declares two local-path dependencies: test/standalone and test/link.
  • cmake/, CMakeLists.txt — CMake bootstrap for stage1 (used when no zig binary exists yet).
  • bootstrap.c, stage1/ — the bootstrap glue.

Format and lint

  • zig fmt — built into the compiler. Runs the parser/formatter from lib/std/zig/.
  • zig build test-fmt — CI gate that runs zig fmt --check over the tree.
  • zig ast-check — parse-only check, useful for validating individual files quickly.

Generators

tools/ hosts code generators that update auto-generated tables. Each is a Zig program; running it requires a working zig.

Tool Output
tools/update_cpu_features.zig (~76 KB) Refreshes the per-target CPU feature tables consumed by lib/std/Target.zig and src/codegen/llvm.zig.
tools/update_clang_options.zig Regenerates src/clang_options_data.zig from clang's option tables.
tools/update_glibc.zig, tools/update_mingw.zig, tools/update_freebsd_libc.zig, tools/update_netbsd_libc.zig, tools/update-linux-headers.zig, tools/process_headers.zig, tools/fetch_them_macos_headers.zig, tools/macos-headers.c, tools/gen_macos_headers_c.zig Rebuilds the bundled libc trees under lib/libc/....
tools/generate_linux_syscalls.zig Regenerates the syscall tables in lib/std/os/linux/.
tools/gen_outline_atomics.zig Builds AArch64 outline atomic helpers in lib/compiler_rt/.
tools/gen_spirv_spec.zig (~31 KB) Generates the SPIR-V spec used by src/codegen/spirv/.
tools/gen_stubs.zig Generates dynamic library stubs (used in cross-link targets).
tools/generate_c_size_and_align_checks.zig Builds the C size/align verification suite consumed by test/c_abi/.
tools/generate_JSONTestSuite.zig Generates JSON test inputs for lib/std/json/.
tools/update_crc_catalog.zig (and tools/crc/) Refreshes CRC parameter tables for lib/std/hash/.

Maintenance and harnesses

  • tools/incr-check.zig (~38 KB) — incremental compilation harness. Runs an edit script against a fixture and compares against a clean rebuild.
  • tools/dump-cov.zig — coverage dump utility.
  • tools/migrate_langref.zig — one-off migration script for the language reference markup.

Documentation

  • tools/docgen.zig (~39 KB) — builds doc/langref.html from doc/langref.html.in plus doc/langref/*.zig snippets.
  • tools/doctest.zig (~66 KB) — compiles and runs each documentation snippet, checking the output matches what the docs claim.
  • lib/compiler/std-docs.zig — implements zig std, the local autodoc browser.

Pretty-printers

  • tools/lldb_pretty_printers.py (~58 KB)
  • tools/stage1_gdb_pretty_printers.py, tools/stage2_gdb_pretty_printers.py
  • tools/zig_gdb_pretty_printers.py, tools/std_gdb_pretty_printers.py

Source these from .lldbinit / .gdbinit to get readable summaries when stepping through the compiler.

CI plumbing

  • .forgejo/workflows/ci.yaml — defines the runner matrix and per-target jobs.
  • ci/<target>-<mode>.sh (POSIX) and ci/<target>-<mode>.ps1 (Windows) — exact build/test commands per target.
  • .forgejo/ISSUE_TEMPLATE/ — issue templates.

Editor integration

zig's standard library autodoc (zig std) and lib/docs/ provide the searchable HTML docs every editor LSP can hyperlink into. zig fmt is the canonical formatter and most editor plugins call it directly.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Tooling – Zig wiki | Factory