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.
This commit is contained in:
Thomas Haller 2019-12-06 13:40:39 +01:00
parent 44c5331e29
commit 3843e0c87d
5 changed files with 72 additions and 5 deletions

View File

@ -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)

View File

@ -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],
)

View File

@ -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,
)

View File

@ -0,0 +1,5 @@
// SPDX-License-Identifier: LGPL-2.1+
#include "nm-default.h"
#include "nm-libnm-aux.h"

View File

@ -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__ */