mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00:00
libnm/keyfile: build keyfile code as separate GPL licensed internal library
Keyfile support was initially added under GPL-2.0+ license as part of
core. It was moved to "libnm-core" in commit 59eb5312a5
('keyfile: merge
branch 'th/libnm-keyfile-bgo744699'').
"libnm-core" is statically linked with by core and "libnm". In
the former case under terms of GPL-2.0+ (good) and in the latter case
under terms of LGPL-2.1+ (bad).
In fact, to this day, "libnm" doesn't actually use the code. The linker
will probably remove all the GPL-2.0+ symbols when compiled with
gc-sections or LTO. Still, linking them together in the first place
makes "libnm" only available under GPL code (despite the code
not actually being used).
Instead, move the GPL code to a separate static library
"shared/nm-keyfile/libnm-keyfile.la" and only link it to the part
that actually uses the code (and which is GPL licensed too).
This fixes the license violation.
Eventually, it would be very useful to be able to expose keyfile
handling via "libnm". However that is not straight forward due to the
licensing conflict.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/381
This commit is contained in:
parent
7bbccab4f2
commit
d964decbbd
43
Makefile.am
43
Makefile.am
|
@ -527,6 +527,41 @@ $(shared_nm_libnm_core_aux_libnm_libnm_core_aux_la_OBJECTS): $(libnm_core_lib_h_
|
|||
|
||||
###############################################################################
|
||||
|
||||
noinst_LTLIBRARIES += shared/nm-keyfile/libnm-keyfile.la
|
||||
|
||||
shared_nm_keyfile_libnm_keyfile_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_LIBNM_CORE_INTERNAL|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)' \
|
||||
$(NULL)
|
||||
|
||||
shared_nm_keyfile_libnm_keyfile_la_SOURCES = \
|
||||
shared/nm-keyfile/nm-keyfile-internal.h \
|
||||
shared/nm-keyfile/nm-keyfile-utils.c \
|
||||
shared/nm-keyfile/nm-keyfile-utils.h \
|
||||
shared/nm-keyfile/nm-keyfile.c \
|
||||
$(NULL)
|
||||
|
||||
shared_nm_keyfile_libnm_keyfile_la_LDFLAGS = \
|
||||
$(CODE_COVERAGE_LDFLAGS) \
|
||||
$(SANITIZER_LIB_LDFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
shared_nm_keyfile_libnm_keyfile_la_LIBADD = \
|
||||
$(GLIB_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
$(shared_nm_keyfile_libnm_keyfile_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
||||
|
||||
###############################################################################
|
||||
|
||||
noinst_LTLIBRARIES += shared/nm-libnm-aux/libnm-libnm-aux.la
|
||||
|
||||
shared_nm_libnm_aux_libnm_libnm_aux_la_CPPFLAGS = \
|
||||
|
@ -909,8 +944,6 @@ libnm_core_lib_h_priv = \
|
|||
libnm-core/nm-core-types-internal.h \
|
||||
libnm-core/nm-crypto-impl.h \
|
||||
libnm-core/nm-crypto.h \
|
||||
libnm-core/nm-keyfile-internal.h \
|
||||
libnm-core/nm-keyfile-utils.h \
|
||||
libnm-core/nm-property-compare.h \
|
||||
libnm-core/nm-setting-private.h \
|
||||
libnm-core/nm-team-utils.h \
|
||||
|
@ -973,8 +1006,6 @@ libnm_core_lib_c_real = \
|
|||
libnm-core/nm-crypto.c \
|
||||
libnm-core/nm-dbus-utils.c \
|
||||
libnm-core/nm-errors.c \
|
||||
libnm-core/nm-keyfile-utils.c \
|
||||
libnm-core/nm-keyfile.c \
|
||||
libnm-core/nm-property-compare.c \
|
||||
libnm-core/nm-setting.c \
|
||||
libnm-core/nm-simple-connection.c \
|
||||
|
@ -1182,6 +1213,7 @@ nodist_libnm_core_tests_test_general_SOURCES = \
|
|||
|
||||
libnm_core_tests_ldadd = \
|
||||
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
|
||||
shared/nm-keyfile/libnm-keyfile.la \
|
||||
libnm-core/libnm-core.la \
|
||||
$(libnm_crypto_lib) \
|
||||
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||
|
@ -2269,6 +2301,7 @@ src_libNetworkManager_la_SOURCES = \
|
|||
src_libNetworkManager_la_LIBADD = \
|
||||
src/libNetworkManagerBase.la \
|
||||
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
|
||||
shared/nm-keyfile/libnm-keyfile.la \
|
||||
libnm-core/libnm-core.la \
|
||||
$(libnm_crypto_lib) \
|
||||
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||
|
@ -2358,6 +2391,7 @@ src_nm_iface_helper_SOURCES = \
|
|||
src_nm_iface_helper_LDADD = \
|
||||
src/libNetworkManagerBase.la \
|
||||
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
|
||||
shared/nm-keyfile/libnm-keyfile.la \
|
||||
libnm-core/libnm-core.la \
|
||||
$(libnm_crypto_lib) \
|
||||
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||
|
@ -2406,6 +2440,7 @@ src_initrd_nm_initrd_generator_LDADD = \
|
|||
src/initrd/libnmi-core.la \
|
||||
src/libNetworkManagerBase.la \
|
||||
shared/nm-libnm-core-aux/libnm-libnm-core-aux.la \
|
||||
shared/nm-keyfile/libnm-keyfile.la \
|
||||
libnm-core/libnm-core.la \
|
||||
$(libnm_crypto_lib) \
|
||||
shared/nm-libnm-core-intern/libnm-libnm-core-intern.la \
|
||||
|
|
|
@ -165,8 +165,6 @@ libnm_core_sources = libnm_core_settings_sources + files(
|
|||
'nm-crypto.c',
|
||||
'nm-dbus-utils.c',
|
||||
'nm-errors.c',
|
||||
'nm-keyfile-utils.c',
|
||||
'nm-keyfile.c',
|
||||
'nm-property-compare.c',
|
||||
'nm-setting.c',
|
||||
'nm-simple-connection.c',
|
||||
|
@ -229,6 +227,24 @@ libnm_libnm_core_aux_dep = declare_dependency(
|
|||
link_with: libnm_libnm_core_aux,
|
||||
)
|
||||
|
||||
libnm_keyfile = static_library(
|
||||
'nm-keyfile',
|
||||
sources: nm_keyfile_source + [libnm_core_enum_sources[1]],
|
||||
dependencies: libnm_utils_base_dep,
|
||||
c_args: [
|
||||
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
|
||||
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
|
||||
],
|
||||
link_with: libnm_libnm_core_intern,
|
||||
)
|
||||
|
||||
libnm_keyfile_dep = declare_dependency(
|
||||
sources: [libnm_core_enum_sources[1], nm_version_macro_header],
|
||||
include_directories: [libnm_core_inc, shared_inc],
|
||||
dependencies: glib_dep,
|
||||
link_with: libnm_keyfile,
|
||||
)
|
||||
|
||||
enums_to_docbook = join_paths(source_root, 'tools', 'enums-to-docbook.pl')
|
||||
|
||||
docbooks = [
|
||||
|
|
|
@ -16,6 +16,7 @@ enum_sources = gnome.mkenums_simple(
|
|||
)
|
||||
|
||||
deps = [
|
||||
libnm_keyfile_dep,
|
||||
libnm_core_dep,
|
||||
libnm_core_nm_default_dep,
|
||||
]
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "nm-setting-wireless-security.h"
|
||||
#include "nm-setting-wpan.h"
|
||||
#include "nm-simple-connection.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
#include "nm-glib-aux/nm-dedup-multi.h"
|
||||
#include "nm-libnm-core-intern/nm-ethtool-utils.h"
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#include "nm-default.h"
|
||||
|
||||
#include "nm-keyfile-utils.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-utils.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
#include "nm-simple-connection.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-wired.h"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "nm-simple-connection.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-errors.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
|
||||
#include "nm-utils/nm-test-utils.h"
|
||||
|
||||
|
|
|
@ -56,8 +56,6 @@ libnm-core/nm-crypto-gnutls.c
|
|||
libnm-core/nm-crypto-nss.c
|
||||
libnm-core/nm-connection.c
|
||||
libnm-core/nm-dbus-utils.c
|
||||
libnm-core/nm-keyfile-utils.c
|
||||
libnm-core/nm-keyfile.c
|
||||
libnm-core/nm-setting-6lowpan.c
|
||||
libnm-core/nm-setting-8021x.c
|
||||
libnm-core/nm-setting-adsl.c
|
||||
|
@ -138,6 +136,8 @@ 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-keyfile/nm-keyfile-utils.c
|
||||
shared/nm-keyfile/nm-keyfile.c
|
||||
shared/nm-libnm-core-aux/nm-libnm-core-aux.c
|
||||
src/NetworkManagerUtils.c
|
||||
src/main.c
|
||||
|
|
|
@ -111,6 +111,11 @@ 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_keyfile_source = files(
|
||||
'nm-keyfile/nm-keyfile-utils.c',
|
||||
'nm-keyfile/nm-keyfile.c',
|
||||
)
|
||||
|
||||
nm_libnm_aux_source = files('nm-libnm-aux/nm-libnm-aux.c')
|
||||
|
||||
nm_meta_setting_source = files('nm-meta-setting.c')
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#ifndef __NM_KEYFILE_UTILS_H__
|
||||
#define __NM_KEYFILE_UTILS_H__
|
||||
|
||||
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
|
||||
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL)
|
||||
#error Cannot use this header.
|
||||
#endif
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include "nm-default.h"
|
||||
#include "nm-core-utils.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
#include "nm-initrd-generator.h"
|
||||
#include "nm-glib-aux/nm-io-utils.h"
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ sources = files(
|
|||
deps = [
|
||||
daemon_nm_default_dep,
|
||||
libn_dhcp4_dep,
|
||||
libnm_keyfile_dep,
|
||||
libnm_core_dep,
|
||||
libnm_systemd_shared_dep,
|
||||
libnm_udev_aux_dep,
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "nm-config.h"
|
||||
#include "devices/nm-device.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "devices/nm-device.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
|
||||
#define DEFAULT_CONFIG_MAIN_FILE NMCONFDIR "/NetworkManager.conf"
|
||||
#define DEFAULT_CONFIG_DIR NMCONFDIR "/conf.d"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define __NM_TEST_UTILS_CORE_H__
|
||||
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
|
||||
#define _NMTST_INSIDE_CORE 1
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "nm-libnm-core-intern/nm-common-macros.h"
|
||||
#include "nm-glib-aux/nm-keyfile-aux.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
#include "nm-dbus-interface.h"
|
||||
#include "nm-connection.h"
|
||||
#include "nm-setting-8021x.h"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "nm-utils.h"
|
||||
#include "nm-config.h"
|
||||
#include "nm-core-internal.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
|
||||
#include "systemd/nm-sd-utils-shared.h"
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nms-keyfile-utils.h"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
#include "nm-glib-aux/nm-io-utils.h"
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-setting-wired.h"
|
||||
#include "nm-setting-wireless.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "nm-keyfile-internal.h"
|
||||
#include "nm-keyfile/nm-keyfile-internal.h"
|
||||
|
||||
#include "nms-keyfile-utils.h"
|
||||
#include "nms-keyfile-reader.h"
|
||||
|
|
Loading…
Reference in a new issue