diff --git a/Makefile.am b/Makefile.am index d61e577c8c..036628ec42 100644 --- a/Makefile.am +++ b/Makefile.am @@ -781,7 +781,6 @@ EXTRA_DIST += \ EXTRA_DIST += \ src/libnm-glib-aux/tests/meson.build \ - shared/README.md \ $(NULL) check_programs += src/libnm-glib-aux/tests/test-shared-general @@ -5500,8 +5499,6 @@ EXTRA_DIST += \ \ po/meson.build \ \ - shared/meson.build \ - \ src/meson.build \ \ src/libnm-core-public/nm-version-macros.h.in \ diff --git a/meson.build b/meson.build index c6aaa20ad3..856919fdd5 100644 --- a/meson.build +++ b/meson.build @@ -4,7 +4,7 @@ project( 'NetworkManager', 'c', # NOTE: When incrementing version also: # - add corresponding NM_VERSION_x_y_z macros in -# "shared/nm-version-macros.h.in" +# "src/libnm-core-public/nm-version-macros.h.in" # - update number in configure.ac version: '1.31.1', license: 'GPL2+', @@ -919,7 +919,6 @@ fi content_files = [] subdir('introspection') -subdir('shared') subdir('src') subdir('dispatcher') subdir('clients') diff --git a/shared/README.md b/shared/README.md deleted file mode 100644 index ed950fce39..0000000000 --- a/shared/README.md +++ /dev/null @@ -1,108 +0,0 @@ -The "shared/" Directory -======================= - -For NetworkManager we place helper/utility code under "shared/" -in static libraries. The idea is to avoid code duplication but also -provide high quality helper functions that simplify the higher layers. -In NetworkManager there are complicated parts, for example "src/nm-manager.c" -is huge. On the other hand, this helper code should be simple and easy -to understand, so that we can build more complex code on top of it. - -As we statically link them into our binaries, they are all inherently -internal API, that means they cannot be part of libnm's (libnm-core's) public API. -It also means that their API/ABI is not stable. - -We don't care these libraries to be minimal and contain only symbols that are -used by all users. Instead, we expect the linker to throw away unused symbols. -We achieve this by having a symbol versioning file to hide internal symbols -(which gives the linker a possibility to remove them if they are unused) and -compiling with LTO or `"-Wl,--gc-sections"`. Let the tool solve this and not -manual organization. - -Hence these libraries (and their content) are structured this way to satisfy -the following questions: - -1) which dependencies (libraries) do they have? That determines which - other libraries can use it. For example: - - - "shared/nm-std-aux" and "shared/nm-glib-aux" both provide general - purpose helpers, the difference is that the former has no dependency - on glib2 library. Both these libraries are a basic dependency for - many other parts of the code. - - - "shared/nm-udev-aux" has a dependency on libudev, it thus cannot - be in "shared/nm-glib-aux". - - - client code also has a glib2 dependency. That means it can link with - "shared/nm-std-aux" and "shared/nm-glib-aux", but must not link - with "shared/nm-udev-aux" (as it has no direct udev dependenct -- - although clients get it indirectly because libnm already requires - it). - -2) what is their overall purpose? As said, we rely on the linker to - prune unused symbols. But in a few cases we avoid to merge different - code in the same library. For example: - - - "shared/nm-glib-aux" and "shared/nm-base" both only have a - glib2 dependency. Hence, they could be merged. However we - don't do that because "shared/nm-base" is more about NetworkManager - specific code, while "shared/nm-glib-aux" is about general - purpose helpers. - -3) some of these libraries are forked from an upstream. They are kept - separate so that we can re-import future upstream versions. - -Detail -====== - -- `shared/c-list` -- `shared/c-rbtree` -- `shared/c-siphash` -- `shared/c-stdoux` -- `shared/n-acd` -- `shared/n-dhcp4` - - These are forked from upstream and imported with git-subtree. They - in general only have a libc dependency (or dependencies between each - other). - -- `shared/nm-std-aux` - - This contains helper code with only a libc dependency. - Almost all C code depends on this library. - -- `shared/nm-glib-aux` - - Like "shared/nm-std-aux" but also has a glib2 dependency. - Almost all glib2 code depends on this library. - -- `shared/nm-udev/aux` - - Like "shared/nm-glib-aux" but also has a libudev dependency. It - has code related to libudev. - -- `shared/systemd` - - These are forked from upstream systemd and imported with a script. - Under "shared/systemd/src" we try to keep the sources as close to - the original as possible. There is also some adapter code to make - it useable for us. It has a dependency on "shared/nm-glib-aux" - and will need a logging implementation for "shared/nm-glib-aux/nm-logging-fwd.h". - -- `shared/nm-base` - - Depends on "shared/nm-glib-aux" and glib2 but it provides helper code - that more about NetworkManager specifc things. - -- `shared/nm-log-core` - - This is the logging implementation as used by NetworkManager core ("src/"). - It is also a dependency for "shared/nm-platform". - -- `shared/nm-platform` - - Platform implementation. It depends on "shared/nm-log-core", "shared/nm-base" - and "shared/nm-glib-aux". - -- Other than that, there are still a few unorganized files/directories here. - These should be cleaned up. diff --git a/shared/meson.build b/shared/meson.build deleted file mode 100644 index d6a9d6a9f7..0000000000 --- a/shared/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-or-later - -glib_nm_default_dep = declare_dependency( - include_directories: [ - top_inc, - ], - dependencies: [ - glib_dep, - ], -) diff --git a/src/core/dhcp/meson.build b/src/core/dhcp/meson.build index 1788f864dc..ddaa32fb0e 100644 --- a/src/core/dhcp/meson.build +++ b/src/core/dhcp/meson.build @@ -7,7 +7,7 @@ executable( src_inc, top_inc, ], - dependencies: glib_nm_default_dep, + dependencies: glib_dep, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/src/core/systemd/meson.build b/src/core/systemd/meson.build index 4e51afe0e1..ec4b935de7 100644 --- a/src/core/systemd/meson.build +++ b/src/core/systemd/meson.build @@ -38,13 +38,14 @@ libnm_systemd_core = static_library( ), include_directories: [ incs, + top_inc, src_inc, src_core_inc, ], dependencies: [ - glib_nm_default_dep, libnm_core_impl_dep, libnm_systemd_shared_dep, + glib_dep, ], link_with: libc_siphash, ) diff --git a/src/libnm-glib-aux/meson.build b/src/libnm-glib-aux/meson.build index 5cf0e69fd1..e9c8544c38 100644 --- a/src/libnm-glib-aux/meson.build +++ b/src/libnm-glib-aux/meson.build @@ -22,7 +22,7 @@ libnm_glib_aux = static_library( src_inc, top_inc, ], - dependencies: glib_nm_default_dep, + dependencies: glib_dep, link_with: [ libc_siphash, libnm_std_aux, @@ -35,7 +35,7 @@ libnm_glib_aux_dep = declare_dependency( top_inc, ], dependencies: [ - glib_nm_default_dep, + glib_dep, ], ) diff --git a/src/libnm-log-core/meson.build b/src/libnm-log-core/meson.build index a8e63ebb78..3eb9145703 100644 --- a/src/libnm-log-core/meson.build +++ b/src/libnm-log-core/meson.build @@ -8,8 +8,8 @@ libnm_log_core = static_library( top_inc, ], dependencies: [ - glib_nm_default_dep, libsystemd_dep, + glib_dep, ], ) diff --git a/src/libnm-log-null/meson.build b/src/libnm-log-null/meson.build index 154af92490..cd35304873 100644 --- a/src/libnm-log-null/meson.build +++ b/src/libnm-log-null/meson.build @@ -7,5 +7,5 @@ libnm_log_null = static_library( src_inc, top_inc, ], - dependencies: glib_nm_default_dep, + dependencies: glib_dep, ) diff --git a/src/libnm-platform/meson.build b/src/libnm-platform/meson.build index 462b505466..3300e8f674 100644 --- a/src/libnm-platform/meson.build +++ b/src/libnm-platform/meson.build @@ -4,6 +4,7 @@ libnm_platform = static_library( 'nm-platform', include_directories: [ src_inc, + top_inc, ], sources: [ 'nm-netlink.c', @@ -11,7 +12,7 @@ libnm_platform = static_library( 'nmp-netns.c', ], dependencies: [ - glib_nm_default_dep, + glib_dep, ], ) diff --git a/src/libnm-systemd-shared/meson.build b/src/libnm-systemd-shared/meson.build index cb4c49b7a5..68512c62c1 100644 --- a/src/libnm-systemd-shared/meson.build +++ b/src/libnm-systemd-shared/meson.build @@ -51,7 +51,7 @@ libnm_systemd_shared = static_library( top_inc, src_inc, ], - dependencies: glib_nm_default_dep, + dependencies: glib_dep, ) libnm_systemd_shared_dep = declare_dependency( diff --git a/src/libnm-udev-aux/meson.build b/src/libnm-udev-aux/meson.build index f31f06f09b..f0e7a7fa45 100644 --- a/src/libnm-udev-aux/meson.build +++ b/src/libnm-udev-aux/meson.build @@ -8,7 +8,7 @@ libnm_udev_aux = static_library( top_inc, ], dependencies: [ - glib_nm_default_dep, + glib_dep, libudev_dep, ], )