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

Expose env vars pkg-config depends on #45

Closed
wants to merge 1 commit into from

Conversation

kornelski
Copy link
Contributor

No description provided.

@alexcrichton
Copy link
Member

Thanks! I wonder, this may need to be opt-in for now? Consumer libraries may not currently be prepared for this if they're using pkg-config otherwise with a different fallback. I'd imagine for a 1.0 release we'd do this by default but for now with the same 0.1 release I'm thinking we may want to stick to being conservative?

@kornelski
Copy link
Contributor Author

kornelski commented Oct 3, 2017

How can a consumer be not prepared for this?

I assume it has no effect in older versions of Cargo, so won't cause back compat problems.

And I assume it only causes rebuild when Cargo sees the env var change, so it's a bug fix for builds that weren't rebuilt, and the worst thing that can happen is that Cargo will rebuild the project too often.

Note that it marks env vars as used only when they're actually used, so if false {pkg_config::probe();} won't have any effect.

@alexcrichton
Copy link
Member

Ah so the problem here is that if you use pkg-config to locate a library and then use cc the crate to compile some support code, that build script won't get rerun when the C code changes. By default the cc crate doesn't print out the rerun-if-used annotations, so this could technically be a breaking change for that specific situation or situations like that

@kornelski
Copy link
Contributor Author

kornelski commented Oct 4, 2017

Oh, so the rerun-if-env-changed annotation replaces all default file-based checks, instead of just adding one more check?

@alexcrichton
Copy link
Member

Right yeah, Cargo's got a default "when do I rerun the build script" heuristic which is quite conservative by default, and printing anything as a dependency will replace this heuristic

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.

None yet

2 participants