libnm,shared: move nm-json.[hc] to shared/nm-glib-aux

nm-json.[hc] uses libjansson, but only loads it at runtime with dlopen. There
is no more run compile time dependency. Move it to shared, so that it can be
(theoretically) used by other components.

Also, drop the conditional compilation. Granted, if you don't build with
libjansson enabled, then the JANSSON_SONAME define is unset and the code
will fail to load at runtime (which is fine). However, we can still build
against our JSON wrappers. The code savings of conditional build are minimal
so drop it.
This commit is contained in:
Thomas Haller 2020-07-01 17:58:44 +02:00
parent 7df0229c62
commit 3814467b88
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
7 changed files with 5 additions and 23 deletions

View file

@ -403,6 +403,8 @@ shared_nm_glib_aux_libnm_glib_aux_la_SOURCES = \
shared/nm-glib-aux/nm-jansson.h \
shared/nm-glib-aux/nm-json-aux.c \
shared/nm-glib-aux/nm-json-aux.h \
shared/nm-glib-aux/nm-json.c \
shared/nm-glib-aux/nm-json.h \
shared/nm-glib-aux/nm-keyfile-aux.c \
shared/nm-glib-aux/nm-keyfile-aux.h \
shared/nm-glib-aux/nm-logging-base.c \
@ -1031,13 +1033,6 @@ libnm_core_lib_c_real = \
libnm-core/nm-vpn-plugin-info.c \
$(NULL)
if WITH_JSON_VALIDATION
libnm_core_lib_h_priv += \
libnm-core/nm-json.h
libnm_core_lib_c_real += \
libnm-core/nm-json.c
endif
libnm_core_lib_c_mkenums = \
libnm-core/nm-core-enum-types.c
@ -1092,11 +1087,6 @@ libnm_core_libnm_core_la_CPPFLAGS = \
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE \
$(NULL)
if WITH_JSON_VALIDATION
libnm_core_libnm_core_la_CPPFLAGS += $(JANSSON_CFLAGS)
libnm_core_libnm_core_la_CPPFLAGS += -fcommon
endif
libnm_core_libnm_core_la_SOURCES = \
$(libnm_core_lib_h_pub_real) \
$(libnm_core_lib_h_priv) \

View file

@ -196,12 +196,6 @@ links = [
libnm_core_c_args = common_c_flags
if enable_json_validation
libnm_core_sources += files('nm-json.c')
deps += jansson_dep
libnm_core_c_args += ['-fcommon']
endif
libnm_core = static_library(
'nm-core',
sources: libnm_core_sources + libnm_core_enum_sources + nm_meta_setting_source + [nm_version_macro_header],

View file

@ -11,7 +11,7 @@
#include "nm-errors.h"
#include "nm-utils-private.h"
#include "nm-json.h"
#include "nm-glib-aux/nm-json.h"
#include "nm-glib-aux/nm-json-aux.h"
#include "nm-core-internal.h"
#include "nm-setting-team.h"

View file

@ -16,10 +16,7 @@
#include <sys/stat.h>
#include <linux/pkt_sched.h>
#if WITH_JSON_VALIDATION
#include "nm-json.h"
#endif
#include "nm-glib-aux/nm-json.h"
#include "nm-glib-aux/nm-str-buf.h"
#include "nm-glib-aux/nm-enum-utils.h"
#include "nm-glib-aux/nm-time-utils.h"

View file

@ -134,6 +134,7 @@ sources = files(
'nm-glib-aux/nm-hash-utils.c',
'nm-glib-aux/nm-io-utils.c',
'nm-glib-aux/nm-json-aux.c',
'nm-glib-aux/nm-json.c',
'nm-glib-aux/nm-keyfile-aux.c',
'nm-glib-aux/nm-logging-base.c',
'nm-glib-aux/nm-random-utils.c',