rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Cargo: providing artifacts (for artifact dependencies) via build.rs

Open joshtriplett opened this issue 5 years ago • 7 comments

This RFC grew out of a discussion on the artifact dependencies RFC. As an extension of that RFC, some crates will want to supply artifacts via build.rs, such as by building them from sources or passing through an artifact dependency from a different crate. Some crates may also want to make decisions about how to supply a binary based on feature flags or detection.

This RFC introduces a mechanism to do so, via targets with manual = true. For such targets, Cargo expects build.rs to supply the target, by placing it in a directory specified by Cargo.

cc @jyn514 @alexcrichton

Rendered

joshtriplett avatar Dec 14 '20 05:12 joshtriplett

CARGO_ARTIFACT_DIR would be very useful for more things than just binaries (I've asked for it in https://github.com/rust-lang/cargo/issues/5457). Crates currently can't build things like man pages or resource files to be bundled later. Having a known location for all build products would be great.

kornelski avatar Dec 20 '20 23:12 kornelski

If a script is building dynamic library, what should it set as the rpath for the library? Can Cargo help with this?

Currently this is undefined/ignored in Cargo and makes dylibs painful to use when dylibs use a relative rpath, because Cargo isn't aware of it, so things like test/bench executables that are in a different directory than build products look for dylibs in a wrong place.

kornelski avatar Dec 20 '20 23:12 kornelski

@kornelski I would love to have a mechanism like this for other kinds of artifacts, including manpages or completions. However, I'd prefer to keep that separate from this RFC. After this RFC goes through, I'd be happy to collaborate on an extension to other kinds of artifacts.

I also think it might make sense for Cargo to export information about other profile options. That seems like it'd be a good item for an RFC as well.

joshtriplett avatar Dec 22 '20 06:12 joshtriplett

(Current status of this: waiting for a completed implementation of baseline artifact dependencies before moving forwards.)

joshtriplett avatar Oct 18 '22 18:10 joshtriplett

@rfcbot postpone

I propose we postpone this until we have rust-lang/cargo#9096 stabilized so we have a better view of where things are at.

epage avatar May 21 '24 16:05 epage

Team member @epage has proposed to postpone this. The next step is review by the rest of the tagged team members:

  • [x] @Eh2406
  • [x] @Muscraft
  • [x] @arlosi
  • [x] @ehuss
  • [x] @epage
  • [ ] @joshtriplett
  • [x] @weihanglo

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

rfcbot avatar May 21 '24 16:05 rfcbot

@epage I don't think that's the right issue. Did you mean https://github.com/rust-lang/cargo/issues/9096 ?

joshtriplett avatar May 21 '24 16:05 joshtriplett

:bell: This is now entering its final comment period, as per the review above. :bell:

rfcbot avatar Oct 01 '24 14:10 rfcbot

The final comment period, with a disposition to postpone, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This is now postponed.

rfcbot avatar Oct 11 '24 14:10 rfcbot