Commit c4512f83 authored by Thomas Haller's avatar Thomas Haller

libnm: use "libnm-systemd-shared.a" in "libnm-core.la" (and "libnm.so")

It's not yet used, but it will be. We will need nm_sd_utils_unbase64mem()
to strictly validate WireGuard settings, which contain keys in base64 encoding.

Note that we also need a stub implementation for logging. This will do
nothing for all logging from "libnm-systemd-shared.a". This makes
sense because "libnm.so" as a library should not log directly. Also,
"libnm.so" will only use a small portion of "libnm-systemd-shared.a" which
doesn't log anything. Thus this code is unused and dropped by the linker
with "--gc-sections".
parent 0298d540
......@@ -940,6 +940,8 @@ nodist_libnm_core_tests_test_general_SOURCES = \
libnm_core_tests_ldadd = \
libnm-core/libnm-core.la \
shared/systemd/libnm-systemd-shared.la \
shared/systemd/libnm-systemd-logging-stub.la \
shared/nm-utils/libnm-utils-base.la \
$(libnm_crypto_lib) \
$(GLIB_LIBS)
......@@ -1191,6 +1193,8 @@ EXTRA_libnm_libnm_la_DEPENDENCIES = \
libnm_libnm_la_LIBADD = \
libnm/libnm-utils.la \
shared/systemd/libnm-systemd-shared.la \
shared/systemd/libnm-systemd-logging-stub.la \
shared/nm-utils/libnm-utils-udev.la \
$(DL_LIBS) \
$(GLIB_LIBS) \
......@@ -1357,6 +1361,8 @@ libnm_tests_cppflags = \
libnm_tests_ldadd = \
libnm/libnm.la \
shared/systemd/libnm-systemd-shared.la \
shared/systemd/libnm-systemd-logging-stub.la \
$(GLIB_LIBS)
libnm_tests_ldflags = \
......@@ -1517,6 +1523,22 @@ libsystemd_libadd = \
$(CODE_COVERAGE_LDFLAGS) \
$(NULL)
noinst_LTLIBRARIES += shared/systemd/libnm-systemd-logging-stub.la
shared_systemd_libnm_systemd_logging_stub_la_CPPFLAGS = \
$(libsystemd_cppflags) \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED \
-DG_LOG_DOMAIN=\""libnm"\" \
$(NULL)
shared_systemd_libnm_systemd_logging_stub_la_SOURCES = \
shared/systemd/nm-logging-stub.c \
$(NULL)
shared_systemd_libnm_systemd_logging_stub_la_LIBADD = \
$(libsystemd_libadd) \
$(NULL)
noinst_LTLIBRARIES += shared/systemd/libnm-systemd-shared.la
shared_systemd_libnm_systemd_shared_la_CPPFLAGS = \
......@@ -2105,6 +2127,7 @@ src_initrd_nm_initrd_generator_LDADD = \
libnm-core/libnm-core.la \
src/initrd/libnmi-core.la \
src/libNetworkManagerBase.la \
shared/systemd/libnm-systemd-shared.la \
shared/nm-utils/libnm-utils-base.la \
$(GLIB_LIBS) \
$(NULL)
......
......@@ -200,6 +200,7 @@ nm_core_dep = declare_dependency(
dependencies: [
shared_dep,
shared_c_siphash_dep,
libnm_systemd_shared_dep,
],
)
......
......@@ -33,7 +33,10 @@ foreach test_unit: test_units
exe = executable(
'libnm-core-' + test_unit,
[test_unit + '.c'] + enum,
dependencies: nm_core_dep,
dependencies: [
nm_core_dep,
libnm_systemd_shared_no_logging_dep,
],
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
......
......@@ -147,6 +147,7 @@ deps = [
libudev_dep,
shared_dep,
uuid_dep,
libnm_systemd_shared_no_logging_dep,
]
linker_script = join_paths(meson.current_source_dir(), 'libnm.ver')
......
......@@ -20,6 +20,7 @@ foreach test_unit: test_units
dependencies: [
libnm_dep,
nm_core_dep,
libnm_systemd_shared_no_logging_dep,
],
c_args: cflags,
link_with: test_unit[1],
......
......@@ -207,3 +207,28 @@ libnm_systemd_shared_dep = declare_dependency(
libnm_systemd_shared,
],
)
libnm_systemd_logging_stub = static_library(
'nm-systemd-logging-stub',
sources: files(
'systemd/nm-logging-stub.c',
),
include_directories: include_directories(
'systemd/sd-adapt-shared',
'systemd/src/basic',
),
dependencies: shared_dep,
c_args: [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED',
'-DG_LOG_DOMAIN="libnm"',
],
)
libnm_systemd_shared_no_logging_dep = declare_dependency(
dependencies: [
libnm_systemd_shared_dep,
],
link_with: [
libnm_systemd_logging_stub,
],
)
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2018 Red Hat, Inc.
*/
#include "nm-default.h"
#include "nm-utils/nm-logging-fwd.h"
/*****************************************************************************/
gboolean
_nm_log_enabled (NMLogLevel level,
NMLogDomain domain)
{
return FALSE;
}
void
_nm_log_impl (const char *file,
guint line,
const char *func,
NMLogLevel level,
NMLogDomain domain,
int error,
const char *ifname,
const char *con_uuid,
const char *fmt,
...)
{
}
......@@ -38,7 +38,6 @@ libnm_systemd_core = static_library(
)
],
dependencies: [
libnm_systemd_shared_dep,
nm_core_dep,
],
c_args: [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment