shared: build helper "libnm-libnm-core-{intern|aux}.la" library for libnm-core

"libnm-core" implements common functionality for "NetworkManager" and
"libnm".

Note that clients like "nmcli" cannot access the internal API provided
by "libnm-core". So, if nmcli wants to do something that is also done by
"libnm-core", , "libnm", or "NetworkManager", the code would have to be
duplicated.

Instead, such code can be in "libnm-libnm-core-{intern|aux}.la".
Note that:

  0) "libnm-libnm-core-intern.la" is used by libnm-core itsself.
     On the other hand, "libnm-libnm-core-aux.la" is not used by
     libnm-core, but provides utilities on top of it.

  1) they both extend "libnm-core" with utlities that are not public
     API of libnm itself. Maybe part of the code should one day become
     public API of libnm. On the other hand, this is code for which
     we may not want to commit to a stable interface or which we
     don't want to provide as part of the API.

  2) "libnm-libnm-core-intern.la" is statically linked by "libnm-core"
     and thus directly available to "libnm" and "NetworkManager".
     On the other hand, "libnm-libnm-core-aux.la" may be used by "libnm"
     and "NetworkManager".
     Both libraries may be statically linked by libnm clients (like
     nmcli).

  3) it must only use glib, libnm-glib-aux.la, and the public API
     of libnm-core.
     This is important: it must not use "libnm-core/nm-core-internal.h"
     nor "libnm-core/nm-utils-private.h" so the static library is usable
     by nmcli which couldn't access these.

Note that "shared/nm-meta-setting.c" is an entirely different case,
because it behaves differently depending on whether linking against
"libnm-core" or the client programs. As such, this file must be compiled
twice.
This commit is contained in:
Thomas Haller 2019-04-15 09:26:53 +02:00
parent 8183335878
commit af07ed01c0
46 changed files with 235 additions and 91 deletions

View file

