Commit b434b9ec authored by Thomas Haller's avatar Thomas Haller

shared: split C-only helper "shared/nm-std-aux" utils out of "shared/nm-utils"

"shared/nm-utils" contains general purpose utility functions that only
depend on glib (and extend glib with some helper functions).

We will also add code that does not use glib, hence it would be good
if the part of "shared/nm-utils" that does not depend on glib, could be
used by these future projects.

Also, we use the term "utils" everywhere. While that covers the purpose
and content well, having everything called "nm-something-utils" is not
great. Instead, call this "nm-std-aux", inspired by "c-util/c-stdaux".
parent df3c7c3f
...@@ -287,6 +287,35 @@ shared_libnacd_la_LIBADD = \ ...@@ -287,6 +287,35 @@ shared_libnacd_la_LIBADD = \
############################################################################### ###############################################################################
noinst_LTLIBRARIES += shared/nm-std-aux/libnm-std-aux.la
shared_nm_std_aux_libnm_std_aux_la_CPPFLAGS = \
$(dflt_cppflags) \
-I$(srcdir)/shared \
$(CODE_COVERAGE_CFLAGS) \
$(SANITIZER_LIB_CFLAGS) \
-DG_LOG_DOMAIN=\""libnm"\" \
-DNETWORKMANAGER_COMPILATION='0' \
$(NULL)
shared_nm_std_aux_libnm_std_aux_la_SOURCES = \
shared/c-list/src/c-list.h \
shared/nm-std-aux/c-list-util.c \
shared/nm-std-aux/c-list-util.h \
shared/nm-std-aux/unaligned.h \
$(NULL)
shared_nm_std_aux_libnm_std_aux_la_LDFLAGS = \
$(CODE_COVERAGE_LDFLAGS) \
$(SANITIZER_LIB_LDFLAGS) \
$(NULL)
shared_nm_std_aux_libnm_std_aux_la_LIBADD = \
shared/libcsiphash.la \
$(NULL)
###############################################################################
shared_nm_utils_libnm_utils_cppflags = \ shared_nm_utils_libnm_utils_cppflags = \
$(dflt_cppflags) \ $(dflt_cppflags) \
-I$(srcdir)/shared \ -I$(srcdir)/shared \
...@@ -304,9 +333,6 @@ shared_nm_utils_libnm_utils_base_la_CPPFLAGS = \ ...@@ -304,9 +333,6 @@ shared_nm_utils_libnm_utils_base_la_CPPFLAGS = \
$(NULL) $(NULL)
shared_nm_utils_libnm_utils_base_la_SOURCES = \ shared_nm_utils_libnm_utils_base_la_SOURCES = \
shared/c-list/src/c-list.h \
shared/nm-utils/c-list-util.c \
shared/nm-utils/c-list-util.h \
shared/nm-utils/nm-c-list.h \ shared/nm-utils/nm-c-list.h \
shared/nm-utils/nm-dedup-multi.c \ shared/nm-utils/nm-dedup-multi.c \
shared/nm-utils/nm-dedup-multi.h \ shared/nm-utils/nm-dedup-multi.h \
...@@ -330,7 +356,6 @@ shared_nm_utils_libnm_utils_base_la_SOURCES = \ ...@@ -330,7 +356,6 @@ shared_nm_utils_libnm_utils_base_la_SOURCES = \
shared/nm-utils/nm-shared-utils.h \ shared/nm-utils/nm-shared-utils.h \
shared/nm-utils/nm-time-utils.c \ shared/nm-utils/nm-time-utils.c \
shared/nm-utils/nm-time-utils.h \ shared/nm-utils/nm-time-utils.h \
shared/nm-utils/unaligned.h \
$(NULL) $(NULL)
shared_nm_utils_libnm_utils_base_la_LDFLAGS = \ shared_nm_utils_libnm_utils_base_la_LDFLAGS = \
...@@ -339,7 +364,7 @@ shared_nm_utils_libnm_utils_base_la_LDFLAGS = \ ...@@ -339,7 +364,7 @@ shared_nm_utils_libnm_utils_base_la_LDFLAGS = \
$(NULL) $(NULL)
shared_nm_utils_libnm_utils_base_la_LIBADD = \ shared_nm_utils_libnm_utils_base_la_LIBADD = \
shared/libcsiphash.la \ shared/nm-std-aux/libnm-std-aux.la \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
$(NULL) $(NULL)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "nm-default.h" #include "nm-default.h"
#include "nm-utils/c-list-util.h" #include "nm-std-aux/c-list-util.h"
#include "nm-utils/nm-enum-utils.h" #include "nm-utils/nm-enum-utils.h"
#include "nm-utils.h" #include "nm-utils.h"
......
...@@ -102,6 +102,29 @@ shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c') ...@@ -102,6 +102,29 @@ shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c')
############################################################################### ###############################################################################
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_utils_c_args = [ shared_nm_utils_c_args = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name), '-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)', '-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
...@@ -109,8 +132,7 @@ shared_nm_utils_c_args = [ ...@@ -109,8 +132,7 @@ shared_nm_utils_c_args = [
shared_nm_utils_base = static_library( shared_nm_utils_base = static_library(
'nm-utils-base', 'nm-utils-base',
sources: files('nm-utils/c-list-util.c', sources: files('nm-utils/nm-dedup-multi.c',
'nm-utils/nm-dedup-multi.c',
'nm-utils/nm-enum-utils.c', 'nm-utils/nm-enum-utils.c',
'nm-utils/nm-errno.c', 'nm-utils/nm-errno.c',
'nm-utils/nm-hash-utils.c', 'nm-utils/nm-hash-utils.c',
...@@ -126,6 +148,7 @@ shared_nm_utils_base = static_library( ...@@ -126,6 +148,7 @@ shared_nm_utils_base = static_library(
], ],
dependencies: [ dependencies: [
glib_dep, glib_dep,
shared_nm_std_aux_dep,
], ],
) )
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define __NM_DEDUP_MULTI_H__ #define __NM_DEDUP_MULTI_H__
#include "nm-obj.h" #include "nm-obj.h"
#include "c-list-util.h" #include "nm-std-aux/c-list-util.h"
/*****************************************************************************/ /*****************************************************************************/
......
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#include "nm-default.h" #include "nm-default.h"
#include "nm-utils/nm-time-utils.h" #include "nm-std-aux/unaligned.h"
#include "nm-utils/nm-random-utils.h" #include "nm-utils/nm-random-utils.h"
#include "nm-utils/unaligned.h" #include "nm-utils/nm-time-utils.h"
#include "nm-utils/nm-test-utils.h" #include "nm-utils/nm-test-utils.h"
......
#pragma once #pragma once
#include "nm-utils/unaligned.h" #include "nm-std-aux/unaligned.h"
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/pkt_sched.h> #include <linux/pkt_sched.h>
#include "nm-std-aux/unaligned.h"
#include "nm-utils/nm-dedup-multi.h" #include "nm-utils/nm-dedup-multi.h"
#include "nm-utils/nm-random-utils.h" #include "nm-utils/nm-random-utils.h"
#include "nm-utils/unaligned.h"
#include "nm-ethtool-utils.h" #include "nm-ethtool-utils.h"
#include "nm-common-macros.h" #include "nm-common-macros.h"
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#include <net/ethernet.h> #include <net/ethernet.h>
#include "nm-std-aux/unaligned.h"
#include "platform/nm-platform.h" #include "platform/nm-platform.h"
#include "nm-utils/unaligned.h"
#include "nm-utils/nm-c-list.h" #include "nm-utils/nm-c-list.h"
#include "nm-utils.h" #include "nm-utils.h"
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <net/if_arp.h> #include <net/if_arp.h>
#include "nm-utils/nm-dedup-multi.h" #include "nm-utils/nm-dedup-multi.h"
#include "nm-utils/unaligned.h" #include "nm-std-aux/unaligned.h"
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-config.h" #include "nm-config.h"
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
#include <net/if_arp.h> #include <net/if_arp.h>
#include <net/ethernet.h> #include <net/ethernet.h>
#include "nm-std-aux/unaligned.h"
#include "nm-utils/nm-random-utils.h" #include "nm-utils/nm-random-utils.h"
#include "nm-utils/nm-io-utils.h" #include "nm-utils/nm-io-utils.h"
#include "nm-utils/unaligned.h"
#include "nm-utils/nm-secret-utils.h" #include "nm-utils/nm-secret-utils.h"
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-core-internal.h" #include "nm-core-internal.h"
......
...@@ -41,6 +41,8 @@ ...@@ -41,6 +41,8 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h> #include <unistd.h>
#include "nm-std-aux/unaligned.h"
#include "nm-utils.h" #include "nm-utils.h"
#include "nm-core-internal.h" #include "nm-core-internal.h"
#include "nm-setting-vlan.h" #include "nm-setting-vlan.h"
...@@ -56,7 +58,6 @@ ...@@ -56,7 +58,6 @@
#include "wifi/nm-wifi-utils.h" #include "wifi/nm-wifi-utils.h"
#include "wifi/nm-wifi-utils-wext.h" #include "wifi/nm-wifi-utils-wext.h"
#include "wpan/nm-wpan-utils.h" #include "wpan/nm-wpan-utils.h"
#include "nm-utils/unaligned.h"
#include "nm-utils/nm-io-utils.h" #include "nm-utils/nm-io-utils.h"
#include "nm-utils/nm-udev-utils.h" #include "nm-utils/nm-udev-utils.h"
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/genetlink.h> #include <linux/genetlink.h>
#include "nm-utils/unaligned.h" #include "nm-std-aux/unaligned.h"
/*****************************************************************************/ /*****************************************************************************/
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <linux/fib_rules.h> #include <linux/fib_rules.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include "nm-utils/c-list-util.h" #include "nm-std-aux/c-list-util.h"
#include "nmp-object.h" #include "nmp-object.h"
/*****************************************************************************/ /*****************************************************************************/
......
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