Open Kixunil opened 5 years ago
Placement of generated files is an unsolved problem for Cargo: https://github.com/rust-lang/cargo/issues/5457
I don't want to invent a method for finding these files without coordination with the rest of the ecosystem, so I've made a post seeking feedback about this:
https://users.rust-lang.org/t/pre-rfc-generating-assets-products-during-cargo-build/32824
That's very reasonable, thanks for writing that post! I replied there about more general stuff. I have an idea that we could already play with some solution for now and clearly document it as an unstable experiment. (Putting it behind a feature flag sounds like a good idea.) That way it'd be easier to figure out what works. Similarly to how famous try!()
macro got converted to ?
operator.
I'm willing to make a PR, but I'd like to know which approach seems like the best for now, so that I start straight away with that. I'm leaning to env var approach, but you seem to prefer cargo directive. If you can point me at a good documentation on reading cargo directives from cargo tools and a reason for chosing that approach, I can do it.
I know about at least two projects that might want to use this, so we already have some real-life code to test it on.
From the user forum discussion this approach seems most promising:
https://matklad.github.io/2018/01/03/make-your-own-make.html
given that it can be made to work with plain Cargo without 3rd party tools.
So I think we could establish some convention:
If there's tools/Cargo.toml
try running cargo run -p tools --bin postbuild
Expect output in target/assets/<crate-name>/
(workspaces share target dir between crates)
I could put that in a lightweight crate to ensure handling is consistent between tools.
Your crate looks great, I look forward into trying it out! I'm going to package some services and I was thinking about integrating my crate
configure_me
with your crate.First, I'd like to integrate man pages - they are already automatically generated from the configuration specification file.
Second, I was thinking about adding debconf support to
configure_me
, so it can automatically generate templates and postinst script (possibly another binary, though)Thirdly I'd love to support bash completions at some point - another thing worth integrating.
I'm not sure how to do all this, but I was thinking that
cargo-deb
could set some environment variables e.g.MAN_OUTDIR
,DEBCONF_TEMPLATE_OUT
(needs append I think), andBASH_COMPLETION_OUTDIR
for bash completions.What do you think?