diff options
author | Thomas Haller <thaller@redhat.com> | 2021-01-28 08:39:19 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-01-28 09:31:13 +0100 |
commit | b98ec9bc58eb5738e5856e1d16aead218a672fcc (patch) | |
tree | 51e90ec8c0cbb6bbc1a5ad61334778e9982d44ac | |
parent | 98ae351134703b0a085db07982e3e03734fb1d39 (diff) | |
download | NetworkManager-b98ec9bc58eb5738e5856e1d16aead218a672fcc.tar.gz |
build/meson: fix linking of core plugins to not include static helper libraries
We have many static helper libraries, like libnm-glib-aux or libnm-core.
These can be statically linked in any end-binary as internal API. However, they
must only be linked once.
Also, we have various plugins (device, settings, ppp, wwan) which are
dlopened by NetworkManager. They should use the symbols from
NetworkManager core. It is important that they do not link with the
static libraries already, because also NetworkManager core links with
it, so these symbols will be duplicate.
As the symbols are internal, you might think that it is not a real
problem to duplicate them. However, there are also global variables,
like the hash tables for NMRefStr or the seed for NMHash. These global
variables must be only be used once, and hence also these symbols must
no be duplicated.
Fix that by adding a new dependency that is for the core plugins. This
dependency only has "include_directories" but not "link_with".
-rw-r--r-- | src/devices/adsl/meson.build | 2 | ||||
-rw-r--r-- | src/devices/bluetooth/meson.build | 2 | ||||
-rw-r--r-- | src/devices/ovs/meson.build | 2 | ||||
-rw-r--r-- | src/devices/team/meson.build | 2 | ||||
-rw-r--r-- | src/devices/wifi/meson.build | 8 | ||||
-rw-r--r-- | src/devices/wwan/meson.build | 4 | ||||
-rw-r--r-- | src/meson.build | 13 | ||||
-rw-r--r-- | src/ppp/meson.build | 2 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/meson.build | 2 | ||||
-rw-r--r-- | src/settings/plugins/ifupdown/meson.build | 2 |
10 files changed, 27 insertions, 12 deletions
diff --git a/src/devices/adsl/meson.build b/src/devices/adsl/meson.build index 8c6263a669..95f61d958a 100644 --- a/src/devices/adsl/meson.build +++ b/src/devices/adsl/meson.build @@ -6,7 +6,7 @@ libnm_device_plugin_adsl = shared_module( 'nm-atm-manager.c', 'nm-device-adsl.c', ), - dependencies: core_default_dep, + dependencies: core_plugin_dep, c_args: daemon_c_flags, link_args: ldflags_linker_script_devices, link_depends: linker_script_devices, diff --git a/src/devices/bluetooth/meson.build b/src/devices/bluetooth/meson.build index d73646971c..d5f260686f 100644 --- a/src/devices/bluetooth/meson.build +++ b/src/devices/bluetooth/meson.build @@ -22,7 +22,7 @@ libnm_device_plugin_bluetooth_static_dep = declare_dependency( libnm_device_plugin_bluetooth = shared_module( 'nm-device-plugin-bluetooth', dependencies: [ - core_default_dep, + core_plugin_dep, libnm_wwan_dep, bluez5_dep, libnm_device_plugin_bluetooth_static_dep, diff --git a/src/devices/ovs/meson.build b/src/devices/ovs/meson.build index 03db173b44..81c29bd6d4 100644 --- a/src/devices/ovs/meson.build +++ b/src/devices/ovs/meson.build @@ -10,7 +10,7 @@ libnm_device_plugin_ovs = shared_module( 'nm-ovs-factory.c', ), dependencies: [ - core_default_dep, + core_plugin_dep, jansson_dep, ], c_args: daemon_c_flags, diff --git a/src/devices/team/meson.build b/src/devices/team/meson.build index 5a2770dc49..d0ff4caa93 100644 --- a/src/devices/team/meson.build +++ b/src/devices/team/meson.build @@ -7,7 +7,7 @@ libnm_device_plugin_team = shared_module( 'nm-team-factory.c', ), dependencies: [ - core_default_dep, + core_plugin_dep, jansson_dep, libteamdctl_dep, ], diff --git a/src/devices/wifi/meson.build b/src/devices/wifi/meson.build index 59ebf2d567..743937dbda 100644 --- a/src/devices/wifi/meson.build +++ b/src/devices/wifi/meson.build @@ -19,7 +19,9 @@ libnm_device_plugin_wifi_static = static_library( 'nm-wifi-p2p-peer.c', 'nm-wifi-utils.c', ) + iwd_sources, - dependencies: core_default_dep, + dependencies: [ + core_plugin_dep, + ], c_args: daemon_c_flags, ) @@ -33,8 +35,8 @@ libnm_device_plugin_wifi = shared_module( 'nm-wifi-factory.c', ), dependencies: [ - core_default_dep, - libnm_device_plugin_wifi_static_dep, + core_plugin_dep, + libnm_device_plugin_wifi_static_dep ], c_args: daemon_c_flags, link_args: ldflags_linker_script_devices, diff --git a/src/devices/wwan/meson.build b/src/devices/wwan/meson.build index d9ac36de16..87af042949 100644 --- a/src/devices/wwan/meson.build +++ b/src/devices/wwan/meson.build @@ -13,7 +13,7 @@ libnm_wwan = shared_module( 'nm-modem-manager.c', ) + (enable_ofono ? files('nm-modem-ofono.c') : files()), dependencies: [ - core_default_dep, + core_plugin_dep, libsystemd_dep, mm_glib_dep, ], @@ -47,7 +47,7 @@ libnm_device_plugin_wwan = shared_module( 'nm-wwan-factory.c', ), dependencies: [ - core_default_dep, + core_plugin_dep, libsystemd_dep, mm_glib_dep, ], diff --git a/src/meson.build b/src/meson.build index 2a7dc31162..ada4d7ab01 100644 --- a/src/meson.build +++ b/src/meson.build @@ -2,6 +2,19 @@ src_inc = include_directories('.') +core_plugin_dep = declare_dependency( + sources: libnm_core_enum_sources[1], + include_directories: [ + src_inc, + top_inc, + shared_inc, + libnm_core_inc, + ], + dependencies: [ + glib_dep, + ], +) + core_default_dep = declare_dependency( sources: libnm_core_enum_sources[1], include_directories: src_inc, diff --git a/src/ppp/meson.build b/src/ppp/meson.build index 4999a23830..991f0b3dc1 100644 --- a/src/ppp/meson.build +++ b/src/ppp/meson.build @@ -20,7 +20,7 @@ core_plugins += shared_module( sources: [ 'nm-ppp-manager.c', ], - dependencies: core_default_dep, + dependencies: core_plugin_dep, c_args: daemon_c_flags, link_args: '-Wl,--version-script,@0@'.format(linker_script), link_depends: linker_script, diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index 4162c67f48..a2f11a927e 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -37,7 +37,7 @@ libnm_settings_plugin_ifcfg_rh = shared_module( 'nms-ifcfg-rh-storage.c', 'nms-ifcfg-rh-plugin.c', ), - dependencies: core_default_dep, + dependencies: core_plugin_dep, c_args: daemon_c_flags, link_with: libnms_ifcfg_rh_core, link_args: ldflags_linker_script_settings, diff --git a/src/settings/plugins/ifupdown/meson.build b/src/settings/plugins/ifupdown/meson.build index b19d92c2c1..dd2527836c 100644 --- a/src/settings/plugins/ifupdown/meson.build +++ b/src/settings/plugins/ifupdown/meson.build @@ -13,7 +13,7 @@ libnms_ifupdown_core = static_library( libnm_settings_plugin_ifupdown = shared_module( 'nm-settings-plugin-ifupdown', sources: 'nms-ifupdown-plugin.c', - dependencies: core_default_dep, + dependencies: core_plugin_dep, c_args: daemon_c_flags, link_with: libnms_ifupdown_core, link_args: ldflags_linker_script_settings, |