Commit 9740bd6d authored by Thomas Haller's avatar Thomas Haller

shared: merge branch 'th/shared-library-refactoring'

!113
parents df3c7c3f c27ad37c
Pipeline #31702 failed with stages
in 39 minutes and 44 seconds
This diff is collapsed.
......@@ -23,7 +23,7 @@
#include <stdlib.h>
#include "nm-common-macros.h"
#include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-client-utils.h"
......
......@@ -22,7 +22,7 @@ deps = [
libnm_dep,
libnmc_base_dep,
libnmc_dep,
nm_core_dep,
libnm_core_dep,
readline_dep,
]
......
......@@ -24,7 +24,7 @@
#include <stdlib.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-vpn-helpers.h"
......
......@@ -4,7 +4,7 @@ nm_polkit_listener = files('nm-polkit-listener.c')
deps = [
libnm_dep,
nm_core_dep,
shared_nm_libnm_core_aux_dep,
]
cflags = clients_cflags + [
......@@ -55,7 +55,7 @@ libnmc = static_library(
sources: files(
'nm-meta-setting-access.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,
c_args: cflags,
link_with: libnmc_base,
......
......@@ -23,7 +23,7 @@
#include "nm-meta-setting.h"
#include "nm-active-connection.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);
......
......@@ -24,10 +24,10 @@
#include <stdlib.h>
#include <arpa/inet.h>
#include "nm-common-macros.h"
#include "nm-utils/nm-enum-utils.h"
#include "nm-utils/nm-secret-utils.h"
#include "nm-libnm-core-utils.h"
#include "nm-libnm-core-intern/nm-common-macros.h"
#include "nm-glib-aux/nm-enum-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
#include "nm-libnm-core-intern/nm-libnm-core-utils.h"
#include "nm-vpn-helpers.h"
#include "nm-client-utils.h"
......
......@@ -20,9 +20,9 @@
#ifndef __NM_META_SETTING_DESC_H__
#define __NM_META_SETTING_DESC_H__
#include "nm-utils/nm-obj.h"
#include "nm-glib-aux/nm-obj.h"
#include "nm-meta-setting.h"
#include "nm-ethtool-utils.h"
#include "nm-libnm-core-intern/nm-ethtool-utils.h"
struct _NMDevice;
......
......@@ -38,7 +38,7 @@
#include "nm-vpn-service-plugin.h"
#include "nm-vpn-helpers.h"
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
/*****************************************************************************/
......
......@@ -30,8 +30,8 @@
#include "nm-client-utils.h"
#include "nm-utils.h"
#include "nm-utils/nm-io-utils.h"
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-io-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
/*****************************************************************************/
......
......@@ -4,7 +4,7 @@ deps = [
libnm_dep,
libnmc_dep,
libnmc_base_dep,
nm_core_dep,
libnm_core_dep,
]
exe = executable(
......
......@@ -2,7 +2,7 @@ name = 'nm-online'
deps = [
libnm_dep,
nm_core_dep,
libnm_core_dep,
]
clients_cflags = [
......
......@@ -2,7 +2,7 @@ name = 'nmtui'
deps = [
newt_dep,
nm_core_dep,
libnm_core_dep,
]
cflags = clients_cflags + [
......
......@@ -30,7 +30,7 @@
#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)
......
......@@ -27,7 +27,7 @@ sources = files('nm-dispatcher-utils.c')
deps = [
libnm_dep,
nm_core_dep,
libnm_core_dep,
]
cflags = [
......
......@@ -28,7 +28,7 @@
#include "nm-setting-ip6-config.h"
#include "nm-setting-connection.h"
#include "nm-dispatcher-api.h"
#include "nm-libnm-core-aux/nm-dispatcher-api.h"
#include "nm-utils.h"
/*****************************************************************************/
......
......@@ -31,7 +31,7 @@
#include <arpa/inet.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 "nmdbus-dispatcher.h"
......
......@@ -9,7 +9,7 @@ exe = executable(
test_unit,
test_unit + '.c',
include_directories: incs,
dependencies: nm_core_dep,
dependencies: libnm_core_dep,
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT',
......
......@@ -24,7 +24,7 @@
#include <stdlib.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"
......
......@@ -14,6 +14,6 @@ foreach example: examples
example[0],
[example[0] + '.c'] + example[1],
include_directories: example[2],
dependencies: [nm_core_dep] + example[3],
dependencies: [libnm_core_dep] + example[3],
)
endforeach
......@@ -139,14 +139,57 @@ libnm_core_enum = gnome.mkenums(
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 = [
dl_dep,
libudev_dep,
uuid_dep,
glib_dep,
shared_c_siphash_dep,
shared_nm_utils_base_dep,
shared_nm_utils_udev_dep,
shared_nm_glib_aux_dep,
shared_nm_udev_aux_dep,
shared_nm_libnm_core_intern_dep,
]
cflags = [
......@@ -188,8 +231,6 @@ endif
libnm_core_sources_all = libnm_core_sources
libnm_core_sources_all += libnm_core_enum
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 = static_library(
......@@ -200,16 +241,54 @@ libnm_core = static_library(
c_args: cflags,
)
nm_core_dep = declare_dependency(
libnm_core_dep = declare_dependency(
sources: libnm_core_enum[1],
include_directories: libnm_core_inc,
dependencies: [
shared_nm_utils_base_dep,
shared_nm_libnm_core_intern_dep,
shared_nm_glib_aux_dep,
shared_c_siphash_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: [
libnm_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')
docbooks = [
......@@ -234,6 +313,8 @@ foreach docbook: docbooks
content_files += xml.full_path()
endforeach
###############################################################################
if enable_tests
subdir('tests')
endif
......@@ -88,7 +88,7 @@
#include "nm-utils.h"
#include "nm-vpn-dbus-interface.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 */
#define NM_BR_MIN_HELLO_TIME 1
......
......@@ -30,7 +30,7 @@
#include <gnutls/x509.h>
#include <gnutls/pkcs12.h>
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
#include "nm-errors.h"
/*****************************************************************************/
......
......@@ -35,7 +35,7 @@
#include <ciferfam.h>
#include <p12plcy.h>
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
#include "nm-errors.h"
/*****************************************************************************/
......
......@@ -29,8 +29,8 @@
#include <unistd.h>
#include <stdlib.h>
#include "nm-utils/nm-secret-utils.h"
#include "nm-utils/nm-io-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
#include "nm-glib-aux/nm-io-utils.h"
#include "nm-crypto-impl.h"
#include "nm-utils.h"
......
......@@ -45,7 +45,7 @@ gboolean nm_jansson_load (void);
#define json_integer_value (*_nm_jansson_json_integer_value)
#define json_string_value (*_nm_jansson_json_string_value)
#include "nm-utils/nm-jansson.h"
#include "nm-glib-aux/nm-jansson.h"
#endif
#endif /* __NM_JSON_H__ */
......@@ -31,9 +31,9 @@
#include <arpa/inet.h>
#include <linux/pkt_sched.h>
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.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-keyfile-utils.h"
......
......@@ -24,7 +24,7 @@
#include "nm-setting-8021x.h"
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
#include "nm-utils.h"
#include "nm-crypto.h"
#include "nm-utils-private.h"
......
......@@ -24,7 +24,7 @@
#include "nm-setting-ethtool.h"
#include "nm-setting-private.h"
#include "nm-ethtool-utils.h"
#include "nm-libnm-core-intern/nm-ethtool-utils.h"
/*****************************************************************************/
......
......@@ -24,7 +24,7 @@
#include <stdlib.h>
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
#include "nm-utils.h"
#include "nm-core-types-internal.h"
......
......@@ -25,7 +25,7 @@
#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-core-types-internal.h"
#include "nm-setting-connection.h"
......
......@@ -25,7 +25,7 @@
#include <stdlib.h>
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
#include "nm-utils.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
......
......@@ -24,7 +24,7 @@
#include <net/ethernet.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-setting-private.h"
......
......@@ -27,7 +27,7 @@
#include <net/ethernet.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-setting-private.h"
......
......@@ -24,7 +24,7 @@
#include "nm-setting-private.h"
#include "nm-utils-private.h"
#include "nm-connection-private.h"
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
/*****************************************************************************/
......
......@@ -27,7 +27,7 @@
#include <net/ethernet.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-setting-private.h"
......
......@@ -37,10 +37,10 @@
#include "nm-json.h"
#endif
#include "nm-utils/nm-enum-utils.h"
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-enum-utils.h"
#include "nm-glib-aux/nm-secret-utils.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-setting-private.h"
#include "nm-crypto.h"
......
......@@ -34,7 +34,7 @@ foreach test_unit: test_units
'libnm-core-' + test_unit,
[test_unit + '.c'] + enum,
dependencies: [
nm_core_dep,
libnm_core_dep,
libnm_systemd_shared_no_logging_dep,
],
c_args: [
......
......@@ -23,8 +23,8 @@
#include "nm-default.h"
#include "nm-utils/c-list-util.h"
#include "nm-utils/nm-enum-utils.h"
#include "nm-std-aux/c-list-util.h"
#include "nm-glib-aux/nm-enum-utils.h"
#include "nm-utils.h"
#include "nm-setting-private.h"
......@@ -63,8 +63,8 @@
#include "nm-setting-wpan.h"
#include "nm-simple-connection.h"
#include "nm-keyfile-internal.h"
#include "nm-utils/nm-dedup-multi.h"
#include "nm-ethtool-utils.h"
#include "nm-glib-aux/nm-dedup-multi.h"
#include "nm-libnm-core-intern/nm-ethtool-utils.h"
#include "test-general-enums.h"
......
......@@ -9,8 +9,8 @@ libnm_utils_sources = files('nm-libnm-utils.c')
deps = [
libnmdbus_dep,
shared_nm_utils_base_dep,
nm_core_dep,
shared_nm_glib_aux_dep,
libnm_core_dep,
]
libnm_utils = static_library(
......@@ -153,8 +153,8 @@ libnm = shared_library(
dependencies: [
dl_dep,
libudev_dep,
shared_nm_utils_base_dep,
nm_core_dep,
shared_nm_glib_aux_dep,
libnm_core_dep,
uuid_dep,
libnm_systemd_shared_no_logging_dep,
],
......
......@@ -25,7 +25,7 @@
#error Cannot use this header.
#endif
#include "nm-dbus-compat.h"
#include "nm-std-aux/nm-dbus-compat.h"
GBusType _nm_dbus_bus_type (void);
......
......@@ -40,7 +40,7 @@
#include "nm-dbus-helpers.h"
#include "nm-device-tun.h"
#include "nm-setting-connection.h"
#include "shared/nm-utils/nm-udev-utils.h"
#include "nm-udev-aux/nm-udev-utils.h"
#include "introspection/org.freedesktop.NetworkManager.Device.h"
......
......@@ -25,7 +25,7 @@
#include "nm-utils.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-wifi.h"
#include "nm-core-internal.h"
......
......@@ -26,7 +26,7 @@
#include <signal.h>
#include <stdlib.h>
#include "nm-utils/nm-secret-utils.h"
#include "nm-glib-aux/nm-secret-utils.h"
#include "nm-enum-types.h"
#include "nm-utils.h"
#include "nm-connection.h"
......
......@@ -19,7 +19,7 @@ foreach test_unit: test_units
],
dependencies: [
libnm_dep,
nm_core_dep,
libnm_core_dep,
libnm_systemd_shared_no_logging_dep,
],
c_args: cflags,
......@@ -39,6 +39,6 @@ libnm_vpn_plugin_utils_test = static_library(
'nm-vpn-plugin-utils-test',
sources: shared_nm_utils_nm_vpn_plugin_utils_c + [libnm_enum[1]],
include_directories: libnm_inc,
dependencies: nm_core_dep,
dependencies: libnm_core_dep,
c_args: cflags,
)
......@@ -137,7 +137,7 @@ libnm/nm-remote-settings.c
libnm/nm-vpn-plugin-old.c
libnm/nm-vpn-service-plugin.c
data/org.freedesktop.NetworkManager.policy.in.in
shared/nm-utils/nm-shared-utils.c
shared/nm-glib-aux/nm-shared-utils.c
src/NetworkManagerUtils.c
src/main.c
src/main-utils.c
......
shared_inc = include_directories('.')
###############################################################################
shared_c_stdaux = static_library(
'c-stdaux',
c_args: '-std=c11',
......@@ -10,6 +12,8 @@ shared_c_stdaux_dep = declare_dependency(
include_directories: shared_inc,
)
###############################################################################
shared_c_siphash = static_library(
'c-siphash',
include_directories: [
......@@ -23,6 +27,8 @@ shared_c_siphash_dep = declare_dependency(
link_with: shared_c_siphash,
)
###############################################################################
shared_c_rbtree = static_library(
'c-rbtree',
c_args: '-std=c11',
......@@ -39,6 +45,7 @@ shared_c_rbtree_dep = declare_dependency(
link_with: shared_c_rbtree,
)
###############################################################################
if enable_ebpf
shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf.c')
......@@ -79,6 +86,8 @@ shared_n_acd_dep = declare_dependency(
link_with: shared_n_acd,
)
###############################################################################
version_conf = configuration_data()
version_conf.set('NM_MAJOR_VERSION', nm_major_version)
version_conf.set('NM_MINOR_VERSION', nm_minor_version)
......@@ -90,10 +99,6 @@ version_header = configure_file(
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_test_utils_impl_c = files('nm-test-utils-impl.c')
......@@ -102,35 +107,60 @@ shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c')
###############################################################################
shared_nm_utils_c_args = [
shared_nm_std_aux = static_library(
'nm-std-aux',
sources: files('nm-std-aux/c-list-util.c'),
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=0',
],
include_directories: [
top_inc,
shared_inc,
],
dependencies: [
],
)
shared_nm_std_aux_dep = declare_dependency(
link_with: shared_nm_std_aux,
include_directories: [
top_inc,
shared_inc,
],
)
###############################################################################
shared_nm_glib_aux_c_args = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
]
shared_nm_utils_base = static_library(