Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does `build.rs` build the project? One of my favorite (Big Corp) code-bases just had a single C file (build.c) that did all the dependency tracking, like, Make, but in some nicely written (easy to understand) C code. The C file started with a shebang: a self-building-and-executing line, so we'd do this:

``` ./build.c ```

... and then magic happened.



No. Cargo does. The `build.rs` is basically a Cargo hook that gets compiled as a Rust program and executed just before the ripgrep binary is compiled. It lets you do things like set linker flags[1] so that you can embed an XML manifest into the binary on Windows to enable "long path support."

ripgrep's build.rs used to do more, like build shell completions and the man page. But that's now part of ripgrep proper. e.g., `rg --generate man` writes roff to stdout.

[1]: https://github.com/BurntSushi/ripgrep/blob/2a4dba3fbfef944c5...

[2]: https://github.com/BurntSushi/ripgrep/blob/2a4dba3fbfef944c5...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: