From 9d9e5bd6c157d57747614beb350f580d51c6ce89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 2 Apr 2024 16:52:06 +0200 Subject: [PATCH 1/7] meson: bump minimum version to 0.51 We were already using some features from 0.49: WARNING: Project specifies a minimum meson_version '>= 0.47.2' but uses features which were added in newer versions: * 0.48.0: {'meson.add_dist_script'} * 0.49.0: {'Calling "add_dist_script" with multiple arguments'} Debian 10 uses meson 0.49.2, but it will get out of support in 2 months so we can start considering it as a too old version. Next oldest meson version used by the distros that we follow is Ubuntu 20.04 with meson 0.53.2. Raise to 0.51 as it is supported by all the distros that we test (except Debian 10) and it contains all the features that we need for the next commits. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b39b4cf453..df56249a79 100644 --- a/meson.build +++ b/meson.build @@ -13,7 +13,7 @@ project( 'c_std=gnu11', 'warning_level=2' # value "2" will add "-Wall" and "-Wextra" to the compiler flags ], - meson_version: '>= 0.47.2', + meson_version: '>= 0.51.0', ) nm_name = meson.project_name() From 9158f4165f748bbf2f346dee0941f28d26392bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 2 Apr 2024 16:59:13 +0200 Subject: [PATCH 2/7] meson: replace deprecated module 'python3' Replaced by 'python' module: https://mesonbuild.com/Python-3-module.html. This get rids of the following deprecation warning: NOTICE: Future-deprecated features used: * 0.48.0: {'module python3'} --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index df56249a79..886f4609e8 100644 --- a/meson.build +++ b/meson.build @@ -875,8 +875,8 @@ test_args = [ '--launch-dbus=auto', ] -py3 = import('python3') -python = py3.find_python() +python_mod = import('python') +python = python_mod.find_installation('python3', required: false) if python.found() config_h.set_quoted('TEST_NM_PYTHON', python.path()) From 07f463bc94e043f5c07d2835a9781223d85fc316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 2 Apr 2024 17:05:39 +0200 Subject: [PATCH 3/7] meson: replace deprecated dep.get_pkgconfig_variable Replaced by dep.get_variable: https://mesonbuild.com/Reference-manual_returned_dep.html#depget_variable This get rid of the following deprecation warning: NOTICE: Future-deprecated features used: * 0.56.0: {'dependency.get_pkgconfig_variable'} --- examples/C/qt/meson.build | 2 +- meson.build | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/C/qt/meson.build b/examples/C/qt/meson.build index 8b905bd61d..18f136e86a 100644 --- a/examples/C/qt/meson.build +++ b/examples/C/qt/meson.build @@ -8,7 +8,7 @@ examples = [ moc = find_program('moc-qt4', required: false) if not moc.found() - moc = qt_core_dep.get_pkgconfig_variable('moc_location') + moc = qt_core_dep.get_variable(pkgconfig: 'moc_location') endif example = 'monitor-nm-running' diff --git a/meson.build b/meson.build index 886f4609e8..6dd2aeba57 100644 --- a/meson.build +++ b/meson.build @@ -253,7 +253,7 @@ config_h.set10('WITH_JANSSON', jansson_dep.found()) jansson_msg = 'no' if jansson_dep.found() - jansson_libdir = jansson_dep.get_pkgconfig_variable('libdir') + jansson_libdir = jansson_dep.get_variable(pkgconfig: 'libdir') res = run_command(find_program('eu-readelf', 'readelf'), '-d', join_paths(jansson_libdir, 'libjansson.so'), check: false) jansson_soname = '' foreach line: res.stdout().split('\n') @@ -362,7 +362,7 @@ install_systemdunitdir = (systemd_systemdsystemunitdir != 'no') if install_systemdunitdir and systemd_systemdsystemunitdir == '' assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd user unit dir or disable it') - systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir', define_variable: ['rootprefix', nm_prefix]) + systemd_systemdsystemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir', pkgconfig_define: ['rootprefix', nm_prefix]) endif enable_systemd_journal = get_option('systemd_journal') @@ -495,7 +495,7 @@ endif enable_polkit = get_option('polkit') if enable_polkit # FIXME: policydir should be relative to `datadir`, not `prefix`. Fixed in https://gitlab.freedesktop.org/polkit/polkit/merge_requests/2 - polkit_gobject_policydir = dependency('polkit-gobject-1').get_pkgconfig_variable('policydir', define_variable: ['prefix', nm_prefix]) + polkit_gobject_policydir = dependency('polkit-gobject-1').get_variable(pkgconfig: 'policydir', pkgconfig_define: ['prefix', nm_prefix]) endif config_auth_polkit_default = get_option('config_auth_polkit_default') @@ -545,11 +545,11 @@ endif dbus_conf_dir = get_option('dbus_conf_dir') if dbus_conf_dir == '' assert(dbus_dep.found(), 'D-Bus required but not found, please provide a valid system bus config dir') - dbus_conf_dir = join_paths(dbus_dep.get_pkgconfig_variable('datarootdir', define_variable: ['prefix', nm_prefix]), 'dbus-1', 'system.d') + dbus_conf_dir = join_paths(dbus_dep.get_variable(pkgconfig: 'datarootdir', pkgconfig_define: ['prefix', nm_prefix]), 'dbus-1', 'system.d') endif -dbus_interfaces_dir = dbus_dep.get_pkgconfig_variable('interfaces_dir', define_variable: ['datadir', nm_datadir]) -dbus_system_bus_services_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', nm_datadir]) +dbus_interfaces_dir = dbus_dep.get_variable(pkgconfig: 'interfaces_dir', pkgconfig_define: ['datadir', nm_datadir]) +dbus_system_bus_services_dir = dbus_dep.get_variable(pkgconfig: 'system_bus_services_dir', pkgconfig_define: ['datadir', nm_datadir]) enable_firewalld_zone = get_option('firewalld_zone') config_h.set10('WITH_FIREWALLD_ZONE', enable_firewalld_zone) @@ -591,7 +591,7 @@ if enable_modem_manager mobile_broadband_provider_info_database = get_option('mobile_broadband_provider_info_database') if mobile_broadband_provider_info_database == '' - mobile_broadband_provider_info_database = dependency('mobile-broadband-provider-info').get_pkgconfig_variable('database') + mobile_broadband_provider_info_database = dependency('mobile-broadband-provider-info').get_variable(pkgconfig: 'database') endif config_h.set_quoted('MOBILE_BROADBAND_PROVIDER_INFO_DATABASE', mobile_broadband_provider_info_database) endif From 3b72f196945f59bd3896cce66507f8de7f607459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 2 Apr 2024 17:09:58 +0200 Subject: [PATCH 4/7] meson: replace deprecated meson.source_root Instead, meson.current_source_root or meson.project_source_root should be used: https://mesonbuild.com/Reference-manual_builtin_meson.html#mesonsource_root Also, the documentation referenced above suggest to use `files()` as a better alternative to refer to files, so do that at the same time. This gets rid of the deprecation warning: NOTICE: Future-deprecated features used: * 0.56.0: {'meson.source_root'} --- man/meson.build | 2 +- meson.build | 2 +- src/libnm-client-impl/meson.build | 4 ++-- src/libnm-client-impl/tests/meson.build | 4 ++-- src/libnmc-setting/meson.build | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/man/meson.build b/man/meson.build index f0113cd5d3..17287a74da 100644 --- a/man/meson.build +++ b/man/meson.build @@ -62,7 +62,7 @@ foreach man: mans endforeach if enable_introspection - merge_cmd = join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-merge.py') + merge_cmd = files(source_root / 'tools' / 'generate-docs-nm-settings-docs-merge.py') name = 'dbus' nm_settings_docs_xml_dbus = custom_target( diff --git a/meson.build b/meson.build index 6dd2aeba57..1df25ca60b 100644 --- a/meson.build +++ b/meson.build @@ -77,7 +77,7 @@ pkg = import('pkgconfig') source_root = meson.current_source_dir() build_root = meson.current_build_dir() -po_dir = join_paths(meson.source_root(), 'po') +po_dir = source_root / 'po' top_inc = include_directories('.') diff --git a/src/libnm-client-impl/meson.build b/src/libnm-client-impl/meson.build index 3f8ce5b1fc..8a4c3e4366 100644 --- a/src/libnm-client-impl/meson.build +++ b/src/libnm-client-impl/meson.build @@ -177,8 +177,8 @@ if enable_introspection endif ld_library_path = meson.current_build_dir() + ld_library_path - gen_infos_cmd = join_paths(meson.source_root(), 'tools', 'generate-docs-nm-property-infos.py') - gen_gir_cmd = join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-gir.py') + gen_infos_cmd = files(source_root / 'tools' / 'generate-docs-nm-property-infos.py') + gen_gir_cmd = files(source_root / 'tools' / 'generate-docs-nm-settings-docs-gir.py') names = [ 'dbus', 'nmcli', 'keyfile' ] if enable_ifcfg_rh diff --git a/src/libnm-client-impl/tests/meson.build b/src/libnm-client-impl/tests/meson.build index 0c0e188b77..42e9883e77 100644 --- a/src/libnm-client-impl/tests/meson.build +++ b/src/libnm-client-impl/tests/meson.build @@ -50,9 +50,9 @@ if enable_introspection 'check-local-libnm-gir', python, args: [ - join_paths(meson.source_root(), 'src', 'libnm-client-impl', 'tests', 'test-gir.py'), + join_paths(source_root, 'src', 'libnm-client-impl', 'tests', 'test-gir.py'), '--gir', libnm_gir[0], - '--ver', join_paths(meson.source_root(), 'src', 'libnm-client-impl', 'libnm.ver'), + '--ver', join_paths(source_root, 'src', 'libnm-client-impl', 'libnm.ver'), ], ) endif diff --git a/src/libnmc-setting/meson.build b/src/libnmc-setting/meson.build index 7fb460dc33..70138d8b51 100644 --- a/src/libnmc-setting/meson.build +++ b/src/libnmc-setting/meson.build @@ -3,7 +3,7 @@ if enable_docs assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true') - merge_cmd = join_paths(meson.source_root(), 'tools', 'generate-docs-nm-settings-docs-merge.py') + merge_cmd = files(source_root / 'tools' / 'generate-docs-nm-settings-docs-merge.py') settings_docs_input_xml = custom_target( 'settings-docs-input.xml', input: [merge_cmd, nm_settings_docs_xml_gir['nmcli'], nm_property_infos_xml['nmcli']], @@ -17,7 +17,7 @@ if enable_docs ], ) - gen_cmd = join_paths(meson.source_root(), 'tools', 'generate-docs-settings-docs.py') + gen_cmd = files(source_root / 'tools' / 'generate-docs-settings-docs.py') settings_docs_source = custom_target( 'settings-docs.h', input: [gen_cmd, settings_docs_input_xml], From ef2438414fd3937d26a76e7e822fa477817ff776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Tue, 2 Apr 2024 17:14:44 +0200 Subject: [PATCH 5/7] meson: remove deprecated ExternalProgram.path Replaced by full_path: https://mesonbuild.com/Reference-manual_returned_external_program.html#external_programpath ExternalProgram.full_path was added in meson 0.55 but we support meson >= 0.51. Because of that, use path or full_path conditionally depending on the meson version. This gets rid of the following deprecation warning: NOTICE: Future-deprecated features used: * 0.48.0: {'module python3'} * 0.55.0: {'ExternalProgram.path'} --- man/meson.build | 4 ++-- meson.build | 40 +++++++++++++++++++++++++------ src/libnm-client-impl/meson.build | 4 ++-- src/libnmc-setting/meson.build | 4 ++-- src/tests/client/meson.build | 4 ++-- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/man/meson.build b/man/meson.build index 17287a74da..56f52bb4b3 100644 --- a/man/meson.build +++ b/man/meson.build @@ -70,7 +70,7 @@ if enable_introspection input: [merge_cmd, nm_property_infos_xml[name], nm_settings_docs_xml_gir[name]], output: 'nm-settings-docs-' + name + '.xml', command: [ - python.path(), + python_path, merge_cmd, '@OUTPUT@', nm_property_infos_xml[name], @@ -84,7 +84,7 @@ if enable_introspection input: [merge_cmd, nm_property_infos_xml[name], gen_metadata_nm_settings_nmcli_xml, nm_settings_docs_xml_gir[name]], output: 'nm-settings-docs-' + name + '.xml', command: [ - python.path(), + python_path, merge_cmd, '@OUTPUT@', '--only-properties-from', diff --git a/meson.build b/meson.build index 1df25ca60b..88184784e6 100644 --- a/meson.build +++ b/meson.build @@ -571,7 +571,11 @@ if enable_ppp if pppd_path == '' pppd = find_program('pppd', '/sbin/pppd', '/usr/sbin/pppd', required: false) assert(pppd.found(), 'pppd required but not found, please provide a valid pppd path or use -Dppp=false to disable it') - pppd_path = pppd.path() + if meson.version().version_compare('>= 0.55') + pppd_path = pppd.full_path() + else + pppd_path = pppd.path() + endif endif config_h.set_quoted('PPPD_PATH', pppd_path) @@ -625,7 +629,11 @@ foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ] '/usr/local/sbin/' + client, required : false) if client_prog.found() - client_path = client_prog.path() + if meson.version().version_compare('>= 0.55') + client_path = client_prog.full_path() + else + client_path = client_prog.path() + endif else client_path = '/usr/sbin/' + client message('@0@ not found, assume path @1@'.format(client, client_path)) @@ -667,7 +675,11 @@ foreach prog_name : ['resolvconf', 'netconfig'] '/usr/local/sbin/' + prog_name, required : false) if prog.found() - prog_path = prog.path() + if meson.version().version_compare('>= 0.55') + prog_path = prog.full_path() + else + prog_path = prog.path() + endif else prog_enable = false endif @@ -705,7 +717,11 @@ foreach prog : progs search_paths += (path + '/' + prog[0]) endforeach exe = find_program(search_paths, required : false) - path = exe.found() ? exe.path() : prog[2] + if meson.version().version_compare('>= 0.55') + path = exe.found() ? exe.full_path() : prog[2] + else + path = exe.found() ? exe.path() : prog[2] + endif endif name = prog[0].to_upper() + '_PATH' config_h.set_quoted(name, path) @@ -864,13 +880,18 @@ if enable_valgrind if valgrind_suppressions_path == '' valgrind_suppressions_path = join_paths(source_root, 'valgrind.suppressions') endif + if meson.version().version_compare('>= 0.55') + valgrind_path = valgrind.full_path() + else + valgrind_path = valgrind.path() + endif endif test_args = [ '--called-from-make', build_root, '', - enable_valgrind ? valgrind.path() : '', + enable_valgrind ? valgrind_path : '', enable_valgrind ? valgrind_suppressions_path : '', '--launch-dbus=auto', ] @@ -879,7 +900,12 @@ python_mod = import('python') python = python_mod.find_installation('python3', required: false) if python.found() - config_h.set_quoted('TEST_NM_PYTHON', python.path()) + if meson.version().version_compare('>= 0.55') + python_path = python.full_path() + else + python_path = python.path() + endif + config_h.set_quoted('TEST_NM_PYTHON', python_path) endif data_conf = configuration_data() @@ -1113,7 +1139,7 @@ output += ' more-logging: ' + more_logging.to_string() + '\n' output += ' warning-level: ' + get_option('warning_level') + '\n' output += ' valgrind: ' + enable_valgrind.to_string() if enable_valgrind - output += ' ' + valgrind.path() + output += ' ' + valgrind_path endif output += '\n' output += ' code coverage: ' + get_option('b_coverage').to_string() + '\n' diff --git a/src/libnm-client-impl/meson.build b/src/libnm-client-impl/meson.build index 8a4c3e4366..3dd2338a82 100644 --- a/src/libnm-client-impl/meson.build +++ b/src/libnm-client-impl/meson.build @@ -190,7 +190,7 @@ if enable_introspection input: [gen_infos_cmd, libnm_gir[0]] + libnm_core_settings_sources, output: 'nm-property-infos-' + name + '.xml', command: [ - python.path(), + python_path, gen_infos_cmd, name, '@OUTPUT@', @@ -206,7 +206,7 @@ if enable_introspection 'env', 'GI_TYPELIB_PATH=' + gi_typelib_path, 'LD_LIBRARY_PATH=' + ld_library_path, - python.path(), + python_path, gen_gir_cmd, '--lib-path', meson.current_build_dir(), '--gir', libnm_gir[0], diff --git a/src/libnmc-setting/meson.build b/src/libnmc-setting/meson.build index 70138d8b51..4d5079dfb3 100644 --- a/src/libnmc-setting/meson.build +++ b/src/libnmc-setting/meson.build @@ -9,7 +9,7 @@ if enable_docs input: [merge_cmd, nm_settings_docs_xml_gir['nmcli'], nm_property_infos_xml['nmcli']], output: 'settings-docs-input.xml', command: [ - python.path(), + python_path, merge_cmd, '@OUTPUT@', nm_property_infos_xml['nmcli'], @@ -23,7 +23,7 @@ if enable_docs input: [gen_cmd, settings_docs_input_xml], output: 'settings-docs.h', command: [ - python.path(), + python_path, gen_cmd, '--output', '@OUTPUT@', '--xml', settings_docs_input_xml diff --git a/src/tests/client/meson.build b/src/tests/client/meson.build index 8c36e40559..5686a1c174 100644 --- a/src/tests/client/meson.build +++ b/src/tests/client/meson.build @@ -6,7 +6,7 @@ test( args: [ build_root, source_root, - python.path(), + python_path, '--', 'TestNmcli', ], @@ -23,7 +23,7 @@ if enable_nm_cloud_setup args: [ build_root, source_root, - python.path(), + python_path, '--', 'TestNmCloudSetup', ], From 873e66a03e2ba92c17f6b48ff8fbb3709688f3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Thu, 4 Apr 2024 08:51:02 +0200 Subject: [PATCH 6/7] meson: use shared_library for target used by linker Meson has shared_library and shared_module. The latter should be used only for shared plugins loaded by dlopen, not for shared libraries linked by the linker. The target `nm_wwan` was defined as shared_module probably because it is a library for loadable plugins only, andcontains references to symbols from the main executable that cannot be resolved at link time. Do as the deprecation message suggest and convert it to shared_library with b_lundef=false: DEPRECATION: target nm-device-plugin-wwan links against shared module nm-wwan, which is incorrect. This will be an error in the future, so please use shared_library() for nm-wwan instead. If shared_module() was used for nm-wwan because it has references to undefined symbols, use shared_library() with `override_options: ['b_lundef=false']` instead. --- src/core/devices/wwan/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/devices/wwan/meson.build b/src/core/devices/wwan/meson.build index 37ef738c48..acccb5fd6e 100644 --- a/src/core/devices/wwan/meson.build +++ b/src/core/devices/wwan/meson.build @@ -4,7 +4,7 @@ wwan_inc = include_directories('.') linker_script = join_paths(meson.current_source_dir(), 'libnm-wwan.ver') -libnm_wwan = shared_module( +libnm_wwan = shared_library( 'nm-wwan', sources: files( 'nm-service-providers.c', @@ -21,6 +21,7 @@ libnm_wwan = shared_module( link_depends: linker_script, install: true, install_dir: nm_plugindir, + override_options: ['b_lundef=false'], ) libnm_wwan_dep = declare_dependency( From ded7b78a7b497c51cf2384cef556c21472678d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= Date: Thu, 4 Apr 2024 08:56:16 +0200 Subject: [PATCH 7/7] meson: remove version checks for old versions We now only support meson >= 0.51, as it is defined in project(..., meson_version: '>= 0.51.0'). Remove checks for versions older than that. --- introspection/meson.build | 10 ++-------- meson.build | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/introspection/meson.build b/introspection/meson.build index 77479277ac..81afa7d674 100644 --- a/introspection/meson.build +++ b/introspection/meson.build @@ -80,14 +80,8 @@ foreach iface: ifaces endif content_files += dbus_iface_xml_path - - # res is an array only since 0.46. Documentation won't work with - # older versions - if meson.version().version_compare('>= 0.46.0') - introspection_files += [ [res[2], dbus_iface_xml_path] ] - headers += res[1] - endif - + introspection_files += [ [res[2], dbus_iface_xml_path] ] + headers += res[1] endforeach install_data( diff --git a/meson.build b/meson.build index 88184784e6..66142d6b09 100644 --- a/meson.build +++ b/meson.build @@ -1002,7 +1002,6 @@ endif if enable_docs assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true') - assert(meson.version().version_compare('>= 0.49.0'), '-Ddocs requires meson >= 0.49') subdir('man') subdir('docs') meson.add_dist_script(