diff --git a/Makefile.am b/Makefile.am index 269fec1e50..6a53f3be6a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -464,6 +464,36 @@ shared_nm_udev_aux_libnm_udev_aux_la_LIBADD = \ ############################################################################### +noinst_LTLIBRARIES += shared/nm-log-core/libnm-log-core.la + +shared_nm_log_core_libnm_log_core_la_CPPFLAGS = \ + $(dflt_cppflags) \ + -I$(srcdir)/shared \ + $(CODE_COVERAGE_CFLAGS) \ + $(SANITIZER_LIB_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(SYSTEMD_JOURNAL_CFLAGS) \ + -DG_LOG_DOMAIN=\""NetworkManager"\" \ + -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)' \ + $(NULL) + +shared_nm_log_core_libnm_log_core_la_SOURCES = \ + shared/nm-log-core/nm-logging.c \ + shared/nm-log-core/nm-logging.h \ + $(NULL) + +shared_nm_log_core_libnm_log_core_la_LDFLAGS = \ + $(CODE_COVERAGE_LDFLAGS) \ + $(SANITIZER_LIB_LDFLAGS) \ + $(NULL) + +shared_nm_log_core_libnm_log_core_la_LIBADD = \ + $(GLIB_LIBS) \ + $(SYSTEMD_JOURNAL_LIBS) \ + $(NULL) + +############################################################################### + noinst_LTLIBRARIES += shared/nm-platform/libnm-platform.la shared_nm_platform_libnm_platform_la_CPPFLAGS = \ @@ -494,6 +524,7 @@ shared_nm_platform_tests_test_nm_platform_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION_TEST \ -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)' \ $(CODE_COVERAGE_CFLAGS) \ + $(SYSTEMD_JOURNAL_CFLAGS) \ $(GLIB_CFLAGS) \ $(SANITIZER_LIB_CFLAGS) \ $(NULL) @@ -505,9 +536,11 @@ shared_nm_platform_tests_test_nm_platform_LDFLAGS = \ shared_nm_platform_tests_test_nm_platform_LDADD = \ shared/nm-platform/libnm-platform.la \ + shared/nm-log-core/libnm-log-core.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ shared/libcsiphash.la \ + $(SYSTEMD_JOURNAL_LIBS) \ $(GLIB_LIBS) \ $(NULL) @@ -2168,8 +2201,6 @@ src_libNetworkManagerBase_la_SOURCES = \ \ src/nm-core-utils.c \ src/nm-core-utils.h \ - src/nm-logging.c \ - src/nm-logging.h \ \ src/NetworkManagerUtils.c \ src/NetworkManagerUtils.h \ @@ -2245,7 +2276,6 @@ endif src_libNetworkManagerBase_la_LIBADD = \ $(GLIB_LIBS) \ - $(SYSTEMD_JOURNAL_LIBS) \ $(LIBUDEV_LIBS) \ $(NULL) @@ -2443,6 +2473,7 @@ src_libNetworkManager_la_LIBADD = \ $(libnm_crypto_lib) \ libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-platform/libnm-platform.la \ + shared/nm-log-core/libnm-log-core.la \ shared/nm-udev-aux/libnm-udev-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ @@ -2555,6 +2586,7 @@ src_nm_iface_helper_LDADD = \ $(libnm_crypto_lib) \ libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-platform/libnm-platform.la \ + shared/nm-log-core/libnm-log-core.la \ shared/nm-udev-aux/libnm-udev-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ @@ -2608,6 +2640,7 @@ src_initrd_nm_initrd_generator_LDADD = \ $(libnm_crypto_lib) \ libnm-core/nm-libnm-core-intern/libnm-libnm-core-intern.la \ shared/nm-platform/libnm-platform.la \ + shared/nm-log-core/libnm-log-core.la \ shared/nm-udev-aux/libnm-udev-aux.la \ shared/nm-glib-aux/libnm-glib-aux.la \ shared/nm-std-aux/libnm-std-aux.la \ diff --git a/po/POTFILES.in b/po/POTFILES.in index cee590c0cf..b3d33487bd 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -147,6 +147,7 @@ libnm/nm-vpn-plugin-old.c libnm/nm-vpn-service-plugin.c data/org.freedesktop.NetworkManager.policy.in.in shared/nm-glib-aux/nm-shared-utils.c +shared/nm-log-core/nm-logging.c src/NetworkManagerUtils.c src/main.c src/main-utils.c @@ -179,7 +180,6 @@ src/devices/wifi/nm-wifi-utils.c src/devices/wwan/nm-modem-broadband.c src/nm-config.c src/nm-iface-helper.c -src/nm-logging.c src/nm-manager.c src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c diff --git a/shared/meson.build b/shared/meson.build index eb96e4d305..fda44444e7 100644 --- a/shared/meson.build +++ b/shared/meson.build @@ -182,6 +182,27 @@ libnm_udev_aux_dep = declare_dependency( link_with: libnm_udev_aux, ) +libnm_log_core = static_library( + 'nm-log-core', + sources: 'nm-log-core/nm-logging.c', + dependencies: [ + glib_nm_default_dep, + libsystemd_dep, + ], + c_args: [ + '-DG_LOG_DOMAIN="NetworkManager"', + '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)', + ], +) + +libnm_log_core_dep = declare_dependency( + include_directories: shared_inc, + dependencies: [ + libnm_utils_base_dep, + ], + link_with: libnm_log_core, +) + libnm_platform = static_library( 'nm-platform', sources: [ diff --git a/shared/nm-default.h b/shared/nm-default.h index 91ab085be8..f2cb024441 100644 --- a/shared/nm-default.h +++ b/shared/nm-default.h @@ -281,7 +281,7 @@ _nm_g_return_if_fail_warning(const char *log_domain, const char *file, int line) #if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_DAEMON #include "nm-core-types.h" #include "nm-types.h" - #include "nm-logging.h" + #include "nm-log-core/nm-logging.h" #endif #if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE diff --git a/src/nm-logging.c b/shared/nm-log-core/nm-logging.c similarity index 100% rename from src/nm-logging.c rename to shared/nm-log-core/nm-logging.c diff --git a/src/nm-logging.h b/shared/nm-log-core/nm-logging.h similarity index 100% rename from src/nm-logging.h rename to shared/nm-log-core/nm-logging.h diff --git a/shared/nm-platform/tests/meson.build b/shared/nm-platform/tests/meson.build index 4c9d91d118..47175331fe 100644 --- a/shared/nm-platform/tests/meson.build +++ b/shared/nm-platform/tests/meson.build @@ -7,7 +7,10 @@ exe = executable( '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)', ], - dependencies: libnm_platform_dep, + dependencies: [ + libnm_log_core_dep, + libnm_platform_dep, + ], link_with: libnm_systemd_logging_stub, ) diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c index 0725e5ba68..5ded8e15a6 100644 --- a/src/devices/wifi/nm-iwd-manager.c +++ b/src/devices/wifi/nm-iwd-manager.c @@ -9,7 +9,6 @@ #include -#include "nm-logging.h" #include "nm-core-internal.h" #include "nm-manager.h" #include "nm-device-iwd.h" diff --git a/src/meson.build b/src/meson.build index f21ce17c44..07014bbb71 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,6 +7,7 @@ daemon_nm_default_dep = declare_dependency( include_directories: src_inc, dependencies: [ libnm_core_nm_default_dep, + libnm_log_core_dep, libnm_platform_dep, ], ) @@ -52,7 +53,6 @@ sources = files( 'nm-ip-config.c', 'nm-ip4-config.c', 'nm-ip6-config.c', - 'nm-logging.c', ) deps = [ diff --git a/src/systemd/meson.build b/src/systemd/meson.build index 536dd9703f..4f3a63eda4 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -36,9 +36,13 @@ libnm_systemd_core = static_library( 'nm-sd-utils-dhcp.c', 'sd-adapt-core/nm-sd-adapt-core.c', ), - include_directories: incs, + include_directories: [ + incs, + src_inc, + ], dependencies: [ - daemon_nm_default_dep, + glib_nm_default_dep, + libnm_core_dep, libnm_systemd_shared_dep, ], c_args: '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD', @@ -49,7 +53,7 @@ libnm_systemd_core_dep = declare_dependency( include_directories: incs, dependencies: [ glib_dep, - daemon_nm_default_dep, + libnm_core_dep, libnm_systemd_shared_dep, ], link_with: libnm_systemd_core, diff --git a/src/tests/meson.build b/src/tests/meson.build index 6366225bce..1d3f596382 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -32,15 +32,18 @@ endforeach exe = executable( 'test-systemd', 'test-systemd.c', - dependencies: daemon_nm_default_dep, + include_directories: [ + top_inc, + src_inc, + ], + dependencies: [ + libnm_systemd_core_dep, + libnm_systemd_shared_dep, + ], c_args: [ '-DNETWORKMANAGER_COMPILATION_TEST', '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD', ], - link_with: [ - libnm_systemd_core, - libnm_systemd_shared, - ], ) test(