From 3843e0c87d1351f8fb2ecfb37a7a33172988aa04 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 6 Dec 2019 13:40:39 +0100 Subject: [PATCH] shared: add "shared/nm-libnm-aux" static library We have "shared/nm-libnm-core-aux", which is shared code that can be used by anybody (including libnm-core, src, libnm and clients). We have "clients/common", which are helper function for clients. But that implies that the code is inside "clients". I think it would be useful to have auxiliary code that extends libnm, but is not only usable by code in "clients". In other words, "shared/nm-libnm-aux" is a better place than "clients/common", and I think most of the functionality form "clients/common" should move there. --- Makefile.am | 37 ++++++++++++++++++++++++++++++ libnm/meson.build | 18 +++++++++++++++ shared/meson.build | 11 +++++---- shared/nm-libnm-aux/nm-libnm-aux.c | 5 ++++ shared/nm-libnm-aux/nm-libnm-aux.h | 6 +++++ 5 files changed, 72 insertions(+), 5 deletions(-) create mode 100644 shared/nm-libnm-aux/nm-libnm-aux.c create mode 100644 shared/nm-libnm-aux/nm-libnm-aux.h diff --git a/Makefile.am b/Makefile.am index 451f36e553..748c0c9ef2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -525,6 +525,43 @@ $(shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_OBJECTS): $(libnm_core_lib_h_ ############################################################################### +noinst_LTLIBRARIES += shared/nm-libnm-aux/libnm-libnm-aux.la + +shared_nm_libnm_aux_libnm_libnm_aux_la_CPPFLAGS = \ + $(dflt_cppflags) \ + -I$(srcdir)/shared \ + -I$(builddir)/shared \ + -I$(srcdir)/libnm-core \ + -I$(builddir)/libnm-core \ + -I$(srcdir)/libnm \ + -I$(builddir)/libnm \ + $(CODE_COVERAGE_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(SANITIZER_LIB_CFLAGS) \ + -DG_LOG_DOMAIN=\""libnmc"\" \ + -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT \ + $(NULL) + +shared_nm_libnm_aux_libnm_libnm_aux_la_SOURCES = \ + shared/nm-libnm-aux/nm-libnm-aux.c \ + shared/nm-libnm-aux/nm-libnm-aux.h \ + $(NULL) + +shared_nm_libnm_aux_libnm_libnm_aux_la_LDFLAGS = \ + $(CODE_COVERAGE_LDFLAGS) \ + $(SANITIZER_LIB_LDFLAGS) \ + $(NULL) + +shared_nm_libnm_aux_libnm_libnm_aux_la_LIBADD = \ + $(GLIB_LIBS) \ + libnm/libnm.la \ + $(NULL) + +$(shared_nm_libnm_aux_libnm_libnm_aux_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) +$(shared_nm_libnm_aux_libnm_libnm_aux_la_OBJECTS): $(libnm_lib_h_pub_mkenums) + +############################################################################### + EXTRA_DIST += \ shared/nm-glib-aux/tests/meson.build \ $(NULL) diff --git a/libnm/meson.build b/libnm/meson.build index 51ca46d2bc..7680b9ebe0 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -278,3 +278,21 @@ endif if enable_tests subdir('tests') endif + +libnm_libnm_aux = static_library( + 'nm-libnm-aux', + sources: nm_libnm_aux_source, + c_args: [ + '-DG_LOG_DOMAIN="@0@"'.format('libnmc'), + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], + dependencies: [ + libnm_core_nm_default_dep, + libnm_dep, + ], +) + +libnm_libnm_aux_dep = declare_dependency( + include_directories: [shared_inc], + link_with: [libnm_libnm_aux], +) diff --git a/shared/meson.build b/shared/meson.build index 88b2de8f09..d6ba659bbd 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -111,6 +111,8 @@ 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_libnm_aux_source = files('nm-libnm-aux/nm-libnm-aux.c') + nm_meta_setting_source = files('nm-meta-setting.c') nm_test_utils_impl_source = files('nm-test-utils-impl.c') @@ -168,15 +170,14 @@ libnm_utils_base_dep = declare_dependency( link_with: libnm_utils_base, ) -deps = [ - glib_nm_default_dep, - libudev_dep, -] libnm_udev_aux = static_library( 'nm-udev-aux', sources: 'nm-udev-aux/nm-udev-utils.c', - dependencies: deps, + dependencies: [ + glib_nm_default_dep, + libudev_dep, + ], c_args: c_flags, ) diff --git a/shared/nm-libnm-aux/nm-libnm-aux.c b/shared/nm-libnm-aux/nm-libnm-aux.c new file mode 100644 index 0000000000..2a6b6b22e2 --- /dev/null +++ b/shared/nm-libnm-aux/nm-libnm-aux.c @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: LGPL-2.1+ + +#include "nm-default.h" + +#include "nm-libnm-aux.h" diff --git a/shared/nm-libnm-aux/nm-libnm-aux.h b/shared/nm-libnm-aux/nm-libnm-aux.h new file mode 100644 index 0000000000..66bf05b69b --- /dev/null +++ b/shared/nm-libnm-aux/nm-libnm-aux.h @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: LGPL-2.1+ + +#ifndef __NM_LIBNM_AUX_H__ +#define __NM_LIBNM_AUX_H__ + +#endif /* __NM_LIBNM_AUX_H__ */