From bfbcf8f3febcba7379f887430c5da16e03e0cf47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 28 Aug 2019 10:40:46 +0200 Subject: [PATCH 01/41] meson: Use generators placeholders Functions derived from generators as `configure_file`, `custom_target` and `i18n.merge_file` can use placeholders like `@BASENAME@` that removes the extension from the input filename string. The output string has been replaced by this placeholder that allows in some cases the use of less variables. --- clients/common/meson.build | 2 +- data/meson.build | 22 ++++++++++------------ dispatcher/meson.build | 5 ++--- docs/api/meson.build | 4 ++-- docs/libnm/meson.build | 4 ++-- docs/meson.build | 2 -- man/meson.build | 6 ++---- meson.build | 8 +++----- shared/meson.build | 2 +- 9 files changed, 23 insertions(+), 32 deletions(-) diff --git a/clients/common/meson.build b/clients/common/meson.build index fed0f3bf81..303b99e7f4 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -45,7 +45,7 @@ if enable_introspection else settings_docs_source = configure_file( input: settings_docs + '.in', - output: settings_docs, + output: '@BASENAME@', configuration: configuration_data(), ) endif diff --git a/data/meson.build b/data/meson.build index 9025eae452..b8e2e117ee 100644 --- a/data/meson.build +++ b/data/meson.build @@ -6,31 +6,29 @@ 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 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, + input: service, + output: '@BASENAME@', install_dir: systemd_system_unit_dir, configuration: data_conf, ) @@ -62,14 +60,14 @@ 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, diff --git a/dispatcher/meson.build b/dispatcher/meson.build index 0706ab07a2..e9f3723c25 100644 --- a/dispatcher/meson.build +++ b/dispatcher/meson.build @@ -8,11 +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, + input: 'org.freedesktop.nm_dispatcher.service.in', + output: '@BASENAME@', install_dir: dbus_sys_dir, configuration: service_conf, ) diff --git a/docs/api/meson.build b/docs/api/meson.build index 62c5b8c926..3ea2edd5fe 100644 --- a/docs/api/meson.build +++ b/docs/api/meson.build @@ -15,8 +15,8 @@ if enable_introspection endif configure_file( - input: version_xml + '.in', - output: version_xml, + input: 'version.xml.in', + output: '@BASENAME@', configuration: version_conf, ) diff --git a/docs/libnm/meson.build b/docs/libnm/meson.build index b4a23729bb..7da4061a3d 100644 --- a/docs/libnm/meson.build +++ b/docs/libnm/meson.build @@ -27,8 +27,8 @@ private_headers = [ ] configure_file( - input: version_xml + '.in', - output: version_xml, + input: 'version.xml.in', + output: '@BASENAME@', configuration: version_conf, ) diff --git a/docs/meson.build b/docs/meson.build index cc814b77e7..f89592ab3d 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -1,8 +1,6 @@ version_conf = configuration_data() version_conf.set('VERSION', nm_version) -version_xml = 'version.xml' - subdir('libnm') subdir('api') 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..1b7ff0fb81 100644 --- a/meson.build +++ b/meson.build @@ -847,11 +847,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, ) @@ -879,7 +877,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, ) diff --git a/shared/meson.build b/shared/meson.build index aa10f792f8..4c8b58c84f 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -132,7 +132,7 @@ version_conf.set('NM_MICRO_VERSION', nm_micro_version) version_header = configure_file( input: 'nm-version-macros.h.in', - output: 'nm-version-macros.h', + output: '@BASENAME@', configuration: version_conf, ) From 48bb5b68e3d7dd44d9130e059ef99c14fb5ca457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 28 Aug 2019 11:44:05 +0200 Subject: [PATCH 02/41] meson: Define meson information early The used meson modules, default directories and includes have been moved to the start of the build file, just after project related information, so they are available early. --- meson.build | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/meson.build b/meson.build index 1b7ff0fb81..69408ad348 100644 --- a/meson.build +++ b/meson.build @@ -65,6 +65,24 @@ libnm_pkgincludedir = join_paths(nm_includedir, libnm_name) nm_debug = get_option('buildtype').contains('debug') +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@'] + +top_inc = include_directories('.') + +perl = find_program('perl') +xsltproc = find_program('xsltproc') + +check_exports = find_program(join_paths(meson.source_root(), 'tools', 'check-exports.sh')) + cc = meson.get_compiler('c') config_h = configuration_data() @@ -783,22 +801,6 @@ 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: @@ -814,8 +816,6 @@ check_so_symbols = \ 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') From 82e79e40a5ca05b5fa9a40cfb55c9c775ac8c849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 28 Aug 2019 11:54:11 +0200 Subject: [PATCH 03/41] meson: Avoid the use of source_root and build_root methods The way some directory paths are defined has also been changed to avoid the use of the `source_root` and `build_root` functions because they are discouraged[0] [0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting --- clients/common/meson.build | 4 ++-- docs/meson.build | 4 ++-- introspection/meson.build | 2 +- libnm-core/meson.build | 2 +- meson.build | 21 ++++++++++++--------- src/meson.build | 8 ++++---- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/clients/common/meson.build b/clients/common/meson.build index 303b99e7f4..324abb441a 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -39,8 +39,8 @@ 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( diff --git a/docs/meson.build b/docs/meson.build index f89592ab3d..e9768e5275 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -6,6 +6,6 @@ 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/introspection/meson.build b/introspection/meson.build index 631432a7a2..03cfa46243 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 diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 9637afaad5..16cec096ff 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -293,7 +293,7 @@ shared_nm_libnm_core_aux_dep = declare_dependency( ############################################################################### -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'], diff --git a/meson.build b/meson.build index 69408ad348..9dc059ee64 100644 --- a/meson.build +++ b/meson.build @@ -69,6 +69,9 @@ 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') @@ -81,7 +84,7 @@ top_inc = include_directories('.') perl = find_program('perl') xsltproc = find_program('xsltproc') -check_exports = find_program(join_paths(meson.source_root(), 'tools', 'check-exports.sh')) +check_exports = find_program(join_paths(source_root, 'tools', 'check-exports.sh')) cc = meson.get_compiler('c') @@ -190,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) ] @@ -736,7 +739,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') @@ -749,13 +752,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 : '', @@ -866,8 +869,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 diff --git a/src/meson.build b/src/meson.build index a9e7601de6..84bad00407 100644 --- a/src/meson.build +++ b/src/meson.build @@ -272,7 +272,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 @@ -295,7 +295,7 @@ 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()], + command: [create_exports_networkmanager, '--called-from-build', source_root], ) ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())] @@ -323,6 +323,6 @@ 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, ) From 31a2710f113ba8b335cdb3cc972b1e7cb91e40d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 28 Aug 2019 22:31:29 +0200 Subject: [PATCH 04/41] meson: Simplified WiFi detection when IWD is enabled --- meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 9dc059ee64..85b5f6a306 100644 --- a/meson.build +++ b/meson.build @@ -280,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') From c74e428342c0219bb54d6cffe24bd0423bcda532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Tue, 3 Sep 2019 09:48:59 +0200 Subject: [PATCH 05/41] meson: Improve the shared build file The `shared` build file has been improved by applying a set of changes: - Indentation has been fixed to be consistent. - Unused libraries and dependencies have been removed. - Dependencies have been reviewed to store the necessary data. - Set of objects used in targets have been grouped together. - Header files have been removed from sources lists as it's unnecessary. - Library variable names have been changed to `lib{name}` pattern following their filename pattern. - `shared` prefix has been removed from all variables using it. - `version_header` its related configuration `version_conf` variables have been renamed to `nm_version_macro*` following its input and final file names. --- clients/common/meson.build | 2 +- libnm-core/meson.build | 51 +-- libnm-core/tests/meson.build | 10 +- libnm/meson.build | 17 +- libnm/tests/meson.build | 10 +- shared/meson.build | 519 +++++++++++++----------------- shared/nm-utils/tests/meson.build | 7 +- src/meson.build | 5 +- 8 files changed, 256 insertions(+), 365 deletions(-) diff --git a/clients/common/meson.build b/clients/common/meson.build index 324abb441a..5ba5c9dbb7 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -55,7 +55,7 @@ libnmc = static_library( sources: files( 'nm-meta-setting-access.c', 'nm-meta-setting-desc.c', - ) + shared_nm_meta_setting_c + [settings_docs_source], + ) + nm_meta_setting_source + [settings_docs_source], dependencies: deps, c_args: cflags, link_with: libnmc_base, diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 16cec096ff..01317c7c98 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -129,7 +129,7 @@ libnm_core_sources = libnm_core_settings_sources + files( 'nm-vpn-plugin-info.c', ) -enum_headers = libnm_core_headers + [version_header] +enum_headers = libnm_core_headers + [nm_version_macro_header] enum_types = 'nm-core-enum-types' libnm_core_enum = gnome.mkenums( @@ -156,42 +156,25 @@ shared_nm_libnm_core_intern = static_library( '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', ], - include_directories: [ - top_inc, - shared_inc, - libnm_core_inc, - ], + include_directories: libnm_core_inc, dependencies: [ - glib_dep, - shared_c_siphash_dep, - shared_nm_glib_aux_dep, libnm_core_enum_dep, + libnm_utils_base_dep, ], ) shared_nm_libnm_core_intern_dep = declare_dependency( + dependencies: libnm_systemd_shared_dep, 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, + libnm_utils_base_dep, libudev_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, ] @@ -233,8 +216,8 @@ 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_sources_all += nm_meta_setting_source +libnm_core_sources_all += [nm_version_macro_header] libnm_core = static_library( 'nm-core', @@ -248,10 +231,8 @@ 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, + shared_nm_libnm_core_intern_dep, ], ) @@ -264,29 +245,17 @@ shared_nm_libnm_core_aux = static_library( '-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, - ], + include_directories: libnm_core_inc, dependencies: [ - glib_dep, - shared_c_siphash_dep, - shared_nm_glib_aux_dep, libnm_core_dep, + libnm_utils_base_dep, ], ) 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, ], ) diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index 1afb9c4b5c..61a9445099 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -33,15 +33,15 @@ 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, - ], + dependencies: libnm_core_dep, c_args: [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', ], - link_with: libnm_core, + link_with: [ + libnm_core, + libnm_systemd_logging_stub, + ], ) test( 'libnm-core/' + test_unit, diff --git a/libnm/meson.build b/libnm/meson.build index 0d7fb3acf2..fbe6f847b1 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -55,11 +55,11 @@ 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_headers = libnm_headers + [nm_version_macro_header] enum_types = 'nm-enum-types' libnm_enum = gnome.mkenums( @@ -137,12 +137,13 @@ liblibnm = static_library( libnmdbus_dep, dl_dep, libudev_dep, - shared_nm_glib_aux_dep, libnm_core_dep, + libnm_utils_base_dep, + libnm_udev_aux_dep, uuid_dep, - libnm_systemd_shared_no_logging_dep, ], c_args: cflags, + link_with: libnm_systemd_logging_stub, ) liblibnm_dep = declare_dependency( @@ -153,13 +154,13 @@ liblibnm_dep = declare_dependency( ], dependencies: [ libnm_core_dep, - libnm_systemd_shared_no_logging_dep, libnmdbus_dep, - shared_nm_glib_aux_dep, + libnm_utils_base_dep, libudev_dep, dl_dep, uuid_dep, ], + link_with: libnm_systemd_logging_stub, ) libnm = shared_library( @@ -170,7 +171,7 @@ libnm = shared_library( libnm_core, libnm_systemd_logging_stub, libnmdbus, - shared_nm_glib_aux, + libnm_utils_base, ], dependencies: liblibnm_dep, link_args: [ @@ -210,7 +211,7 @@ test( ) if enable_introspection - gir_sources = libnm_core_enum + libnm_core_headers + libnm_core_sources + libnm_enum + libnm_headers + libnm_sources + [version_header] + gir_sources = libnm_core_enum + libnm_core_headers + libnm_core_sources + libnm_enum + libnm_headers + libnm_sources + [nm_version_macro_header] libnm_gir = gnome.generate_gir( libnm, diff --git a/libnm/tests/meson.build b/libnm/tests/meson.build index 5b72a24fae..65f5bb1b91 100644 --- a/libnm/tests/meson.build +++ b/libnm/tests/meson.build @@ -15,16 +15,14 @@ foreach test_unit: test_units test_unit[0], [ test_unit[0] + '.c', - shared_nm_test_utils_impl_c, - ], - dependencies: [ - liblibnm_dep, - libnm_systemd_shared_no_logging_dep, + nm_test_utils_impl_source, ], + dependencies: liblibnm_dep, c_args: cflags, link_with: [ liblibnm, libnm_core, + libnm_systemd_logging_stub, ], ) @@ -39,7 +37,7 @@ 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[1]], include_directories: libnm_inc, dependencies: libnm_core_dep, c_args: cflags, diff --git a/shared/meson.build b/shared/meson.build index 4c8b58c84f..a9114ca40c 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -1,334 +1,259 @@ shared_inc = include_directories('.') -############################################################################### - -shared_c_stdaux = static_library( - 'c-stdaux', - c_args: '-std=c11', - sources: files('c-stdaux/src/c-stdaux.h'), +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', ) -############################################################################### - -shared_c_siphash = static_library( - 'c-siphash', - include_directories: [ - include_directories('c-stdaux/src'), - ], - sources: 'c-siphash/src/c-siphash.c', +sources = files( + 'n-acd/src/n-acd.c', + 'n-acd/src/n-acd-probe.c', + 'n-acd/src/util/timer.c', ) -shared_c_siphash_dep = declare_dependency( - include_directories: shared_inc, - link_with: shared_c_siphash, -) - -############################################################################### - -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'), -) - -shared_c_rbtree_dep = declare_dependency( - include_directories: shared_inc, - link_with: shared_c_rbtree, -) - -############################################################################### - if enable_ebpf - shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf.c') + sources += files('n-acd/src/n-acd-bpf.c') else - shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf-fallback.c') + sources += files('n-acd/src/n-acd-bpf-fallback.c') endif -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, - ], +incs = include_directories( + 'c-list/src', + 'c-rbtree/src', + 'c-siphash/src', + 'c-stdaux/src', ) -shared_n_acd_dep = declare_dependency( - include_directories: shared_inc, - link_with: shared_n_acd, -) - -############################################################################### - -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, - ], -) - -shared_n_dhcp4_dep = declare_dependency( - include_directories: shared_inc, - link_with: shared_n_dhcp4, -) - -############################################################################### - -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) - -version_header = configure_file( - input: 'nm-version-macros.h.in', - output: '@BASENAME@', - configuration: version_conf, -) - -shared_nm_meta_setting_c = files('nm-meta-setting.c') - -shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c') - -shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c') - -############################################################################### - -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: [ - ], -) - -shared_nm_std_aux_dep = declare_dependency( - link_with: shared_nm_std_aux, - include_directories: [ - top_inc, - shared_inc, - ], -) - -############################################################################### - -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)', +c_flags = [ + '-D_GNU_SOURCE', + '-DSO_ATTACH_BPF=50', + '-std=c11', + '-Wno-pointer-arith', + '-Wno-vla', ] -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, - ], +links = [ + libc_rbtree, + libc_siphash, +] + +libn_acd = static_library( + 'n-acd', + sources: sources, + include_directories: incs, + c_args: c_flags, + link_with: links, ) -shared_nm_glib_aux_dep = declare_dependency( - link_with: shared_nm_glib_aux, - include_directories: [ - top_inc, - shared_inc, - ], - dependencies: glib_dep, +libn_acd_dep = declare_dependency( + include_directories: shared_inc, + link_with: libn_acd, ) -############################################################################### - -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( + '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', ) -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( + 'c-list/src', + 'c-siphash/src', + 'c-stdaux/src', ) -############################################################################### +c_flags = [ + '-D_GNU_SOURCE', + '-Wno-declaration-after-statement', + '-Wno-pointer-arith', +] + +libn_dhcp4 = static_library( + 'n-dhcp4', + sources: sources, + c_args: c_flags, + include_directories: incs, + link_with: libc_siphash, +) + +libn_dhcp4_dep = declare_dependency( + include_directories: shared_inc, + link_with: libn_dhcp4, +) + +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) + +nm_version_macro_header = configure_file( + input: 'nm-version-macros.h.in', + output: '@BASENAME@', + configuration: nm_version_macro_conf, +) + +nm_meta_setting_source = files('nm-meta-setting.c') + +nm_test_utils_impl_source = files('nm-test-utils-impl.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', +] + +libnm_std_aux = static_library( + 'nm-std-aux', + sources: 'nm-std-aux/c-list-util.c', + c_args: c_flags, +) + +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, + include_directories: top_inc, + dependencies: glib_dep, + c_args: c_flags, + link_with: links, +) + +incs = [ + top_inc, + shared_inc, +] + +libnm_utils_base_dep = declare_dependency( + include_directories: incs, + dependencies: glib_dep, + link_with: libnm_utils_base, +) + +deps = [ + libudev_dep, + libnm_utils_base_dep, +] + +libnm_udev_aux = static_library( + 'nm-udev-aux', + sources: 'nm-udev-aux/nm-udev-utils.c', + c_args: c_flags, + dependencies: deps, +) + +libnm_udev_aux_dep = declare_dependency( + include_directories: shared_inc, + link_with: libnm_udev_aux, +) + +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', +) + +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: libnm_utils_base_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: libnm_utils_base_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: libnm_utils_base_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..bf52740dae 100644 --- a/shared/nm-utils/tests/meson.build +++ b/shared/nm-utils/tests/meson.build @@ -7,11 +7,8 @@ exe = executable( '-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, - ], + dependencies: libnm_utils_base_dep, + link_with: libnm_systemd_logging_stub, ) test( diff --git a/src/meson.build b/src/meson.build index 84bad00407..ac03a568f5 100644 --- a/src/meson.build +++ b/src/meson.build @@ -52,7 +52,8 @@ deps = [ libsystemd_dep, libudev_dep, libnm_core_dep, - shared_n_dhcp4_dep, + libn_dhcp4_dep, + libnm_udev_aux_dep, ] if enable_wext @@ -155,7 +156,7 @@ nm_deps = [ libndp_dep, libudev_dep, libnm_core_dep, - shared_n_acd_dep, + libn_acd_dep, logind_dep, ] From 70a34c54fef0ec2bde4ad27ac751f8efd8e3c13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Sat, 7 Sep 2019 23:00:41 +0200 Subject: [PATCH 06/41] meson: Use dependency for nm-default header The `nm-default.h` header is used widely in the code by many targets. This header includes different headers and needs different libraries depending the compilation flags. A new set of `*nm_default_dep` dependencies have been created to ease the inclusion of different directorires and libraries. This allows cleaner build files and avoiding linking unnecessary libraries so this has been applied allowing the removal of some dependencies involving the linking of unnecessary libraries. --- clients/cli/meson.build | 2 +- clients/common/meson.build | 1 + clients/common/tests/meson.build | 3 ++- clients/meson.build | 2 +- clients/tui/meson.build | 2 +- dispatcher/meson.build | 2 +- dispatcher/tests/meson.build | 3 ++- examples/C/glib/meson.build | 10 ++++----- libnm-core/meson.build | 8 ++++++- libnm-core/tests/meson.build | 4 ++-- libnm/meson.build | 27 +++++++---------------- libnm/tests/meson.build | 4 ++-- shared/meson.build | 25 +++++++++------------ src/devices/adsl/meson.build | 1 + src/devices/bluetooth/meson.build | 1 + src/devices/ovs/meson.build | 1 + src/devices/team/meson.build | 1 + src/devices/wifi/meson.build | 1 + src/devices/wwan/meson.build | 1 + src/dhcp/meson.build | 2 +- src/initrd/meson.build | 6 ++--- src/meson.build | 22 +++++++++--------- src/ppp/meson.build | 3 ++- src/settings/plugins/ifcfg-rh/meson.build | 1 + src/settings/plugins/ifupdown/meson.build | 1 + src/systemd/meson.build | 19 ++++++++-------- src/tests/meson.build | 3 +-- 27 files changed, 79 insertions(+), 77 deletions(-) diff --git a/clients/cli/meson.build b/clients/cli/meson.build index 396466a221..f5ca1c0ab9 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -22,7 +22,7 @@ deps = [ libnm_dep, libnmc_base_dep, libnmc_dep, - libnm_core_dep, + libnm_nm_default_dep, readline_dep, ] diff --git a/clients/common/meson.build b/clients/common/meson.build index 5ba5c9dbb7..bddb9cb629 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -4,6 +4,7 @@ nm_polkit_listener = files('nm-polkit-listener.c') deps = [ libnm_dep, + libnm_nm_default_dep, shared_nm_libnm_core_aux_dep, ] diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index 624dd89cd7..ab37e36196 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -7,7 +7,7 @@ exe = executable( libnm_dep, libnmc_dep, libnmc_base_dep, - libnm_core_dep, + libnm_nm_default_dep, ], c_args: clients_cflags + [ '-DNETWORKMANAGER_COMPILATION_TEST', @@ -31,6 +31,7 @@ exe = executable( ], dependencies: [ libnm_dep, + libnm_nm_default_dep, shared_nm_libnm_core_aux_dep, shared_nm_libnm_core_intern_dep, ], diff --git a/clients/meson.build b/clients/meson.build index 76d39fa78b..1c539d98ef 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -2,7 +2,7 @@ name = 'nm-online' deps = [ libnm_dep, - libnm_core_dep, + libnm_nm_default_dep, ] clients_cflags = [ diff --git a/clients/tui/meson.build b/clients/tui/meson.build index 837645a61e..17194579d3 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -1,8 +1,8 @@ name = 'nmtui' deps = [ + libnm_nm_default_dep, newt_dep, - libnm_core_dep, ] cflags = clients_cflags + [ diff --git a/dispatcher/meson.build b/dispatcher/meson.build index e9f3723c25..aaaedda5c8 100644 --- a/dispatcher/meson.build +++ b/dispatcher/meson.build @@ -25,7 +25,7 @@ sources = files('nm-dispatcher-utils.c') deps = [ libnm_dep, - libnm_core_dep, + libnm_nm_default_dep, ] cflags = [ diff --git a/dispatcher/tests/meson.build b/dispatcher/tests/meson.build index 9d6a16de1f..d339455b59 100644 --- a/dispatcher/tests/meson.build +++ b/dispatcher/tests/meson.build @@ -10,8 +10,9 @@ exe = executable( [ test_unit + '.c' ] + [ nmdbus_dispatcher_sources ], include_directories: incs, dependencies: [ - libnm_core_dep, libnm_dep, + libnm_nm_default_dep, + libnm_utils_base_dep, ], c_args: [ '-DNETWORKMANAGER_COMPILATION_TEST', diff --git a/examples/C/glib/meson.build b/examples/C/glib/meson.build index 47d64bddf9..1735581283 100644 --- a/examples/C/glib/meson.build +++ b/examples/C/glib/meson.build @@ -1,10 +1,10 @@ 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]], + ['add-connection-gdbus', [libnm_enum[1], nm_version_macro_header], [libnm_inc, shared_inc], [uuid_dep]], + ['add-connection-libnm', [nm_version_macro_header], [shared_inc], [libnm_dep]], + ['get-active-connections-gdbus', [libnm_enum[1], nm_version_macro_header], [libnm_inc, shared_inc], []], + ['get-ap-info-libnm', [nm_version_macro_header], [shared_inc], [libnm_dep]], ['list-connections-gdbus', [], [], []], - ['list-connections-libnm', [], [], [libnm_dep]], + ['list-connections-libnm', [nm_version_macro_header], [shared_inc], [libnm_dep]], ['monitor-nm-running-gdbus', [], [], []], ['monitor-nm-state-gdbus', [], [], []], ] diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 01317c7c98..fb9be04a2c 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -1,5 +1,11 @@ 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, +) + libnm_core_headers = files( 'nm-connection.h', 'nm-core-types.h', @@ -159,7 +165,7 @@ shared_nm_libnm_core_intern = static_library( include_directories: libnm_core_inc, dependencies: [ libnm_core_enum_dep, - libnm_utils_base_dep, + libnm_core_nm_default_dep, ], ) diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index 61a9445099..a9b3c9baab 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -32,8 +32,8 @@ 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, + [test_unit + '.c', libnm_core_enum[1]] + enum, + dependencies: libnm_core_nm_default_dep, c_args: [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', diff --git a/libnm/meson.build b/libnm/meson.build index fbe6f847b1..e21710a9a1 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -1,5 +1,11 @@ libnm_inc = include_directories('.') +libnm_nm_default_dep = declare_dependency( + sources: libnm_core_enum[1], + include_directories: libnm_inc, + dependencies: libnm_core_nm_default_dep, +) + cflags = [ '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM', @@ -138,7 +144,7 @@ liblibnm = static_library( dl_dep, libudev_dep, libnm_core_dep, - libnm_utils_base_dep, + libnm_nm_default_dep, libnm_udev_aux_dep, uuid_dep, ], @@ -146,26 +152,10 @@ liblibnm = static_library( 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, - libnmdbus_dep, - libnm_utils_base_dep, - libudev_dep, - dl_dep, - uuid_dep, - ], - link_with: libnm_systemd_logging_stub, -) - libnm = shared_library( 'nm', version: libnm_version, + dependencies: libnm_nm_default_dep, link_whole: [ liblibnm, libnm_core, @@ -173,7 +163,6 @@ libnm = shared_library( libnmdbus, libnm_utils_base, ], - dependencies: liblibnm_dep, link_args: [ '-Wl,--version-script,@0@'.format(linker_script), ], diff --git a/libnm/tests/meson.build b/libnm/tests/meson.build index 65f5bb1b91..597c197b54 100644 --- a/libnm/tests/meson.build +++ b/libnm/tests/meson.build @@ -17,7 +17,7 @@ foreach test_unit: test_units test_unit[0] + '.c', nm_test_utils_impl_source, ], - dependencies: liblibnm_dep, + dependencies: libnm_nm_default_dep, c_args: cflags, link_with: [ liblibnm, @@ -39,6 +39,6 @@ libnm_vpn_plugin_utils_test = static_library( 'nm-vpn-plugin-utils-test', sources: nm_vpn_plugin_utils_source + [libnm_enum[1]], include_directories: libnm_inc, - dependencies: libnm_core_dep, + dependencies: libnm_nm_default_dep, c_args: cflags, ) diff --git a/shared/meson.build b/shared/meson.build index a9114ca40c..107c406694 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -1,5 +1,9 @@ shared_inc = include_directories('.') +nm_default_dep = declare_dependency(include_directories: [top_inc, shared_inc]) + +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', @@ -152,33 +156,26 @@ links = [ libnm_utils_base = static_library( 'nm-utils-base', sources: sources, - include_directories: top_inc, - dependencies: glib_dep, + dependencies: glib_nm_default_dep, c_args: c_flags, link_with: links, ) -incs = [ - top_inc, - shared_inc, -] - libnm_utils_base_dep = declare_dependency( - include_directories: incs, - dependencies: glib_dep, + dependencies: glib_nm_default_dep, link_with: libnm_utils_base, ) deps = [ + glib_nm_default_dep, libudev_dep, - libnm_utils_base_dep, ] libnm_udev_aux = static_library( 'nm-udev-aux', sources: 'nm-udev-aux/nm-udev-utils.c', - c_args: c_flags, dependencies: deps, + c_args: c_flags, ) libnm_udev_aux_dep = declare_dependency( @@ -239,20 +236,20 @@ libnm_systemd_shared = static_library( 'nm-systemd-shared', sources: sources, include_directories: incs, - dependencies: libnm_utils_base_dep, + dependencies: glib_nm_default_dep, c_args: c_flags, ) libnm_systemd_shared_dep = declare_dependency( include_directories: incs, - dependencies: libnm_utils_base_dep, + dependencies: glib_dep, link_with: libnm_systemd_shared, ) libnm_systemd_logging_stub = static_library( 'nm-systemd-logging-stub', sources: 'systemd/nm-logging-stub.c', - dependencies: libnm_utils_base_dep, + dependencies: glib_nm_default_dep, c_args: c_flags, ) diff --git a/src/devices/adsl/meson.build b/src/devices/adsl/meson.build index f92e809c97..d0492985dc 100644 --- a/src/devices/adsl/meson.build +++ b/src/devices/adsl/meson.build @@ -5,6 +5,7 @@ sources = files( deps = [ libudev_dep, + nm_default_dep, nm_dep, ] diff --git a/src/devices/bluetooth/meson.build b/src/devices/bluetooth/meson.build index 31fbf00674..8d9d788f34 100644 --- a/src/devices/bluetooth/meson.build +++ b/src/devices/bluetooth/meson.build @@ -6,6 +6,7 @@ sources = files( deps = [ libnm_wwan_dep, + nm_default_dep, nm_dep, ] diff --git a/src/devices/ovs/meson.build b/src/devices/ovs/meson.build index 834b27b014..49a19a2e17 100644 --- a/src/devices/ovs/meson.build +++ b/src/devices/ovs/meson.build @@ -8,6 +8,7 @@ sources = files( deps = [ jansson_dep, + nm_default_dep, nm_dep, ] diff --git a/src/devices/team/meson.build b/src/devices/team/meson.build index 3f755012b2..ca823ed27c 100644 --- a/src/devices/team/meson.build +++ b/src/devices/team/meson.build @@ -6,6 +6,7 @@ sources = files( deps = [ jansson_dep, libteamdctl_dep, + nm_default_dep, nm_dep, ] diff --git a/src/devices/wifi/meson.build b/src/devices/wifi/meson.build index 4dfbe4c8da..f97308685c 100644 --- a/src/devices/wifi/meson.build +++ b/src/devices/wifi/meson.build @@ -20,6 +20,7 @@ if enable_iwd endif deps = [ + nm_default_dep, nm_dep, ] diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 363e522bf1..84c7dda125 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -8,6 +8,7 @@ sources = files( deps = [ libsystemd_dep, mm_glib_dep, + nm_default_dep, nm_dep, ] diff --git a/src/dhcp/meson.build b/src/dhcp/meson.build index c1f28be0e3..593e9d5ebc 100644 --- a/src/dhcp/meson.build +++ b/src/dhcp/meson.build @@ -8,7 +8,7 @@ cflags = [ executable( name, name + '.c', - dependencies: libnm_core_dep, + dependencies: glib_nm_default_dep, c_args: cflags, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, diff --git a/src/initrd/meson.build b/src/initrd/meson.build index acef8c4eac..516a8570b1 100644 --- a/src/initrd/meson.build +++ b/src/initrd/meson.build @@ -10,8 +10,7 @@ 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, ) name = 'nm-initrd-generator' @@ -19,8 +18,7 @@ executable( name, name + '.c', c_args: nm_cflags, - include_directories: src_inc, - dependencies: [ libnm_core_dep ], + dependencies: daemon_nm_default_dep, link_with: [libnetwork_manager_base, libnmi_core], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, diff --git a/src/meson.build b/src/meson.build index ac03a568f5..5cc4c80f47 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[1], + include_directories: src_inc, + dependencies: libnm_core_nm_default_dep, +) + install_data( 'org.freedesktop.NetworkManager.conf', install_dir: dbus_conf_dir, @@ -49,10 +55,11 @@ sources = files( ) deps = [ + daemon_nm_default_dep, libsystemd_dep, libudev_dep, - libnm_core_dep, libn_dhcp4_dep, + libnm_systemd_shared_dep, libnm_udev_aux_dep, ] @@ -152,10 +159,10 @@ sources = files( ) nm_deps = [ + daemon_nm_default_dep, dl_dep, libndp_dep, libudev_dep, - libnm_core_dep, libn_acd_dep, logind_dep, ] @@ -189,10 +196,10 @@ libnetwork_manager = static_library( ) deps = [ + daemon_nm_default_dep, dl_dep, libndp_dep, libudev_dep, - libnm_core_dep, ] name = 'nm-iface-helper' @@ -220,11 +227,6 @@ if enable_tests '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'] @@ -233,13 +235,13 @@ if enable_tests libnetwork_manager_test = static_library( nm_name + 'Test', sources: sources, - dependencies: deps, + dependencies: daemon_nm_default_dep, c_args: cflags + test_cflags, link_with: libnetwork_manager, ) test_nm_dep = declare_dependency( - dependencies: nm_dep, + dependencies: [daemon_nm_default_dep, nm_dep], compile_args: test_cflags, link_with: libnetwork_manager_test, ) diff --git a/src/ppp/meson.build b/src/ppp/meson.build index 04c539e3de..eeba278954 100644 --- a/src/ppp/meson.build +++ b/src/ppp/meson.build @@ -2,7 +2,7 @@ name = 'nm-pppd-plugin' deps = [ dl_dep, - libnm_core_dep, + libnm_core_nm_default_dep, ] nm_pppd_plugin = shared_module( @@ -22,6 +22,7 @@ nm_pppd_plugin = shared_module( name = 'nm-ppp-plugin' deps = [ + daemon_nm_default_dep, nm_dep, ] diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index 58acdcfcb1..404c0825c6 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -26,6 +26,7 @@ core_sources = files( ) deps = [ + nm_default_dep, nm_dep, ] diff --git a/src/settings/plugins/ifupdown/meson.build b/src/settings/plugins/ifupdown/meson.build index 365ae1a9c5..51d690cb95 100644 --- a/src/settings/plugins/ifupdown/meson.build +++ b/src/settings/plugins/ifupdown/meson.build @@ -4,6 +4,7 @@ sources = files( ) deps = [ + nm_default_dep, libudev_dep, nm_dep, ] diff --git a/src/systemd/meson.build b/src/systemd/meson.build index af1d0c8b35..64f0c3ccd1 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -27,19 +27,18 @@ libnm_systemd_core = static_library( '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', - ) - ], + include_directories: include_directories( + 'sd-adapt-core', + 'src/libsystemd-network', + 'src/libsystemd/sd-event', + 'src/systemd', + ), dependencies: [ - libnm_core_dep, + daemon_nm_default_dep, + libnm_systemd_shared_dep, ], c_args: [ '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD', ], + link_with: libc_siphash, ) diff --git a/src/tests/meson.build b/src/tests/meson.build index b2bc13ab37..df81f3ce47 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -35,8 +35,7 @@ cflags = [ exe = executable( test_unit, test_unit + '.c', - include_directories: src_inc, - dependencies: libnm_core_dep, + dependencies: daemon_nm_default_dep, c_args: cflags, link_with: [ libnm_systemd_core, From de90fc0810465a67b7e5ff6e6fcb29941162d1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Tue, 3 Sep 2019 13:41:18 +0200 Subject: [PATCH 07/41] meson: Improve the shared utils test build file A new variable has been created for the C compiler flags to avoid polluting the target creation call so the flags are encapsulated. --- shared/nm-utils/tests/meson.build | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/shared/nm-utils/tests/meson.build b/shared/nm-utils/tests/meson.build index bf52740dae..1ee5efff95 100644 --- a/shared/nm-utils/tests/meson.build +++ b/shared/nm-utils/tests/meson.build @@ -1,12 +1,14 @@ 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)', - ], + c_args: c_flags, dependencies: libnm_utils_base_dep, link_with: libnm_systemd_logging_stub, ) From ad4834009b2e520303a2483d23084c37f07ace93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Thu, 5 Sep 2019 09:11:07 +0200 Subject: [PATCH 08/41] meson: Improve crypto support build There are multiple conditional steps for building encryption support. This is because the support varies from `gnutls` or `nss`. This has been improved to reduce the number of used conditions. --- libnm-core/meson.build | 46 +++++++++++++++--------------------------- meson.build | 14 ++++++++----- 2 files changed, 25 insertions(+), 35 deletions(-) diff --git a/libnm-core/meson.build b/libnm-core/meson.build index fb9be04a2c..0b6acf8557 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -177,11 +177,8 @@ shared_nm_libnm_core_intern_dep = declare_dependency( ############################################################################### deps = [ - dl_dep, + crypto_dep, libnm_utils_base_dep, - libudev_dep, - uuid_dep, - shared_nm_libnm_core_intern_dep, ] cflags = [ @@ -189,37 +186,26 @@ cflags = [ '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', ] +libnm_crypto = static_library( + 'nm-crypto', + sources: 'nm-crypto-@0@.c'.format(crypto), + dependencies: deps, + c_args: cflags, +) + +deps = [ + dl_dep, + libnm_utils_base_dep, + libudev_dep, + uuid_dep, + shared_nm_libnm_core_intern_dep, +] + if enable_json_validation libnm_core_sources += files('nm-json.c') 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 += nm_meta_setting_source diff --git a/meson.build b/meson.build index 85b5f6a306..73f161485c 100644 --- a/meson.build +++ b/meson.build @@ -475,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 @@ -961,7 +965,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' From f427f4771e4a500933ed3065a9789ce8bd0b6938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Mon, 9 Sep 2019 11:40:11 +0200 Subject: [PATCH 09/41] meson: Improve the libnm-core build file The `libnm-core` build file has been improved by applying a set of changes: - Indentation has been fixed to be consistent. - Library variable names have been changed to `lib{name}` pattern following their filename pattern. - `shared` prefix has been removed from all variables using it. - Dependencies have been reviewed to store the necessary data. - The use of the libraries and dependencies created in this file has been reviewed through the entire source code. This has required the addition or the removal of different libraries and dependencies in different targets. - Some files used directly with the `files` function have been moved to their nearest path build file because meson stores their full path seamessly and they can be used anywhere later. --- clients/common/meson.build | 7 +- clients/common/tests/meson.build | 14 +- clients/tui/meson.build | 2 + examples/C/glib/meson.build | 19 ++- libnm-core/meson.build | 162 +++++++++------------- libnm-core/tests/meson.build | 14 +- libnm/meson.build | 7 +- libnm/tests/meson.build | 14 +- shared/meson.build | 6 + src/devices/adsl/meson.build | 9 +- src/devices/bluetooth/meson.build | 4 +- src/devices/ovs/meson.build | 4 +- src/devices/team/meson.build | 4 +- src/devices/wifi/meson.build | 8 +- src/devices/wwan/meson.build | 5 +- src/initrd/meson.build | 7 +- src/meson.build | 32 ++--- src/ppp/meson.build | 8 +- src/settings/plugins/ifcfg-rh/meson.build | 11 +- src/settings/plugins/ifupdown/meson.build | 12 +- 20 files changed, 153 insertions(+), 196 deletions(-) diff --git a/clients/common/meson.build b/clients/common/meson.build index bddb9cb629..b277f441eb 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -4,8 +4,8 @@ nm_polkit_listener = files('nm-polkit-listener.c') deps = [ libnm_dep, + libnm_libnm_core_aux_dep, libnm_nm_default_dep, - shared_nm_libnm_core_aux_dep, ] cflags = clients_cflags + [ @@ -51,6 +51,11 @@ else ) endif +deps += [ + libnm_libnm_core_aux_dep, + libnm_utils_base_dep, +] + libnmc = static_library( 'nmc', sources: files( diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index ab37e36196..061b1fd68d 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -22,6 +22,12 @@ test( ############################################################################### +deps = [ + libnm_dep, + libnm_libnm_core_aux_dep, + libnm_nm_default_dep, +] + exe = executable( 'test-libnm-core-aux', [ 'test-libnm-core-aux.c', ], @@ -29,12 +35,8 @@ exe = executable( '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', ], - dependencies: [ - libnm_dep, - libnm_nm_default_dep, - shared_nm_libnm_core_aux_dep, - shared_nm_libnm_core_intern_dep, - ], + dependencies: deps, + link_with: libnm_systemd_logging_stub, ) test( diff --git a/clients/tui/meson.build b/clients/tui/meson.build index 17194579d3..68162bc00b 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -58,6 +58,7 @@ deps += [ libnm_dep, libnmc_dep, libnmc_base_dep, + libnm_libnm_core_aux_dep, libnmt_newt_dep, ] @@ -66,6 +67,7 @@ executable( sources, dependencies: deps, c_args: cflags, + link_with: libnm_systemd_logging_stub, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/examples/C/glib/meson.build b/examples/C/glib/meson.build index 1735581283..b095718099 100644 --- a/examples/C/glib/meson.build +++ b/examples/C/glib/meson.build @@ -1,19 +1,18 @@ examples = [ - ['add-connection-gdbus', [libnm_enum[1], nm_version_macro_header], [libnm_inc, shared_inc], [uuid_dep]], - ['add-connection-libnm', [nm_version_macro_header], [shared_inc], [libnm_dep]], - ['get-active-connections-gdbus', [libnm_enum[1], nm_version_macro_header], [libnm_inc, shared_inc], []], - ['get-ap-info-libnm', [nm_version_macro_header], [shared_inc], [libnm_dep]], - ['list-connections-gdbus', [], [], []], - ['list-connections-libnm', [nm_version_macro_header], [shared_inc], [libnm_dep]], - ['monitor-nm-running-gdbus', [], [], []], - ['monitor-nm-state-gdbus', [], [], []], + ['add-connection-gdbus', [libnm_enum[1]], [uuid_dep]], + ['add-connection-libnm', [], [libnm_dep]], + ['get-active-connections-gdbus', [libnm_enum[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/libnm-core/meson.build b/libnm-core/meson.build index 0b6acf8557..ffe9e4bd9e 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -6,6 +6,11 @@ libnm_core_nm_default_dep = declare_dependency( 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', @@ -68,6 +73,37 @@ libnm_core_headers = files( 'nm-vpn-plugin-info.h', ) +enum_types = 'nm-core-enum-types' + +libnm_core_enum_sources = gnome.mkenums( + enum_types, + sources: libnm_core_headers + [nm_version_macro_header], + 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_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, +) + +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', @@ -135,70 +171,16 @@ libnm_core_sources = libnm_core_settings_sources + files( 'nm-vpn-plugin-info.c', ) -enum_headers = libnm_core_headers + [nm_version_macro_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: libnm_core_inc, - dependencies: [ - libnm_core_enum_dep, - libnm_core_nm_default_dep, - ], -) - -shared_nm_libnm_core_intern_dep = declare_dependency( - dependencies: libnm_systemd_shared_dep, - link_with: shared_nm_libnm_core_intern, -) - -############################################################################### - -deps = [ - crypto_dep, - libnm_utils_base_dep, -] - -cflags = [ - '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', -] - -libnm_crypto = static_library( - 'nm-crypto', - sources: 'nm-crypto-@0@.c'.format(crypto), - dependencies: deps, - c_args: cflags, -) - deps = [ dl_dep, + libnm_systemd_shared_dep, libnm_utils_base_dep, - libudev_dep, uuid_dep, - shared_nm_libnm_core_intern_dep, +] + +links = [ + libnm_crypto, + libnm_libnm_core_intern, ] if enable_json_validation @@ -206,54 +188,42 @@ if enable_json_validation deps += jansson_dep endif -libnm_core_sources_all = libnm_core_sources -libnm_core_sources_all += libnm_core_enum -libnm_core_sources_all += nm_meta_setting_source -libnm_core_sources_all += [nm_version_macro_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: [ - libnm_systemd_shared_dep, - shared_nm_libnm_core_intern_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: libnm_core_inc, - dependencies: [ - libnm_core_dep, - libnm_utils_base_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, - dependencies: [ - libnm_core_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(source_root, 'tools', 'enums-to-docbook.pl') docbooks = [ @@ -278,8 +248,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 a9b3c9baab..01aad44506 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -29,19 +29,21 @@ test_units = [ test_cert_dir = join_paths(meson.current_source_dir(), 'certs') +deps = [ + libnm_core_dep, + libnm_core_nm_default_dep, +] + foreach test_unit: test_units exe = executable( 'libnm-core-' + test_unit, - [test_unit + '.c', libnm_core_enum[1]] + enum, - dependencies: libnm_core_nm_default_dep, + [test_unit + '.c'] + enum, + dependencies: deps, c_args: [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', ], - link_with: [ - libnm_core, - libnm_systemd_logging_stub, - ], + link_with: libnm_systemd_logging_stub, ) test( 'libnm-core/' + test_unit, diff --git a/libnm/meson.build b/libnm/meson.build index e21710a9a1..76cadc71e3 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -1,7 +1,7 @@ libnm_inc = include_directories('.') libnm_nm_default_dep = declare_dependency( - sources: libnm_core_enum[1], + sources: libnm_core_enum_sources[1], include_directories: libnm_inc, dependencies: libnm_core_nm_default_dep, ) @@ -143,13 +143,12 @@ liblibnm = static_library( libnmdbus_dep, dl_dep, libudev_dep, - libnm_core_dep, libnm_nm_default_dep, libnm_udev_aux_dep, uuid_dep, ], c_args: cflags, - link_with: libnm_systemd_logging_stub, + link_with: [libnm_systemd_logging_stub, libnm_libnm_core_intern], ) libnm = shared_library( @@ -200,7 +199,7 @@ test( ) if enable_introspection - gir_sources = libnm_core_enum + libnm_core_headers + libnm_core_sources + libnm_enum + libnm_headers + libnm_sources + [nm_version_macro_header] + gir_sources = libnm_core_enum_sources + libnm_core_headers + libnm_core_sources + libnm_enum + libnm_headers + libnm_sources + [nm_version_macro_header] libnm_gir = gnome.generate_gir( libnm, diff --git a/libnm/tests/meson.build b/libnm/tests/meson.build index 597c197b54..bfa126e2ec 100644 --- a/libnm/tests/meson.build +++ b/libnm/tests/meson.build @@ -5,6 +5,11 @@ test_units = [ ['test-secret-agent', 90], ] +deps = [ + libnm_core_dep, + libnm_nm_default_dep, +] + cflags = [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM', @@ -16,14 +21,11 @@ foreach test_unit: test_units [ test_unit[0] + '.c', nm_test_utils_impl_source, + libnm_enum[1], ], - dependencies: libnm_nm_default_dep, + dependencies: deps, c_args: cflags, - link_with: [ - liblibnm, - libnm_core, - libnm_systemd_logging_stub, - ], + link_with: liblibnm, ) test( diff --git a/shared/meson.build b/shared/meson.build index 107c406694..7a9dbaac48 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -110,6 +110,12 @@ nm_version_macro_header = configure_file( configuration: nm_version_macro_conf, ) +nm_ethtool_utils_source = files('nm-libnm-core-intern/nm-ethtool-utils.c') + +nm_libnm_core_aux_source = files('nm-libnm-core-aux/nm-libnm-core-aux.c') + +nm_libnm_core_utils_source = files('nm-libnm-core-intern/nm-libnm-core-utils.c') + nm_meta_setting_source = files('nm-meta-setting.c') nm_test_utils_impl_source = files('nm-test-utils-impl.c') diff --git a/src/devices/adsl/meson.build b/src/devices/adsl/meson.build index d0492985dc..16fed29658 100644 --- a/src/devices/adsl/meson.build +++ b/src/devices/adsl/meson.build @@ -3,16 +3,11 @@ sources = files( 'nm-device-adsl.c', ) -deps = [ - libudev_dep, - nm_default_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, diff --git a/src/devices/bluetooth/meson.build b/src/devices/bluetooth/meson.build index 8d9d788f34..3540fb158c 100644 --- a/src/devices/bluetooth/meson.build +++ b/src/devices/bluetooth/meson.build @@ -5,9 +5,8 @@ sources = files( ) deps = [ + daemon_nm_default_dep, libnm_wwan_dep, - nm_default_dep, - nm_dep, ] if enable_bluez5_dun @@ -20,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, diff --git a/src/devices/ovs/meson.build b/src/devices/ovs/meson.build index 49a19a2e17..cffe015ebe 100644 --- a/src/devices/ovs/meson.build +++ b/src/devices/ovs/meson.build @@ -7,15 +7,15 @@ sources = files( ) deps = [ + daemon_nm_default_dep, jansson_dep, - nm_default_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, diff --git a/src/devices/team/meson.build b/src/devices/team/meson.build index ca823ed27c..147676b0ce 100644 --- a/src/devices/team/meson.build +++ b/src/devices/team/meson.build @@ -4,16 +4,16 @@ sources = files( ) deps = [ + daemon_nm_default_dep, jansson_dep, libteamdctl_dep, - nm_default_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, diff --git a/src/devices/wifi/meson.build b/src/devices/wifi/meson.build index f97308685c..81b3d17d9c 100644 --- a/src/devices/wifi/meson.build +++ b/src/devices/wifi/meson.build @@ -19,15 +19,11 @@ if enable_iwd ) endif -deps = [ - nm_default_dep, - 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, diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 84c7dda125..88649a25a8 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -6,10 +6,9 @@ sources = files( ) deps = [ + daemon_nm_default_dep, libsystemd_dep, mm_glib_dep, - nm_default_dep, - nm_dep, ] if enable_ofono @@ -22,6 +21,7 @@ libnm_wwan = shared_module( 'nm-wwan', sources: sources, dependencies: deps, + c_args: daemon_c_flags, link_args: [ '-Wl,--version-script,@0@'.format(linker_script), ], @@ -54,6 +54,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, diff --git a/src/initrd/meson.build b/src/initrd/meson.build index 516a8570b1..3495454eaf 100644 --- a/src/initrd/meson.build +++ b/src/initrd/meson.build @@ -4,21 +4,20 @@ 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, dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, ) name = 'nm-initrd-generator' + executable( name, name + '.c', - c_args: nm_cflags, dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, link_with: [libnetwork_manager_base, libnmi_core], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, diff --git a/src/meson.build b/src/meson.build index 5cc4c80f47..9da0d0bb3e 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,7 +1,7 @@ src_inc = include_directories('.') daemon_nm_default_dep = declare_dependency( - sources: libnm_core_enum[1], + sources: libnm_core_enum_sources[1], include_directories: src_inc, dependencies: libnm_core_nm_default_dep, ) @@ -15,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', @@ -59,6 +51,7 @@ deps = [ libsystemd_dep, libudev_dep, libn_dhcp4_dep, + libnm_core_dep, libnm_systemd_shared_dep, libnm_udev_aux_dep, ] @@ -71,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( @@ -187,7 +179,7 @@ libnetwork_manager = static_library( nm_name, sources: sources, dependencies: nm_deps, - c_args: cflags, + c_args: daemon_c_flags, link_with: [ libnetwork_manager_base, libnm_systemd_core, @@ -208,7 +200,7 @@ executable( name, name + '.c', dependencies: deps, - c_args: cflags, + c_args: daemon_c_flags, link_with: [ libnetwork_manager_base, libnm_systemd_core, @@ -227,7 +219,7 @@ if enable_tests 'platform/nm-fake-platform.c', ) - test_cflags = ['-DNETWORKMANAGER_COMPILATION_TEST'] + test_cflags = daemon_c_flags + ['-DNETWORKMANAGER_COMPILATION_TEST'] if require_root_tests test_cflags += ['-DREQUIRE_ROOT_TESTS=1'] endif @@ -236,12 +228,12 @@ if enable_tests nm_name + 'Test', sources: sources, dependencies: daemon_nm_default_dep, - c_args: cflags + test_cflags, + c_args: test_cflags, link_with: libnetwork_manager, ) test_nm_dep = declare_dependency( - dependencies: [daemon_nm_default_dep, nm_dep], + dependencies: daemon_nm_default_dep, compile_args: test_cflags, link_with: libnetwork_manager_test, ) @@ -286,9 +278,9 @@ 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, ) @@ -307,7 +299,7 @@ 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, diff --git a/src/ppp/meson.build b/src/ppp/meson.build index eeba278954..3cfbd6018b 100644 --- a/src/ppp/meson.build +++ b/src/ppp/meson.build @@ -21,17 +21,13 @@ nm_pppd_plugin = shared_module( name = 'nm-ppp-plugin' -deps = [ - daemon_nm_default_dep, - 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, + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, link_args: [ '-Wl,--version-script,@0@'.format(linker_script), ], diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index 404c0825c6..cda65e18be 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -25,15 +25,11 @@ core_sources = files( 'shvar.c', ) -deps = [ - nm_default_dep, - 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') @@ -41,7 +37,8 @@ sources = [dbus_sources] + core_sources + files('nms-ifcfg-rh-storage.c', 'nms-i libnm_settings_plugin_ifcfg_rh = shared_module( 'nm-settings-plugin-ifcfg-rh', sources: sources, - dependencies: deps, + 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, diff --git a/src/settings/plugins/ifupdown/meson.build b/src/settings/plugins/ifupdown/meson.build index 51d690cb95..3094e7af14 100644 --- a/src/settings/plugins/ifupdown/meson.build +++ b/src/settings/plugins/ifupdown/meson.build @@ -3,16 +3,11 @@ sources = files( 'nms-ifupdown-parser.c', ) -deps = [ - nm_default_dep, - libudev_dep, - nm_dep, -] - libnms_ifupdown_core = static_library( 'nms-ifupdown-core', sources: sources, - dependencies: deps, + dependencies: daemon_nm_default_dep, + c_args: daemon_c_flags, ) sources = files( @@ -22,7 +17,8 @@ sources = files( libnm_settings_plugin_ifupdown = shared_module( 'nm-settings-plugin-ifupdown', sources: sources, - dependencies: deps, + 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, From 1cd615288e2add0f129ccf9c9de8fb47585d5dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Mon, 9 Sep 2019 23:04:31 +0200 Subject: [PATCH 10/41] meson: Improve the libnm-core test build file All variables used in every test have been moved to the start of the build file. Generated enum sources variable has been renamed to `enum_sources` to clearly specify what it is holding. --- libnm-core/tests/meson.build | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index 01aad44506..f91fb6ab11 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -9,7 +9,7 @@ enum_types = 'nm-core-tests-enum-types' -enum = gnome.mkenums( +enum_sources = gnome.mkenums( enum_types, sources: 'test-general-enums.h', identifier_prefix: nm_id_prefix, @@ -17,6 +17,18 @@ enum = gnome.mkenums( 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,24 +39,15 @@ test_units = [ 'test-settings-defaults', ] -test_cert_dir = join_paths(meson.current_source_dir(), 'certs') - -deps = [ - libnm_core_dep, - libnm_core_nm_default_dep, -] - foreach test_unit: test_units exe = executable( 'libnm-core-' + test_unit, - [test_unit + '.c'] + enum, + [test_unit + '.c'] + enum_sources, dependencies: deps, - c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE', - ], + c_args: c_flags, link_with: libnm_systemd_logging_stub, ) + test( 'libnm-core/' + test_unit, test_script, From caf470f788f69e91f09985313f61ced414514b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Tue, 10 Sep 2019 09:17:23 +0200 Subject: [PATCH 11/41] meson: Improve targets involving libnm library The targets that involve the use of the `libnm` library have been improved by applying a set of changes: - Generated enum sources variable `libnm_enum` has been renamed to `libnm_enum_sources` to clearly specify what it is holding. - Indentation in the `libnm` build and test files has been fixed. - Set of objects used in targets have been grouped together. --- clients/tui/newt/meson.build | 2 +- examples/C/glib/meson.build | 4 +- libnm/meson.build | 77 ++++++++++++++++++------------------ libnm/tests/meson.build | 20 ++++------ 4 files changed, 49 insertions(+), 54 deletions(-) diff --git a/clients/tui/newt/meson.build b/clients/tui/newt/meson.build index 5bb713d313..0b7fde9428 100644 --- a/clients/tui/newt/meson.build +++ b/clients/tui/newt/meson.build @@ -23,7 +23,7 @@ sources = files( libnmt_newt = static_library( 'nmt-newt', - sources: sources + [libnm_enum[1]], + sources: sources + [libnm_enum_sources[1]], include_directories: libnm_inc, dependencies: deps, c_args: cflags, diff --git a/examples/C/glib/meson.build b/examples/C/glib/meson.build index b095718099..7471ecad22 100644 --- a/examples/C/glib/meson.build +++ b/examples/C/glib/meson.build @@ -1,7 +1,7 @@ examples = [ - ['add-connection-gdbus', [libnm_enum[1]], [uuid_dep]], + ['add-connection-gdbus', [libnm_enum_sources[1]], [uuid_dep]], ['add-connection-libnm', [], [libnm_dep]], - ['get-active-connections-gdbus', [libnm_enum[1]], []], + ['get-active-connections-gdbus', [libnm_enum_sources[1]], []], ['get-ap-info-libnm', [], [libnm_dep]], ['list-connections-gdbus', [], []], ['list-connections-libnm', [], [libnm_dep]], diff --git a/libnm/meson.build b/libnm/meson.build index 76cadc71e3..acf2284bee 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -6,7 +6,7 @@ libnm_nm_default_dep = declare_dependency( dependencies: libnm_core_nm_default_dep, ) -cflags = [ +c_flags = [ '-DG_LOG_DOMAIN="@0@"'.format(libnm_name), '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM', ] @@ -65,12 +65,11 @@ install_headers( subdir: libnm_name, ) -enum_headers = libnm_headers + [nm_version_macro_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', @@ -133,48 +132,50 @@ libnm_sources = files( 'nm-wimax-nsp.c', ) -linker_script = join_paths(meson.current_source_dir(), 'libnm.ver') +deps = [ + libnmdbus_dep, + libnm_nm_default_dep, + libnm_udev_aux_dep, + libudev_dep, +] + +links = [ + libnm_libnm_core_intern, + libnm_systemd_logging_stub, +] liblibnm = static_library( 'libnm', - sources: libnm_sources + libnm_enum, + sources: libnm_sources + libnm_enum_sources, include_directories: libnm_core_inc, - dependencies: [ - libnmdbus_dep, - dl_dep, - libudev_dep, - libnm_nm_default_dep, - libnm_udev_aux_dep, - uuid_dep, - ], - c_args: cflags, - link_with: [libnm_systemd_logging_stub, libnm_libnm_core_intern], + dependencies: deps, + c_args: c_flags, + link_with: links, ) +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, dependencies: libnm_nm_default_dep, - link_whole: [ - liblibnm, - libnm_core, - libnm_systemd_logging_stub, - libnmdbus, - libnm_utils_base, - ], - link_args: [ - '-Wl,--version-script,@0@'.format(linker_script), - ], + 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, ) @@ -199,21 +200,19 @@ test( ) if enable_introspection - gir_sources = libnm_core_enum_sources + libnm_core_headers + libnm_core_sources + libnm_enum + libnm_headers + libnm_sources + [nm_version_macro_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') @@ -276,9 +275,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 bfa126e2ec..76c3b2876d 100644 --- a/libnm/tests/meson.build +++ b/libnm/tests/meson.build @@ -1,8 +1,8 @@ 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], ] deps = [ @@ -10,7 +10,7 @@ deps = [ libnm_nm_default_dep, ] -cflags = [ +c_flags = [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM', ] @@ -18,13 +18,9 @@ cflags = [ foreach test_unit: test_units exe = executable( test_unit[0], - [ - test_unit[0] + '.c', - nm_test_utils_impl_source, - libnm_enum[1], - ], + [test_unit[0] + '.c', nm_test_utils_impl_source, libnm_enum_sources[1]], dependencies: deps, - c_args: cflags, + c_args: c_flags, link_with: liblibnm, ) @@ -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: nm_vpn_plugin_utils_source + [libnm_enum[1]], + sources: nm_vpn_plugin_utils_source + [libnm_enum_sources[1]], include_directories: libnm_inc, dependencies: libnm_nm_default_dep, - c_args: cflags, + c_args: c_flags, ) From 1066ddb3a1c1ab56e0214990665e96874476a397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Tue, 10 Sep 2019 10:15:34 +0200 Subject: [PATCH 12/41] meson: Improve the systemd build file The `systemd` build file has been improved by grouping together all the objects used in the building of the `libnm-systemd-core` library. --- src/systemd/meson.build | 84 +++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 40 deletions(-) diff --git a/src/systemd/meson.build b/src/systemd/meson.build index 64f0c3ccd1..5c4fa3e2ad 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -1,44 +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: include_directories( - 'sd-adapt-core', - 'src/libsystemd-network', - 'src/libsystemd/sd-event', - 'src/systemd', - ), - dependencies: [ - daemon_nm_default_dep, - libnm_systemd_shared_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, ) From 31f15167607a15c07723706ef993223378684086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Tue, 10 Sep 2019 12:54:46 +0200 Subject: [PATCH 13/41] meson: Improve the src build file The targets that involve the use of the `NetworkManager` library, built in the `src` build file have been improved by applying a set of changes: - Indentation has been fixed. - Set of objects used in targets have been grouped together. - Aritificial dependencies used to group dependencies and custom compiler flags have been removed and their use replaced with proper dependencies and compiler flags to avoid any confussion. --- src/devices/tests/meson.build | 4 +- src/devices/wifi/tests/meson.build | 3 +- src/devices/wwan/tests/meson.build | 3 +- src/dhcp/tests/meson.build | 3 +- src/dnsmasq/tests/meson.build | 3 +- src/initrd/tests/meson.build | 11 ++- src/meson.build | 71 +++++++++---------- src/ndisc/tests/meson.build | 6 +- src/platform/tests/meson.build | 29 ++++---- .../plugins/ifcfg-rh/tests/meson.build | 7 +- .../plugins/ifupdown/tests/meson.build | 3 +- .../plugins/keyfile/tests/meson.build | 3 +- src/supplicant/tests/meson.build | 3 +- src/tests/config/meson.build | 7 +- src/tests/meson.build | 17 +++-- 15 files changed, 93 insertions(+), 80 deletions(-) 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/tests/meson.build b/src/devices/wifi/tests/meson.build index ba756d531b..e705e1307e 100644 --- a/src/devices/wifi/tests/meson.build +++ b/src/devices/wifi/tests/meson.build @@ -3,7 +3,8 @@ test_unit = 'test-devices-wifi' exe = executable( test_unit, [test_unit + '.c'] + common_sources, - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( diff --git a/src/devices/wwan/tests/meson.build b/src/devices/wwan/tests/meson.build index 64dd76742a..a61fb81782 100644 --- a/src/devices/wwan/tests/meson.build +++ b/src/devices/wwan/tests/meson.build @@ -2,8 +2,9 @@ exe = executable( 'test-service-providers', sources: files('test-service-providers.c', '../nm-service-providers.c'), - dependencies: test_nm_dep, include_directories: wwan_inc, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) test( 'wwan/test-service-providers', 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/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 9da0d0bb3e..748fa519bc 100644 --- a/src/meson.build +++ b/src/meson.build @@ -48,12 +48,12 @@ sources = files( deps = [ daemon_nm_default_dep, - libsystemd_dep, - libudev_dep, libn_dhcp4_dep, libnm_core_dep, libnm_systemd_shared_dep, libnm_udev_aux_dep, + libsystemd_dep, + libudev_dep, ] if enable_wext @@ -153,12 +153,18 @@ sources = files( nm_deps = [ daemon_nm_default_dep, dl_dep, + libn_acd_dep, libndp_dep, libudev_dep, - libn_acd_dep, logind_dep, ] +nm_links = [ + libnetwork_manager_base, + libnm_systemd_core, + libnm_systemd_shared, +] + if enable_concheck nm_deps += libcurl_dep endif @@ -180,11 +186,7 @@ libnetwork_manager = static_library( sources: sources, dependencies: nm_deps, c_args: daemon_c_flags, - link_with: [ - libnetwork_manager_base, - libnm_systemd_core, - libnm_systemd_shared, - ], + link_with: nm_links, ) deps = [ @@ -201,11 +203,7 @@ executable( name + '.c', dependencies: deps, c_args: daemon_c_flags, - link_with: [ - libnetwork_manager_base, - libnm_systemd_core, - libnm_systemd_shared, - ], + link_with: nm_links, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, @@ -213,41 +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', ) - test_cflags = daemon_c_flags + ['-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: daemon_nm_default_dep, - c_args: test_cflags, + c_args: test_c_flags, link_with: libnetwork_manager, ) - test_nm_dep = declare_dependency( + libnetwork_manager_test_dep = declare_dependency( dependencies: daemon_nm_default_dep, - compile_args: test_cflags, 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') @@ -282,18 +269,20 @@ network_manager_sym = executable( 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 ], + 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, @@ -308,11 +297,15 @@ 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 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..8f01c01b13 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], @@ -28,5 +32,6 @@ endforeach executable( 'monitor', 'monitor.c', - dependencies: test_nm_dep, + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, ) diff --git a/src/settings/plugins/ifcfg-rh/tests/meson.build b/src/settings/plugins/ifcfg-rh/tests/meson.build index f65494bb45..25d548ebef 100644 --- a/src/settings/plugins/ifcfg-rh/tests/meson.build +++ b/src/settings/plugins/ifcfg-rh/tests/meson.build @@ -1,11 +1,12 @@ -test_unit = 'test-ifcfg-rh' - test_ifcfg_dir = meson.current_source_dir() +test_unit = 'test-ifcfg-rh' + 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/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/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 df81f3ce47..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,20 +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', dependencies: daemon_nm_default_dep, - c_args: cflags, - link_with: [ - libnm_systemd_core, - libnm_systemd_shared, - ], + c_args: c_flags, + link_with: links, ) test( From 780585952d663f3701314843322937354cb6c016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 07:52:00 +0200 Subject: [PATCH 14/41] meson: Use variable for test program name The name of the `monitor` test program is duplicated. A variable has been used to avoid using the same string twice. --- src/platform/tests/meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platform/tests/meson.build b/src/platform/tests/meson.build index 8f01c01b13..6f7173b6da 100644 --- a/src/platform/tests/meson.build +++ b/src/platform/tests/meson.build @@ -29,9 +29,11 @@ foreach test_unit: test_units ) endforeach +name = 'monitor' + executable( - 'monitor', - 'monitor.c', + name, + name + '.c', dependencies: libnetwork_manager_test_dep, c_args: test_c_flags, ) From 23bd02110cbb99d102c2478a9ba8085d8ee6a9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 07:54:23 +0200 Subject: [PATCH 15/41] meson: Rename the compiler flags variable Renamed the variable holding the compiler flags to be consistent with different meson ports. This naming pattern improves the use of different compiler flags in environments with multiple languages. --- src/dhcp/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dhcp/meson.build b/src/dhcp/meson.build index 593e9d5ebc..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', ] @@ -9,7 +9,7 @@ executable( name, name + '.c', dependencies: glib_nm_default_dep, - c_args: cflags, + c_args: c_flags, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, From dababfa59ea68d780576d860c3ba1d2b43645465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 08:04:39 +0200 Subject: [PATCH 16/41] meson: Improve ppp build file The set of c_flags used when building `ppp` targets has been grouped together. Used dependencies have also been reviewed and removed the unnecessary one. --- src/ppp/meson.build | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/ppp/meson.build b/src/ppp/meson.build index 3cfbd6018b..0c458768f3 100644 --- a/src/ppp/meson.build +++ b/src/ppp/meson.build @@ -1,20 +1,16 @@ name = 'nm-pppd-plugin' -deps = [ - dl_dep, - libnm_core_nm_default_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, ) @@ -28,9 +24,7 @@ core_plugins += shared_module( sources: 'nm-ppp-manager.c', dependencies: daemon_nm_default_dep, c_args: daemon_c_flags, - link_args: [ - '-Wl,--version-script,@0@'.format(linker_script), - ], + link_args: '-Wl,--version-script,@0@'.format(linker_script), link_depends: linker_script, install: true, install_dir: nm_plugindir, From c4dc02c9bd1498bfcf10b7dc633176ef057e40da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 08:07:57 +0200 Subject: [PATCH 17/41] meson: Avoid the use of unnecessary array The linker flags used when building `libnm_wwan` target uses an array even when it only uses one value. When using only one value the array is unnecessary so it has been removed. --- src/devices/wwan/meson.build | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 88649a25a8..5a79096934 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -22,9 +22,7 @@ libnm_wwan = shared_module( sources: sources, dependencies: deps, c_args: daemon_c_flags, - link_args: [ - '-Wl,--version-script,@0@'.format(linker_script), - ], + link_args: '-Wl,--version-script,@0@'.format(linker_script), link_depends: linker_script, install: true, install_dir: nm_plugindir, From 4e5b1e257eba0052c813bf0867ecace879842d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 08:25:18 +0200 Subject: [PATCH 18/41] meson: Improve nm-initrd-generator target The set of link targets used when building `nm-initrd-generator` target has been grouped together. --- src/initrd/meson.build | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/initrd/meson.build b/src/initrd/meson.build index 3495454eaf..09036f27c4 100644 --- a/src/initrd/meson.build +++ b/src/initrd/meson.build @@ -13,12 +13,17 @@ libnmi_core = static_library( name = 'nm-initrd-generator' +links = [ + libnetwork_manager_base, + libnmi_core, +] + executable( name, name + '.c', dependencies: daemon_nm_default_dep, c_args: daemon_c_flags, - link_with: [libnetwork_manager_base, libnmi_core], + link_with: links, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, From f5f9c071bac44a5710d47a34956ad040ef48bedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 08:54:05 +0200 Subject: [PATCH 19/41] meson: Improve ifcfg-rh plugin build The file has been fixed to be consistent with the rest of the files. The data files to be installed have been grouped together. The sourc files has been listed vertically and the link target in `nm-settings-plugin-ifcfg-rh` does not use an array anymore. --- src/settings/plugins/ifcfg-rh/meson.build | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index cda65e18be..f5cfff4c9d 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -32,14 +32,17 @@ libnms_ifcfg_rh_core = static_library( 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: daemon_nm_default_dep, c_args: daemon_c_flags, - link_with: [libnms_ifcfg_rh_core], + link_with: libnms_ifcfg_rh_core, link_args: ldflags_linker_script_settings, link_depends: linker_script_settings, install: true, @@ -60,8 +63,13 @@ check-local-symbols-settings-ifcfg-rh: src/settings/plugins/ifcfg-rh/libnm-setti $(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', ) From a010fcb5f799bce8af5f497f4e2cbef75a2cdfb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 08:59:12 +0200 Subject: [PATCH 20/41] meson: Move network-config directory creation to main install file The `ifcfg-rh` meson build file installs a new post install script to create the `network-config` directory. This has been moved to the main post install file so it's easier to find because all post install steps are together and it avoids and extra post install script execution. --- meson.build | 2 ++ src/settings/plugins/ifcfg-rh/meson.build | 3 --- tools/meson-post-install.sh | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 73f161485c..a5dea295fa 100644 --- a/meson.build +++ b/meson.build @@ -895,6 +895,8 @@ meson.add_install_script( nm_pkgstatedir, enable_docs ? 'install_docs' : '', nm_mandir, + enable_ifcfg_rh ? 'create_network_scripts' : '', + nm_sysconfdir, ) output = '\nSystem paths:\n' diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index f5cfff4c9d..9cda662a43 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -74,9 +74,6 @@ install_data( 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/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 From 146348199e8cfb1fe361e8164d5226dbc50d0cfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 09:06:16 +0200 Subject: [PATCH 21/41] meson: Remove unused variable --- src/settings/plugins/ifcfg-rh/tests/meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/tests/meson.build b/src/settings/plugins/ifcfg-rh/tests/meson.build index 25d548ebef..216990457a 100644 --- a/src/settings/plugins/ifcfg-rh/tests/meson.build +++ b/src/settings/plugins/ifcfg-rh/tests/meson.build @@ -1,5 +1,3 @@ -test_ifcfg_dir = meson.current_source_dir() - test_unit = 'test-ifcfg-rh' exe = executable( From 509706b62b51bdaf3a4067d29b7772ac36767a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 09:10:21 +0200 Subject: [PATCH 22/41] meson: Avoid the creation of an extra variable An extra variable is used for sources of `libnm-settings-plugin-ifupdown` module. However, it only contains one source file and using it directly avoiding the creation of the extra variable doesn't hurt readibility. --- src/settings/plugins/ifupdown/meson.build | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/settings/plugins/ifupdown/meson.build b/src/settings/plugins/ifupdown/meson.build index 3094e7af14..78d353a56e 100644 --- a/src/settings/plugins/ifupdown/meson.build +++ b/src/settings/plugins/ifupdown/meson.build @@ -10,13 +10,9 @@ libnms_ifupdown_core = static_library( c_args: daemon_c_flags, ) -sources = files( - 'nms-ifupdown-plugin.c', -) - libnm_settings_plugin_ifupdown = shared_module( 'nm-settings-plugin-ifupdown', - sources: sources, + sources: 'nms-ifupdown-plugin.c', dependencies: daemon_nm_default_dep, c_args: daemon_c_flags, link_with: libnms_ifupdown_core, From c5e80a23fef8227a8963821868be5814666dcb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 09:11:58 +0200 Subject: [PATCH 23/41] meson: Remove extra new line --- dispatcher/meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/dispatcher/meson.build b/dispatcher/meson.build index aaaedda5c8..e0559422ae 100644 --- a/dispatcher/meson.build +++ b/dispatcher/meson.build @@ -8,7 +8,6 @@ service_conf.set('sysconfdir', nm_sysconfdir) service_conf.set('localstatedir', nm_localstatedir) service_conf.set('libexecdir', nm_libexecdir) - configure_file( input: 'org.freedesktop.nm_dispatcher.service.in', output: '@BASENAME@', From 4e85fdcdb77b050e4d02eedd76be0ef4404ca53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 09:16:58 +0200 Subject: [PATCH 24/41] meson: Avoid the creation of extra variables Extra variables are used for sources of targets in the `dispatcher` build file. These have been moved to the `source` parameter because using them directly avoiding the creation of extra variablse doesn't hurt readibility. The compiler flags `cflags` variable has also been renamed to be consistent with the rest of build files. --- dispatcher/meson.build | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/dispatcher/meson.build b/dispatcher/meson.build index e0559422ae..bd27e49b20 100644 --- a/dispatcher/meson.build +++ b/dispatcher/meson.build @@ -20,27 +20,23 @@ install_data( install_dir: dbus_conf_dir, ) -sources = files('nm-dispatcher-utils.c') - deps = [ libnm_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', @@ -50,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, From 70da6993c878444cd3a95f81753594af87ea1793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 09:28:04 +0200 Subject: [PATCH 25/41] meson: Improve dispatcher test build file Different objects used in the `test-dispatcher-envp` target have been grouped together. The dependency over the `libnm` library has been removed as it is unnecessary. --- dispatcher/tests/meson.build | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/dispatcher/tests/meson.build b/dispatcher/tests/meson.build index d339455b59..83c915e585 100644 --- a/dispatcher/tests/meson.build +++ b/dispatcher/tests/meson.build @@ -1,23 +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_dep, - libnm_nm_default_dep, - libnm_utils_base_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, ) From 096748a196965ee781ac01b73b23e7d51b5459e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 11:10:08 +0200 Subject: [PATCH 26/41] meson: Rename cflags variable The variable holding the compiler flags, `cflags`, has been renamed to `c_flags` to be consistent with the rest of build files. Different objects used in the `test-dispatcher-envp` target have been grouped together. The dependency over the `libnm` library has been removed as it is unnecessary. --- clients/cli/meson.build | 4 ++-- clients/common/meson.build | 6 +++--- clients/common/tests/meson.build | 2 +- clients/meson.build | 6 +++--- clients/tui/meson.build | 4 ++-- clients/tui/newt/meson.build | 2 +- meson.build | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/clients/cli/meson.build b/clients/cli/meson.build index f5ca1c0ab9..d8cb6e2856 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -26,7 +26,7 @@ deps = [ readline_dep, ] -cflags = clients_cflags + [ +c_flags = clients_c_flags + [ '-DG_LOG_DOMAIN="@0@"'.format(name), ] @@ -40,7 +40,7 @@ executable( name, sources, dependencies: deps, - c_args: cflags, + c_args: c_flags, 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 b277f441eb..c7f0e861cd 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -8,7 +8,7 @@ deps = [ libnm_nm_default_dep, ] -cflags = clients_cflags + [ +c_flags = clients_c_flags + [ '-DG_LOG_DOMAIN="libnmc"', ] @@ -20,7 +20,7 @@ libnmc_base = static_library( 'nm-vpn-helpers.c', ), dependencies: deps, - c_args: cflags, + c_args: c_flags, ) libnmc_base_dep = declare_dependency( @@ -63,7 +63,7 @@ libnmc = static_library( 'nm-meta-setting-desc.c', ) + nm_meta_setting_source + [settings_docs_source], dependencies: deps, - c_args: cflags, + c_args: c_flags, link_with: libnmc_base, link_depends: settings_docs_source, ) diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index 061b1fd68d..ea46de50a0 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -9,7 +9,7 @@ exe = executable( libnmc_base_dep, libnm_nm_default_dep, ], - c_args: clients_cflags + [ + c_args: clients_c_flags + [ '-DNETWORKMANAGER_COMPILATION_TEST', ], ) diff --git a/clients/meson.build b/clients/meson.build index 1c539d98ef..93aa9b15fa 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -5,11 +5,11 @@ deps = [ libnm_nm_default_dep, ] -clients_cflags = [ +clients_c_flags = [ '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', ] -cflags = clients_cflags + [ +c_flags = clients_c_flags + [ '-DG_LOG_DOMAIN="@0@"'.format(name), ] @@ -17,7 +17,7 @@ executable( name, name + '.c', dependencies: deps, - c_args: cflags, + c_args: c_flags, 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 68162bc00b..a93f41b6f7 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -5,7 +5,7 @@ deps = [ newt_dep, ] -cflags = clients_cflags + [ +c_flags = clients_c_flags + [ '-DG_LOG_DOMAIN="@0@"'.format(name), ] @@ -66,7 +66,7 @@ executable( name, sources, dependencies: deps, - c_args: cflags, + c_args: c_flags, link_with: libnm_systemd_logging_stub, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, diff --git a/clients/tui/newt/meson.build b/clients/tui/newt/meson.build index 0b7fde9428..af32247bd9 100644 --- a/clients/tui/newt/meson.build +++ b/clients/tui/newt/meson.build @@ -26,7 +26,7 @@ libnmt_newt = static_library( sources: sources + [libnm_enum_sources[1]], include_directories: libnm_inc, dependencies: deps, - c_args: cflags, + c_args: c_flags, ) libnmt_newt_dep = declare_dependency( diff --git a/meson.build b/meson.build index a5dea295fa..969ac382d5 100644 --- a/meson.build +++ b/meson.build @@ -137,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 From 60b2c8683f0841ff75b6579d36101e23ed772f98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 11:22:57 +0200 Subject: [PATCH 27/41] meson: Make one liner compiler flag --- clients/meson.build | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/clients/meson.build b/clients/meson.build index 93aa9b15fa..71041f7e39 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -1,3 +1,5 @@ +clients_c_flags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT'] + name = 'nm-online' deps = [ @@ -5,19 +7,11 @@ deps = [ libnm_nm_default_dep, ] -clients_c_flags = [ - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', -] - -c_flags = clients_c_flags + [ - '-DG_LOG_DOMAIN="@0@"'.format(name), -] - executable( name, name + '.c', dependencies: deps, - c_args: c_flags, + c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, From 25bb43f4db20bbf58666ba5994e2fc54f08e4d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 11:45:10 +0200 Subject: [PATCH 28/41] meson: Ease the use of the libnm-libnm-core-intern library The dependency for the `libnm-libnm-core-intern` library has been recovered to ease its use. --- libnm-core/meson.build | 7 +++++++ libnm/meson.build | 9 ++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/libnm-core/meson.build b/libnm-core/meson.build index ffe9e4bd9e..0060bed140 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -92,6 +92,13 @@ libnm_libnm_core_intern = static_library( 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, diff --git a/libnm/meson.build b/libnm/meson.build index acf2284bee..8b68a63679 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -134,23 +134,18 @@ libnm_sources = files( deps = [ libnmdbus_dep, + libnm_libnm_core_intern_dep, libnm_nm_default_dep, libnm_udev_aux_dep, libudev_dep, ] -links = [ - libnm_libnm_core_intern, - libnm_systemd_logging_stub, -] - liblibnm = static_library( 'libnm', sources: libnm_sources + libnm_enum_sources, - include_directories: libnm_core_inc, dependencies: deps, c_args: c_flags, - link_with: links, + link_with: libnm_systemd_logging_stub, ) links = [ From 83b760cf98b32ddfa5fa2846c76a99993ecf3183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 12:03:42 +0200 Subject: [PATCH 29/41] meson: Improve the client common build file The build file in the `client` `common` directory has been improved by grouping the objects used in properties and by reviewing the dependencies used by libraries built in the file. --- clients/common/meson.build | 41 ++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/clients/common/meson.build b/clients/common/meson.build index c7f0e861cd..afa257b1df 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -2,29 +2,29 @@ common_inc = include_directories('.') nm_polkit_listener = files('nm-polkit-listener.c') -deps = [ +common_deps = [ libnm_dep, - libnm_libnm_core_aux_dep, libnm_nm_default_dep, ] -c_flags = clients_c_flags + [ - '-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: c_flags, + 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, ) @@ -51,25 +51,22 @@ else ) endif -deps += [ - libnm_libnm_core_aux_dep, - libnm_utils_base_dep, -] +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', - ) + nm_meta_setting_source + [settings_docs_source], - dependencies: deps, + sources: sources, + dependencies: common_deps + [libnm_libnm_core_aux_dep], c_args: c_flags, - link_with: libnmc_base, link_depends: settings_docs_source, ) libnmc_dep = declare_dependency( include_directories: common_inc, + dependencies: common_deps, link_with: libnmc, ) From f5d74ce179732f8511dcd8e61074acaf56826fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 12:12:26 +0200 Subject: [PATCH 30/41] meson: Improve the client common test build file The build file in the `client` `common` directory has been improved by grouping the objects used in properties and by reviewing the dependencies used by tests built. Finally the indentation has also been fixed. --- clients/common/tests/meson.build | 41 +++++++++++++++----------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index ea46de50a0..479cb78101 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -1,26 +1,26 @@ +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_nm_default_dep, - ], - c_args: clients_c_flags + [ - '-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, @@ -29,18 +29,15 @@ deps = [ ] exe = executable( - 'test-libnm-core-aux', - [ 'test-libnm-core-aux.c', ], - c_args: [ - '-DNETWORKMANAGER_COMPILATION_TEST', - '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', - ], - dependencies: deps, - link_with: libnm_systemd_logging_stub, + 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()] ) From 8a5a38f74af38ec4ab25afca21642b593c2dc8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 12:15:16 +0200 Subject: [PATCH 31/41] meson: Improve nmcli build The dependencies used in the build of `nmcli` has been reviewed and removed the unnecessary ones. The used compiler flags has also been moved to one line. --- clients/cli/meson.build | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/clients/cli/meson.build b/clients/cli/meson.build index d8cb6e2856..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_nm_default_dep, readline_dep, ] -c_flags = clients_c_flags + [ - '-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: c_flags, + c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, From da40a6597fb37bd49bb1c7b01954de199ffed740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 12:23:26 +0200 Subject: [PATCH 32/41] meson: Improve nmtui and libnmt-newt build The dependencies used in the build of the `nmtui` executable and the `libnmt-newt` library have been reviewed. The compiler flags used in common by them has also been moved to a `common_c_flags` variable to avoid any confussion. --- clients/tui/meson.build | 17 ++++------------- clients/tui/newt/meson.build | 11 ++++++++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/clients/tui/meson.build b/clients/tui/meson.build index a93f41b6f7..8948d6ff35 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -1,13 +1,6 @@ name = 'nmtui' -deps = [ - libnm_nm_default_dep, - newt_dep, -] - -c_flags = clients_c_flags + [ - '-DG_LOG_DOMAIN="@0@"'.format(name), -] +common_c_flags = clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)] subdir('newt') @@ -54,11 +47,9 @@ sources = files( 'nmt-widget-list.c', ) -deps += [ - libnm_dep, - libnmc_dep, +deps = [ libnmc_base_dep, - libnm_libnm_core_aux_dep, + libnmc_dep, libnmt_newt_dep, ] @@ -66,7 +57,7 @@ executable( name, sources, dependencies: deps, - c_args: c_flags, + c_args: common_c_flags, link_with: libnm_systemd_logging_stub, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, diff --git a/clients/tui/newt/meson.build b/clients/tui/newt/meson.build index af32247bd9..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_sources[1]], - include_directories: libnm_inc, + sources: sources, dependencies: deps, - c_args: c_flags, + c_args: common_c_flags, ) libnmt_newt_dep = declare_dependency( include_directories: include_directories('.'), + dependencies: newt_dep, link_with: libnmt_newt, ) From 700f6f6b5fd5dd9975200cb22a9251e811963d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 13:00:54 +0200 Subject: [PATCH 33/41] meson: Improve Qt examples Qt dependencies have been moved to the main build file where the rest of dependencies are located. This makes it easier to find them. The included directories has also reviewed and removed the unnecessary ones. --- examples/C/qt/meson.build | 13 +++---------- meson.build | 5 +++++ 2 files changed, 8 insertions(+), 10 deletions(-) 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/meson.build b/meson.build index 969ac382d5..4f93dd3a9a 100644 --- a/meson.build +++ b/meson.build @@ -840,6 +840,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 From 9d4e1ad5e3bd6b903f6c96f65fc1d7ef3a0febc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 13:15:22 +0200 Subject: [PATCH 34/41] meson: Improve libnm documentation build file the `doc_module` variable has been removed. It was created because its used in the autotools build file but actually `libnm_name` variable can be used easily. Different objects used in the documentation target have been grouped together. The content file `version.xml` is now added properly. --- docs/libnm/meson.build | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/docs/libnm/meson.build b/docs/libnm/meson.build index 7da4061a3d..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( +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, ) From f0b7041063593361419a872df56d27502f174443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 22:28:07 +0200 Subject: [PATCH 35/41] meson: Improve api documentation build file the `doc_module` variable has been removed. It was created because its used in the autotools build file but actually `nm_name` variable can be used easily. Different objects used in the documentation target have been grouped together. The content file `version.xml`, and different build files are now added properly. --- docs/api/meson.build | 53 +++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/docs/api/meson.build b/docs/api/meson.build index 3ea2edd5fe..dde1eecb03 100644 --- a/docs/api/meson.build +++ b/docs/api/meson.build @@ -1,45 +1,52 @@ -doc_module = nm_name - -settings = 'settings-spec' -output = settings + '.xml' - if enable_introspection - settings_xml = custom_target( + settings = 'settings-spec' + output = settings + '.xml' + + inputs = [ + settings + '.xsl', + nm_settings_docs, + ] + + 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( +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, From 7e1aacaef253b7b58b099924a14d9c03868cbad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 23:05:24 +0200 Subject: [PATCH 36/41] meson: Remove tests related to check_so_symbols These tests are already working since 19a718bc1 so `FIXME` comments are not needed anymore. --- meson.build | 13 ------------- src/devices/adsl/meson.build | 7 ------- src/devices/bluetooth/meson.build | 7 ------- src/devices/ovs/meson.build | 7 ------- src/devices/team/meson.build | 7 ------- src/devices/wifi/meson.build | 7 ------- src/devices/wwan/meson.build | 9 --------- src/settings/plugins/ifcfg-rh/meson.build | 12 ------------ src/settings/plugins/ifupdown/meson.build | 12 ------------ 9 files changed, 81 deletions(-) diff --git a/meson.build b/meson.build index 4f93dd3a9a..20145fba49 100644 --- a/meson.build +++ b/meson.build @@ -808,19 +808,6 @@ fi 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 -''' - subdir('introspection') subdir('shared') subdir('libnm-core') diff --git a/src/devices/adsl/meson.build b/src/devices/adsl/meson.build index 16fed29658..a5d1c4b474 100644 --- a/src/devices/adsl/meson.build +++ b/src/devices/adsl/meson.build @@ -21,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 3540fb158c..d3489871f2 100644 --- a/src/devices/bluetooth/meson.build +++ b/src/devices/bluetooth/meson.build @@ -34,10 +34,3 @@ test( check_exports, 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) -''' diff --git a/src/devices/ovs/meson.build b/src/devices/ovs/meson.build index cffe015ebe..27e1b4d02c 100644 --- a/src/devices/ovs/meson.build +++ b/src/devices/ovs/meson.build @@ -29,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 147676b0ce..0e63183b5e 100644 --- a/src/devices/team/meson.build +++ b/src/devices/team/meson.build @@ -27,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/wifi/meson.build b/src/devices/wifi/meson.build index 81b3d17d9c..f1c4af9625 100644 --- a/src/devices/wifi/meson.build +++ b/src/devices/wifi/meson.build @@ -38,13 +38,6 @@ 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') endif diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 5a79096934..37d3c2ca4e 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -69,15 +69,6 @@ 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') endif diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index 9cda662a43..d9dd3edba5 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -51,18 +51,6 @@ 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', diff --git a/src/settings/plugins/ifupdown/meson.build b/src/settings/plugins/ifupdown/meson.build index 78d353a56e..0cabe771fe 100644 --- a/src/settings/plugins/ifupdown/meson.build +++ b/src/settings/plugins/ifupdown/meson.build @@ -24,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 From 2172b885b4d0ee15ae572d26c2016b6a4f957e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Wed, 11 Sep 2019 23:39:48 +0200 Subject: [PATCH 37/41] meson: Improve the wwan test build file The test unit name string is used in different place so it has been replaced by a variable. The `nm-service-providers.c` source file is appended by using a `files` generated object. --- src/devices/wwan/meson.build | 5 +++-- src/devices/wwan/tests/meson.build | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 37d3c2ca4e..7f0ca27f04 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -1,8 +1,9 @@ -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 = [ diff --git a/src/devices/wwan/tests/meson.build b/src/devices/wwan/tests/meson.build index a61fb81782..e165c5482b 100644 --- a/src/devices/wwan/tests/meson.build +++ b/src/devices/wwan/tests/meson.build @@ -1,13 +1,15 @@ +test_unit = 'test-service-providers' + exe = executable( - 'test-service-providers', - sources: files('test-service-providers.c', - '../nm-service-providers.c'), + test_unit, + [test_unit + '.c'] + nm_service_providers_source, include_directories: wwan_inc, dependencies: libnetwork_manager_test_dep, c_args: test_c_flags, ) + test( - 'wwan/test-service-providers', + 'wwan/' + test_unit, test_script, timeout: default_test_timeout, args: test_args + [exe.full_path()], From 23b4dc5f77bb854e57ec2de07ed608f2a916a101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Thu, 29 Aug 2019 08:09:09 +0200 Subject: [PATCH 38/41] meson: Rename variables related to pkg-config variables Some variables belong to variables in their correspondent pkg-config file. These variables have been renamed to `dependency_variable` to reflect the dependency and variables from pkg-config files they are related to. Some of these has also been fixed to use paths relative to installation prefix. --- data/meson.build | 12 ++++++------ dispatcher/meson.build | 2 +- introspection/meson.build | 2 +- meson.build | 30 +++++++++++++++--------------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/data/meson.build b/data/meson.build index b8e2e117ee..c317877070 100644 --- a/data/meson.build +++ b/data/meson.build @@ -13,7 +13,7 @@ configure_file( configuration: data_conf, ) -if install_systemd_unit_dir +if install_systemdunitdir services = [ 'NetworkManager-dispatcher.service.in', 'NetworkManager.service.in', @@ -29,7 +29,7 @@ if install_systemd_unit_dir configure_file( input: service, output: '@BASENAME@', - install_dir: systemd_system_unit_dir, + install_dir: systemd_systemdsystemunitdir, configuration: data_conf, ) endforeach @@ -37,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', @@ -51,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 @@ -70,6 +70,6 @@ if enable_polkit 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 bd27e49b20..a7e555702a 100644 --- a/dispatcher/meson.build +++ b/dispatcher/meson.build @@ -11,7 +11,7 @@ service_conf.set('libexecdir', nm_libexecdir) configure_file( input: 'org.freedesktop.nm_dispatcher.service.in', output: '@BASENAME@', - install_dir: dbus_sys_dir, + install_dir: dbus_system_bus_services_dir, configuration: service_conf, ) diff --git a/introspection/meson.build b/introspection/meson.build index 03cfa46243..10b0405053 100644 --- a/introspection/meson.build +++ b/introspection/meson.build @@ -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/meson.build b/meson.build index 20145fba49..f5eb547864 100644 --- a/meson.build +++ b/meson.build @@ -314,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') @@ -461,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() @@ -494,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') @@ -526,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 @@ -894,7 +894,7 @@ meson.add_install_script( 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' From 95abecb24d5621f56e48203b5d4fe5b9f9a0e446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Fri, 13 Sep 2019 14:36:44 +0200 Subject: [PATCH 39/41] meson: Make use of gnome.mkenums_simple There are different enum files created that make use of different template files. However, `mkenums_simple` method allows the creation of the same enum files without the need of template files. The creation of the `nm-core-enum-types` and `nm-core-tests-enum-types` use now `mkenums_simple` so template files are now unnecessary. --- libnm-core/meson.build | 4 +--- libnm-core/tests/meson.build | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/libnm-core/meson.build b/libnm-core/meson.build index 0060bed140..4c72590e7b 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -75,12 +75,10 @@ libnm_core_headers = files( enum_types = 'nm-core-enum-types' -libnm_core_enum_sources = gnome.mkenums( +libnm_core_enum_sources = gnome.mkenums_simple( enum_types, sources: libnm_core_headers + [nm_version_macro_header], identifier_prefix: nm_id_prefix, - c_template: enum_types + '.c.template', - h_template: enum_types + '.h.template', install_header: true, install_dir: libnm_pkgincludedir, ) diff --git a/libnm-core/tests/meson.build b/libnm-core/tests/meson.build index f91fb6ab11..292eeaa015 100644 --- a/libnm-core/tests/meson.build +++ b/libnm-core/tests/meson.build @@ -9,12 +9,10 @@ enum_types = 'nm-core-tests-enum-types' -enum_sources = 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 = [ From 05c7a7702277e522579474abccd2e0cf16d42dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Tue, 24 Sep 2019 12:56:09 +0200 Subject: [PATCH 40/41] meson: Add missing "nm-bt-test" helper program In 878d4963e a new `nm-bt-test` helper program was added. However, although `autotools` build steps were included, meson build steps were not. This add meson's build steps. --- Makefile.am | 4 +++- src/devices/bluetooth/meson.build | 2 ++ src/devices/bluetooth/tests/meson.build | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/devices/bluetooth/tests/meson.build diff --git a/Makefile.am b/Makefile.am index 95238324a4..3cae931805 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3486,7 +3486,9 @@ check_local += check-local-devices-bluetooth endif EXTRA_DIST += \ - src/devices/bluetooth/meson.build + src/devices/bluetooth/meson.build \ + src/devices/bluetooth/tests/meson.build \ + $(NULL) ############################################################################### # src/devices/wifi diff --git a/src/devices/bluetooth/meson.build b/src/devices/bluetooth/meson.build index d3489871f2..7854d1756e 100644 --- a/src/devices/bluetooth/meson.build +++ b/src/devices/bluetooth/meson.build @@ -34,3 +34,5 @@ test( check_exports, args: [libnm_device_plugin_bluetooth.full_path(), linker_script_devices], ) + +subdir('tests') diff --git a/src/devices/bluetooth/tests/meson.build b/src/devices/bluetooth/tests/meson.build new file mode 100644 index 0000000000..19b1955d17 --- /dev/null +++ b/src/devices/bluetooth/tests/meson.build @@ -0,0 +1,8 @@ +test_unit = 'nm-bt-test' + +executable( + test_unit, + test_unit + '.c', + dependencies: libnetwork_manager_test_dep, + c_args: test_c_flags, +) From 42a8533d5f35a2b3a6664f9228f9e1dce7708164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Mart=C3=ADnez?= Date: Tue, 24 Sep 2019 13:07:50 +0200 Subject: [PATCH 41/41] meson: Remove devices tests' meson build files The devices tests' meson build files include only the build of a single executable file and its execution as a test unit. This has been moved to the devices' main meson build files so this files can be removed. --- Makefile.am | 4 +--- src/devices/bluetooth/meson.build | 9 ++++++++- src/devices/bluetooth/tests/meson.build | 8 -------- src/devices/wifi/meson.build | 16 +++++++++++++++- src/devices/wifi/tests/meson.build | 15 --------------- src/devices/wwan/meson.build | 17 ++++++++++++++++- src/devices/wwan/tests/meson.build | 16 ---------------- 7 files changed, 40 insertions(+), 45 deletions(-) delete mode 100644 src/devices/bluetooth/tests/meson.build delete mode 100644 src/devices/wifi/tests/meson.build delete mode 100644 src/devices/wwan/tests/meson.build diff --git a/Makefile.am b/Makefile.am index 3cae931805..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) ############################################################################### @@ -3487,7 +3486,6 @@ endif EXTRA_DIST += \ src/devices/bluetooth/meson.build \ - src/devices/bluetooth/tests/meson.build \ $(NULL) ############################################################################### @@ -3560,7 +3558,7 @@ endif EXTRA_DIST += \ src/devices/wifi/meson.build \ - src/devices/wifi/tests/meson.build + $(NULL) ############################################################################### # src/devices/team diff --git a/src/devices/bluetooth/meson.build b/src/devices/bluetooth/meson.build index 7854d1756e..63c47bcba9 100644 --- a/src/devices/bluetooth/meson.build +++ b/src/devices/bluetooth/meson.build @@ -35,4 +35,11 @@ test( args: [libnm_device_plugin_bluetooth.full_path(), linker_script_devices], ) -subdir('tests') +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/bluetooth/tests/meson.build b/src/devices/bluetooth/tests/meson.build deleted file mode 100644 index 19b1955d17..0000000000 --- a/src/devices/bluetooth/tests/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -test_unit = 'nm-bt-test' - -executable( - test_unit, - test_unit + '.c', - dependencies: libnetwork_manager_test_dep, - c_args: test_c_flags, -) diff --git a/src/devices/wifi/meson.build b/src/devices/wifi/meson.build index f1c4af9625..6566f20119 100644 --- a/src/devices/wifi/meson.build +++ b/src/devices/wifi/meson.build @@ -39,5 +39,19 @@ test( ) 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 e705e1307e..0000000000 --- a/src/devices/wifi/tests/meson.build +++ /dev/null @@ -1,15 +0,0 @@ -test_unit = 'test-devices-wifi' - -exe = executable( - test_unit, - [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, -) diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index 7f0ca27f04..ed6f801058 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -71,5 +71,20 @@ run_target( ) 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 e165c5482b..0000000000 --- a/src/devices/wwan/tests/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -test_unit = 'test-service-providers' - -exe = executable( - test_unit, - [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()], -)