merge: branch 'ih/meson_deprecations'

meson: bump minimum version to 0.51 and remove usages of deprecated features

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1909
This commit is contained in:
Íñigo Huguet
2024-04-04 08:13:55 +00:00
9 changed files with 64 additions and 44 deletions

View File

@@ -8,7 +8,7 @@ examples = [
moc = find_program('moc-qt4', required: false) moc = find_program('moc-qt4', required: false)
if not moc.found() if not moc.found()
moc = qt_core_dep.get_pkgconfig_variable('moc_location') moc = qt_core_dep.get_variable(pkgconfig: 'moc_location')
endif endif
example = 'monitor-nm-running' example = 'monitor-nm-running'

View File

@@ -80,14 +80,8 @@ foreach iface: ifaces
endif endif
content_files += dbus_iface_xml_path content_files += dbus_iface_xml_path
introspection_files += [ [res[2], dbus_iface_xml_path] ]
# res is an array only since 0.46. Documentation won't work with headers += res[1]
# older versions
if meson.version().version_compare('>= 0.46.0')
introspection_files += [ [res[2], dbus_iface_xml_path] ]
headers += res[1]
endif
endforeach endforeach
install_data( install_data(

View File

@@ -62,7 +62,7 @@ foreach man: mans
endforeach endforeach
if enable_introspection 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' name = 'dbus'
nm_settings_docs_xml_dbus = custom_target( nm_settings_docs_xml_dbus = custom_target(
@@ -70,7 +70,7 @@ if enable_introspection
input: [merge_cmd, nm_property_infos_xml[name], nm_settings_docs_xml_gir[name]], input: [merge_cmd, nm_property_infos_xml[name], nm_settings_docs_xml_gir[name]],
output: 'nm-settings-docs-' + name + '.xml', output: 'nm-settings-docs-' + name + '.xml',
command: [ command: [
python.path(), python_path,
merge_cmd, merge_cmd,
'@OUTPUT@', '@OUTPUT@',
nm_property_infos_xml[name], 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]], 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', output: 'nm-settings-docs-' + name + '.xml',
command: [ command: [
python.path(), python_path,
merge_cmd, merge_cmd,
'@OUTPUT@', '@OUTPUT@',
'--only-properties-from', '--only-properties-from',

View File

@@ -13,7 +13,7 @@ project(
'c_std=gnu11', 'c_std=gnu11',
'warning_level=2' # value "2" will add "-Wall" and "-Wextra" to the compiler flags '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() nm_name = meson.project_name()
@@ -77,7 +77,7 @@ pkg = import('pkgconfig')
source_root = meson.current_source_dir() source_root = meson.current_source_dir()
build_root = meson.current_build_dir() build_root = meson.current_build_dir()
po_dir = join_paths(meson.source_root(), 'po') po_dir = source_root / 'po'
top_inc = include_directories('.') top_inc = include_directories('.')
@@ -253,7 +253,7 @@ config_h.set10('WITH_JANSSON', jansson_dep.found())
jansson_msg = 'no' jansson_msg = 'no'
if jansson_dep.found() 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) res = run_command(find_program('eu-readelf', 'readelf'), '-d', join_paths(jansson_libdir, 'libjansson.so'), check: false)
jansson_soname = '' jansson_soname = ''
foreach line: res.stdout().split('\n') foreach line: res.stdout().split('\n')
@@ -362,7 +362,7 @@ install_systemdunitdir = (systemd_systemdsystemunitdir != 'no')
if install_systemdunitdir and systemd_systemdsystemunitdir == '' 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') 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 endif
enable_systemd_journal = get_option('systemd_journal') enable_systemd_journal = get_option('systemd_journal')
@@ -495,7 +495,7 @@ endif
enable_polkit = get_option('polkit') enable_polkit = get_option('polkit')
if enable_polkit if enable_polkit
# FIXME: policydir should be relative to `datadir`, not `prefix`. Fixed in https://gitlab.freedesktop.org/polkit/polkit/merge_requests/2 # 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 endif
config_auth_polkit_default = get_option('config_auth_polkit_default') config_auth_polkit_default = get_option('config_auth_polkit_default')
@@ -545,11 +545,11 @@ endif
dbus_conf_dir = get_option('dbus_conf_dir') dbus_conf_dir = get_option('dbus_conf_dir')
if 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') 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 endif
dbus_interfaces_dir = dbus_dep.get_pkgconfig_variable('interfaces_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_pkgconfig_variable('system_bus_services_dir', define_variable: ['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') enable_firewalld_zone = get_option('firewalld_zone')
config_h.set10('WITH_FIREWALLD_ZONE', enable_firewalld_zone) config_h.set10('WITH_FIREWALLD_ZONE', enable_firewalld_zone)
@@ -571,7 +571,11 @@ if enable_ppp
if pppd_path == '' if pppd_path == ''
pppd = find_program('pppd', '/sbin/pppd', '/usr/sbin/pppd', required: false) 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') 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 endif
config_h.set_quoted('PPPD_PATH', pppd_path) config_h.set_quoted('PPPD_PATH', pppd_path)
@@ -591,7 +595,7 @@ if enable_modem_manager
mobile_broadband_provider_info_database = get_option('mobile_broadband_provider_info_database') mobile_broadband_provider_info_database = get_option('mobile_broadband_provider_info_database')
if 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 endif
config_h.set_quoted('MOBILE_BROADBAND_PROVIDER_INFO_DATABASE', mobile_broadband_provider_info_database) config_h.set_quoted('MOBILE_BROADBAND_PROVIDER_INFO_DATABASE', mobile_broadband_provider_info_database)
endif endif
@@ -625,7 +629,11 @@ foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ]
'/usr/local/sbin/' + client, '/usr/local/sbin/' + client,
required : false) required : false)
if client_prog.found() 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 else
client_path = '/usr/sbin/' + client client_path = '/usr/sbin/' + client
message('@0@ not found, assume path @1@'.format(client, client_path)) 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, '/usr/local/sbin/' + prog_name,
required : false) required : false)
if prog.found() 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 else
prog_enable = false prog_enable = false
endif endif
@@ -705,7 +717,11 @@ foreach prog : progs
search_paths += (path + '/' + prog[0]) search_paths += (path + '/' + prog[0])
endforeach endforeach
exe = find_program(search_paths, required : false) 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 endif
name = prog[0].to_upper() + '_PATH' name = prog[0].to_upper() + '_PATH'
config_h.set_quoted(name, path) config_h.set_quoted(name, path)
@@ -864,22 +880,32 @@ if enable_valgrind
if valgrind_suppressions_path == '' if valgrind_suppressions_path == ''
valgrind_suppressions_path = join_paths(source_root, 'valgrind.suppressions') valgrind_suppressions_path = join_paths(source_root, 'valgrind.suppressions')
endif endif
if meson.version().version_compare('>= 0.55')
valgrind_path = valgrind.full_path()
else
valgrind_path = valgrind.path()
endif
endif endif
test_args = [ test_args = [
'--called-from-make', '--called-from-make',
build_root, build_root,
'', '',
enable_valgrind ? valgrind.path() : '', enable_valgrind ? valgrind_path : '',
enable_valgrind ? valgrind_suppressions_path : '', enable_valgrind ? valgrind_suppressions_path : '',
'--launch-dbus=auto', '--launch-dbus=auto',
] ]
py3 = import('python3') python_mod = import('python')
python = py3.find_python() python = python_mod.find_installation('python3', required: false)
if python.found() 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 endif
data_conf = configuration_data() data_conf = configuration_data()
@@ -976,7 +1002,6 @@ endif
if enable_docs if enable_docs
assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true') assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true')
assert(meson.version().version_compare('>= 0.49.0'), '-Ddocs requires meson >= 0.49')
subdir('man') subdir('man')
subdir('docs') subdir('docs')
meson.add_dist_script( meson.add_dist_script(
@@ -1113,7 +1138,7 @@ output += ' more-logging: ' + more_logging.to_string() + '\n'
output += ' warning-level: ' + get_option('warning_level') + '\n' output += ' warning-level: ' + get_option('warning_level') + '\n'
output += ' valgrind: ' + enable_valgrind.to_string() output += ' valgrind: ' + enable_valgrind.to_string()
if enable_valgrind if enable_valgrind
output += ' ' + valgrind.path() output += ' ' + valgrind_path
endif endif
output += '\n' output += '\n'
output += ' code coverage: ' + get_option('b_coverage').to_string() + '\n' output += ' code coverage: ' + get_option('b_coverage').to_string() + '\n'

View File

@@ -4,7 +4,7 @@ wwan_inc = include_directories('.')
linker_script = join_paths(meson.current_source_dir(), 'libnm-wwan.ver') linker_script = join_paths(meson.current_source_dir(), 'libnm-wwan.ver')
libnm_wwan = shared_module( libnm_wwan = shared_library(
'nm-wwan', 'nm-wwan',
sources: files( sources: files(
'nm-service-providers.c', 'nm-service-providers.c',
@@ -21,6 +21,7 @@ libnm_wwan = shared_module(
link_depends: linker_script, link_depends: linker_script,
install: true, install: true,
install_dir: nm_plugindir, install_dir: nm_plugindir,
override_options: ['b_lundef=false'],
) )
libnm_wwan_dep = declare_dependency( libnm_wwan_dep = declare_dependency(

View File

@@ -177,8 +177,8 @@ if enable_introspection
endif endif
ld_library_path = meson.current_build_dir() + ld_library_path 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_infos_cmd = files(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_gir_cmd = files(source_root / 'tools' / 'generate-docs-nm-settings-docs-gir.py')
names = [ 'dbus', 'nmcli', 'keyfile' ] names = [ 'dbus', 'nmcli', 'keyfile' ]
if enable_ifcfg_rh if enable_ifcfg_rh
@@ -190,7 +190,7 @@ if enable_introspection
input: [gen_infos_cmd, libnm_gir[0]] + libnm_core_settings_sources, input: [gen_infos_cmd, libnm_gir[0]] + libnm_core_settings_sources,
output: 'nm-property-infos-' + name + '.xml', output: 'nm-property-infos-' + name + '.xml',
command: [ command: [
python.path(), python_path,
gen_infos_cmd, gen_infos_cmd,
name, name,
'@OUTPUT@', '@OUTPUT@',
@@ -206,7 +206,7 @@ if enable_introspection
'env', 'env',
'GI_TYPELIB_PATH=' + gi_typelib_path, 'GI_TYPELIB_PATH=' + gi_typelib_path,
'LD_LIBRARY_PATH=' + ld_library_path, 'LD_LIBRARY_PATH=' + ld_library_path,
python.path(), python_path,
gen_gir_cmd, gen_gir_cmd,
'--lib-path', meson.current_build_dir(), '--lib-path', meson.current_build_dir(),
'--gir', libnm_gir[0], '--gir', libnm_gir[0],

View File

@@ -50,9 +50,9 @@ if enable_introspection
'check-local-libnm-gir', 'check-local-libnm-gir',
python, python,
args: [ 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], '--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 endif

View File

@@ -3,13 +3,13 @@
if enable_docs if enable_docs
assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true') 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 = custom_target(
'settings-docs-input.xml', 'settings-docs-input.xml',
input: [merge_cmd, nm_settings_docs_xml_gir['nmcli'], nm_property_infos_xml['nmcli']], input: [merge_cmd, nm_settings_docs_xml_gir['nmcli'], nm_property_infos_xml['nmcli']],
output: 'settings-docs-input.xml', output: 'settings-docs-input.xml',
command: [ command: [
python.path(), python_path,
merge_cmd, merge_cmd,
'@OUTPUT@', '@OUTPUT@',
nm_property_infos_xml['nmcli'], nm_property_infos_xml['nmcli'],
@@ -17,13 +17,13 @@ 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_source = custom_target(
'settings-docs.h', 'settings-docs.h',
input: [gen_cmd, settings_docs_input_xml], input: [gen_cmd, settings_docs_input_xml],
output: 'settings-docs.h', output: 'settings-docs.h',
command: [ command: [
python.path(), python_path,
gen_cmd, gen_cmd,
'--output', '@OUTPUT@', '--output', '@OUTPUT@',
'--xml', settings_docs_input_xml '--xml', settings_docs_input_xml

View File

@@ -6,7 +6,7 @@ test(
args: [ args: [
build_root, build_root,
source_root, source_root,
python.path(), python_path,
'--', '--',
'TestNmcli', 'TestNmcli',
], ],
@@ -23,7 +23,7 @@ if enable_nm_cloud_setup
args: [ args: [
build_root, build_root,
source_root, source_root,
python.path(), python_path,
'--', '--',
'TestNmCloudSetup', 'TestNmCloudSetup',
], ],