Skip to content

[th/move-to-src-shared] move more code from `shared/` to `src/`

Thomas Haller requested to merge th/move-to-src-shared into master

Our source code should be under src/ in a flat hierarchy that reflects the individual modules that we build.

For that, move some libraries from shared/ to src/.

These are all static helper libraries, hence their name is now src/libnm-* to reflect that. Note that later we may also move applications like src/nmcli, src/nm-dispatcher, src/nm-initrd-generator, ... hence the "libnm-" prefix.


Edit: 2021-02-23:

There are several goals here:

  • as said, the flat directory structure under src/, where we have "modules". Basically static libraries or other build products that belong together.

  • as we have everything under src/, internal users should like #include "libnm-core-intern/nm-core-internal.h", with qualifying the "module". The result is that we only need to pass -I$(top_srcdir) -I$(top_srcdir)/src as CFLAGS to the compiler -- simplifying the arguments on the command line that we need. Another advantage is that you can easier find out who is using a certain module (git grep '#include "libnm-core-intern/'), which is useful because a module may only be used by certain other modules. E.g. libnm-core-intern is only available to users who statically link against libnm-core-impl.so, that is inside libnm-core, libnm-client, libnm.so and NetworkManager core. But (for example) not nmcli.

  • the build setup (meson and autotools) does not yet completely cleanup all the includes, dependencies, etc. For example, there is still glib_nm_default_dep and many unnecessary dependencies and include_directories. But I think that can be simplified a bit further -- because of the new layout. In particular, if you look at one of the src/*/meson.build files, it should (soon) be quite minimal and it should (soon) be easy to see that it is correct.

Edited by Thomas Haller

Merge request reports