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

zig build: respect PKG_CONFIG environment variable #19901

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

BratishkaErik
Copy link
Contributor

@BratishkaErik BratishkaErik commented May 8, 2024

PKG_CONFIG environment variable is used to override path to
pkg-config executable, for example when it's name is prepended by
target triple for cross-compilation purposes:

PKG_CONFIG=/usr/bin/aarch64-unknown-linux-gnu-pkgconf zig build

@nektro
Copy link
Contributor

nektro commented May 8, 2024

standard practice here is to check the PKG_CONFIG env var

@BratishkaErik
Copy link
Contributor Author

standard practice here is to check the PKG_CONFIG env var

I know, it was intentionally omitted. I think it will be easier to merge without it, since there are less lines added and less ehh controversial points (IIRC core team wants to avoid this kind of environment variables, f.e. #17585 and #10754 (comment)), don't want to convince them, just easy merge.

@BratishkaErik
Copy link
Contributor Author

Fixed merge conflict.

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

I don't see how those linked issues are relevant. If PKG_CONFIG environment variable is a standard practice then it's desirable to use as the default. The purpose of the pkg-config integration is to integrate with the system. Respecting a standard environment variable would make the system integration more complete.

@BratishkaErik
Copy link
Contributor Author

I don't see how those linked issues are relevant. If PKG_CONFIG environment variable is a standard practice then it's desirable to use as the default. The purpose of the pkg-config integration is to integrate with the system. Respecting a standard environment variable would make the system integration more complete.

It's even better, will do :)

`PKG_CONFIG` environment variable is used to override path to
pkg-config executable, for example when it's name is prepended by
target triple for cross-compilation purposes:

```
PKG_CONFIG=/usr/bin/aarch64-unknown-linux-gnu-pkgconf zig build
```

Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
@BratishkaErik BratishkaErik changed the title zig build: add --pkg-config option zig build: respect PKG_CONFIG environment variable May 12, 2024
@xnhp0320
Copy link
Sponsor Contributor

you can use below code in the build.zig to achieve the same effect.

b.graph.env_map.put("PKG_CONFIG_PATH", "XXXX") catch unreachable;

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

4 participants