Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo: Run build.rs to get extra --cfg args #13779

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

xclaesse
Copy link
Member

Based on top of #12952.

Introduce a global Cargo interpreter state that keeps track of enabled
features on each crate.

Before generating AST of a Cargo subproject, it downloads every
sub-subproject and resolves the set of features enabled on each of them
recursively. When it later generates AST for one its dependencies, its
set of features and dependencies is already determined.
The library name defaults to its package name, but it can be different.
For example:
- package name: cairo-sys-rs
- library name: cairo-sys
- dependency name: ffi
In the case the main project has a .wrap file for a cargo subproject,
that subproject's Cargo.lock must be loaded before we can recursively
fetch all its dependencies.
This returns --target value from rustc command line, or the native
target.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I've said before, we should not be doing this. At all. We cannot reliably run build.rs, the garden path of cases that actually (and really slowly) manage to successfully run also do not need to be a build.rs so using meson/meson.build will be a superior experience, etc.

The system-deps patch does look quite nice though :) and it's very good that we can do it without build.rs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, what you actually want is rust-lang/cargo#7178 and to have people opt into that via run_command(), which we already document as an escape hatch to do whatever you want as long as meson doesn't take responsibility for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants