theseus-os/Theseus

Replace Make with Cargo

amab8901 opened this issue · 1 comments

I think that switching over to Cargo will significantly reduce the barrier to entry for Rust developers to start contributing to Theseus. Many Rust developers aren't familiar with Make, and learning how Make works will probably require tons of work that could have been used for solving Rust issues, and the knowledge of Make isn't transferable to most other Rust projects.

Notes from Discord conversation:

  • "it would be cool to have a config file and probably a .cargo/config.toml runner (which is just a rust executable) which does the parts of the build for us which can't be supported by cargo."
  1. read all this https://os.phil-opp.com/
  2. read all this https://www.theseus-os.com/Theseus/book/index.html
  3. take a closer look at this https://www.theseus-os.com/Theseus/book/building/building.html

I'll echo my previous comments on this topic here:

While I agree that make is kinda crappy, it's well known and has been around for a while, so it introduces the least friction for newcomers to the project.
Fundamentally, we cannot use cargo alone because cargo is not meant to be a "do-it-all" build tool. I have spoken to both Ed Page (cargo lead) and Josh Triplett (Rust lang team lead) about this a few times over the years, and they basically gave me the same answer -- cargo can't do everything we need it to.
For example, it does not support pre-build and post-build actions, which we obviously need to generate basic OS images and perform other transformative actions.

Currently, we have moved all possible build steps into cargo in order to keep the makefile as simple as possible, but we will always need some kind of build tool that wraps around cargo.

Other alternatives would be things like ninja, bazel, just, etc, but those aren't necessarily any easier to integrate than make, and would still require our contributors to learn how they work.

Overall, make is very well-tested, has lots of platform-specific support, is well understood by many users, is easy to extend, and most importantly can be easily configured on the command line.