meson: Don't pass 'method' to dependency()
cover meson: Don't pass 'method' to dependency()
See [1] for recent discussion about libgcrypt specifically, which the first patch is about.
After writing that one, I realized that there is no point in explicitly passing 'method' to dependency() because Meson will do the right thing by default - hence the next two patches.
[1] https://lists.gnu.org/archive/html/qemu-devel/2022-01/msg01224.html
Andrea Bolognani (3):
meson: Don't force use of libgcrypt-config
meson: Don't pass 'method' to dependency()
docs: Don't recommend passing 'method' to dependency()
docs/devel/build-system.rst | 1 - meson.build | 75 +++++++++++++++---------------------- tcg/meson.build | 2 +- 3 files changed, 31 insertions(+), 47 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 meson: Don't force use of libgcrypt-config
libgcrypt 1.9.0 (released in 2021-01) ships with a proper pkg-config file, which Meson's libgcrypt detection code can use if available.
Passing 'config-tool' as 'method' when calling dependency(), however, forces Meson to ignore the pkg-config file and always use libgcrypt-config instead.
--- meson.build | 1 - 1 file changed, 1 deletion(-)
meson.build +0 -1
@@ -1036,7 +1036,6 @@ endif if not gnutls_crypto.found() if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled() gcrypt = dependency('libgcrypt', version: '>=1.8', - method: 'config-tool', required: get_option('gcrypt'), kwargs: static_kwargs) # Debian has removed -lgpg-error from libgcrypt-config
Signature · 1 line
2.34.1
PATCH 2/3 meson: Don't pass 'method' to dependency()
In reply to Andrea BolognaniMeson will do the right thing by default.
--- meson.build | 74 ++++++++++++++++++++----------------------------- tcg/meson.build | 2 +- 2 files changed, 31 insertions(+), 45 deletions(-)
meson.build +30 -44
@@ -427,13 +427,13 @@ if 'CONFIG_GIO' in config_host endif lttng = not_found if 'ust' in get_option('trace_backends') - lttng = dependency('lttng-ust', required: true, method: 'pkg-config', + lttng = dependency('lttng-ust', required: true, kwargs: static_kwargs) endif pixman = not_found if have_system or have_tools pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8', - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif zlib = dependency('zlib', required: true, kwargs: static_kwargs)
@@ -446,18 +446,18 @@ endif linux_io_uring = not_found if not get_option('linux_io_uring').auto() or have_block linux_io_uring = dependency('liburing', required: get_option('linux_io_uring'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif libxml2 = not_found if not get_option('libxml2').auto() or have_block libxml2 = dependency('libxml-2.0', required: get_option('libxml2'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif libnfs = not_found if not get_option('libnfs').auto() or have_block libnfs = dependency('libnfs', version: '>=1.9.3', required: get_option('libnfs'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif libattr_test = '''
@@ -505,7 +505,7 @@ seccomp = not_found if not get_option('seccomp').auto() or have_system or have_tools seccomp = dependency('libseccomp', version: '>=2.3.0', required: get_option('seccomp'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif libcap_ng = not_found
@@ -533,7 +533,7 @@ if get_option('xkbcommon').auto() and not have_system and not have_tools xkbcommon = not_found else xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif vde = not_found
@@ -562,30 +562,30 @@ endif pulse = not_found if not get_option('pa').auto() or (targetos == 'linux' and have_system) pulse = dependency('libpulse', required: get_option('pa'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif alsa = not_found if not get_option('alsa').auto() or (targetos == 'linux' and have_system) alsa = dependency('alsa', required: get_option('alsa'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif jack = not_found if not get_option('jack').auto() or have_system jack = dependency('jack', required: get_option('jack'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif spice_protocol = not_found if not get_option('spice_protocol').auto() or have_system spice_protocol = dependency('spice-protocol', version: '>=0.12.3', required: get_option('spice_protocol'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif spice = not_found if not get_option('spice').auto() or have_system spice = dependency('spice-server', version: '>=0.12.5', required: get_option('spice'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif spice_headers = spice.partial_dependency(compile_args: true, includes: true)
@@ -595,32 +595,29 @@ libiscsi = not_found if not get_option('libiscsi').auto() or have_block libiscsi = dependency('libiscsi', version: '>=1.9.0', required: get_option('libiscsi'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif zstd = not_found if not get_option('zstd').auto() or have_block zstd = dependency('libzstd', version: '>=1.4.0', required: get_option('zstd'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif virgl = not_found if not get_option('virglrenderer').auto() or have_system virgl = dependency('virglrenderer', - method: 'pkg-config', required: get_option('virglrenderer'), kwargs: static_kwargs) endif curl = not_found if not get_option('curl').auto() or have_block curl = dependency('libcurl', version: '>=7.29.0', - method: 'pkg-config', required: get_option('curl'), kwargs: static_kwargs) endif libudev = not_found if targetos == 'linux' and (have_system or have_tools) libudev = dependency('libudev', - method: 'pkg-config', required: get_option('libudev'), kwargs: static_kwargs) endif
@@ -720,7 +717,6 @@ if have_system and not get_option('curses').disabled() if not curses.found() curses = dependency(curses_dep, required: false, - method: 'pkg-config', kwargs: static_kwargs) endif endforeach
@@ -821,7 +817,7 @@ if sdl.found() sdl = declare_dependency(compile_args: '-Wno-undef', dependencies: sdl) sdl_image = dependency('SDL2_image', required: get_option('sdl_image'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) else if get_option('sdl_image').enabled() error('sdl-image required, but SDL was @0@'.format(
@@ -864,7 +860,7 @@ glusterfs_iocb_has_stat = false if not get_option('glusterfs').auto() or have_block glusterfs = dependency('glusterfs-api', version: '>=3', required: get_option('glusterfs'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) if glusterfs.found() glusterfs_ftruncate_has_stat = cc.links(''' #include <glusterfs/api/glfs.h>
@@ -898,7 +894,6 @@ endif libssh = not_found if not get_option('libssh').auto() or have_block libssh = dependency('libssh', version: '>=0.8.7', - method: 'pkg-config', required: get_option('libssh'), kwargs: static_kwargs) endif
@@ -980,7 +975,7 @@ if 'CONFIG_OPENGL' in config_host endif gbm = not_found if (have_system or have_tools) and (virgl.found() or opengl.found()) - gbm = dependency('gbm', method: 'pkg-config', required: false, + gbm = dependency('gbm', required: false, kwargs: static_kwargs) endif
@@ -1001,7 +996,6 @@ if get_option('gnutls').enabled() or (get_option('gnutls').auto() and have_syste # still use a different crypto backend to satisfy # the platform support requirements gnutls_crypto = dependency('gnutls', version: '>=3.6.14', - method: 'pkg-config', required: false, kwargs: static_kwargs) if gnutls_crypto.found()
@@ -1009,7 +1003,6 @@ if get_option('gnutls').enabled() or (get_option('gnutls').auto() and have_syste else # Our min version if all we need is TLS gnutls = dependency('gnutls', version: '>=3.5.18', - method: 'pkg-config', required: get_option('gnutls'), kwargs: static_kwargs) endif
@@ -1049,7 +1042,6 @@ if not gnutls_crypto.found() endif if (not get_option('nettle').auto() or have_system) and not gcrypt.found() nettle = dependency('nettle', version: '>=3.4', - method: 'pkg-config', required: get_option('nettle'), kwargs: static_kwargs) if nettle.found() and not cc.has_header('nettle/xts.h', dependencies: nettle)
@@ -1063,19 +1055,16 @@ gtkx11 = not_found vte = not_found if not get_option('gtk').auto() or (have_system and not cocoa.found()) gtk = dependency('gtk+-3.0', version: '>=3.22.0', - method: 'pkg-config', required: get_option('gtk'), kwargs: static_kwargs) if gtk.found() gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0', - method: 'pkg-config', required: false, kwargs: static_kwargs) gtk = declare_dependency(dependencies: [gtk, gtkx11]) if not get_option('vte').auto() or have_system vte = dependency('vte-2.91', - method: 'pkg-config', required: get_option('vte'), kwargs: static_kwargs) endif
@@ -1084,7 +1073,7 @@ endif x11 = not_found if gtkx11.found() - x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found(), + x11 = dependency('x11', required: gtkx11.found(), kwargs: static_kwargs) endif vnc = not_found
@@ -1094,9 +1083,9 @@ sasl = not_found if have_system and not get_option('vnc').disabled() vnc = declare_dependency() # dummy dependency png = dependency('libpng', required: get_option('vnc_png'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) jpeg = dependency('libjpeg', required: get_option('vnc_jpeg'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'], required: get_option('vnc_sasl'), kwargs: static_kwargs)
@@ -1181,54 +1170,52 @@ endif cacard = not_found if not get_option('smartcard').auto() or have_system cacard = dependency('libcacard', required: get_option('smartcard'), - version: '>=2.5.1', method: 'pkg-config', + version: '>=2.5.1', kwargs: static_kwargs) endif u2f = not_found if have_system u2f = dependency('u2f-emu', required: get_option('u2f'), - method: 'pkg-config', kwargs: static_kwargs) endif usbredir = not_found if not get_option('usb_redir').auto() or have_system usbredir = dependency('libusbredirparser-0.5', required: get_option('usb_redir'), - version: '>=0.6', method: 'pkg-config', + version: '>=0.6', kwargs: static_kwargs) endif libusb = not_found if not get_option('libusb').auto() or have_system libusb = dependency('libusb-1.0', required: get_option('libusb'), - version: '>=1.0.13', method: 'pkg-config', + version: '>=1.0.13', kwargs: static_kwargs) endif libpmem = not_found if not get_option('libpmem').auto() or have_system libpmem = dependency('libpmem', required: get_option('libpmem'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) endif libdaxctl = not_found if not get_option('libdaxctl').auto() or have_system libdaxctl = dependency('libdaxctl', required: get_option('libdaxctl'), - version: '>=57', method: 'pkg-config', + version: '>=57', kwargs: static_kwargs) endif tasn1 = not_found if gnutls.found() tasn1 = dependency('libtasn1', - method: 'pkg-config', kwargs: static_kwargs) endif keyutils = dependency('libkeyutils', required: false, - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) has_gettid = cc.has_function('gettid') # libselinux selinux = dependency('libselinux', required: get_option('selinux'), - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) # Malloc tests
@@ -1286,7 +1273,7 @@ if get_option('fuse').disabled() and get_option('fuse_lseek').enabled() endif fuse = dependency('fuse3', required: get_option('fuse'), - version: '>=3.1', method: 'pkg-config', + version: '>=3.1', kwargs: static_kwargs) fuse_lseek = not_found
@@ -1304,7 +1291,7 @@ if not get_option('fuse_lseek').disabled() endif # libbpf -libbpf = dependency('libbpf', required: get_option('bpf'), method: 'pkg-config') +libbpf = dependency('libbpf', required: get_option('bpf')) if libbpf.found() and not cc.links(''' #include <bpf/libbpf.h> int main(void)
@@ -2053,7 +2040,7 @@ capstone_opt = get_option('capstone') if capstone_opt in ['enabled', 'auto', 'system'] have_internal = fs.exists(meson.current_source_dir() / 'capstone/Makefile') capstone = dependency('capstone', version: '>=4.0', - kwargs: static_kwargs, method: 'pkg-config', + kwargs: static_kwargs, required: capstone_opt == 'system' or capstone_opt == 'enabled' and not have_internal)
@@ -2177,7 +2164,6 @@ if have_system if slirp_opt in ['enabled', 'auto', 'system'] have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build') slirp = dependency('slirp', kwargs: static_kwargs, - method: 'pkg-config', required: slirp_opt == 'system' or slirp_opt == 'enabled' and not have_internal) if slirp.found()
tcg/meson.build +1 -1
@@ -12,7 +12,7 @@ tcg_ss.add(files( if get_option('tcg_interpreter') libffi = dependency('libffi', version: '>=3.0', required: true, - method: 'pkg-config', kwargs: static_kwargs) + kwargs: static_kwargs) specific_ss.add(libffi) specific_ss.add(files('tci.c')) endif
Signature · 1 line
2.34.1
PATCH 3/3 docs: Don't recommend passing 'method' to dependency()
In reply to Andrea BolognaniMeson will do the right thing by default.
--- docs/devel/build-system.rst | 1 - 1 file changed, 1 deletion(-)
docs/devel/build-system.rst +0 -1
@@ -316,7 +316,6 @@ dependency will be used:: sdl_image = not_found if not get_option('sdl_image').auto() or have_system sdl_image = dependency('SDL2_image', required: get_option('sdl_image'), - method: 'pkg-config', static: enable_static) endif
Signature · 1 line
2.34.1
Quoted 6 lines · Andrea Bolognani
See [1] for recent discussion about libgcrypt specifically, which the first patch is about.
After writing that one, I realized that there is no point in explicitly passing 'method' to
dependency()because Meson will do the right thing by default - hence the next two patches.
This whole series is effectively reverting
commit 1a94933fcc3d641bda9988244cde61769baae2e5
Author: Paolo Bonzini <[email protected]>
Date: Mon Aug 31 06:27:00 2020 -0400
meson: use pkg-config method to find dependencies
We do not need to ask cmake for the dependencies, so just use the pkg-config mechanism. Keep "auto" for SDL so that it tries using sdl-config too.
The documentation is adjusted to use SDL2_image as the example, rather than SDL which does not use the "pkg-config" method.
which IIRC was done to get rid of mesons' confusing/misleading attempts to probe for things via cmake when the pkg-config file is not present.
Quoted 8 lines
[1] https://lists.gnu.org/archive/html/qemu-devel/2022-01/msg01224.html
Andrea Bolognani (3):
meson: Don't force use of libgcrypt-config
meson: Don't pass 'method' todependency()
docs: Don't recommend passing 'method' todependency()
Quoted 9 lines
docs/devel/build-system.rst | 1 - meson.build | 75 +++++++++++++++---------------------- tcg/meson.build | 2 +- 3 files changed, 31 insertions(+), 47 deletions(-)Signature · 1 line
2.34.1
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 20 lines · Daniel P. Berrangé
Quoted 6 lines · Andrea Bolognani
See [1] for recent discussion about libgcrypt specifically, which the first patch is about.
After writing that one, I realized that there is no point in explicitly passing 'method' to
dependency()because Meson will do the right thing by default - hence the next two patches.This whole series is effectively reverting
commit
1a94933fcc3d641bda9988244cde61769baae2e5
Author: Paolo Bonzini <[email protected]>
Date: Mon Aug 31 06:27:00 2020 -0400meson: use pkg-config method to find dependencies
We do not need to ask cmake for the dependencies, so just use the pkg-config mechanism. Keep "auto" for SDL so that it tries using sdl-config too.
Quoted 8 lines
The documentation is adjusted to use
SDL2_imageas the example, rather than SDL which does not use the "pkg-config" method.Signed-off-by Paolo Bonzini <[email protected]>which IIRC was done to get rid of mesons' confusing/misleading attempts to probe for things via cmake when the pkg-config file is not present.
I guess I stand corrected on Meson doing the right thing by default then :)
The first patch should still makes sense though: libgcrypt is like SDL in that Meson implements special handling for it, and we should allow the pkg-config file to be used if available.
Signature · 1 line
Andrea Bolognani / Red Hat / Virtualization