What if you could build a Rust project without Cargo[^1]? Bygge can.
bygge [v]. (Danish, Norwegian Bokmål)
- to build, construct,
- to craft
(via [Wiktionary])
I wanted to understand all the work cargo does, without needing to dissect cargo itself.
I followed the output of cargo build --verbose
and turned that into simple build instructions.
Additionally I've been reading about build systems, such as Ninja and was intrigued to rebuild that. I haven't done that yet, but at least I'm using Ninja.
bygge create
generates a Ninja build configuration (in build.ninja
by default),
listing all the targets a binary crate depends on, including all crate dependencies.
ninja
can then take this configuration and assemble the final binary.
The result should be about the same as an invocation of cargo build
.
bygge
is and never will be an alternative to Cargo.
Cargo is a full-fledged build system, aware of different build targets, allowing to enable features per dependency, easily cross-compile to different targets and run the built programs as well as tests and generate documentation.
bygge
... builds.
build.rs
filesbygge
bygge
can create a Ninja build configuration to build itself.
But first you need a compiled bygge
.
Use the bundled pre-generated configuration for that:
ninja -f manual.ninja
Then create the default build configuration and build:
build/bygge create
build/bygge build
bygge is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.