A less-sucky, modern and quick Ninja compatible build system in Rust. It is designed to be a smaller, modern, and memory safe replacement for the Meson build system.
- Fully memory safe
- Actually human readable error messages
- Simple glob based source discovery
- Smaller codebase than alternatives
- Single configuration file
You will need Rust and Cargo installed to compile Bearbuild from source.
git clone https://github.com/xorlaw/bearbuild
cd bearbuild
cargo build --releaseThe release build profile will create a leaner and more optimized binary. However, the release binary takes noticeably longer to
compile than some other options. If you are on a lower end machine, you can compile using the debug profile which is slower but easier
to compile. You can compile with the debug profile by simply adding the debug flag when building with Cargo.
The binary will be at target/release/bearbuild. Copy it somewhere on your PATH:
cp target/release/bearbuild ~/.local/bin/project/
bear.toml
src/
main.c
util.c
include/
util.h
[project]
name = "myproject"
version = "0.1.0"
[build]
compiler = "gcc"
std = "c11"
sources = ["src/*.c"]
includes = ["include"]
flags = ["-Wall", "-Wextra"]
[output]
binary = "myproject"bearbuild # generates build.ninja
ninja # compiles your project
./project # run it| Key | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Name of the project |
version |
string | yes | Version string (e.g. "1.0.0") |
| Key | Type | Required | Description |
|---|---|---|---|
compiler |
string | yes | Compiler binary to use (e.g. "gcc", "clang") |
std |
string | yes | C standard to pass to -std= (e.g. "c11", "c99") |
sources |
list | yes | Source file globs or paths (e.g. ["src/*.c"]) |
includes |
list | no | Include directories, passed as -I flags |
flags |
list | no | Extra compiler flags (e.g. ["-Wall", "-O2"]) |
| Key | Type | Description |
|---|---|---|
pkgs |
list | Package names as passed to pkg-config |
Example:
[deps]
pkgs = ["libpng", "zlib"]| Key | Type | Required | Description |
|---|---|---|---|
binary |
string | yes | Name of the output binary |
Licensed under The Unlicense.