@ -396,6 +396,74 @@ shared_nm_udev_aux_libnm_udev_aux_la_LIBADD = \
############################################################################### ###############################################################################
noinst_LTLIBRARIES += shared/nm-libnm-core-intern/libnm-libnm-core-intern.la
shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_CPPFLAGS = \
$(dflt_cppflags) \
-I$(srcdir)/shared \
-I$(builddir)/shared \
-I$(srcdir)/libnm-core \
-I$(builddir)/libnm-core \
$(CODE_COVERAGE_CFLAGS) \
$(GLIB_CFLAGS) \
$(SANITIZER_LIB_CFLAGS) \
-DG_LOG_DOMAIN=\""libnm"\" \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE \
$(NULL)
shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_SOURCES = \
shared/nm-libnm-core-intern/nm-common-macros.h \
shared/nm-libnm-core-intern/nm-ethtool-utils.c \
shared/nm-libnm-core-intern/nm-ethtool-utils.h \
shared/nm-libnm-core-intern/nm-libnm-core-utils.c \
shared/nm-libnm-core-intern/nm-libnm-core-utils.h \
$(NULL)
shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_LDFLAGS = \
$(CODE_COVERAGE_LDFLAGS) \
$(SANITIZER_LIB_LDFLAGS) \
$(NULL)
shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_LIBADD = \
$(GLIB_LIBS) \
$(NULL)
$(shared_nm_libnm_core_intern_libnm_libnm_core_intern_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
###############################################################################
noinst_LTLIBRARIES += shared/nm-libnm-core-aux/libnm-libnm-core-aux.la
shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_CPPFLAGS = \
$(dflt_cppflags) \
-I$(srcdir)/shared \
-I$(builddir)/shared \
-I$(srcdir)/libnm-core \
-I$(builddir)/libnm-core \
$(CODE_COVERAGE_CFLAGS) \
$(GLIB_CFLAGS) \
$(SANITIZER_LIB_CFLAGS) \
-DG_LOG_DOMAIN=\""libnm"\" \
-DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)' \
$(NULL)
shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_SOURCES = \
shared/nm-libnm-core-aux/nm-dispatcher-api.h \
$(NULL)
shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_LDFLAGS = \
$(CODE_COVERAGE_LDFLAGS) \
$(SANITIZER_LIB_LDFLAGS) \
$(NULL)
shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_LIBADD = \
$(GLIB_LIBS) \
$(NULL)
$(shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
###############################################################################
check_programs += shared/nm-utils/tests/test-shared-general check_programs += shared/nm-utils/tests/test-shared-general
shared_nm_utils_tests_test_shared_general_CPPFLAGS = \ shared_nm_utils_tests_test_shared_general_CPPFLAGS = \
@ -723,8 +791,6 @@ libnm_core_lib_h_pub_real = \
libnm_core_lib_h_pub_mkenums = \ libnm_core_lib_h_pub_mkenums = \
libnm-core/nm-core-enum-types.h libnm-core/nm-core-enum-types.h
libnm_core_lib_h_priv = \ libnm_core_lib_h_priv = \
shared/nm-ethtool-utils.h \
shared/nm-libnm-core-utils.h \
shared/nm-meta-setting.h \ shared/nm-meta-setting.h \
libnm-core/nm-crypto.h \ libnm-core/nm-crypto.h \
libnm-core/nm-crypto-impl.h \ libnm-core/nm-crypto-impl.h \
@ -786,8 +852,6 @@ libnm_core_lib_c_settings_real = \
libnm-core/nm-setting-wpan.c libnm-core/nm-setting-wpan.c
libnm_core_lib_c_real = \ libnm_core_lib_c_real = \
$(libnm_core_lib_c_settings_real) \ $(libnm_core_lib_c_settings_real) \
shared/nm-ethtool-utils.c \
shared/nm-libnm-core-utils.c \
shared/nm-meta-setting.c \ shared/nm-meta-setting.c \
libnm-core/nm-crypto.c \ libnm-core/nm-crypto.c \
libnm-core/nm-connection.c \ libnm-core/nm-connection.c \
@ -988,22 +1052,28 @@ libnm_core_tests_test_settings_defaults_CPPFLAGS = $(libnm_core_tests_cppflags)
libnm_core_tests_test_general_SOURCES = \ libnm_core_tests_test_general_SOURCES = \
libnm-core/tests/test-general-enums.h \ libnm-core/tests/test-general-enums.h \
libnm-core/tests/test-general.c libnm-core/tests/test-general.c \
$(NULL)
nodist_libnm_core_tests_test_general_SOURCES = \ nodist_libnm_core_tests_test_general_SOURCES = \
libnm-core/tests/nm-core-tests-enum-types.c \ libnm-core/tests/nm-core-tests-enum-types.c \
libnm-core/tests/nm-core-tests-enum-types.h libnm-core/tests/nm-core-tests-enum-types.h \
$(NULL)
libnm_core_tests_ldadd = \ libnm_core_tests_ldadd = \
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
libnm-core/libnm-core.la \ libnm-core/libnm-core.la \
$(libnm_crypto_lib) \
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
shared/systemd/libnm-systemd-shared.la \ shared/systemd/libnm-systemd-shared.la \
shared/systemd/libnm-systemd-logging-stub.la \ shared/systemd/libnm-systemd-logging-stub.la \
shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \
$(libnm_crypto_lib) \ $(GLIB_LIBS) \
$(GLIB_LIBS) $(NULL)
libnm_core_tests_ldflags = \ libnm_core_tests_ldflags = \
$(SANITIZER_EXEC_LDFLAGS) $(SANITIZER_EXEC_LDFLAGS) \
$(NULL)
libnm_core_tests_test_compare_LDADD = $(libnm_core_tests_ldadd) libnm_core_tests_test_compare_LDADD = $(libnm_core_tests_ldadd)
libnm_core_tests_test_crypto_LDADD = $(libnm_core_tests_ldadd) libnm_core_tests_test_crypto_LDADD = $(libnm_core_tests_ldadd)
@ -1207,8 +1277,10 @@ libnm_libnm_utils_la_SOURCES = \
libnm/nm-libnm-utils.c libnm/nm-libnm-utils.c
libnm_libnm_utils_la_LIBADD = \ libnm_libnm_utils_la_LIBADD = \
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
libnm-core/libnm-core.la \ libnm-core/libnm-core.la \
$(libnm_crypto_lib) \ $(libnm_crypto_lib) \
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
introspection/libnmdbus.la \ introspection/libnmdbus.la \
shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
@ -1426,9 +1498,6 @@ libnm_tests_test_general_LDADD = \
libnm/libnm-utils.la \ libnm/libnm-utils.la \
$(libnm_tests_ldadd) $(libnm_tests_ldadd)
libnm_tests_test_general_LDFLAGS = \
$(libnm_tests_ldflags)
libnm_tests_test_nm_client_LDADD = $(libnm_tests_ldadd) libnm_tests_test_nm_client_LDADD = $(libnm_tests_ldadd)
libnm_tests_test_remote_settings_client_LDADD = $(libnm_tests_ldadd) libnm_tests_test_remote_settings_client_LDADD = $(libnm_tests_ldadd)
libnm_tests_test_secret_agent_LDADD = $(libnm_tests_ldadd) libnm_tests_test_secret_agent_LDADD = $(libnm_tests_ldadd)
@ -1863,8 +1932,10 @@ src_libNetworkManagerBase_la_SOURCES += \
endif endif
src_libNetworkManagerBase_la_LIBADD = \ src_libNetworkManagerBase_la_LIBADD = \
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
libnm-core/libnm-core.la \ libnm-core/libnm-core.la \
$(libnm_crypto_lib) \ $(libnm_crypto_lib) \
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
shared/nm-udev-aux/libnm-udev-aux.la \ shared/nm-udev-aux/libnm-udev-aux.la \
shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
@ -2169,7 +2240,6 @@ src_initrd_nm_initrd_generator_SOURCES = \
src/initrd/nm-initrd-generator.c src/initrd/nm-initrd-generator.c
src_initrd_nm_initrd_generator_LDADD = \ src_initrd_nm_initrd_generator_LDADD = \
libnm-core/libnm-core.la \
src/initrd/libnmi-core.la \ src/initrd/libnmi-core.la \
src/libNetworkManagerBase.la \ src/libNetworkManagerBase.la \
shared/systemd/libnm-systemd-shared.la \ shared/systemd/libnm-systemd-shared.la \
@ -2193,7 +2263,6 @@ src_initrd_tests_test_ibft_reader_LDFLAGS = \
$(SANITIZER_EXEC_LDFLAGS) $(SANITIZER_EXEC_LDFLAGS)
src_initrd_tests_test_ibft_reader_LDADD = \ src_initrd_tests_test_ibft_reader_LDADD = \
libnm-core/libnm-core.la \
src/initrd/libnmi-core.la \ src/initrd/libnmi-core.la \
src/libNetworkManagerTest.la \ src/libNetworkManagerTest.la \
shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \
@ -2409,7 +2478,6 @@ src_initrd_tests_test_cmdline_reader_LDFLAGS = \
$(SANITIZER_EXEC_LDFLAGS) $(SANITIZER_EXEC_LDFLAGS)
src_initrd_tests_test_cmdline_reader_LDADD = \ src_initrd_tests_test_cmdline_reader_LDADD = \
libnm-core/libnm-core.la \
src/initrd/libnmi-core.la \ src/initrd/libnmi-core.la \
src/libNetworkManagerTest.la \ src/libNetworkManagerTest.la \
shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \
@ -3784,9 +3852,9 @@ $(dispatcher_nm_dispatcher_OBJECTS): $(dispatcher_nmdbus_dispatcher_sources)
CLEANFILES += $(dispatcher_nmdbus_dispatcher_sources) CLEANFILES += $(dispatcher_nmdbus_dispatcher_sources)
dispatcher_libnm_dispatcher_core_la_SOURCES = \ dispatcher_libnm_dispatcher_core_la_SOURCES = \
shared/nm-dispatcher-api.h \
dispatcher/nm-dispatcher-utils.c \ dispatcher/nm-dispatcher-utils.c \
dispatcher/nm-dispatcher-utils.h dispatcher/nm-dispatcher-utils.h \
$(NULL)
dispatcher_libnm_dispatcher_core_la_CPPFLAGS = $(dispatcher_cppflags) dispatcher_libnm_dispatcher_core_la_CPPFLAGS = $(dispatcher_cppflags)
@ -3795,8 +3863,8 @@ dispatcher_libnm_dispatcher_core_la_LIBADD = \
$(GLIB_LIBS) $(GLIB_LIBS)
dispatcher_nm_dispatcher_SOURCES = \ dispatcher_nm_dispatcher_SOURCES = \
shared/nm-dispatcher-api.h \ dispatcher/nm-dispatcher.c \
dispatcher/nm-dispatcher.c $(NULL)
nodist_dispatcher_nm_dispatcher_SOURCES = $(dispatcher_nmdbus_dispatcher_sources) nodist_dispatcher_nm_dispatcher_SOURCES = $(dispatcher_nmdbus_dispatcher_sources)
@ -3986,11 +4054,6 @@ clients_common_libnmc_la_SOURCES = \
shared/nm-meta-setting.c \ shared/nm-meta-setting.c \
shared/nm-meta-setting.h \ shared/nm-meta-setting.h \
\ \
shared/nm-ethtool-utils.c \
shared/nm-ethtool-utils.h \
shared/nm-libnm-core-utils.c \
shared/nm-libnm-core-utils.h \
\
clients/common/nm-meta-setting-desc.c \ clients/common/nm-meta-setting-desc.c \
clients/common/nm-meta-setting-desc.h \ clients/common/nm-meta-setting-desc.h \
clients/common/nm-meta-setting-access.c \ clients/common/nm-meta-setting-access.c \
@ -4003,8 +4066,10 @@ clients_common_libnmc_la_CPPFLAGS = \
$(NULL) $(NULL)
clients_common_libnmc_la_LIBADD = \ clients_common_libnmc_la_LIBADD = \
libnm/libnm.la \
clients/common/libnmc-base.la \ clients/common/libnmc-base.la \
libnm/libnm.la \
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
$(GLIB_LIBS) $(GLIB_LIBS)
$(clients_common_libnmc_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) $(clients_common_libnmc_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
@ -4604,9 +4669,7 @@ EXTRA_DIST += \
\ \
po/meson.build \ po/meson.build \
\ \
shared/nm-common-macros.h \
shared/nm-default.h \ shared/nm-default.h \
shared/nm-dispatcher-api.h \
shared/nm-test-libnm-utils.h \ shared/nm-test-libnm-utils.h \
shared/nm-test-utils-impl.c \ shared/nm-test-utils-impl.c \
shared/nm-utils/nm-compat.c \ shared/nm-utils/nm-compat.c \

View file

@ -23,7 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-client-utils.h" #include "nm-client-utils.h"

View file

@ -24,7 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-client-utils.h" #include "nm-client-utils.h"
#include "nm-vpn-helpers.h" #include "nm-vpn-helpers.h"

View file

@ -4,7 +4,7 @@ nm_polkit_listener = files('nm-polkit-listener.c')
deps = [ deps = [
libnm_dep, libnm_dep,
nm_core_dep, shared_nm_libnm_core_aux_dep,
] ]
cflags = clients_cflags + [ cflags = clients_cflags + [
@ -55,7 +55,7 @@ libnmc = static_library(
sources: files( sources: files(
'nm-meta-setting-access.c', 'nm-meta-setting-access.c',
'nm-meta-setting-desc.c', 'nm-meta-setting-desc.c',
) + shared_nm_meta_setting_c + shared_nm_ethtool_utils_c + shared_nm_libnm_core_utils_c + [settings_docs_source], ) + shared_nm_meta_setting_c + [settings_docs_source],
dependencies: deps, dependencies: deps,
c_args: cflags, c_args: cflags,
link_with: libnmc_base, link_with: libnmc_base,

View file

@ -23,7 +23,7 @@
#include "nm-meta-setting.h" #include "nm-meta-setting.h"
#include "nm-active-connection.h" #include "nm-active-connection.h"
#include "nm-device.h" #include "nm-device.h"
#include "nm-libnm-core-utils.h" #include "nm-libnm-core-intern/nm-libnm-core-utils.h"
const NMObject **nmc_objects_sort_by_path (const NMObject *const*objs, gssize len); const NMObject **nmc_objects_sort_by_path (const NMObject *const*objs, gssize len);

View file

@ -24,10 +24,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-glib-aux/nm-enum-utils.h" #include "nm-glib-aux/nm-enum-utils.h"
#include "nm-glib-aux/nm-secret-utils.h" #include "nm-glib-aux/nm-secret-utils.h"
#include "nm-libnm-core-utils.h" #include "nm-libnm-core-intern/nm-libnm-core-utils.h"
#include "nm-vpn-helpers.h" #include "nm-vpn-helpers.h"
#include "nm-client-utils.h" #include "nm-client-utils.h"

View file

@ -22,7 +22,7 @@
#include "nm-glib-aux/nm-obj.h" #include "nm-glib-aux/nm-obj.h"
#include "nm-meta-setting.h" #include "nm-meta-setting.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
struct _NMDevice; struct _NMDevice;

View file

@ -30,7 +30,7 @@
#include "nmt-mac-entry.h" #include "nmt-mac-entry.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
G_DEFINE_TYPE (NmtMacEntry, nmt_mac_entry, NMT_TYPE_NEWT_ENTRY) G_DEFINE_TYPE (NmtMacEntry, nmt_mac_entry, NMT_TYPE_NEWT_ENTRY)

View file

@ -28,7 +28,7 @@
#include "nm-setting-ip6-config.h" #include "nm-setting-ip6-config.h"
#include "nm-setting-connection.h" #include "nm-setting-connection.h"
#include "nm-dispatcher-api.h" #include "nm-libnm-core-aux/nm-dispatcher-api.h"
#include "nm-utils.h" #include "nm-utils.h"
/*****************************************************************************/ /*****************************************************************************/

View file

@ -31,7 +31,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <glib-unix.h> #include <glib-unix.h>
#include "nm-dispatcher-api.h" #include "nm-libnm-core-aux/nm-dispatcher-api.h"
#include "nm-dispatcher-utils.h" #include "nm-dispatcher-utils.h"
#include "nmdbus-dispatcher.h" #include "nmdbus-dispatcher.h"

View file

@ -24,7 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "nm-dispatcher-utils.h" #include "nm-dispatcher-utils.h"
#include "nm-dispatcher-api.h" #include "nm-libnm-core-aux/nm-dispatcher-api.h"
#include "nm-utils/nm-test-utils.h" #include "nm-utils/nm-test-utils.h"

View file

@ -139,6 +139,48 @@ libnm_core_enum = gnome.mkenums(
install_dir: libnm_pkgincludedir, install_dir: libnm_pkgincludedir,
) )
libnm_core_enum_dep = declare_dependency(
sources: libnm_core_enum[1],
)
###############################################################################
shared_nm_libnm_core_intern = static_library(
'nm-libnm-core-intern',
sources: files('../shared/nm-libnm-core-intern/nm-ethtool-utils.c',
'../shared/nm-libnm-core-intern/nm-libnm-core-utils.c'),
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
],
include_directories: [
top_inc,
shared_inc,
libnm_core_inc,
],
dependencies: [
glib_dep,
shared_c_siphash_dep,
shared_nm_glib_aux_dep,
libnm_core_enum_dep,
],
)
shared_nm_libnm_core_intern_dep = declare_dependency(
link_with: shared_nm_libnm_core_intern,
include_directories: [
top_inc,
shared_inc,
],
dependencies: [
glib_dep,
shared_nm_glib_aux_dep,
libnm_systemd_shared_dep,
],
)
###############################################################################
deps = [ deps = [
dl_dep, dl_dep,
libudev_dep, libudev_dep,
@ -147,6 +189,7 @@ deps = [
shared_c_siphash_dep, shared_c_siphash_dep,
shared_nm_glib_aux_dep, shared_nm_glib_aux_dep,
shared_nm_udev_aux_dep, shared_nm_udev_aux_dep,
shared_nm_libnm_core_intern_dep,
] ]
cflags = [ cflags = [
@ -188,8 +231,6 @@ endif
libnm_core_sources_all = libnm_core_sources libnm_core_sources_all = libnm_core_sources
libnm_core_sources_all += libnm_core_enum libnm_core_sources_all += libnm_core_enum
libnm_core_sources_all += shared_nm_meta_setting_c libnm_core_sources_all += shared_nm_meta_setting_c
libnm_core_sources_all += shared_nm_ethtool_utils_c
libnm_core_sources_all += shared_nm_libnm_core_utils_c
libnm_core_sources_all += [version_header] libnm_core_sources_all += [version_header]
libnm_core = static_library( libnm_core = static_library(
@ -204,12 +245,50 @@ nm_core_dep = declare_dependency(
sources: libnm_core_enum[1], sources: libnm_core_enum[1],
include_directories: libnm_core_inc, include_directories: libnm_core_inc,
dependencies: [ dependencies: [
shared_nm_libnm_core_intern_dep,
shared_nm_glib_aux_dep, shared_nm_glib_aux_dep,
shared_c_siphash_dep, shared_c_siphash_dep,
libnm_systemd_shared_dep, libnm_systemd_shared_dep,
], ],
) )
###############################################################################
shared_nm_libnm_core_aux = static_library(
'nm-libnm-core-aux',
sources: files('../shared/nm-libnm-core-aux/nm-dispatcher-api.h'),
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
],
include_directories: [
top_inc,
shared_inc,
libnm_core_inc,
],
dependencies: [
glib_dep,
shared_c_siphash_dep,
shared_nm_glib_aux_dep,
],
)
shared_nm_libnm_core_aux_dep = declare_dependency(
link_with: shared_nm_libnm_core_aux,
include_directories: [
top_inc,
shared_inc,
],
dependencies: [
nm_core_dep,
glib_dep,
shared_nm_glib_aux_dep,
libnm_systemd_shared_dep,
],
)
###############################################################################
enums_to_docbook = join_paths(meson.source_root(), 'tools', 'enums-to-docbook.pl') enums_to_docbook = join_paths(meson.source_root(), 'tools', 'enums-to-docbook.pl')
docbooks = [ docbooks = [
@ -234,6 +313,8 @@ foreach docbook: docbooks
content_files += xml.full_path() content_files += xml.full_path()
endforeach endforeach
###############################################################################
if enable_tests if enable_tests
subdir('tests') subdir('tests')
endif endif

View file

@ -88,7 +88,7 @@
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-vpn-dbus-interface.h" #include "nm-vpn-dbus-interface.h"
#include "nm-vpn-editor-plugin.h" #include "nm-vpn-editor-plugin.h"
#include "nm-libnm-core-utils.h" #include "nm-libnm-core-intern/nm-libnm-core-utils.h"
/* IEEE 802.1D-1998 timer values */ /* IEEE 802.1D-1998 timer values */
#define NM_BR_MIN_HELLO_TIME 1 #define NM_BR_MIN_HELLO_TIME 1

View file

@ -33,7 +33,7 @@
#include "nm-glib-aux/nm-secret-utils.h" #include "nm-glib-aux/nm-secret-utils.h"
#include "systemd/nm-sd-utils-shared.h" #include "systemd/nm-sd-utils-shared.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-core-internal.h" #include "nm-core-internal.h"
#include "nm-keyfile-utils.h" #include "nm-keyfile-utils.h"

View file

@ -24,7 +24,7 @@
#include "nm-setting-ethtool.h" #include "nm-setting-ethtool.h"
#include "nm-setting-private.h" #include "nm-setting-private.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
/*****************************************************************************/ /*****************************************************************************/

View file

@ -25,7 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "nm-libnm-core-utils.h" #include "nm-libnm-core-intern/nm-libnm-core-utils.h"
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-core-types-internal.h" #include "nm-core-types-internal.h"
#include "nm-setting-connection.h" #include "nm-setting-connection.h"

View file

@ -24,7 +24,7 @@
#include <net/ethernet.h> #include <net/ethernet.h>
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-utils-private.h" #include "nm-utils-private.h"
#include "nm-setting-private.h" #include "nm-setting-private.h"

View file

@ -27,7 +27,7 @@
#include <net/ethernet.h> #include <net/ethernet.h>
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-utils-private.h" #include "nm-utils-private.h"
#include "nm-setting-private.h" #include "nm-setting-private.h"

View file

@ -27,7 +27,7 @@
#include <net/ethernet.h> #include <net/ethernet.h>
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-utils-private.h" #include "nm-utils-private.h"
#include "nm-setting-private.h" #include "nm-setting-private.h"

View file

@ -40,7 +40,7 @@
#include "nm-glib-aux/nm-enum-utils.h" #include "nm-glib-aux/nm-enum-utils.h"
#include "nm-glib-aux/nm-secret-utils.h" #include "nm-glib-aux/nm-secret-utils.h"
#include "systemd/nm-sd-utils-shared.h" #include "systemd/nm-sd-utils-shared.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-utils-private.h" #include "nm-utils-private.h"
#include "nm-setting-private.h" #include "nm-setting-private.h"
#include "nm-crypto.h" #include "nm-crypto.h"

View file

@ -64,7 +64,7 @@
#include "nm-simple-connection.h" #include "nm-simple-connection.h"
#include "nm-keyfile-internal.h" #include "nm-keyfile-internal.h"
#include "nm-glib-aux/nm-dedup-multi.h" #include "nm-glib-aux/nm-dedup-multi.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
#include "test-general-enums.h" #include "test-general-enums.h"

View file

@ -25,7 +25,7 @@
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-checkpoint.h" #include "nm-checkpoint.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-device-ethernet.h" #include "nm-device-ethernet.h"
#include "nm-device-wifi.h" #include "nm-device-wifi.h"
#include "nm-core-internal.h" #include "nm-core-internal.h"

View file

@ -99,10 +99,6 @@ version_header = configure_file(
configuration: version_conf, configuration: version_conf,
) )
shared_nm_ethtool_utils_c = files('nm-ethtool-utils.c')
shared_nm_libnm_core_utils_c = files('nm-libnm-core-utils.c')
shared_nm_meta_setting_c = files('nm-meta-setting.c') shared_nm_meta_setting_c = files('nm-meta-setting.c')
shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c') shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c')
@ -204,24 +200,6 @@ shared_nm_udev_aux_dep = declare_dependency(
############################################################################### ###############################################################################
test_shared_general = executable(
'nm-utils/tests/test-shared-general',
[ 'nm-utils/tests/test-shared-general.c', ],
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
],
dependencies: shared_nm_glib_aux_dep,
link_with: shared_c_siphash,
)
test(
'shared/nm-utils/test-shared-general',
test_script,
args: test_args + [test_shared_general.full_path()]
)
###############################################################################
libnm_systemd_shared = static_library( libnm_systemd_shared = static_library(
'nm-systemd-shared', 'nm-systemd-shared',
sources: files( sources: files(
@ -306,3 +284,21 @@ libnm_systemd_shared_no_logging_dep = declare_dependency(
libnm_systemd_logging_stub, libnm_systemd_logging_stub,
], ],
) )
###############################################################################
test_shared_general = executable(
'nm-utils/tests/test-shared-general',
[ 'nm-utils/tests/test-shared-general.c', ],
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
],
dependencies: shared_nm_glib_aux_dep,
link_with: shared_c_siphash,
)
test(
'shared/nm-utils/test-shared-general',
test_script,
args: test_args + [test_shared_general.full_path()]
)

View file

@ -18,6 +18,9 @@
* Copyright (C) 2008 - 2012 Red Hat, Inc. * Copyright (C) 2008 - 2012 Red Hat, Inc.
*/ */
#ifndef __NM_DISPACHER_API_H__
#define __NM_DISPACHER_API_H__
#define NMD_SCRIPT_DIR_DEFAULT NMCONFDIR "/dispatcher.d" #define NMD_SCRIPT_DIR_DEFAULT NMCONFDIR "/dispatcher.d"
#define NMD_SCRIPT_DIR_PRE_UP NMD_SCRIPT_DIR_DEFAULT "/pre-up.d" #define NMD_SCRIPT_DIR_PRE_UP NMD_SCRIPT_DIR_DEFAULT "/pre-up.d"
#define NMD_SCRIPT_DIR_PRE_DOWN NMD_SCRIPT_DIR_DEFAULT "/pre-down.d" #define NMD_SCRIPT_DIR_PRE_DOWN NMD_SCRIPT_DIR_DEFAULT "/pre-down.d"
@ -59,3 +62,4 @@ typedef enum {
DISPATCH_RESULT_TIMEOUT = 4, DISPATCH_RESULT_TIMEOUT = 4,
} DispatchResult; } DispatchResult;
#endif /* __NM_DISPACHER_API_H__ */

View file

@ -27,7 +27,7 @@
#include "nm-glib-aux/nm-c-list.h" #include "nm-glib-aux/nm-c-list.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-setting-connection.h" #include "nm-setting-connection.h"
#include "nm-setting-ip4-config.h" #include "nm-setting-ip4-config.h"

View file

@ -40,8 +40,8 @@
#include "nm-glib-aux/nm-dedup-multi.h" #include "nm-glib-aux/nm-dedup-multi.h"
#include "nm-glib-aux/nm-random-utils.h" #include "nm-glib-aux/nm-random-utils.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-device-private.h" #include "nm-device-private.h"
#include "NetworkManagerUtils.h" #include "NetworkManagerUtils.h"
#include "nm-manager.h" #include "nm-manager.h"

View file

@ -22,7 +22,7 @@
#include "nm-device-iwd.h" #include "nm-device-iwd.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "devices/nm-device.h" #include "devices/nm-device.h"
#include "devices/nm-device-private.h" #include "devices/nm-device-private.h"
#include "nm-utils.h" #include "nm-utils.h"

View file

@ -28,7 +28,7 @@
#include "nm-device-wifi-p2p.h" #include "nm-device-wifi-p2p.h"
#include "nm-wifi-ap.h" #include "nm-wifi-ap.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "devices/nm-device.h" #include "devices/nm-device.h"
#include "devices/nm-device-private.h" #include "devices/nm-device-private.h"
#include "nm-dbus-manager.h" #include "nm-dbus-manager.h"

View file

@ -22,7 +22,7 @@
#include "nm-active-connection.h" #include "nm-active-connection.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-dbus-interface.h" #include "nm-dbus-interface.h"
#include "devices/nm-device.h" #include "devices/nm-device.h"
#include "settings/nm-settings-connection.h" #include "settings/nm-settings-connection.h"

View file

@ -23,7 +23,7 @@
#include "nm-dispatcher.h" #include "nm-dispatcher.h"
#include "nm-dispatcher-api.h" #include "nm-libnm-core-aux/nm-dispatcher-api.h"
#include "NetworkManagerUtils.h" #include "NetworkManagerUtils.h"
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-connectivity.h" #include "nm-connectivity.h"

View file

@ -28,7 +28,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-dbus-interface.h" #include "nm-dbus-interface.h"
#include "nm-connection.h" #include "nm-connection.h"
#include "nm-utils.h" #include "nm-utils.h"

View file

@ -29,7 +29,7 @@
#include "nm-glib-aux/nm-c-list.h" #include "nm-glib-aux/nm-c-list.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-dbus-manager.h" #include "nm-dbus-manager.h"
#include "vpn/nm-vpn-manager.h" #include "vpn/nm-vpn-manager.h"
#include "devices/nm-device.h" #include "devices/nm-device.h"

View file

@ -35,7 +35,7 @@
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-setting-wired.h" #include "nm-setting-wired.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
#include "nm-core-utils.h" #include "nm-core-utils.h"

View file

@ -23,7 +23,7 @@
#include "nm-platform.h" #include "nm-platform.h"
#include "nm-setting-wired.h" #include "nm-setting-wired.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
/*****************************************************************************/ /*****************************************************************************/

View file

@ -24,7 +24,7 @@
#include <pwd.h> #include <pwd.h>
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-dbus-interface.h" #include "nm-dbus-interface.h"
#include "nm-secret-agent.h" #include "nm-secret-agent.h"
#include "nm-auth-utils.h" #include "nm-auth-utils.h"

View file

@ -25,7 +25,7 @@
#include "c-list/src/c-list.h" #include "c-list/src/c-list.h"
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-config.h" #include "nm-config.h"
#include "nm-config-data.h" #include "nm-config-data.h"
#include "nm-dbus-interface.h" #include "nm-dbus-interface.h"

View file

@ -36,7 +36,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
#endif #endif
#include "nm-common-macros.h" #include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-dbus-interface.h" #include "nm-dbus-interface.h"
#include "nm-connection.h" #include "nm-connection.h"
#include "nm-setting-8021x.h" #include "nm-setting-8021x.h"

View file

@ -53,7 +53,7 @@
#include "nm-setting-generic.h" #include "nm-setting-generic.h"
#include "nm-core-internal.h" #include "nm-core-internal.h"
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
#include "platform/nm-platform.h" #include "platform/nm-platform.h"
#include "NetworkManagerUtils.h" #include "NetworkManagerUtils.h"

View file

@ -22,7 +22,7 @@
#define _UTILS_H_ #define _UTILS_H_
#include "nm-connection.h" #include "nm-connection.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
#include "shvar.h" #include "shvar.h"

View file

@ -50,7 +50,7 @@
#include "nm-core-internal.h" #include "nm-core-internal.h"
#include "NetworkManagerUtils.h" #include "NetworkManagerUtils.h"
#include "nm-meta-setting.h" #include "nm-meta-setting.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
#include "nms-ifcfg-rh-common.h" #include "nms-ifcfg-rh-common.h"
#include "nms-ifcfg-rh-reader.h" #include "nms-ifcfg-rh-reader.h"

View file

@ -49,7 +49,7 @@
#include "nm-setting-vlan.h" #include "nm-setting-vlan.h"
#include "nm-setting-dcb.h" #include "nm-setting-dcb.h"
#include "nm-core-internal.h" #include "nm-core-internal.h"
#include "nm-ethtool-utils.h" #include "nm-libnm-core-intern/nm-ethtool-utils.h"
#include "NetworkManagerUtils.h" #include "NetworkManagerUtils.h"