I'm packaging up some C libraries to build with Cargo, and one of the built libraries depends on some additional files when running. I.e. Runtime dependency, not a build-time dependency.
So I can copy the files from the src dir of my crate into the $OUT_DIR in my build.rs file, but I don't know the right way to tell the code that uses the files how to find them.
I've been thinking of Cargo as just a build system, but install is intimately coupled to build, and the whole "install" aspect of cargo seems to be missing.
For instance, how does a cargo package package include unix man files so they ultimately end up in the right place on the system where the man cmd can find them?
I'm not sure I'm thinking about Cargo quite the right way, and it feel like there is a whole other tool / system that I'm neglecting.
All that Cargo does is creating the binary. cargo install is a convenience method of installing single-binary programs, but it can't be expected to replace the full-featured installation method, be it Windows MSI files, *.deb packages, or whatever else. Note that your example is inherently system-dependent - man files might be placed differently in different distributions (and on Windows they don't exist at all), and why should Cargo even know where to put them on install?
However, if you know the system you'll be working on, it's entirely possible to make a tool which uses Cargo as one of the build steps - cargo-deb being one obvious example.
Yeah, cargo isn’t a generic build system a-la gradle, make or CMake. The only thing you can build with cargo are Rust artifacts. For everything else, you need some other build system which would call into cargo and integrate its output with the rest of the build process.
There’s no standard for such extra build system. My preferred approach to this is to just write some “scripts” in Rust itself, with the help of the hack to integrate them into cargo’s command line: GitHub - matklad/cargo-xtask
If you are looking specifically into packaging the software for a specific OS, there are various per-OS tools like cargo-deb for that.