A Meson-compatible build system written in Rust
README.md

Oxidized Meson #

Part of the overby.me monorepo, where this lives in safety/oxidized/meson and where all development happens.

It is also published on its own, as tangled.org/overby.me/oxidized-meson and github.com/overby-me/oxidized-meson. Both are read-only mirrors, rebuilt from the monorepo with josh: a commit made to either is overwritten by the next sync, so please open issues and pull requests on the monorepo.

A drop-in Meson build system replacement written in Rust, inspired by muon.

Version: 0.1.0 · License: MIT · Binary: meson

Architecture #

Unlike AST-walking interpreters, oxidized-meson uses a bytecode compiler and stack-based VM:

meson.build → Lexer → Parser → AST → Compiler → Bytecode → VM → Build Graph → Backend → build.ninja

Features #

  • Full CLI: setup, compile, test, install, introspect, init, dist, format
  • Bytecode VM: compiled execution rather than AST interpretation
  • Compiler detection: automatic discovery of C/C++ and other compilers
  • Dependency finding: pkg-config, CMake, config-tool, and system methods
  • Ninja backend: generates build.ninja files
  • Options system: built-in and project-specific options
  • Wrap/subproject support: dependency vendoring and subproject management
  • Cross-compilation: cross-file support
  • 18+ modules: fs, pkgconfig, python, gnome, cmake, rust, windows, i18n, qt, sourceset, keyval, wayland, cuda, hotdoc, java, dlang, simd, icestorm, external_project, modtest

Source Layout #

src/
├── main.rs            # Entry point
├── cli.rs             # CLI argument parsing
├── lexer.rs           # Tokenizer
├── parser.rs          # Parser
├── ast.rs             # AST types
├── compiler.rs        # Bytecode compiler
├── vm.rs              # Stack-based virtual machine
├── interpreter.rs     # High-level interpretation logic
├── backend.rs         # Ninja backend
├── objects.rs         # Meson object types
├── options.rs         # Build options handling
├── compilers.rs       # Compiler detection
├── dependencies.rs    # Dependency resolution
├── wrap.rs            # Wrap/subproject support
├── builtins/
│   ├── functions.rs   # Built-in functions
│   └── methods.rs     # Built-in methods
└── modules/           # 21 modules (fs, pkgconfig, python, gnome, cmake, ...)

Dependencies #

serde, serde_json, toml, glob, regex-lite, sha2

Building #

cargo build --release

Or with Nix:

nix build .#oxidized-meson

Tests #

284/284 upstream Meson test cases passing (test cases/common/), each exposed as an individual Nix check:

# Run a single test
nix build .#checks.x86_64-linux.oxidized-meson-test-1-trivial

# Run all tests
nix flake show --json | jq -r '.checks."x86_64-linux" | keys[] | select(startswith("oxidized-meson-test-"))' \
  | xargs -I{} nix build --keep-going --no-link '.#checks.x86_64-linux."{}"'