From 13f8eba9b63fe5185ba34c2690dffac651d91593 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 1 Aug 2023 14:23:57 -0400 Subject: treewide: internally avoid deprecated machine file uses of "pkgconfig" We support this in a machine file: ``` [binaries] pkgconfig = 'pkg-config' pkg-config = 'pkg-config' ``` and you can use either one, because internally we look up both. If you only set *one* of them, this plays awkwardly with setting $PKG_CONFIG, since we don't know which one you set in the machine file and the *other* one will be initialized from the environment instead. In commit 22df45a31981874310a78dde0df59a6a7c5ebb29 we changed program lookup of config-tool style dependencies to use the regular tool names and only fall back on the strange internal names. This affected the pkg-config class too. The result is that instead of preferring `pkgconfig =` followed by $PKG_CONFIG followed by `pkg-config =`, we inverted the lookup order. This is a good idea anyway, because now it behaves consistently with `find_program('pkg-config')`. Unfortunately, we documented the wrong name in a bunch of places, and also used the wrong name in various testsuite bits, which meant that if you set $PKG_CONFIG and then ran the testsuite, it would fail. Correct these references, because they are buggy. One test case expected to find_program() a native copy for convenience of testing against natively installed glib. Force it to resolve a native copy. --- cross/armclang-linux.txt | 2 +- cross/linux-mingw-w64-32bit.txt | 2 +- cross/linux-mingw-w64-64bit.txt | 2 +- cross/none.txt | 2 +- cross/ubuntu-armhf.txt | 2 +- docs/markdown/Machine-files.md | 6 +++--- mesonbuild/scripts/env2mfile.py | 2 +- test cases/common/44 pkgconfig-gen/meson.build | 2 +- .../33 cross file overrides always args/ubuntu-armhf-overrides.txt | 2 +- test cases/unit/36 exe_wrapper behaviour/broken-cross.txt | 2 +- unittests/allplatformstests.py | 4 ++-- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cross/armclang-linux.txt b/cross/armclang-linux.txt index 863b355c3..36927b882 100644 --- a/cross/armclang-linux.txt +++ b/cross/armclang-linux.txt @@ -22,7 +22,7 @@ c = ['/opt/arm/developmentstudio-2019.0/sw/ARMCompiler6.12/bin/armclang', '--tar #cpp = '/usr/bin/arm-linux-gnueabihf-g++' ar = '/opt/arm/developmentstudio-2019.0/sw/ARMCompiler6.12/bin/armar' #strip = '/usr/arm-linux-gnueabihf/bin/strip' -#pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config' +#pkg-config = '/usr/bin/arm-linux-gnueabihf-pkg-config' [host_machine] system = 'baremetal' diff --git a/cross/linux-mingw-w64-32bit.txt b/cross/linux-mingw-w64-32bit.txt index caf1da1a0..91ad9c502 100644 --- a/cross/linux-mingw-w64-32bit.txt +++ b/cross/linux-mingw-w64-32bit.txt @@ -4,7 +4,7 @@ cpp = '/usr/bin/i686-w64-mingw32-g++' objc = '/usr/bin/i686-w64-mingw32-gcc' ar = '/usr/bin/i686-w64-mingw32-ar' strip = '/usr/bin/i686-w64-mingw32-strip' -pkgconfig = '/usr/bin/i686-w64-mingw32-pkg-config' +pkg-config = '/usr/bin/i686-w64-mingw32-pkg-config' windres = '/usr/bin/i686-w64-mingw32-windres' exe_wrapper = 'wine' ld = '/usr/bin/i686-w64-mingw32-ld' diff --git a/cross/linux-mingw-w64-64bit.txt b/cross/linux-mingw-w64-64bit.txt index 7403803b4..08fa70410 100644 --- a/cross/linux-mingw-w64-64bit.txt +++ b/cross/linux-mingw-w64-64bit.txt @@ -4,7 +4,7 @@ cpp = '/usr/bin/x86_64-w64-mingw32-g++' objc = '/usr/bin/x86_64-w64-mingw32-gcc' ar = '/usr/bin/x86_64-w64-mingw32-ar' strip = '/usr/bin/x86_64-w64-mingw32-strip' -pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' +pkg-config = '/usr/bin/x86_64-w64-mingw32-pkg-config' windres = '/usr/bin/x86_64-w64-mingw32-windres' exe_wrapper = 'wine' cmake = '/usr/bin/cmake' diff --git a/cross/none.txt b/cross/none.txt index 1fbe4713a..9eadf974c 100644 --- a/cross/none.txt +++ b/cross/none.txt @@ -15,5 +15,5 @@ fc = ['false'] objc = ['false'] objcpp = ['false'] ar = ['false'] -pkgconfig = ['false'] +pkg-config = ['false'] cmake = ['false'] diff --git a/cross/ubuntu-armhf.txt b/cross/ubuntu-armhf.txt index 408c2ceae..6409e396b 100644 --- a/cross/ubuntu-armhf.txt +++ b/cross/ubuntu-armhf.txt @@ -6,7 +6,7 @@ cpp = ['/usr/bin/arm-linux-gnueabihf-g++'] rust = ['rustc', '--target', 'arm-unknown-linux-gnueabihf', '-C', 'linker=/usr/bin/arm-linux-gnueabihf-gcc-7'] ar = '/usr/arm-linux-gnueabihf/bin/ar' strip = '/usr/arm-linux-gnueabihf/bin/strip' -pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config' +pkg-config = '/usr/bin/arm-linux-gnueabihf-pkg-config' ld = '/usr/bin/arm-linux/gnueabihf-ld' [built-in options] diff --git a/docs/markdown/Machine-files.md b/docs/markdown/Machine-files.md index 9e4b0c2a5..c30076919 100644 --- a/docs/markdown/Machine-files.md +++ b/docs/markdown/Machine-files.md @@ -90,7 +90,7 @@ arch = 'aarch64-linux-gnu' c = arch + '-gcc' cpp = arch + '-g++' strip = arch + '-strip' -pkgconfig = arch + '-pkg-config' +pkg-config = arch + '-pkg-config' ... ``` @@ -165,7 +165,7 @@ c_ld = 'gold' cpp_ld = 'gold' ar = '/usr/i586-mingw32msvc/bin/ar' strip = '/usr/i586-mingw32msvc/bin/strip' -pkgconfig = '/usr/bin/i586-mingw32msvc-pkg-config' +pkg-config = '/usr/bin/i586-mingw32msvc-pkg-config' ``` An incomplete list of internally used programs that can be overridden @@ -179,7 +179,7 @@ here is: - libwmf-config - llvm-config - pcap-config -- pkgconfig +- pkg-config - sdl2-config - wx-config (or wx-3.0-config or wx-config-gtk) diff --git a/mesonbuild/scripts/env2mfile.py b/mesonbuild/scripts/env2mfile.py index 27a7dd969..df9373042 100755 --- a/mesonbuild/scripts/env2mfile.py +++ b/mesonbuild/scripts/env2mfile.py @@ -213,7 +213,7 @@ def detect_cross_debianlike(options: T.Any) -> MachineInfo: except ValueError: pass try: - infos.binaries['pkgconfig'] = locate_path("%s-pkg-config" % host_arch) + infos.binaries['pkg-config'] = locate_path("%s-pkg-config" % host_arch) except ValueError: pass # pkg-config is optional try: diff --git a/test cases/common/44 pkgconfig-gen/meson.build b/test cases/common/44 pkgconfig-gen/meson.build index adf3e2765..fd6371ef4 100644 --- a/test cases/common/44 pkgconfig-gen/meson.build +++ b/test cases/common/44 pkgconfig-gen/meson.build @@ -8,7 +8,7 @@ if not cc.find_library('z', required: false).found() endif # First check we have pkg-config >= 0.29 -pkgconfig = find_program('pkg-config', required: false) +pkgconfig = find_program('pkg-config', native: true, required: false) if not pkgconfig.found() error('MESON_SKIP_TEST: pkg-config not found') endif diff --git a/test cases/unit/33 cross file overrides always args/ubuntu-armhf-overrides.txt b/test cases/unit/33 cross file overrides always args/ubuntu-armhf-overrides.txt index a00a7d136..d687b2981 100644 --- a/test cases/unit/33 cross file overrides always args/ubuntu-armhf-overrides.txt +++ b/test cases/unit/33 cross file overrides always args/ubuntu-armhf-overrides.txt @@ -6,7 +6,7 @@ cpp = '/usr/bin/arm-linux-gnueabihf-g++' rust = ['rustc', '--target', 'arm-unknown-linux-gnueabihf', '-C', 'linker=/usr/bin/arm-linux-gnueabihf-gcc-7'] ar = '/usr/arm-linux-gnueabihf/bin/ar' strip = '/usr/arm-linux-gnueabihf/bin/strip' -pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config' +pkg-config = '/usr/bin/arm-linux-gnueabihf-pkg-config' [properties] root = '/usr/arm-linux-gnueabihf' diff --git a/test cases/unit/36 exe_wrapper behaviour/broken-cross.txt b/test cases/unit/36 exe_wrapper behaviour/broken-cross.txt index a5a39318d..3615f92f7 100644 --- a/test cases/unit/36 exe_wrapper behaviour/broken-cross.txt +++ b/test cases/unit/36 exe_wrapper behaviour/broken-cross.txt @@ -3,7 +3,7 @@ c = '/usr/bin/x86_64-w64-mingw32-gcc' cpp = '/usr/bin/x86_64-w64-mingw32-g++' ar = '/usr/bin/x86_64-w64-mingw32-ar' strip = '/usr/bin/x86_64-w64-mingw32-strip' -pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' +pkg-config = '/usr/bin/x86_64-w64-mingw32-pkg-config' windres = '/usr/bin/x86_64-w64-mingw32-windres' exe_wrapper = 'broken' diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 12eafd595..4327d99fc 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -2722,7 +2722,7 @@ class AllPlatformTests(BasePlatformTests): with tempfile.NamedTemporaryFile(mode='w', delete=False, encoding='utf-8') as crossfile: crossfile.write(textwrap.dedent( '''[binaries] - pkgconfig = '{}' + pkg-config = '{}' [properties] @@ -2749,7 +2749,7 @@ class AllPlatformTests(BasePlatformTests): with tempfile.NamedTemporaryFile(mode='w', delete=False, encoding='utf-8') as crossfile: crossfile.write(textwrap.dedent( '''[binaries] - pkgconfig = 'pkg-config' + pkg-config = 'pkg-config' [properties] pkg_config_libdir = ['{}'] -- cgit v1.2.3