diff options
52 files changed, 869 insertions, 1110 deletions
diff --git a/Makefile.am b/Makefile.am index 95238324a4..50b0738eec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3399,7 +3399,6 @@ EXTRA_DIST += \ src/devices/wwan/libnm-wwan.ver \ src/devices/wwan/meson.build \ src/devices/wwan/tests/test-service-providers.xml \ - src/devices/wwan/tests/meson.build \ $(NULL) ############################################################################### @@ -3486,7 +3485,8 @@ check_local += check-local-devices-bluetooth endif EXTRA_DIST += \ - src/devices/bluetooth/meson.build + src/devices/bluetooth/meson.build \ + $(NULL) ############################################################################### # src/devices/wifi @@ -3558,7 +3558,7 @@ endif EXTRA_DIST += \ src/devices/wifi/meson.build \ - src/devices/wifi/tests/meson.build + $(NULL) ############################################################################### # src/devices/team diff --git a/clients/cli/meson.build b/clients/cli/meson.build index 396466a221..562020630d 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -19,17 +19,11 @@ sources = files( ) deps = [ - libnm_dep, libnmc_base_dep, libnmc_dep, - libnm_core_dep, readline_dep, ] -cflags = clients_cflags + [ - '-DG_LOG_DOMAIN="@0@"'.format(name), -] - if enable_polkit_agent sources += nm_polkit_listener @@ -40,7 +34,7 @@ executable( name, sources, dependencies: deps, - c_args: cflags, + c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/clients/common/meson.build b/clients/common/meson.build index fed0f3bf81..afa257b1df 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -2,28 +2,29 @@ common_inc = include_directories('.') nm_polkit_listener = files('nm-polkit-listener.c') -deps = [ +common_deps = [ libnm_dep, - shared_nm_libnm_core_aux_dep, + libnm_nm_default_dep, ] -cflags = clients_cflags + [ - '-DG_LOG_DOMAIN="libnmc"', -] +common_c_flags = clients_c_flags + ['-DG_LOG_DOMAIN="libnmc"'] + +sources = files( + 'nm-client-utils.c', + 'nm-secret-agent-simple.c', + 'nm-vpn-helpers.c', +) libnmc_base = static_library( 'nmc-base', - sources: files( - 'nm-client-utils.c', - 'nm-secret-agent-simple.c', - 'nm-vpn-helpers.c', - ), - dependencies: deps, - c_args: cflags, + sources: sources, + dependencies: common_deps, + c_args: common_c_flags, ) libnmc_base_dep = declare_dependency( include_directories: common_inc, + dependencies: common_deps, link_with: libnmc_base, ) @@ -39,31 +40,33 @@ if enable_introspection test( 'check-settings-docs', - find_program(join_paths(meson.source_root(), 'tools', 'check-settings-docs.sh')), - args: [meson.source_root(), meson.build_root(), 'clients/common/' + settings_docs] + find_program(join_paths(source_root, 'tools', 'check-settings-docs.sh')), + args: [source_root, build_root, 'clients/common/' + settings_docs], ) else settings_docs_source = configure_file( input: settings_docs + '.in', - output: settings_docs, + output: '@BASENAME@', configuration: configuration_data(), ) endif +sources = nm_meta_setting_source + [settings_docs_source] + files( + 'nm-meta-setting-access.c', + 'nm-meta-setting-desc.c', +) + libnmc = static_library( 'nmc', - sources: files( - 'nm-meta-setting-access.c', - 'nm-meta-setting-desc.c', - ) + shared_nm_meta_setting_c + [settings_docs_source], - dependencies: deps, - c_args: cflags, - link_with: libnmc_base, + sources: sources, + dependencies: common_deps + [libnm_libnm_core_aux_dep], + c_args: c_flags, link_depends: settings_docs_source, ) libnmc_dep = declare_dependency( include_directories: common_inc, + dependencies: common_deps, link_with: libnmc, ) diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index 624dd89cd7..479cb78101 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -1,43 +1,43 @@ +common_c_flags = clients_c_flags + ['-DNETWORKMANAGER_COMPILATION_TEST'] + test_name = 'test-clients-common' +deps = [ + libnmc_base_dep, + libnmc_dep, +] + exe = executable( test_name, test_name + '.c', - dependencies: [ - libnm_dep, - libnmc_dep, - libnmc_base_dep, - libnm_core_dep, - ], - c_args: clients_cflags + [ - '-DNETWORKMANAGER_COMPILATION_TEST', - ], + dependencies: deps, + c_args: common_c_flags, ) test( - test_name, + 'clients/common/tests/' + test_name, test_script, args: test_args + [exe.full_path()], ) -############################################################################### +test_name = 'test-libnm-core-aux' + +deps = [ + libnm_dep, + libnm_libnm_core_aux_dep, + libnm_nm_default_dep, +] exe = executable( - 'test-libnm-core-aux', - [ 'test-libnm-core-aux.c', ], - c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', - ], - dependencies: [ - libnm_dep, - shared_nm_libnm_core_aux_dep, - shared_nm_libnm_core_intern_dep, - ], + test_name, + test_name + '.c', + dependencies: deps, + c_args: common_c_flags, + link_with: libnm_systemd_logging_stub, ) test( - 'clients/common/tests/test-libnm-core-aux', - test_script, - args: test_args + [exe.full_path()] + 'clients/common/tests/' + test_name, + test_script, + args: test_args + [exe.full_path()] ) diff --git a/clients/meson.build b/clients/meson.build index 76d39fa78b..71041f7e39 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -1,23 +1,17 @@ +clients_c_flags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT'] + name = 'nm-online' deps = [ libnm_dep, - libnm_core_dep, -] - -clients_cflags = [ - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', -] - -cflags = clients_cflags + [ - '-DG_LOG_DOMAIN="@0@"'.format(name), + libnm_nm_default_dep, ] executable( name, name + '.c', dependencies: deps, - c_args: cflags, + c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/clients/tui/meson.build b/clients/tui/meson.build index 837645a61e..8948d6ff35 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -1,13 +1,6 @@ name = 'nmtui' -deps = [ - newt_dep, - libnm_core_dep, -] - -cflags = clients_cflags + [ - '-DG_LOG_DOMAIN="@0@"'.format(name), -] +common_c_flags = clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)] subdir('newt') @@ -54,10 +47,9 @@ sources = files( 'nmt-widget-list.c', ) -deps += [ - libnm_dep, - libnmc_dep, +deps = [ libnmc_base_dep, + libnmc_dep, libnmt_newt_dep, ] @@ -65,7 +57,8 @@ executable( name, sources, dependencies: deps, - c_args: cflags, + c_args: common_c_flags, + link_with: libnm_systemd_logging_stub, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/clients/tui/newt/meson.build b/clients/tui/newt/meson.build index 5bb713d313..d543f7ea6f 100644 --- a/clients/tui/newt/meson.build +++ b/clients/tui/newt/meson.build @@ -21,15 +21,20 @@ sources = files( 'nmt-newt-widget.c', ) +deps = [ + libnm_nm_default_dep, + newt_dep, +] + libnmt_newt = static_library( 'nmt-newt', - sources: sources + [libnm_enum[1]], - include_directories: libnm_inc, + sources: sources, dependencies: deps, - c_args: cflags, + c_args: common_c_flags, ) libnmt_newt_dep = declare_dependency( include_directories: include_directories('.'), + dependencies: newt_dep, link_with: libnmt_newt, ) diff --git a/data/meson.build b/data/meson.build index 9025eae452..c317877070 100644 --- a/data/meson.build +++ b/data/meson.build @@ -6,32 +6,30 @@ data_conf.set('sysconfdir', nm_sysconfdir) data_conf.set('DISTRO_NETWORK_SERVICE', (enable_ifcfg_rh ? 'network.service' : '')) data_conf.set('NM_MODIFY_SYSTEM_POLICY', (enable_modify_system ? 'yes' : 'auth_admin_keep')) -server = 'server.conf' - configure_file( - input: server + '.in', - output: server, + input: 'server.conf.in', + output: '@BASENAME@', install_dir: join_paths(nm_datadir, 'doc', nm_name, 'examples'), configuration: data_conf, ) -if install_systemd_unit_dir +if install_systemdunitdir services = [ - 'NetworkManager-dispatcher.service', - 'NetworkManager.service', + 'NetworkManager-dispatcher.service.in', + 'NetworkManager.service.in', ] if have_systemd_200 - services += ['NetworkManager-wait-online.service'] + services += ['NetworkManager-wait-online.service.in'] else - services += ['NetworkManager-wait-online-systemd-pre200.service'] + services += ['NetworkManager-wait-online-systemd-pre200.service.in'] endif foreach service: services configure_file( - input: service + '.in', - output: service, - install_dir: systemd_system_unit_dir, + input: service, + output: '@BASENAME@', + install_dir: systemd_systemdsystemunitdir, configuration: data_conf, ) endforeach @@ -39,12 +37,12 @@ if install_systemd_unit_dir if enable_ovs install_data( 'NetworkManager-ovs.conf', - install_dir: join_paths(systemd_system_unit_dir, 'NetworkManager.service.d'), + install_dir: join_paths(systemd_systemdsystemunitdir, 'NetworkManager.service.d'), ) endif endif -if install_udev_dir +if install_udevdir data = files( '84-nm-drivers.rules', '85-nm-unmanaged.rules', @@ -53,7 +51,7 @@ if install_udev_dir install_data( data, - install_dir: join_paths(udev_dir, 'rules.d'), + install_dir: join_paths(udev_udevdir, 'rules.d'), ) endif @@ -62,16 +60,16 @@ if enable_polkit policy_in = configure_file( input: policy + '.in.in', - output: policy + '.in', + output: '@BASENAME@', configuration: data_conf, ) custom_target( policy, input: policy_in, - output: policy, + output: '@BASENAME@', command: intltool_xml_cmd, install: true, - install_dir: polkit_dir, + install_dir: polkit_gobject_policydir, ) endif diff --git a/dispatcher/meson.build b/dispatcher/meson.build index 0706ab07a2..a7e555702a 100644 --- a/dispatcher/meson.build +++ b/dispatcher/meson.build @@ -8,12 +8,10 @@ service_conf.set('sysconfdir', nm_sysconfdir) service_conf.set('localstatedir', nm_localstatedir) service_conf.set('libexecdir', nm_libexecdir) -service = 'org.freedesktop.nm_dispatcher.service' - configure_file( - input: service + '.in', - output: service, - install_dir: dbus_sys_dir, + input: 'org.freedesktop.nm_dispatcher.service.in', + output: '@BASENAME@', + install_dir: dbus_system_bus_services_dir, configuration: service_conf, ) @@ -22,27 +20,23 @@ install_data( install_dir: dbus_conf_dir, ) -sources = files('nm-dispatcher-utils.c') - deps = [ libnm_dep, - libnm_core_dep, + libnm_nm_default_dep, ] -cflags = [ +c_flags = [ '-DG_LOG_DOMAIN="@0@"'.format(name), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', ] libnm_dispatcher_core = static_library( name + '-core', - sources: sources, + sources: 'nm-dispatcher-utils.c', dependencies: deps, - c_args: cflags, + c_args: c_flags, ) -sources = files('nm-dispatcher.c') - nmdbus_dispatcher_sources = gnome.gdbus_codegen( 'nmdbus-dispatcher', name + '.xml', @@ -52,9 +46,9 @@ nmdbus_dispatcher_sources = gnome.gdbus_codegen( executable( name, - sources, + name + '.c', dependencies: deps, - c_args: cflags, + c_args: c_flags, link_with: libnm_dispatcher_core, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, diff --git a/dispatcher/tests/meson.build b/dispatcher/tests/meson.build index 9d6a16de1f..83c915e585 100644 --- a/dispatcher/tests/meson.build +++ b/dispatcher/tests/meson.build @@ -1,22 +1,21 @@ test_unit = 'test-dispatcher-envp' -incs = [ - dispatcher_inc, - libnm_inc, +deps = [ + libnm_nm_default_dep, + libnm_utils_base_dep, +] + +c_flags = [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', ] exe = executable( test_unit, - [ test_unit + '.c' ] + [ nmdbus_dispatcher_sources ], - include_directories: incs, - dependencies: [ - libnm_core_dep, - libnm_dep, - ], - c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', - ], + [test_unit + '.c', nmdbus_dispatcher_sources], + include_directories: dispatcher_inc, + dependencies: deps, + c_args: c_flags, link_with: libnm_dispatcher_core, ) diff --git a/docs/api/meson.build b/docs/api/meson.build index 62c5b8c926..dde1eecb03 100644 --- a/docs/api/meson.build +++ b/docs/api/meson.build @@ -1,45 +1,52 @@ -doc_module = nm_name +if enable_introspection + settings = 'settings-spec' + output = settings + '.xml' -settings = 'settings-spec' -output = settings + '.xml' + inputs = [ + settings + '.xsl', + nm_settings_docs, + ] -if enable_introspection - settings_xml = custom_target( + content_files += custom_target( output, - input: nm_settings_docs, + input: inputs, output: output, - command: [xsltproc, '--output', '@OUTPUT@', join_paths(meson.current_source_dir(), settings + '.xsl'), '@INPUT@'], - # FIXME: there is no target depending on this, so it will not be built + command: [xsltproc, '--output', '@OUTPUT@', '@INPUT0@', '@INPUT1@'], build_by_default: true, ) endif -configure_file( - input: version_xml + '.in', - output: version_xml, +content_files += configure_file( + input: 'version.xml.in', + output: '@BASENAME@', configuration: version_conf, ) filecopier = find_program('cp') -foreach intro : introspection_files - path = intro[1].split('/')[-1] - custom_target(path, - input: intro[0], - output: path, - command: [filecopier, intro[1], '@OUTPUT@'], - build_by_default: true, +foreach intro: introspection_files + output = intro[1].split('/')[-1] + + content_files += custom_target( + output, + input: intro[0], + output: output, + command: [filecopier, intro[1], '@OUTPUT@'], + build_by_default: true, ) endforeach -custom_target('common.ent', - input: common_ent_file, - output: 'common.ent', - command: [filecopier, '@INPUT@', '@OUTPUT@'], - build_by_default: true, +output = 'common.ent' + +content_files += custom_target( + output, + input: common_ent_file, + output: output, + command: [filecopier, '@INPUT@', '@OUTPUT@'], + build_by_default: true, ) gnome.gtkdoc( - doc_module, + nm_name, main_xml: 'network-manager-docs.xml', src_dir: meson.current_source_dir(), content_files: content_files, diff --git a/docs/libnm/meson.build b/docs/libnm/meson.build index b4a23729bb..43a13f498a 100644 --- a/docs/libnm/meson.build +++ b/docs/libnm/meson.build @@ -1,4 +1,7 @@ -doc_module = libnm_name +src_dirs = [ + libnm_core_inc, + libnm_inc, +] private_headers = [ 'common.h', @@ -26,29 +29,29 @@ private_headers = [ 'test-general-enums.h', ] -configure_file( - input: version_xml + '.in', - output: version_xml, +scan_args = [ + '--rebuild-types', + '--rebuild-sections', + '--ignore-decorators=NM_AVAILABLE_IN_\d_\d\d?|NM_DEPRECATED_IN_\d_\d\d?', + '--ignore-headers=' + ' '.join(private_headers), +] + +version_xml = configure_file( + input: 'version.xml.in', + output: '@BASENAME@', configuration: version_conf, ) gnome.gtkdoc( - doc_module, - main_xml: doc_module + '-docs.xml', - src_dir: [ - libnm_core_inc, - libnm_inc, - ], + libnm_name, + main_xml: libnm_name + '-docs.xml', + src_dir: src_dirs, dependencies: libnm_dep, - scan_args: [ - '--rebuild-types', - '--rebuild-sections', - '--ignore-decorators=NM_AVAILABLE_IN_\d_\d\d?|NM_DEPRECATED_IN_\d_\d\d?', - '--ignore-headers=' + ' '.join(private_headers), - ], + scan_args: scan_args, scanobjs_args: '--type-init-func="g_type_init();"', - fixxref_args: '--html-dir=' + join_paths(nm_prefix, gnome.gtkdoc_html_dir(doc_module)), - gobject_typesfile: doc_module + '.types', - html_assets: doc_module + '.png', + fixxref_args: '--html-dir=' + join_paths(nm_prefix, gnome.gtkdoc_html_dir(libnm_name)), + gobject_typesfile: libnm_name + '.types', + html_assets: 'libnm.png', + content_files: version_xml, install: true, ) diff --git a/docs/meson.build b/docs/meson.build index cc814b77e7..e9768e5275 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -1,13 +1,11 @@ version_conf = configuration_data() version_conf.set('VERSION', nm_version) -version_xml = 'version.xml' - subdir('libnm') subdir('api') test( 'check-docs', - find_program(join_paths(meson.source_root(), 'tools', 'check-docs.sh')), - args: [meson.source_root(), meson.build_root()], + find_program(join_paths(source_root, 'tools', 'check-docs.sh')), + args: [source_root, build_root], ) diff --git a/examples/C/glib/meson.build b/examples/C/glib/meson.build index 47d64bddf9..7471ecad22 100644 --- a/examples/C/glib/meson.build +++ b/examples/C/glib/meson.build @@ -1,19 +1,18 @@ examples = [ - ['add-connection-gdbus', [libnm_enum[1]], [libnm_inc], [uuid_dep]], - ['add-connection-libnm', [], [], [libnm_dep]], - ['get-active-connections-gdbus', [libnm_enum[1]], [libnm_inc], []], - ['get-ap-info-libnm', [], [], [libnm_dep]], - ['list-connections-gdbus', [], [], []], - ['list-connections-libnm', [], [], [libnm_dep]], - ['monitor-nm-running-gdbus', [], [], []], - ['monitor-nm-state-gdbus', [], [], []], + ['add-connection-gdbus', [libnm_enum_sources[1]], [uuid_dep]], + ['add-connection-libnm', [], [libnm_dep]], + ['get-active-connections-gdbus', [libnm_enum_sources[1]], []], + ['get-ap-info-libnm', [], [libnm_dep]], + ['list-connections-gdbus', [], []], + ['list-connections-libnm', [], [libnm_dep]], + ['monitor-nm-running-gdbus', [], []], + ['monitor-nm-state-gdbus', [], []], ] foreach example: examples executable( example[0], [example[0] + '.c'] + example[1], - include_directories: example[2], - dependencies: [libnm_core_dep] + example[3], + dependencies: [libnm_nm_default_dep] + example[2], ) endforeach diff --git a/examples/C/qt/meson.build b/examples/C/qt/meson.build index c3487af4a0..172502a210 100644 --- a/examples/C/qt/meson.build +++ b/examples/C/qt/meson.build @@ -4,18 +4,11 @@ examples = [ ['change-ipv4-addresses', []], ] -incs = [ - top_inc, - libnm_core_inc, -] - -qt_core_dep = dependency('QtCore', version: '>= 4') - deps = [ dbus_dep, qt_core_dep, - dependency('QtDBus'), - dependency('QtNetwork'), + qt_dbus_dep, + qt_network_dep, ] moc = find_program('moc-qt4', required: false) @@ -39,7 +32,7 @@ foreach example: examples executable( example[0], example[0] + '.cpp', - include_directories: incs, + include_directories: libnm_core_inc, dependencies: deps, link_depends: example[1], ) diff --git a/introspection/meson.build b/introspection/meson.build index 631432a7a2..10b0405053 100644 --- a/introspection/meson.build +++ b/introspection/meson.build @@ -76,7 +76,7 @@ foreach iface: ifaces if gio_unix_dep.version().version_compare('>= 2.51.3') dbus_iface_xml_path = join_paths(meson.current_build_dir(), 'dbus-' + iface_xml) else - dbus_iface_xml_path = join_paths(meson.build_root(), 'dbus-' + iface_xml) + dbus_iface_xml_path = join_paths(build_root, 'dbus-' + iface_xml) endif content_files += dbus_iface_xml_path @@ -91,7 +91,7 @@ endforeach install_data( ifaces_xmls, - install_dir: dbus_ifaces_dir, + install_dir: dbus_interfaces_dir, ) libnmdbus = static_library( diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 9637afaad5..4c72590e7b 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -1,5 +1,16 @@ libnm_core_inc = include_directories('.') +libnm_core_nm_default_dep = declare_dependency( + sources: nm_version_macro_header, + include_directories: libnm_core_inc, + dependencies: glib_nm_default_dep, +) + +common_c_flags = [ + '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', +] + libnm_core_headers = files( 'nm-connection.h', 'nm-core-types.h', @@ -62,6 +73,42 @@ libnm_core_headers = files( 'nm-vpn-plugin-info.h', ) +enum_types = 'nm-core-enum-types' + +libnm_core_enum_sources = gnome.mkenums_simple( + enum_types, + sources: libnm_core_headers + [nm_version_macro_header], + identifier_prefix: nm_id_prefix, + install_header: true, + install_dir: libnm_pkgincludedir, +) + +libnm_libnm_core_intern = static_library( + 'nm-libnm-core-intern', + sources: nm_ethtool_utils_source + nm_libnm_core_utils_source + [libnm_core_enum_sources[1]], + dependencies: libnm_core_nm_default_dep, + c_args: common_c_flags, +) + +libnm_libnm_core_intern_dep = declare_dependency( + sources: [libnm_core_enum_sources[1], nm_version_macro_header], + include_directories: [libnm_core_inc, shared_inc], + dependencies: libnm_utils_base_dep, + link_with: libnm_libnm_core_intern, +) + +deps = [ + crypto_dep, + libnm_utils_base_dep, +] + +libnm_crypto = static_library( + 'nm-crypto', + sources: 'nm-crypto-@0@.c'.format(crypto), + dependencies: deps, + c_args: common_c_flags, +) + libnm_core_settings_sources = files( 'nm-setting-6lowpan.c', 'nm-setting-8021x.c', @@ -129,75 +176,16 @@ libnm_core_sources = libnm_core_settings_sources + files( 'nm-vpn-plugin-info.c', ) -enum_headers = libnm_core_headers + [version_header] -enum_types = 'nm-core-enum-types' - -libnm_core_enum = gnome.mkenums( - enum_types, - sources: enum_headers, - identifier_prefix: nm_id_prefix, - c_template: enum_types + '.c.template', - h_template: enum_types + '.h.template', - install_header: true, - install_dir: libnm_pkgincludedir, -) - -libnm_core_enum_dep = declare_dependency( - sources: libnm_core_enum[1], -) - -############################################################################### - -shared_nm_libnm_core_intern = static_library( - 'nm-libnm-core-intern', - sources: files('../shared/nm-libnm-core-intern/nm-ethtool-utils.c', - '../shared/nm-libnm-core-intern/nm-libnm-core-utils.c'), - c_args: [ - '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', - ], - include_directories: [ - top_inc, - shared_inc, - libnm_core_inc, - ], - dependencies: [ - glib_dep, - shared_c_siphash_dep, - shared_nm_glib_aux_dep, - libnm_core_enum_dep, - ], -) - -shared_nm_libnm_core_intern_dep = declare_dependency( - link_with: shared_nm_libnm_core_intern, - include_directories: [ - top_inc, - shared_inc, - ], - dependencies: [ - glib_dep, - shared_nm_glib_aux_dep, - libnm_systemd_shared_dep, - ], -) - -############################################################################### - deps = [ dl_dep, - libudev_dep, + libnm_systemd_shared_dep, + libnm_utils_base_dep, uuid_dep, - glib_dep, - shared_c_siphash_dep, - shared_nm_glib_aux_dep, - shared_nm_udev_aux_dep, - shared_nm_libnm_core_intern_dep, ] -cflags = [ - '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', +links = [ + libnm_crypto, + libnm_libnm_core_intern, ] if enable_json_validation @@ -205,95 +193,43 @@ if enable_json_validation deps += jansson_dep endif -if (crypto_gnutls_dep.found()) - libnm_crypto_gnutls = static_library( - 'nm-crypto-gnutls', - sources: [ 'nm-crypto-gnutls.c' ], - dependencies: deps + [ crypto_gnutls_dep ], - c_args: cflags, - ) -endif - -if (crypto_nss_dep.found()) - libnm_crypto_nss = static_library( - 'nm-crypto-nss', - sources: [ 'nm-crypto-nss.c' ], - dependencies: deps + [ crypto_nss_dep ], - c_args: cflags, - ) -endif - -if crypto == 'gnutls' - libnm_crypto = libnm_crypto_gnutls -elif crypto == 'nss' - libnm_crypto = libnm_crypto_nss -else - error('bug') -endif - -libnm_core_sources_all = libnm_core_sources -libnm_core_sources_all += libnm_core_enum -libnm_core_sources_all += shared_nm_meta_setting_c -libnm_core_sources_all += [version_header] - libnm_core = static_library( 'nm-core', - sources: libnm_core_sources_all, + sources: libnm_core_sources + libnm_core_enum_sources + nm_meta_setting_source + [nm_version_macro_header], + include_directories: top_inc, dependencies: deps, - link_with: libnm_crypto, - c_args: cflags, + c_args: common_c_flags, + link_with: links, ) libnm_core_dep = declare_dependency( - sources: libnm_core_enum[1], - include_directories: libnm_core_inc, - dependencies: [ - shared_nm_libnm_core_intern_dep, - shared_nm_glib_aux_dep, - shared_c_siphash_dep, - libnm_systemd_shared_dep, - ], + sources: [libnm_core_enum_sources[1], nm_version_macro_header], + include_directories: [libnm_core_inc, shared_inc], + dependencies: glib_dep, + link_with: libnm_core, ) -############################################################################### +c_flags = [ + '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), + '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)', +] -shared_nm_libnm_core_aux = static_library( - 'nm-libnm-core-aux', - sources: files('../shared/nm-libnm-core-aux/nm-libnm-core-aux.c'), - c_args: [ - '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), - '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)', - ], - include_directories: [ - top_inc, - shared_inc, - libnm_core_inc, - ], - dependencies: [ - glib_dep, - shared_c_siphash_dep, - shared_nm_glib_aux_dep, - libnm_core_dep, - ], +libnm_libnm_core_aux = static_library( + 'nm-libnm-core-aux', + sources: nm_libnm_core_aux_source + [libnm_core_enum_sources[1]], + dependencies: libnm_utils_base_dep, + c_args: c_flags, + link_with: libnm_libnm_core_intern, ) -shared_nm_libnm_core_aux_dep = declare_dependency( - link_with: shared_nm_libnm_core_aux, - include_directories: [ - top_inc, - shared_inc, - ], - dependencies: [ - libnm_core_dep, - glib_dep, - shared_nm_glib_aux_dep, - libnm_systemd_shared_dep, - ], +libnm_libnm_core_aux_dep = declare_dependency( + sources: [libnm_core_enum_sources[1], nm_version_macro_header], + include_directories: [libnm_core_inc, shared_inc], + dependencies: glib_dep, + link_with: libnm_libnm_core_aux, ) -############################################################################### - -enums_to_docbook = join_paths(meson.source_root(), 'tools', 'enums-to-docbook.pl') +enums_to_docbook = join_paths(source_root, 'tools', 'enums-to-docbook.pl') docbooks = [ ['nm-dbus-types', 'nm-dbus-interface.h', 'NetworkManager D-Bus API Types'], @@ -317,8 +253,6 @@ foreach docbook: docbooks content_files += xml.full_path() endforeach -############################################################################### - if enable_tests subdir('tests') endif diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index 1afb9c4b5c..292eeaa015 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -9,14 +9,24 @@ enum_types = 'nm-core-tests-enum-types' -enum = gnome.mkenums( +enum_sources = gnome.mkenums_simple( enum_types, sources: 'test-general-enums.h', identifier_prefix: nm_id_prefix, - c_template: enum_types + '.c.template', - h_template: enum_types + '.h.template', ) +deps = [ + libnm_core_dep, + libnm_core_nm_default_dep, +] + +c_flags = [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', +] + +test_cert_dir = join_paths(meson.current_source_dir(), 'certs') + test_units = [ 'test-compare', 'test-crypto', @@ -27,22 +37,15 @@ test_units = [ 'test-settings-defaults', ] -test_cert_dir = join_paths(meson.current_source_dir(), 'certs') - foreach test_unit: test_units exe = executable( 'libnm-core-' + test_unit, - [test_unit + '.c'] + enum, - dependencies: [ - libnm_core_dep, - libnm_systemd_shared_no_logging_dep, - ], - c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', - ], - link_with: libnm_core, + [test_unit + '.c'] + enum_sources, + dependencies: deps, + c_args: c_flags, + link_with: libnm_systemd_logging_stub, ) + test( 'libnm-core/' + test_unit, test_script, diff --git a/libnm/meson.build b/libnm/meson.build index 0d7fb3acf2..8b68a63679 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -1,6 +1,12 @@ libnm_inc = include_directories('.') -cflags = [ +libnm_nm_default_dep = declare_dependency( + sources: libnm_core_enum_sources[1], + include_directories: libnm_inc, + dependencies: libnm_core_nm_default_dep, +) + +c_flags = [ '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM', ] @@ -55,16 +61,15 @@ libnm_headers = files( ) install_headers( - libnm_core_headers + libnm_headers + [version_header], + libnm_core_headers + libnm_headers + [nm_version_macro_header], subdir: libnm_name, ) -enum_headers = libnm_headers + [version_header] enum_types = 'nm-enum-types' -libnm_enum = gnome.mkenums( +libnm_enum_sources = gnome.mkenums( enum_types, - sources: enum_headers, + sources: libnm_headers + [nm_version_macro_header], identifier_prefix: nm_id_prefix, c_template: enum_types + '.c.template', h_template: enum_types + '.h.template', @@ -127,65 +132,45 @@ libnm_sources = files( 'nm-wimax-nsp.c', ) -linker_script = join_paths(meson.current_source_dir(), 'libnm.ver') +deps = [ + libnmdbus_dep, + libnm_libnm_core_intern_dep, + libnm_nm_default_dep, + libnm_udev_aux_dep, + libudev_dep, +] liblibnm = static_library( 'libnm', - sources: libnm_sources + libnm_enum, - include_directories: libnm_core_inc, - dependencies: [ - libnmdbus_dep, - dl_dep, - libudev_dep, - shared_nm_glib_aux_dep, - libnm_core_dep, - uuid_dep, - libnm_systemd_shared_no_logging_dep, - ], - c_args: cflags, + sources: libnm_sources + libnm_enum_sources, + dependencies: deps, + c_args: c_flags, + link_with: libnm_systemd_logging_stub, ) -liblibnm_dep = declare_dependency( - sources: libnm_enum[1], - include_directories: [ - libnm_inc, - libnm_core_inc, - ], - dependencies: [ - libnm_core_dep, - libnm_systemd_shared_no_logging_dep, - libnmdbus_dep, - shared_nm_glib_aux_dep, - libudev_dep, - dl_dep, - uuid_dep, - ], -) +links = [ + liblibnm, + libnm_core, + libnmdbus, + libnm_systemd_logging_stub, + libnm_utils_base, +] + +linker_script = join_paths(meson.current_source_dir(), 'libnm.ver') libnm = shared_library( 'nm', version: libnm_version, - link_whole: [ - liblibnm, - libnm_core, - libnm_systemd_logging_stub, - libnmdbus, - shared_nm_glib_aux, - ], - dependencies: liblibnm_dep, - link_args: [ - '-Wl,--version-script,@0@'.format(linker_script), - ], + dependencies: libnm_nm_default_dep, + link_whole: links, + link_args: '-Wl,--version-script,@0@'.format(linker_script), link_depends: linker_script, install: true, ) libnm_dep = declare_dependency( - sources: libnm_enum[1], - include_directories: [ - libnm_inc, - libnm_core_inc, - ], + sources: libnm_enum_sources[1], + include_directories: libnm_inc, link_with: libnm, ) @@ -210,21 +195,19 @@ test( ) if enable_introspection - gir_sources = libnm_core_enum + libnm_core_headers + libnm_core_sources + libnm_enum + libnm_headers + libnm_sources + [version_header] libnm_gir = gnome.generate_gir( libnm, - sources: gir_sources, + sources: libnm_core_sources + libnm_core_headers + libnm_core_enum_sources + libnm_sources + libnm_headers + libnm_enum_sources + [nm_version_macro_header], + includes: 'Gio-2.0', nsversion: nm_gir_version, namespace: 'NM', identifier_prefix: nm_id_prefix, symbol_prefix: nm_id_prefix.to_lower(), - export_packages: libnm_name, - includes: 'Gio-2.0', - extra_args: cflags, header: 'NetworkManager.h', + export_packages: libnm_name, + extra_args: c_flags, install: true, - dependencies: libnm_dep, ) generate_plugin_docs = join_paths(meson.current_source_dir(), 'generate-plugin-docs.pl') @@ -287,9 +270,9 @@ if enable_introspection name = 'nm-settings-docs.xml' nm_settings_docs = custom_target( name, - input: libnm_gir[0], + input: [libnm_gir[0], nm_settings_docs_overrides], output: name, - command: [generate_setting_docs_env, python.path(), generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT@', '--overrides', nm_settings_docs_overrides, '--output', '@OUTPUT@'], + command: [generate_setting_docs_env, python.path(), generate_setting_docs, '--lib-path', meson.current_build_dir(), '--gir', '@INPUT0@', '--overrides', '@INPUT1@', '--output', '@OUTPUT@'], depends: libnm_gir, ) endif diff --git a/libnm/tests/meson.build b/libnm/tests/meson.build index 5b72a24fae..76c3b2876d 100644 --- a/libnm/tests/meson.build +++ b/libnm/tests/meson.build @@ -1,11 +1,16 @@ test_units = [ - ['test-libnm', 30], - ['test-nm-client', 90], + ['test-libnm', 30], + ['test-nm-client', 90], ['test-remote-settings-client', 90], - ['test-secret-agent', 90], + ['test-secret-agent', 90], ] -cflags = [ +deps = [ + libnm_core_dep, + libnm_nm_default_dep, +] + +c_flags = [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM', ] @@ -13,19 +18,10 @@ cflags = [ foreach test_unit: test_units exe = executable( test_unit[0], - [ - test_unit[0] + '.c', - shared_nm_test_utils_impl_c, - ], - dependencies: [ - liblibnm_dep, - libnm_systemd_shared_no_logging_dep, - ], - c_args: cflags, - link_with: [ - liblibnm, - libnm_core, - ], + [test_unit[0] + '.c', nm_test_utils_impl_source, libnm_enum_sources[1]], + dependencies: deps, + c_args: c_flags, + link_with: liblibnm, ) test( @@ -39,8 +35,8 @@ endforeach # just test, that we can build "nm-vpn-plugin-utils.c" libnm_vpn_plugin_utils_test = static_library( 'nm-vpn-plugin-utils-test', - sources: shared_nm_utils_nm_vpn_plugin_utils_c + [libnm_enum[1]], + sources: nm_vpn_plugin_utils_source + [libnm_enum_sources[1]], include_directories: libnm_inc, - dependencies: libnm_core_dep, - c_args: cflags, + dependencies: libnm_nm_default_dep, + c_args: c_flags, ) diff --git a/man/meson.build b/man/meson.build index a4ef3d9e21..8ba6f4d8a1 100644 --- a/man/meson.build +++ b/man/meson.build @@ -9,11 +9,9 @@ common_conf.set('NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT', config_default_logging_a common_conf.set('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default) common_conf.set('NM_CONFIG_DEFAULT_MAIN_DHCP', config_dhcp_default) -common = 'common.ent' - common_ent_file = configure_file( - input: common + '.in', - output: common, + input: 'common.ent.in', + output: '@BASENAME@', configuration: common_conf, ) diff --git a/meson.build b/meson.build index 9c4ee0712e..f5eb547864 100644 --- a/meson.build +++ b/meson.build @@ -65,6 +65,27 @@ libnm_pkgincludedir = join_paths(nm_includedir, libnm_name) nm_debug = get_option('buildtype').contains('debug') +gnome = import('gnome') +i18n = import('i18n') +pkg = import('pkgconfig') + +source_root = meson.current_source_dir() +build_root = meson.current_build_dir() + +po_dir = join_paths(meson.source_root(), 'po') + +intltool_merge = find_program('intltool-merge') +intltool_cache = join_paths(po_dir, '.intltool-merge-cache') +intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'] +intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'] + +top_inc = include_directories('.') + +perl = find_program('perl') +xsltproc = find_program('xsltproc') + +check_exports = find_program(join_paths(source_root, 'tools', 'check-exports.sh')) + cc = meson.get_compiler('c') config_h = configuration_data() @@ -116,18 +137,18 @@ common_ldflags = [] enable_ld_gc = get_option('ld_gc') if enable_ld_gc - test_cflags = [ + test_c_flags = [ '-fdata-sections', '-ffunction-sections', ] test_ldflags = ['-Wl,--gc-sections'] - foreach cflag: test_cflags + test_ldflags + foreach cflag: test_c_flags + test_ldflags assert(cc.has_argument(cflag), 'Unused symbol eviction requested but not supported. Use -Dld_gc=false to build without it.') endforeach - common_flags += test_cflags + common_flags += test_c_flags common_ldflags += test_ldflags endif @@ -172,9 +193,9 @@ endif add_project_arguments(common_flags, language: 'c') add_project_link_arguments(common_ldflags, language: 'c') -linker_script_binary = join_paths(meson.source_root(), 'linker-script-binary.ver') -linker_script_devices = join_paths(meson.source_root(), 'linker-script-devices.ver') -linker_script_settings = join_paths(meson.source_root(), 'linker-script-settings.ver') +linker_script_binary = join_paths(source_root, 'linker-script-binary.ver') +linker_script_devices = join_paths(source_root, 'linker-script-devices.ver') +linker_script_settings = join_paths(source_root, 'linker-script-settings.ver') ldflags_linker_script_binary = [ '-Wl,--version-script,@0@'.format(linker_script_binary) ] ldflags_linker_script_devices = [ '-Wl,--version-script,@0@'.format(linker_script_devices) ] @@ -259,9 +280,7 @@ config_h.set_quoted('NM_DIST_VERSION', dist_version) enable_wifi = get_option('wifi') enable_iwd = get_option('iwd') -if enable_iwd - assert(enable_wifi, 'Enabling iwd support requires Wi-Fi support as well') -endif +assert((not enable_iwd) or enable_wifi, 'Enabling iwd support requires Wi-Fi support as well') config_h.set10('WITH_IWD', enable_iwd) enable_wext = get_option('wext') @@ -295,19 +314,19 @@ if enable_introspection assert(gir_dep.found(), 'introspection support was requested, but the gobject-introspection library is not available. Use -Dintrospection=false to build without it.') endif -udev_dir = get_option('udev_dir') -install_udev_dir = (udev_dir != 'no') +udev_udevdir = get_option('udev_dir') +install_udevdir = (udev_udevdir != 'no') -if install_udev_dir and udev_dir == '' - udev_dir = dependency('udev').get_pkgconfig_variable('udevdir') +if install_udevdir and udev_udevdir == '' + udev_udevdir = dependency('udev').get_pkgconfig_variable('udevdir') endif -systemd_system_unit_dir = get_option('systemdsystemunitdir') -install_systemd_unit_dir = (systemd_system_unit_dir != 'no') +systemd_systemdsystemunitdir = get_option('systemdsystemunitdir') +install_systemdunitdir = (systemd_systemdsystemunitdir != 'no') -if install_systemd_unit_dir and systemd_system_unit_dir == '' +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_system_unit_dir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') + systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') endif enable_systemd_journal = get_option('systemd_journal') @@ -442,7 +461,7 @@ config_h.set10('WITH_JSON_VALIDATION', enable_json_validation) 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_dir = dependency('polkit-gobject-1').get_pkgconfig_variable('policydir', define_variable: ['prefix', nm_prefix]) + polkit_gobject_policydir = dependency('polkit-gobject-1').get_pkgconfig_variable('policydir', define_variable: ['prefix', nm_prefix]) endif config_default_main_auth_polkit = enable_polkit.to_string() @@ -456,14 +475,18 @@ if enable_polkit_agent endif config_h.set10('WITH_POLKIT_AGENT', enable_polkit_agent) -crypto_gnutls_dep = dependency('gnutls', version: '>= 2.12', required: false) -crypto_nss_dep = dependency('nss', required: false) crypto = get_option('crypto') if crypto == 'nss' - assert(crypto_nss_dep.found(), 'Requires gnutls crypto support') + crypto_dep = dependency('nss', required: false) + assert(crypto_dep.found(), 'Requires nss crypto support') elif crypto == 'gnutls' - assert(crypto_gnutls_dep.found(), 'Requires gnutls crypto support') + crypto_dep = dependency( + 'gnutls', + version: '>= 2.12', + required: false, + ) + assert(crypto_dep.found(), 'Requires gnutls crypto support') else error('bug') endif @@ -471,11 +494,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('sysconfdir'), 'dbus-1', 'system.d') + dbus_conf_dir = join_paths(dbus_dep.get_pkgconfig_variable('sysconfdir', define_variable: ['sysconfdir', nm_sysconfdir]), 'dbus-1', 'system.d') endif -dbus_ifaces_dir = dbus_dep.get_pkgconfig_variable('interfaces_dir', define_variable: ['datadir', nm_datadir]) -dbus_sys_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', nm_datadir]) +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]) # pppd enable_ppp = get_option('ppp') @@ -503,8 +526,8 @@ enable_modem_manager = get_option('modem_manager') if enable_modem_manager mm_glib_dep = dependency('mm-glib', version: '>= 0.7.991') - service_provider_db = dependency('mobile-broadband-provider-info').get_pkgconfig_variable('database') - config_h.set_quoted('MOBILE_BROADBAND_PROVIDER_INFO_DATABASE', service_provider_db) + mobile_broadband_provider_info_database = dependency('mobile-broadband-provider-info').get_pkgconfig_variable('database') + config_h.set_quoted('MOBILE_BROADBAND_PROVIDER_INFO_DATABASE', mobile_broadband_provider_info_database) endif # Bluez5 DUN support @@ -718,7 +741,7 @@ endif tests = get_option('tests') enable_tests = (tests != 'no') require_root_tests = (tests == 'root') -test_script = find_program(join_paths(meson.source_root(), 'tools', 'run-nm-test.sh')) +test_script = find_program(join_paths(source_root, 'tools', 'run-nm-test.sh')) # valgrind locations = get_option('valgrind') @@ -731,13 +754,13 @@ endif if enable_valgrind valgrind_suppressions_path = get_option('valgrind_suppressions') if valgrind_suppressions_path == '' - valgrind_suppressions_path = join_paths(meson.source_root(), 'valgrind.suppressions') + valgrind_suppressions_path = join_paths(source_root, 'valgrind.suppressions') endif endif test_args = [ '--called-from-make', - meson.build_root(), + build_root, '', enable_valgrind ? valgrind.path() : '', enable_valgrind ? valgrind_suppressions_path : '', @@ -783,39 +806,8 @@ else fi ''' -gnome = import('gnome') -i18n = import('i18n') -pkg = import('pkgconfig') - -po_dir = join_paths(meson.source_root(), 'po') - -intltool_merge = find_program('intltool-merge') -intltool_cache = join_paths(po_dir, '.intltool-merge-cache') -intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'] -intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@'] - -perl = find_program('perl') -xsltproc = find_program('xsltproc') - -check_exports = find_program(join_paths(meson.source_root(), 'tools', 'check-exports.sh')) - content_files = [] -# FIXME: every plugin calls to this: -''' -set_sanitizer_env = \ - [ -n "$(SANITIZER_ENV)" ] && export $(SANITIZER_ENV) ; \ - if [ -n "$(1)" ] && echo $(CFLAGS) | grep -e -fsanitize=address ; then \ - export LD_PRELOAD="$${LD_PRELOAD}:$$(ldd $(1) | grep libasan\.so\.. -o | head -n 1)"; \ - fi - -check_so_symbols = \ - $(call set_sanitizer_env,$(1)); \ - LD_BIND_NOW=1 LD_PRELOAD=$${LD_PRELOAD}:$(1) $(builddir)/src/NetworkManager --version >/dev/null -''' - -top_inc = include_directories('.') - subdir('introspection') subdir('shared') subdir('libnm-core') @@ -835,6 +827,11 @@ subdir('examples/C/glib') enable_qt = get_option('qt') if enable_qt add_languages('cpp') + + qt_core_dep = dependency('QtCore', version: '>= 4') + qt_dbus_dep = dependency('QtDBus') + qt_network_dep = dependency('QtNetwork') + subdir('examples/C/qt') endif @@ -847,11 +844,9 @@ if enable_docs subdir('docs') endif -config = 'config.h' - configure_file( - input: config + '.meson', - output: config, + input: 'config.h.meson', + output: '@BASENAME@', configuration: config_h, ) @@ -868,8 +863,8 @@ config_extra_h.set_quoted('NMPLUGINDIR', nm_plugindir) config_extra_h.set_quoted('NMRUNDIR', nm_pkgrundir) config_extra_h.set_quoted('NMSTATEDIR', nm_pkgstatedir) config_extra_h.set_quoted('NMVPNDIR', nm_vpndir) -config_extra_h.set_quoted('NM_BUILD_BUILDDIR', meson.build_root()) -config_extra_h.set_quoted('NM_BUILD_SRCDIR', meson.source_root()) +config_extra_h.set_quoted('NM_BUILD_BUILDDIR', build_root) +config_extra_h.set_quoted('NM_BUILD_SRCDIR', source_root) if enable_ppp config_extra_h.set_quoted('PPPD_PLUGIN_DIR', pppd_plugin_dir) endif @@ -879,7 +874,7 @@ config_extra_h.set_quoted('SYSCONFDIR', nm_sysconfdir) configure_file( input: 'config-extra.h.meson', - output: 'config-extra.h', + output: '@BASENAME@', configuration: config_extra_h, ) @@ -892,12 +887,14 @@ meson.add_install_script( nm_pkgstatedir, enable_docs ? 'install_docs' : '', nm_mandir, + enable_ifcfg_rh ? 'create_network_scripts' : '', + nm_sysconfdir, ) output = '\nSystem paths:\n' output += ' prefix: ' + nm_prefix + '\n' output += ' exec_prefix: ' + nm_prefix + '\n' -output += ' systemdunitdir: ' + systemd_system_unit_dir + '\n' +output += ' systemdunitdir: ' + systemd_systemdsystemunitdir + '\n' output += ' nmbinary: ' + nm_pkgsbindir + '\n' output += ' nmconfdir: ' + nm_pkgconfdir + '\n' output += ' nmlibdir: ' + nm_pkglibdir + '\n' @@ -962,7 +959,7 @@ output += ' code coverage: ' + get_option('b_coverage').to_string() + '\n' output += ' LTO: ' + enable_lto.to_string() + '\n' output += ' Linker garbage collection: ' + enable_ld_gc.to_string() + '\n' output += ' JSON validation for libnm: ' + enable_json_validation.to_string() + '\n' -output += ' crypto: ' + crypto + ' (have-gnutls: ' + crypto_gnutls_dep.found().to_string() + ', have-nss: ' + crypto_nss_dep.found().to_string() + ')\n' +output += ' crypto: ' + crypto + '\n' output += ' sanitizers: ' + get_option('b_sanitize') + '\n' output += ' Mozilla Public Suffix List: ' + enable_libpsl.to_string() + '\n' output += ' vapi: ' + enable_vapi.to_string() + '\n' diff --git a/shared/meson.build b/shared/meson.build index aa10f792f8..7a9dbaac48 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -1,334 +1,262 @@ shared_inc = include_directories('.') -############################################################################### +nm_default_dep = declare_dependency(include_directories: [top_inc, shared_inc]) -shared_c_stdaux = static_library( - 'c-stdaux', - c_args: '-std=c11', - sources: files('c-stdaux/src/c-stdaux.h'), +glib_nm_default_dep = declare_dependency(dependencies: [glib_dep, nm_default_dep]) + +libc_siphash = static_library( + 'c-siphash', + sources: 'c-siphash/src/c-siphash.c', + include_directories: include_directories('c-stdaux/src'), ) -shared_c_stdaux_dep = declare_dependency( - include_directories: shared_inc, +libc_rbtree = static_library( + 'c-rbtree', + sources: 'c-rbtree/src/c-rbtree.c', + include_directories: include_directories('c-stdaux/src'), + c_args: '-std=c11', ) -############################################################################### +sources = files( + 'n-acd/src/n-acd.c', + 'n-acd/src/n-acd-probe.c', + 'n-acd/src/util/timer.c', +) -shared_c_siphash = static_library( - 'c-siphash', - include_directories: [ - include_directories('c-stdaux/src'), - ], - sources: 'c-siphash/src/c-siphash.c', +if enable_ebpf + sources += files('n-acd/src/n-acd-bpf.c') +else + sources += files('n-acd/src/n-acd-bpf-fallback.c') +endif + +incs = include_directories( + 'c-list/src', + 'c-rbtree/src', + 'c-siphash/src', + 'c-stdaux/src', ) -shared_c_siphash_dep = declare_dependency( - include_directories: shared_inc, - link_with: shared_c_siphash, +c_flags = [ + '-D_GNU_SOURCE', + '-DSO_ATTACH_BPF=50', + '-std=c11', + '-Wno-pointer-arith', + '-Wno-vla', +] + +links = [ + libc_rbtree, + libc_siphash, +] + +libn_acd = static_library( + 'n-acd', + sources: sources, + include_directories: incs, + c_args: c_flags, + link_with: links, ) -############################################################################### - -shared_c_rbtree = static_library( - 'c-rbtree', - c_args: '-std=c11', - include_directories: [ - include_directories('c-stdaux/src'), - ], - sources: files('c-rbtree/src/c-rbtree.c', - 'c-rbtree/src/c-rbtree.h', - 'c-rbtree/src/c-rbtree-private.h'), +libn_acd_dep = declare_dependency( + include_directories: shared_inc, + link_with: libn_acd, ) -shared_c_rbtree_dep = declare_dependency( - include_directories: shared_inc, - link_with: shared_c_rbtree, +sources = files( + 'n-dhcp4/src/n-dhcp4-c-connection.c', + 'n-dhcp4/src/n-dhcp4-c-lease.c', + 'n-dhcp4/src/n-dhcp4-client.c', + 'n-dhcp4/src/n-dhcp4-c-probe.c', + 'n-dhcp4/src/n-dhcp4-incoming.c', + 'n-dhcp4/src/n-dhcp4-outgoing.c', + 'n-dhcp4/src/n-dhcp4-socket.c', + 'n-dhcp4/src/util/packet.c', + 'n-dhcp4/src/util/socket.c', ) -############################################################################### +incs = include_directories( + 'c-list/src', + 'c-siphash/src', + 'c-stdaux/src', +) -if enable_ebpf - shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf.c') -else - shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf-fallback.c') -endif +c_flags = [ + '-D_GNU_SOURCE', + '-Wno-declaration-after-statement', + '-Wno-pointer-arith', +] -shared_n_acd = static_library( - 'n-acd', - sources: files('n-acd/src/n-acd.c', - 'n-acd/src/n-acd.h', - 'n-acd/src/n-acd-private.h', - 'n-acd/src/n-acd-probe.c', - 'n-acd/src/util/timer.c', - 'n-acd/src/util/timer.h') - + shared_n_acd_bpf_files, - c_args: [ - '-D_GNU_SOURCE', - '-DSO_ATTACH_BPF=50', - '-std=c11', - '-Wno-pointer-arith', - '-Wno-vla', - ], - include_directories: [ - include_directories('c-stdaux/src'), - include_directories('c-siphash/src'), - include_directories('c-list/src'), - include_directories('c-rbtree/src'), - ], - dependencies: [ - shared_c_siphash_dep, - shared_c_rbtree_dep, - ], +libn_dhcp4 = static_library( + 'n-dhcp4', + sources: sources, + c_args: c_flags, + include_directories: incs, + link_with: libc_siphash, ) -shared_n_acd_dep = declare_dependency( - include_directories: shared_inc, - link_with: shared_n_acd, +libn_dhcp4_dep = declare_dependency( + include_directories: shared_inc, + link_with: libn_dhcp4, ) -############################################################################### - -shared_n_dhcp4 = static_library( - 'n-dhcp4', - sources: files('n-dhcp4/src/n-dhcp4-c-connection.c', - 'n-dhcp4/src/n-dhcp4-c-lease.c', - 'n-dhcp4/src/n-dhcp4-c-probe.c', - 'n-dhcp4/src/n-dhcp4-client.c', - 'n-dhcp4/src/n-dhcp4-incoming.c', - 'n-dhcp4/src/n-dhcp4-outgoing.c', - 'n-dhcp4/src/n-dhcp4-private.h', - 'n-dhcp4/src/n-dhcp4-socket.c', - 'n-dhcp4/src/n-dhcp4.h', - 'n-dhcp4/src/util/packet.c', - 'n-dhcp4/src/util/packet.h', - 'n-dhcp4/src/util/socket.c', - 'n-dhcp4/src/util/socket.h'), - c_args: [ - '-D_GNU_SOURCE', - '-Wno-declaration-after-statement', - '-Wno-pointer-arith', - ], - include_directories: [ - include_directories('c-list/src'), - include_directories('c-siphash/src'), - include_directories('c-stdaux/src'), - ], - dependencies: [ - shared_c_siphash_dep, - ], -) +nm_version_macro_conf = configuration_data() +nm_version_macro_conf.set('NM_MAJOR_VERSION', nm_major_version) +nm_version_macro_conf.set('NM_MINOR_VERSION', nm_minor_version) +nm_version_macro_conf.set('NM_MICRO_VERSION', nm_micro_version) -shared_n_dhcp4_dep = declare_dependency( - include_directories: shared_inc, - link_with: shared_n_dhcp4, +nm_version_macro_header = configure_file( + input: 'nm-version-macros.h.in', + output: '@BASENAME@', + configuration: nm_version_macro_conf, ) -############################################################################### +nm_ethtool_utils_source = files('nm-libnm-core-intern/nm-ethtool-utils.c') -version_conf = configuration_data() -version_conf.set('NM_MAJOR_VERSION', nm_major_version) -version_conf.set('NM_MINOR_VERSION', nm_minor_version) -version_conf.set('NM_MICRO_VERSION', nm_micro_version) +nm_libnm_core_aux_source = files('nm-libnm-core-aux/nm-libnm-core-aux.c') -version_header = configure_file( - input: 'nm-version-macros.h.in', - output: 'nm-version-macros.h', - configuration: version_conf, -) +nm_libnm_core_utils_source = files('nm-libnm-core-intern/nm-libnm-core-utils.c') -shared_nm_meta_setting_c = files('nm-meta-setting.c') +nm_meta_setting_source = files('nm-meta-setting.c') -shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c') +nm_test_utils_impl_source = files('nm-test-utils-impl.c') -shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c') +nm_vpn_plugin_utils_source = files('nm-utils/nm-vpn-plugin-utils.c') -############################################################################### +c_flags = [ + '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), + '-DNETWORKMANAGER_COMPILATION=0', +] -shared_nm_std_aux = static_library( - 'nm-std-aux', - sources: files('nm-std-aux/c-list-util.c'), - c_args: [ - '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), - '-DNETWORKMANAGER_COMPILATION=0', - ], - include_directories: [ - top_inc, - shared_inc, - ], - dependencies: [ - ], +libnm_std_aux = static_library( + 'nm-std-aux', + sources: 'nm-std-aux/c-list-util.c', + c_args: c_flags, ) -shared_nm_std_aux_dep = declare_dependency( - link_with: shared_nm_std_aux, - include_directories: [ - top_inc, - shared_inc, - ], +sources = files( + 'nm-glib-aux/nm-dbus-aux.c', + 'nm-glib-aux/nm-dedup-multi.c', + 'nm-glib-aux/nm-enum-utils.c', + 'nm-glib-aux/nm-errno.c', + 'nm-glib-aux/nm-hash-utils.c', + 'nm-glib-aux/nm-io-utils.c', + 'nm-glib-aux/nm-json-aux.c', + 'nm-glib-aux/nm-keyfile-aux.c', + 'nm-glib-aux/nm-random-utils.c', + 'nm-glib-aux/nm-ref-string.c', + 'nm-glib-aux/nm-secret-utils.c', + 'nm-glib-aux/nm-shared-utils.c', + 'nm-glib-aux/nm-time-utils.c' +) + +c_flags = [ + '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), + '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)', +] + +links = [ + libc_siphash, + libnm_std_aux, +] + +libnm_utils_base = static_library( + 'nm-utils-base', + sources: sources, + dependencies: glib_nm_default_dep, + c_args: c_flags, + link_with: links, ) -############################################################################### +libnm_utils_base_dep = declare_dependency( + dependencies: glib_nm_default_dep, + link_with: libnm_utils_base, +) -shared_nm_glib_aux_c_args = [ - '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), - '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)', +deps = [ + glib_nm_default_dep, + libudev_dep, ] -shared_nm_glib_aux = static_library( - 'nm-utils-base', - sources: files('nm-glib-aux/nm-dbus-aux.c', - 'nm-glib-aux/nm-dedup-multi.c', - 'nm-glib-aux/nm-enum-utils.c', - 'nm-glib-aux/nm-errno.c', - 'nm-glib-aux/nm-hash-utils.c', - 'nm-glib-aux/nm-io-utils.c', - 'nm-glib-aux/nm-json-aux.c', - 'nm-glib-aux/nm-keyfile-aux.c', - 'nm-glib-aux/nm-random-utils.c', - 'nm-glib-aux/nm-ref-string.c', - 'nm-glib-aux/nm-secret-utils.c', - 'nm-glib-aux/nm-shared-utils.c', - 'nm-glib-aux/nm-time-utils.c'), - c_args: shared_nm_glib_aux_c_args, - include_directories: [ - top_inc, - shared_inc, - ], - dependencies: [ - glib_dep, - shared_nm_std_aux_dep, - ], +libnm_udev_aux = static_library( + 'nm-udev-aux', + sources: 'nm-udev-aux/nm-udev-utils.c', + dependencies: deps, + c_args: c_flags, ) -shared_nm_glib_aux_dep = declare_dependency( - link_with: shared_nm_glib_aux, - include_directories: [ - top_inc, - shared_inc, - ], - dependencies: glib_dep, +libnm_udev_aux_dep = declare_dependency( + include_directories: shared_inc, + link_with: libnm_udev_aux, ) -############################################################################### - -shared_nm_udev_aux = static_library( - 'nm-udev-aux', - sources: files('nm-udev-aux/nm-udev-utils.c'), - c_args: shared_nm_glib_aux_c_args, - include_directories: [ - top_inc, - shared_inc, - ], - dependencies: [ - glib_dep, - shared_nm_glib_aux_dep, - libudev_dep, - ], +sources = files( + 'systemd/src/basic/alloc-util.c', + 'systemd/src/basic/escape.c', + 'systemd/src/basic/env-file.c', + 'systemd/src/basic/env-util.c', + 'systemd/src/basic/ether-addr-util.c', + 'systemd/src/basic/extract-word.c', + 'systemd/src/basic/fd-util.c', + 'systemd/src/basic/fileio.c', + 'systemd/src/basic/format-util.c', + 'systemd/src/basic/fs-util.c', + 'systemd/src/basic/hash-funcs.c', + 'systemd/src/basic/hashmap.c', + 'systemd/src/basic/hexdecoct.c', + 'systemd/src/basic/hostname-util.c', + 'systemd/src/basic/in-addr-util.c', + 'systemd/src/basic/io-util.c', + 'systemd/src/basic/memory-util.c', + 'systemd/src/basic/mempool.c', + 'systemd/src/basic/parse-util.c', + 'systemd/src/basic/path-util.c', + 'systemd/src/basic/prioq.c', + 'systemd/src/basic/process-util.c', + 'systemd/src/basic/random-util.c', + 'systemd/src/basic/socket-util.c', + 'systemd/src/basic/stat-util.c', + 'systemd/src/basic/string-table.c', + 'systemd/src/basic/string-util.c', + 'systemd/src/basic/strv.c', + 'systemd/src/basic/strxcpyx.c', + 'systemd/src/basic/time-util.c', + 'systemd/src/basic/tmpfile-util.c', + 'systemd/src/basic/utf8.c', + 'systemd/src/basic/util.c', + 'systemd/src/shared/dns-domain.c', + 'systemd/nm-sd-utils-shared.c', ) -shared_nm_udev_aux_dep = declare_dependency( - link_with: shared_nm_udev_aux, - include_directories: [ - top_inc, - shared_inc, - ], - dependencies: [ - glib_dep, - shared_nm_glib_aux_dep, - libudev_dep, - ], +incs = include_directories( + 'systemd/sd-adapt-shared', + 'systemd/src/basic', + 'systemd/src/shared', ) -############################################################################### +c_flags = [ + '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED', +] libnm_systemd_shared = static_library( 'nm-systemd-shared', - sources: files( - 'systemd/src/basic/alloc-util.c', - 'systemd/src/basic/escape.c', - 'systemd/src/basic/env-file.c', - 'systemd/src/basic/env-util.c', - 'systemd/src/basic/ether-addr-util.c', - 'systemd/src/basic/extract-word.c', - 'systemd/src/basic/fd-util.c', - 'systemd/src/basic/fileio.c', - 'systemd/src/basic/format-util.c', - 'systemd/src/basic/fs-util.c', - 'systemd/src/basic/hash-funcs.c', - 'systemd/src/basic/hashmap.c', - 'systemd/src/basic/hexdecoct.c', - 'systemd/src/basic/hostname-util.c', - 'systemd/src/basic/in-addr-util.c', - 'systemd/src/basic/io-util.c', - 'systemd/src/basic/memory-util.c', - 'systemd/src/basic/mempool.c', - 'systemd/src/basic/parse-util.c', - 'systemd/src/basic/path-util.c', - 'systemd/src/basic/prioq.c', - 'systemd/src/basic/process-util.c', - 'systemd/src/basic/random-util.c', - 'systemd/src/basic/socket-util.c', - 'systemd/src/basic/stat-util.c', - 'systemd/src/basic/string-table.c', - 'systemd/src/basic/string-util.c', - 'systemd/src/basic/strv.c', - 'systemd/src/basic/strxcpyx.c', - 'systemd/src/basic/time-util.c', - 'systemd/src/basic/tmpfile-util.c', - 'systemd/src/basic/utf8.c', - 'systemd/src/basic/util.c', - 'systemd/src/shared/dns-domain.c', - 'systemd/nm-sd-utils-shared.c', - ), - include_directories: include_directories( - 'systemd/sd-adapt-shared', - 'systemd/src/basic', - 'systemd/src/shared', - ), - dependencies: shared_nm_glib_aux_dep, - c_args: [ - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED', - '-DG_LOG_DOMAIN="libnm"', - ], + sources: sources, + include_directories: incs, + dependencies: glib_nm_default_dep, + c_args: c_flags, ) libnm_systemd_shared_dep = declare_dependency( - include_directories: include_directories( - 'systemd/sd-adapt-shared', - 'systemd/src/basic', - 'systemd/src/shared', - ), - dependencies: [ - shared_nm_glib_aux_dep, - ], - link_with: [ - libnm_systemd_shared, - ], + include_directories: incs, + dependencies: glib_dep, + link_with: libnm_systemd_shared, ) libnm_systemd_logging_stub = static_library( 'nm-systemd-logging-stub', - sources: files( - 'systemd/nm-logging-stub.c', - ), - include_directories: include_directories( - 'systemd/sd-adapt-shared', - 'systemd/src/basic', - ), - dependencies: shared_nm_glib_aux_dep, - c_args: [ - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED', - '-DG_LOG_DOMAIN="libnm"', - ], -) - -libnm_systemd_shared_no_logging_dep = declare_dependency( - dependencies: [ - libnm_systemd_shared_dep, - ], - link_with: [ - libnm_systemd_logging_stub, - ], + sources: 'systemd/nm-logging-stub.c', + dependencies: glib_nm_default_dep, + c_args: c_flags, ) if enable_tests diff --git a/shared/nm-utils/tests/meson.build b/shared/nm-utils/tests/meson.build index e0560f296d..1ee5efff95 100644 --- a/shared/nm-utils/tests/meson.build +++ b/shared/nm-utils/tests/meson.build @@ -1,17 +1,16 @@ test_unit = 'test-shared-general' +c_flags = [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)', +] + exe = executable( test_unit, test_unit + '.c', - c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)', - ], - dependencies: [ - shared_nm_glib_aux_dep, - libnm_systemd_shared_no_logging_dep, - shared_c_siphash_dep, - ], + c_args: c_flags, + dependencies: libnm_utils_base_dep, + link_with: libnm_systemd_logging_stub, ) test( diff --git a/src/devices/adsl/meson.build b/src/devices/adsl/meson.build index f92e809c97..a5d1c4b474 100644 --- a/src/devices/adsl/meson.build +++ b/src/devices/adsl/meson.build @@ -3,15 +3,11 @@ sources = files( 'nm-device-adsl.c', ) -deps = [ - libudev_dep, - nm_dep, -] - libnm_device_plugin_adsl = shared_module( 'nm-device-plugin-adsl', sources: sources, - dependencies: deps, + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, link_args: ldflags_linker_script_devices, link_depends: linker_script_devices, install: true, @@ -25,10 +21,3 @@ test( check_exports, args: [libnm_device_plugin_adsl.full_path(), linker_script_devices], ) - -# FIXME: check_so_symbols replacement -''' -check-local-devices-adsl: src/devices/adsl/libnm-device-plugin-adsl.la - $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/adsl/.libs/libnm-device-plugin-adsl.so "$(srcdir)/linker-script-devices.ver" - $(call check_so_symbols,$(builddir)/src/devices/adsl/.libs/libnm-device-plugin-adsl.so) -''' diff --git a/src/devices/bluetooth/meson.build b/src/devices/bluetooth/meson.build index 31fbf00674..63c47bcba9 100644 --- a/src/devices/bluetooth/meson.build +++ b/src/devices/bluetooth/meson.build @@ -5,8 +5,8 @@ sources = files( ) deps = [ + daemon_nm_default_dep, libnm_wwan_dep, - nm_dep, ] if enable_bluez5_dun @@ -19,6 +19,7 @@ libnm_device_plugin_bluetooth = shared_module( 'nm-device-plugin-bluetooth', sources: sources, dependencies: deps, + c_args: daemon_c_flags, link_args: ldflags_linker_script_devices, link_depends: linker_script_devices, install: true, @@ -34,9 +35,11 @@ test( args: [libnm_device_plugin_bluetooth.full_path(), linker_script_devices], ) -# FIXME: check_so_symbols replacement -''' -check-local-devices-bluetooth: src/devices/bluetooth/libnm-device-plugin-bluetooth.la - $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/bluetooth/.libs/libnm-device-plugin-bluetooth.so "$(srcdir)/linker-script-devices.ver" - $(call check_so_symbols,$(builddir)/src/devices/bluetooth/.libs/libnm-device-plugin-bluetooth.so) -''' +test_unit = 'nm-bt-test' + +executable( + test_unit, + 'tests/' + test_unit + '.c', + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, +) diff --git a/src/devices/ovs/meson.build b/src/devices/ovs/meson.build index 834b27b014..27e1b4d02c 100644 --- a/src/devices/ovs/meson.build +++ b/src/devices/ovs/meson.build @@ -7,14 +7,15 @@ sources = files( ) deps = [ + daemon_nm_default_dep, jansson_dep, - nm_dep, ] libnm_device_plugin_ovs = shared_module( 'nm-device-plugin-ovs', sources: sources, dependencies: deps, + c_args: daemon_c_flags, link_args: ldflags_linker_script_devices, link_depends: linker_script_devices, install: true, @@ -28,10 +29,3 @@ test( check_exports, args: [libnm_device_plugin_ovs.full_path(), linker_script_devices], ) - -# FIXME: check_so_symbols replacement -''' -check-local-devices-ovs: src/devices/ovs/libnm-device-plugin-ovs.la - $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/ovs/.libs/libnm-device-plugin-ovs.so "$(srcdir)/linker-script-devices.ver" - $(call check_so_symbols,$(builddir)/src/devices/ovs/.libs/libnm-device-plugin-ovs.so) -''' diff --git a/src/devices/team/meson.build b/src/devices/team/meson.build index 3f755012b2..0e63183b5e 100644 --- a/src/devices/team/meson.build +++ b/src/devices/team/meson.build @@ -4,15 +4,16 @@ sources = files( ) deps = [ + daemon_nm_default_dep, jansson_dep, libteamdctl_dep, - nm_dep, ] libnm_device_plugin_team = shared_module( 'nm-device-plugin-team', sources: sources, dependencies: deps, + c_args: daemon_c_flags, link_args: ldflags_linker_script_devices, link_depends: linker_script_devices, install: true, @@ -26,10 +27,3 @@ test( check_exports, args: [libnm_device_plugin_team.full_path(), linker_script_devices], ) - -# FIXME: check_so_symbols replacement -''' -check-local-devices-team: src/devices/team/libnm-device-plugin-team.la - $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/team/.libs/libnm-device-plugin-team.so "$(srcdir)/linker-script-devices.ver" - $(call check_so_symbols,$(builddir)/src/devices/team/.libs/libnm-device-plugin-team.so) -''' diff --git a/src/devices/tests/meson.build b/src/devices/tests/meson.build index 4b4c5c7ee5..bb53d1ee47 100644 --- a/src/devices/tests/meson.build +++ b/src/devices/tests/meson.build @@ -7,8 +7,10 @@ foreach test_unit: test_units exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) + test( 'devices/' + test_unit, test_script, diff --git a/src/devices/wifi/meson.build b/src/devices/wifi/meson.build index 4dfbe4c8da..6566f20119 100644 --- a/src/devices/wifi/meson.build +++ b/src/devices/wifi/meson.build @@ -19,14 +19,11 @@ if enable_iwd ) endif -deps = [ - nm_dep, -] - libnm_device_plugin_wifi = shared_module( 'nm-device-plugin-wifi', sources: sources, - dependencies: deps, + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, link_args: ldflags_linker_script_devices, link_depends: linker_script_devices, install: true, @@ -41,13 +38,20 @@ test( args: [libnm_device_plugin_wifi.full_path(), linker_script_devices], ) -# FIXME: check_so_symbols replacement -''' -check-local-devices-wifi: src/devices/wifi/libnm-device-plugin-wifi.la - $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/wifi/.libs/libnm-device-plugin-wifi.so "$(srcdir)/linker-script-devices.ver" - $(call check_so_symbols,$(builddir)/src/devices/wifi/.libs/libnm-device-plugin-wifi.so) -''' - if enable_tests - subdir('tests') + test_unit = 'test-devices-wifi' + + exe = executable( + test_unit, + ['tests/' + test_unit + '.c'] + common_sources, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, + ) + + test( + test_unit, + test_script, + args: test_args + [exe.full_path()], + timeout: default_test_timeout, + ) endif diff --git a/src/devices/wifi/tests/meson.build b/src/devices/wifi/tests/meson.build deleted file mode 100644 index ba756d531b..0000000000 --- a/src/devices/wifi/tests/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -test_unit = 'test-devices-wifi' - -exe = executable( - test_unit, - [test_unit + '.c'] + common_sources, - dependencies: test_nm_dep, -) - -test( - test_unit, - test_script, - args: test_args + [exe.full_path()], - timeout: default_test_timeout, -) diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 363e522bf1..ed6f801058 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -1,14 +1,15 @@ -sources = files( +nm_service_providers_source = files('nm-service-providers.c') + +sources = nm_service_providers_source + files( 'nm-modem-broadband.c', 'nm-modem.c', 'nm-modem-manager.c', - 'nm-service-providers.c', ) deps = [ + daemon_nm_default_dep, libsystemd_dep, mm_glib_dep, - nm_dep, ] if enable_ofono @@ -21,9 +22,8 @@ libnm_wwan = shared_module( 'nm-wwan', sources: sources, dependencies: deps, - link_args: [ - '-Wl,--version-script,@0@'.format(linker_script), - ], + c_args: daemon_c_flags, + link_args: '-Wl,--version-script,@0@'.format(linker_script), link_depends: linker_script, install: true, install_dir: nm_plugindir, @@ -53,6 +53,7 @@ libnm_device_plugin_wwan = shared_module( 'nm-device-plugin-wwan', sources: sources, dependencies: deps, + c_args: daemon_c_flags, link_with: libnm_wwan, link_args: ldflags_linker_script_devices, link_depends: linker_script_devices, @@ -69,15 +70,21 @@ run_target( depends: libnm_device_plugin_wwan, ) -# FIXME: check_so_symbols replacement -''' -check-local-devices-wwan: src/devices/wwan/libnm-device-plugin-wwan.la src/devices/wwan/libnm-wwan.la - $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/wwan/.libs/libnm-device-plugin-wwan.so "$(srcdir)/linker-script-devices.ver" - $(call check_so_symbols,$(builddir)/src/devices/wwan/.libs/libnm-device-plugin-wwan.so) - $(srcdir)/tools/check-exports.sh $(builddir)/src/devices/wwan/.libs/libnm-wwan.so "$(srcdir)/src/devices/wwan/libnm-wwan.ver" - $(call check_so_symbols,$(builddir)/src/devices/wwan/.libs/libnm-wwan.so) -''' - if enable_tests - subdir('tests') + test_unit = 'test-service-providers' + + exe = executable( + test_unit, + ['tests/' + test_unit + '.c'] + nm_service_providers_source, + include_directories: wwan_inc, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, + ) + + test( + 'wwan/' + test_unit, + test_script, + timeout: default_test_timeout, + args: test_args + [exe.full_path()], + ) endif diff --git a/src/devices/wwan/tests/meson.build b/src/devices/wwan/tests/meson.build deleted file mode 100644 index 64dd76742a..0000000000 --- a/src/devices/wwan/tests/meson.build +++ /dev/null @@ -1,13 +0,0 @@ -exe = executable( - 'test-service-providers', - sources: files('test-service-providers.c', - '../nm-service-providers.c'), - dependencies: test_nm_dep, - include_directories: wwan_inc, -) -test( - 'wwan/test-service-providers', - test_script, - timeout: default_test_timeout, - args: test_args + [exe.full_path()], -) diff --git a/src/dhcp/meson.build b/src/dhcp/meson.build index c1f28be0e3..609fe663ac 100644 --- a/src/dhcp/meson.build +++ b/src/dhcp/meson.build @@ -1,6 +1,6 @@ name = 'nm-dhcp-helper' -cflags = [ +c_flags = [ '-DG_LOG_DOMAIN="@0@"'.format(name), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_GLIB', ] @@ -8,8 +8,8 @@ cflags = [ executable( name, name + '.c', - dependencies: libnm_core_dep, - c_args: cflags, + dependencies: glib_nm_default_dep, + c_args: c_flags, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/src/dhcp/tests/meson.build b/src/dhcp/tests/meson.build index 43b33951ca..031e2efdbc 100644 --- a/src/dhcp/tests/meson.build +++ b/src/dhcp/tests/meson.build @@ -7,7 +7,8 @@ foreach test_unit: test_units exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( diff --git a/src/dnsmasq/tests/meson.build b/src/dnsmasq/tests/meson.build index 09ef52e505..6e4298997f 100644 --- a/src/dnsmasq/tests/meson.build +++ b/src/dnsmasq/tests/meson.build @@ -3,7 +3,8 @@ test_unit = 'test-dnsmasq-utils' exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( diff --git a/src/initrd/meson.build b/src/initrd/meson.build index acef8c4eac..09036f27c4 100644 --- a/src/initrd/meson.build +++ b/src/initrd/meson.build @@ -4,24 +4,26 @@ sources = files( 'nmi-ibft-reader.c', ) -nm_cflags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON'] - libnmi_core = static_library( 'nmi-core', - c_args: nm_cflags, sources: sources, - include_directories: src_inc, - dependencies: libnm_core_dep, + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, ) name = 'nm-initrd-generator' + +links = [ + libnetwork_manager_base, + libnmi_core, +] + executable( name, name + '.c', - c_args: nm_cflags, - include_directories: src_inc, - dependencies: [ libnm_core_dep ], - link_with: [libnetwork_manager_base, libnmi_core], + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, + link_with: links, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/src/initrd/tests/meson.build b/src/initrd/tests/meson.build index 6a508d3d8b..5dd2873cc1 100644 --- a/src/initrd/tests/meson.build +++ b/src/initrd/tests/meson.build @@ -1,21 +1,20 @@ +c_flags = test_c_flags + ['-DTEST_INITRD_DIR="@0@"'.format(meson.current_source_dir())] + test_units = [ 'test-dt-reader', 'test-ibft-reader', 'test-cmdline-reader', ] -cflags = [ - '-DTEST_INITRD_DIR="@0@"'.format(meson.current_source_dir()), -] - foreach test_unit : test_units exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, - c_args: cflags, + dependencies: libnetwork_manager_test_dep, + c_args: c_flags, link_with: libnmi_core, ) + test( 'initrd/' + test_unit, test_script, diff --git a/src/meson.build b/src/meson.build index a9e7601de6..748fa519bc 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,5 +1,11 @@ src_inc = include_directories('.') +daemon_nm_default_dep = declare_dependency( + sources: libnm_core_enum_sources[1], + include_directories: src_inc, + dependencies: libnm_core_nm_default_dep, +) + install_data( 'org.freedesktop.NetworkManager.conf', install_dir: dbus_conf_dir, @@ -9,15 +15,7 @@ subdir('systemd') core_plugins = [] -nm_cflags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON'] - -nm_dep = declare_dependency( - include_directories: src_inc, - dependencies: libnm_core_dep, - compile_args: nm_cflags, -) - -cflags = nm_cflags +daemon_c_flags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON'] sources = files( 'dhcp/nm-dhcp-client.c', @@ -49,10 +47,13 @@ sources = files( ) deps = [ + daemon_nm_default_dep, + libn_dhcp4_dep, + libnm_core_dep, + libnm_systemd_shared_dep, + libnm_udev_aux_dep, libsystemd_dep, libudev_dep, - libnm_core_dep, - shared_n_dhcp4_dep, ] if enable_wext @@ -63,8 +64,7 @@ libnetwork_manager_base = static_library( nm_name + 'Base', sources: sources, dependencies: deps, - c_args: cflags, - link_with: libnm_core, + c_args: daemon_c_flags, ) sources = files( @@ -151,14 +151,20 @@ sources = files( ) nm_deps = [ + daemon_nm_default_dep, dl_dep, + libn_acd_dep, libndp_dep, libudev_dep, - libnm_core_dep, - shared_n_acd_dep, logind_dep, ] +nm_links = [ + libnetwork_manager_base, + libnm_systemd_core, + libnm_systemd_shared, +] + if enable_concheck nm_deps += libcurl_dep endif @@ -179,19 +185,15 @@ libnetwork_manager = static_library( nm_name, sources: sources, dependencies: nm_deps, - c_args: cflags, - link_with: [ - libnetwork_manager_base, - libnm_systemd_core, - libnm_systemd_shared, - ], + c_args: daemon_c_flags, + link_with: nm_links, ) deps = [ + daemon_nm_default_dep, dl_dep, libndp_dep, libudev_dep, - libnm_core_dep, ] name = 'nm-iface-helper' @@ -200,12 +202,8 @@ executable( name, name + '.c', dependencies: deps, - c_args: cflags, - link_with: [ - libnetwork_manager_base, - libnm_systemd_core, - libnm_systemd_shared, - ], + c_args: daemon_c_flags, + link_with: nm_links, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, @@ -213,46 +211,30 @@ executable( ) if enable_tests + test_c_flags = daemon_c_flags + ['-DNETWORKMANAGER_COMPILATION_TEST'] + if require_root_tests + test_c_flags += ['-DREQUIRE_ROOT_TESTS=1'] + endif + sources = files( 'ndisc/nm-fake-ndisc.c', 'platform/tests/test-common.c', 'platform/nm-fake-platform.c', ) - deps = [ - libudev_dep, - libnm_core_dep, - ] - - test_cflags = ['-DNETWORKMANAGER_COMPILATION_TEST'] - if require_root_tests - test_cflags += ['-DREQUIRE_ROOT_TESTS=1'] - endif - libnetwork_manager_test = static_library( nm_name + 'Test', sources: sources, - dependencies: deps, - c_args: cflags + test_cflags, + dependencies: daemon_nm_default_dep, + c_args: test_c_flags, link_with: libnetwork_manager, ) - test_nm_dep = declare_dependency( - dependencies: nm_dep, - compile_args: test_cflags, + libnetwork_manager_test_dep = declare_dependency( + dependencies: daemon_nm_default_dep, link_with: libnetwork_manager_test, ) - test_nm_dep_fake = declare_dependency( - dependencies: test_nm_dep, - compile_args: ['-DSETUP=nm_fake_platform_setup'] - ) - - test_nm_dep_linux = declare_dependency( - dependencies: test_nm_dep, - compile_args: ['-DSETUP=nm_linux_platform_setup'] - ) - subdir('dnsmasq/tests') subdir('ndisc/tests') subdir('platform/tests') @@ -272,7 +254,7 @@ subdir('settings/plugins') # NetworkManager binary -create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh') +create_exports_networkmanager = join_paths(source_root, 'tools', 'create-exports-NetworkManager.sh') symbol_map_name = 'NetworkManager.ver' # libNetworkManager.a, as built by meson doesn't contain all symbols @@ -283,28 +265,30 @@ symbol_map_name = 'NetworkManager.ver' network_manager_sym = executable( 'nm-full-symbols', 'main.c', - c_args: nm_cflags, - link_args: '-Wl,--no-gc-sections', dependencies: nm_deps, + c_args: daemon_c_flags, + link_args: '-Wl,--no-gc-sections', link_whole: [libnetwork_manager, libnetwork_manager_base, libnm_core], - install: false, ) # this uses symbols from nm-full-symbols instead of libNetworkManager.a ver_script = custom_target( symbol_map_name, output: symbol_map_name, - depends: [ network_manager_sym, core_plugins ], - command: [create_exports_networkmanager, '--called-from-build', meson.source_root()], + depends: [network_manager_sym, core_plugins], + command: [create_exports_networkmanager, '--called-from-build', source_root], ) -ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())] +ldflags = [ + '-rdynamic', + '-Wl,--version-script,@0@'.format(ver_script.full_path()), +] network_manager = executable( nm_name, 'main.c', dependencies: nm_deps, - c_args: nm_cflags, + c_args: daemon_c_flags, link_with: libnetwork_manager, link_args: ldflags, link_depends: ver_script, @@ -313,16 +297,20 @@ network_manager = executable( ) if enable_tests - foreach plugin : core_plugins - test ('sym/' + plugin.full_path().split('/')[-1], - network_manager, - args: '--version', - env: ['LD_BIND_NOW=1', 'LD_PRELOAD=' + plugin.full_path()]) + foreach plugin: core_plugins + plugin_path = plugin.full_path() + + test( + 'sym/' + plugin_path.split('/')[-1], + network_manager, + args: '--version', + env: ['LD_BIND_NOW=1', 'LD_PRELOAD=' + plugin_path], + ) endforeach endif test( 'check-config-options', - find_program(join_paths(meson.source_root(), 'tools', 'check-config-options.sh')), - args: [meson.source_root()] + find_program(join_paths(source_root, 'tools', 'check-config-options.sh')), + args: source_root, ) diff --git a/src/ndisc/tests/meson.build b/src/ndisc/tests/meson.build index 99cf664e83..c81e24ad4c 100644 --- a/src/ndisc/tests/meson.build +++ b/src/ndisc/tests/meson.build @@ -3,7 +3,8 @@ test_unit = 'test-ndisc-fake' exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep_fake, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( @@ -18,5 +19,6 @@ test = 'test-ndisc-linux' exe = executable( test, test + '.c', - dependencies: test_nm_dep_linux, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) diff --git a/src/platform/tests/meson.build b/src/platform/tests/meson.build index aaee8964eb..6f7173b6da 100644 --- a/src/platform/tests/meson.build +++ b/src/platform/tests/meson.build @@ -1,21 +1,25 @@ +test_fake_c_flags = test_c_flags + ['-DSETUP=nm_fake_platform_setup'] +test_linux_c_flags = test_c_flags + ['-DSETUP=nm_linux_platform_setup'] + test_units = [ - [ 'test-address-fake', 'test-address.c', test_nm_dep_fake, default_test_timeout ], - [ 'test-address-linux', 'test-address.c', test_nm_dep_linux, default_test_timeout ], - [ 'test-cleanup-fake', 'test-cleanup.c', test_nm_dep_fake, default_test_timeout ], - [ 'test-cleanup-linux', 'test-cleanup.c', test_nm_dep_linux, default_test_timeout ], - [ 'test-link-fake', 'test-link.c', test_nm_dep_fake, default_test_timeout ], - [ 'test-link-linux', 'test-link.c', test_nm_dep_linux, 900 ], - [ 'test-nmp-object', 'test-nmp-object.c', test_nm_dep, default_test_timeout ], - [ 'test-platform-general', 'test-platform-general.c', test_nm_dep, default_test_timeout ], - [ 'test-route-fake', 'test-route.c', test_nm_dep_fake, default_test_timeout ], - [ 'test-route-linux', 'test-route.c', test_nm_dep_linux, default_test_timeout ], + ['test-address-fake', 'test-address.c', test_fake_c_flags, default_test_timeout], + ['test-address-linux', 'test-address.c', test_linux_c_flags, default_test_timeout], + ['test-cleanup-fake', 'test-cleanup.c', test_fake_c_flags, default_test_timeout], + ['test-cleanup-linux', 'test-cleanup.c', test_linux_c_flags, default_test_timeout], + ['test-link-fake', 'test-link.c', test_fake_c_flags, default_test_timeout], + ['test-link-linux', 'test-link.c', test_linux_c_flags, 900], + ['test-nmp-object', 'test-nmp-object.c', test_c_flags, default_test_timeout], + ['test-platform-general', 'test-platform-general.c', test_c_flags, default_test_timeout], + ['test-route-fake', 'test-route.c', test_fake_c_flags, default_test_timeout], + ['test-route-linux', 'test-route.c', test_linux_c_flags, default_test_timeout], ] foreach test_unit: test_units exe = executable( test_unit[0], test_unit[1], - dependencies: test_unit[2], + dependencies: libnetwork_manager_test_dep, + c_args: test_unit[2], ) test( 'platform/' + test_unit[0], @@ -25,8 +29,11 @@ foreach test_unit: test_units ) endforeach +name = 'monitor' + executable( - 'monitor', - 'monitor.c', - dependencies: test_nm_dep, + name, + name + '.c', + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) diff --git a/src/ppp/meson.build b/src/ppp/meson.build index 04c539e3de..0c458768f3 100644 --- a/src/ppp/meson.build +++ b/src/ppp/meson.build @@ -1,39 +1,30 @@ name = 'nm-pppd-plugin' -deps = [ - dl_dep, - libnm_core_dep, +c_flags = [ + '-DG_LOG_DOMAIN="@0@"'.format(name), + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_GLIB', ] nm_pppd_plugin = shared_module( name, name_prefix: '', sources: name + '.c', - include_directories: src_inc, - dependencies: deps, - c_args: [ - '-DG_LOG_DOMAIN="@0@"'.format(name), - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_GLIB', - ], + dependencies: libnm_core_nm_default_dep, + c_args: c_flags, install: true, install_dir: pppd_plugin_dir, ) name = 'nm-ppp-plugin' -deps = [ - nm_dep, -] - linker_script = join_paths(meson.current_source_dir(), 'nm-ppp-plugin.ver') core_plugins += shared_module( name, sources: 'nm-ppp-manager.c', - dependencies: deps, - link_args: [ - '-Wl,--version-script,@0@'.format(linker_script), - ], + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, + link_args: '-Wl,--version-script,@0@'.format(linker_script), link_depends: linker_script, install: true, install_dir: nm_plugindir, diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index 58acdcfcb1..d9dd3edba5 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -25,23 +25,24 @@ core_sources = files( 'shvar.c', ) -deps = [ - nm_dep, -] - libnms_ifcfg_rh_core = static_library( 'nms-ifcfg-rh-core', sources: core_sources, - dependencies: deps, + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, ) -sources = [dbus_sources] + core_sources + files('nms-ifcfg-rh-storage.c', 'nms-ifcfg-rh-plugin.c') +sources = [dbus_sources] + core_sources + files( + 'nms-ifcfg-rh-storage.c', + 'nms-ifcfg-rh-plugin.c', +) libnm_settings_plugin_ifcfg_rh = shared_module( 'nm-settings-plugin-ifcfg-rh', sources: sources, - dependencies: deps, - link_with: [libnms_ifcfg_rh_core], + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, + link_with: libnms_ifcfg_rh_core, link_args: ldflags_linker_script_settings, link_depends: linker_script_settings, install: true, @@ -50,27 +51,17 @@ libnm_settings_plugin_ifcfg_rh = shared_module( core_plugins += libnm_settings_plugin_ifcfg_rh -# FIXME: check_so_symbols replacement -''' -run_target( - 'check-local-symbols-settings-ifcfg-rh', - command: [check_so_symbols, libnm_settings_plugin_ifcfg_rh.full_path()], - depends: libnm_settings_plugin_ifcfg_rh, -) - -check-local-symbols-settings-ifcfg-rh: src/settings/plugins/ifcfg-rh/libnm-settings-plugin-ifcfg-rh.la - $(call check_so_symbols,$(builddir)/src/settings/plugins/ifcfg-rh/.libs/libnm-settings-plugin-ifcfg-rh.so) -''' +data = [ + 'nm-ifdown', + 'nm-ifup', +] install_data( - ['nm-ifup', 'nm-ifdown'], + data, install_dir: nm_libexecdir, install_mode: 'rwxr-xr-x', ) -meson.add_install_script('sh', '-c', - 'mkdir -p $DESTDIR/@0@/sysconfig/network-scripts'.format(nm_sysconfdir)) - if enable_tests subdir('tests') endif diff --git a/src/settings/plugins/ifcfg-rh/tests/meson.build b/src/settings/plugins/ifcfg-rh/tests/meson.build index f65494bb45..216990457a 100644 --- a/src/settings/plugins/ifcfg-rh/tests/meson.build +++ b/src/settings/plugins/ifcfg-rh/tests/meson.build @@ -1,11 +1,10 @@ test_unit = 'test-ifcfg-rh' -test_ifcfg_dir = meson.current_source_dir() - exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, link_with: libnms_ifcfg_rh_core, ) diff --git a/src/settings/plugins/ifupdown/meson.build b/src/settings/plugins/ifupdown/meson.build index 365ae1a9c5..0cabe771fe 100644 --- a/src/settings/plugins/ifupdown/meson.build +++ b/src/settings/plugins/ifupdown/meson.build @@ -3,25 +3,18 @@ sources = files( 'nms-ifupdown-parser.c', ) -deps = [ - libudev_dep, - nm_dep, -] - libnms_ifupdown_core = static_library( 'nms-ifupdown-core', sources: sources, - dependencies: deps, -) - -sources = files( - 'nms-ifupdown-plugin.c', + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, ) libnm_settings_plugin_ifupdown = shared_module( 'nm-settings-plugin-ifupdown', - sources: sources, - dependencies: deps, + sources: 'nms-ifupdown-plugin.c', + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, link_with: libnms_ifupdown_core, link_args: ldflags_linker_script_settings, link_depends: linker_script_settings, @@ -31,18 +24,6 @@ libnm_settings_plugin_ifupdown = shared_module( core_plugins += libnm_settings_plugin_ifupdown -# FIXME: check_so_symbols replacement -''' -run_target( - 'check-local-symbols-settings-ifupdown', - command: [check_so_symbols, libnm_settings_plugin_ifupdown.full_path()], - depends: libnm_settings_plugin_ifupdown, -) - -check-local-symbols-settings-ifupdown: src/settings/plugins/ifupdown/libnm-settings-plugin-ifupdown.la - $(call check_so_symbols,$(builddir)/src/settings/plugins/ifupdown/.libs/libnm-settings-plugin-ifupdown.so) -''' - if enable_tests subdir('tests') endif diff --git a/src/settings/plugins/ifupdown/tests/meson.build b/src/settings/plugins/ifupdown/tests/meson.build index 9b844c75c0..1ca094b52c 100644 --- a/src/settings/plugins/ifupdown/tests/meson.build +++ b/src/settings/plugins/ifupdown/tests/meson.build @@ -3,7 +3,8 @@ test_unit = 'test-ifupdown' exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, link_with: libnms_ifupdown_core, ) diff --git a/src/settings/plugins/keyfile/tests/meson.build b/src/settings/plugins/keyfile/tests/meson.build index f1e96bdfe3..7bf9fda001 100644 --- a/src/settings/plugins/keyfile/tests/meson.build +++ b/src/settings/plugins/keyfile/tests/meson.build @@ -3,7 +3,8 @@ test_unit = 'test-keyfile-settings' exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( diff --git a/src/supplicant/tests/meson.build b/src/supplicant/tests/meson.build index fbccb3134c..207d22f874 100644 --- a/src/supplicant/tests/meson.build +++ b/src/supplicant/tests/meson.build @@ -3,7 +3,8 @@ test_unit = 'test-supplicant-config' exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( diff --git a/src/systemd/meson.build b/src/systemd/meson.build index af1d0c8b35..5c4fa3e2ad 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -1,45 +1,48 @@ +sources = files( + 'src/libsystemd-network/arp-util.c', + 'src/libsystemd-network/dhcp-identifier.c', + 'src/libsystemd-network/dhcp-network.c', + 'src/libsystemd-network/dhcp-option.c', + 'src/libsystemd-network/dhcp-packet.c', + 'src/libsystemd-network/dhcp6-network.c', + 'src/libsystemd-network/dhcp6-option.c', + 'src/libsystemd-network/lldp-neighbor.c', + 'src/libsystemd-network/lldp-network.c', + 'src/libsystemd-network/network-internal.c', + 'src/libsystemd-network/sd-dhcp-client.c', + 'src/libsystemd-network/sd-dhcp-lease.c', + 'src/libsystemd-network/sd-dhcp6-client.c', + 'src/libsystemd-network/sd-dhcp6-lease.c', + 'src/libsystemd-network/sd-ipv4acd.c', + 'src/libsystemd-network/sd-ipv4ll.c', + 'src/libsystemd-network/sd-lldp.c', + 'src/libsystemd/sd-event/event-util.c', + 'src/libsystemd/sd-event/sd-event.c', + 'src/libsystemd/sd-id128/id128-util.c', + 'src/libsystemd/sd-id128/sd-id128.c', + 'nm-sd.c', + 'nm-sd-utils-core.c', + 'nm-sd-utils-dhcp.c', + 'sd-adapt-core/nm-sd-adapt-core.c', +) + +incs = include_directories( + 'sd-adapt-core', + 'src/libsystemd-network', + 'src/libsystemd/sd-event', + 'src/systemd', +) + +deps = [ + daemon_nm_default_dep, + libnm_systemd_shared_dep, +] + libnm_systemd_core = static_library( 'nm-systemd-core', - sources: files( - 'sd-adapt-core/nm-sd-adapt-core.c', - 'src/libsystemd-network/arp-util.c', - 'src/libsystemd-network/dhcp-identifier.c', - 'src/libsystemd-network/dhcp-network.c', - 'src/libsystemd-network/dhcp-option.c', - 'src/libsystemd-network/dhcp-packet.c', - 'src/libsystemd-network/dhcp6-network.c', - 'src/libsystemd-network/dhcp6-option.c', - 'src/libsystemd-network/lldp-neighbor.c', - 'src/libsystemd-network/lldp-network.c', - 'src/libsystemd-network/network-internal.c', - 'src/libsystemd-network/sd-dhcp-client.c', - 'src/libsystemd-network/sd-dhcp-lease.c', - 'src/libsystemd-network/sd-dhcp6-client.c', - 'src/libsystemd-network/sd-dhcp6-lease.c', - 'src/libsystemd-network/sd-ipv4acd.c', - 'src/libsystemd-network/sd-ipv4ll.c', - 'src/libsystemd-network/sd-lldp.c', - 'src/libsystemd/sd-event/event-util.c', - 'src/libsystemd/sd-event/sd-event.c', - 'src/libsystemd/sd-id128/id128-util.c', - 'src/libsystemd/sd-id128/sd-id128.c', - 'nm-sd.c', - 'nm-sd-utils-core.c', - 'nm-sd-utils-dhcp.c', - ), - include_directories: [ - src_inc, - include_directories( - 'sd-adapt-core', - 'src/libsystemd-network', - 'src/libsystemd/sd-event', - 'src/systemd', - ) - ], - dependencies: [ - libnm_core_dep, - ], - c_args: [ - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD', - ], + sources: sources, + include_directories: incs, + dependencies: deps, + c_args: '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD', + link_with: libc_siphash, ) diff --git a/src/tests/config/meson.build b/src/tests/config/meson.build index f65f90bb80..e3ebfa199e 100644 --- a/src/tests/config/meson.build +++ b/src/tests/config/meson.build @@ -1,3 +1,5 @@ +test_config_dir = meson.current_source_dir() + test_unit = 'test-config' sources = files( @@ -5,12 +7,11 @@ sources = files( 'test-config.c', ) -test_config_dir = meson.current_source_dir() - exe = executable( test_unit, sources, - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( diff --git a/src/tests/meson.build b/src/tests/meson.build index b2bc13ab37..ac877e184a 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -14,7 +14,8 @@ foreach test_unit: test_units exe = executable( test_unit, test_unit + '.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( @@ -27,21 +28,22 @@ endforeach test_unit = 'test-systemd' -cflags = [ +c_flags = [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD', ] +links = [ + libnm_systemd_core, + libnm_systemd_shared, +] + exe = executable( test_unit, test_unit + '.c', - include_directories: src_inc, - dependencies: libnm_core_dep, - c_args: cflags, - link_with: [ - libnm_systemd_core, - libnm_systemd_shared, - ], + dependencies: daemon_nm_default_dep, + c_args: c_flags, + link_with: links, ) test( diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh index 76b44371b1..aaf3576da4 100755 --- a/tools/meson-post-install.sh +++ b/tools/meson-post-install.sh @@ -49,3 +49,7 @@ if [ "$6" = install_docs ]; then ln -f "${DESTDIR}${mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${mandir}/man5/nm-system-settings.conf.5" fi +if [ "$8" = create_network_scripts ]; then + sysconfdir=$9 + mkdir -p "${DESTDIR}${sysconfdir}/sysconfig/network-scripts" +fi |