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)
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'

View File

@@ -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
endforeach
install_data(

View File

@@ -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(
@@ -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',

View File

@@ -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()
@@ -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('.')
@@ -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)
@@ -571,8 +571,12 @@ 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')
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)
@@ -591,7 +595,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
@@ -625,7 +629,11 @@ foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ]
'/usr/local/sbin/' + client,
required : false)
if client_prog.found()
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()
if meson.version().version_compare('>= 0.55')
prog_path = prog.full_path()
else
prog_path = prog.path()
endif
else
prog_enable = false
endif
@@ -705,8 +717,12 @@ foreach prog : progs
search_paths += (path + '/' + prog[0])
endforeach
exe = find_program(search_paths, required : false)
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)
endforeach
@@ -864,22 +880,32 @@ 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',
]
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())
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()
@@ -976,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(
@@ -1113,7 +1138,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'

View File

@@ -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(

View File

@@ -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
@@ -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],

View File

@@ -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

View File

@@ -3,13 +3,13 @@
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']],
output: 'settings-docs-input.xml',
command: [
python.path(),
python_path,
merge_cmd,
'@OUTPUT@',
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.h',
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

View File

@@ -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',
],