meson
meson copied to clipboard
pkgconfig: Set PKG_CONFIG in env for devenv and g-ir-scanner
The pkg-config binary could come from meson.override_find_program(), or machine file. In those case we need PKG_CONFIG env for external tools to find it.
This is needed for g-ir-scanner to find pkg-config there: https://gitlab.gnome.org/GNOME/gobject-introspection/-/blob/main/giscanner/pkgconfig.py#L30.
Codecov Report
Merging #11007 (8d69627) into master (ae6c8d4) will decrease coverage by
2.27%
. The diff coverage is91.66%
.
@@ Coverage Diff @@
## master #11007 +/- ##
==========================================
- Coverage 65.10% 62.83% -2.28%
==========================================
Files 207 412 +205
Lines 44893 87820 +42927
Branches 9275 18748 +9473
==========================================
+ Hits 29229 55182 +25953
- Misses 13369 28310 +14941
- Partials 2295 4328 +2033
Impacted Files | Coverage Δ | |
---|---|---|
mesonbuild/scripts/depfixer.py | 63.24% <25.00%> (ø) |
|
mesonbuild/dependencies/pkgconfig.py | 69.42% <96.96%> (ø) |
|
mesonbuild/compilers/asm.py | 52.34% <100.00%> (ø) |
|
mesonbuild/coredata.py | 82.83% <100.00%> (ø) |
|
mesonbuild/interpreter/primitives/string.py | 98.54% <100.00%> (ø) |
|
scripts/run_tool.py | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
scripts/test_loaded_modules.py | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
scripts/clangtidy.py | 0.00% <0.00%> (-93.34%) |
:arrow_down: |
scripts/uninstall.py | 0.00% <0.00%> (-71.88%) |
:arrow_down: |
mconf.py | 15.41% <0.00%> (-70.84%) |
:arrow_down: |
... and 305 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
I was trying a similar approach and hit the same issue. This doesn't work since find_external_program
does not finds correctly pkg-config, which is provided by a wrap like this:
meson.override_find_program('pkg-config', find_program('pkg-config.exe'))
In the logs I can see:
win-pkgconfig| Project name: win-pkgconfig
win-pkgconfig| Project version: 0.29.2
win-pkgconfig| Message: Downloading pkg-config.exe binary for Windows...
win-pkgconfig| Program pkg-config.exe found: YES (C:\gstreamer\subprojects\win-pkgconfig\pkg-config.exe)
win-pkgconfig| Build targets in project: 0
win-pkgconfig| Subproject win-pkgconfig finished.
[...]
gstreamer| Did not find pkg-config by name 'pkg-config'
gstreamer| Found Pkg-config: NO
PkgConfigDependency.search_pkgbin
should do the equivalent to find_program('pkg-config')
Since lots of things changed and I had a PR already that touch this code, I included a similar fix into https://github.com/mesonbuild/meson/pull/12126.
This doesn't work since
find_external_program
does not finds correctly pkg-configPkgConfigDependency.search_pkgbin
should do the equivalent tofind_program('pkg-config')
I'm writing a unit test for that, and you were right. I'll try to find a solution.
I'm writing a unit test for that, and you were right. I'll try to find a solution.
It's actually way too complicated to get it working through override_find_program(), the problem is PkgConfigDependency does not have access to the interpreter. I don't know how to fix that without doing ugly hacks or way too big refactoring.
Note that this PR was not useless either, it sets PKG_CONFIG to the value from cross file, which at least makes g-ir-scanner consistent in using the same pkg-config as Meson. That part is now done in https://github.com/mesonbuild/meson/pull/12126.