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

PKG_CONFIG_PATH_FOR_BUILD env var #139

Open
Ericson2314 opened this issue Oct 26, 2022 · 4 comments · May be fixed by #140
Open

PKG_CONFIG_PATH_FOR_BUILD env var #139

Ericson2314 opened this issue Oct 26, 2022 · 4 comments · May be fixed by #140

Comments

@Ericson2314
Copy link

Ericson2314 commented Oct 26, 2022

Currently, this library picks up

<build-kind>_<var> - for example, HOST_PKG_CONFIG_PATH or TARGET_PKG_CONFIG_PATH

This is fine, but this is quite non-standard. A standard way of doing things is instead using a _FOR_BUILD suffix:

  • TARGET_PKG_CONFIG_PATH = PKG_CONFIG_PATH
  • PKG_CONFIG_PATH = PKG_CONFIG_PATH_FOR_BUILD

This is what we do in Nipxkgs, and also what Meson does (see https://mesonbuild.com/Reference-tables.html#environment-variables-per-machine). This convention goes back to autotools.

CC @dcbaker @alyssais @lovesegfault

@alyssais
Copy link

I didn't open an issue here for a reason. :)

pkg-config-rs can't use PKG_CONFIG_FOR_BUILD, because Cargo doesn't expose to build.rs files whether they're being built for (in LLVM terminology) the host or the target. All the build.rs file knows is which architecture it's being built for. There's no way for it to know whether it should be looking at PKG_CONFIG or PKG_CONFIG_FOR_BUILD.

What would be feasible for this crate to implement is calling prefixed pkg-config executables (#53), but it's not easy due to the need to map from Rust triples to GNU triples.

@Ericson2314
Copy link
Author

Ericson2314 commented Oct 29, 2022

I do see the HOST and TARGET logic in here is pretty sketchy, but actually it might work out.

@Ericson2314 Ericson2314 changed the title PKG_CONFIG_FOR_BUILD env var PKG_CONFIG_PATH_FOR_BUILD env var Oct 29, 2022
Ericson2314 added a commit to Ericson2314/pkg-config-rs that referenced this issue Oct 29, 2022
@Ericson2314 Ericson2314 linked a pull request Oct 29, 2022 that will close this issue
@Ericson2314
Copy link
Author

See https://github.com/rust-lang/pkg-config-rs/pull/140/files I don't love it, but I think it's not unreasonable to get Cargo to pass something like our "offset" so it is improved in the future.

@sdroege
Copy link
Collaborator

sdroege commented Nov 20, 2022

@alyssais What do you think about the PR? This all seems rather hackish but then it's not very different from what was there before so...

Without changes at the cargo level there won't be any better solution, so maybe instead you'd like to take it over there?

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 a pull request may close this issue.

3 participants