build: merge branch 'th/meson-cleanup'

This commit is contained in:
Thomas Haller
2021-01-28 08:31:12 +01:00
28 changed files with 550 additions and 570 deletions

View File

@@ -1026,7 +1026,7 @@ dbusinterfaces_DATA = \
CLEANFILES += $(introspection_sources)
CLEANFILES += $(DBUS_INTERFACE_DOCS)
$(libnm_liblibnm_la_OBJECTS): $(introspection_sources)
$(libnm_libnm_static_la_OBJECTS): $(introspection_sources)
$(libnm_libnm_la_OBJECTS): $(introspection_sources)
EXTRA_DIST += \
@@ -1595,23 +1595,23 @@ nodist_libnminclude_HEADERS += \
###############################################################################
noinst_LTLIBRARIES += libnm/liblibnm.la
noinst_LTLIBRARIES += libnm/libnm_static.la
libnm_liblibnm_la_CPPFLAGS = \
libnm_libnm_static_la_CPPFLAGS = \
$(INTROSPECTION_CFLAGS) \
$(libnm_lib_cppflags) \
$(NULL)
libnm_liblibnm_la_SOURCES = \
libnm_libnm_static_la_SOURCES = \
$(libnm_lib_c_real) \
$(NULL)
nodist_libnm_liblibnm_la_SOURCES = \
nodist_libnm_libnm_static_la_SOURCES = \
$(libnm_lib_h_pub_mkenums) \
$(libnm_lib_c_mkenums) \
$(NULL)
libnm_liblibnm_la_LIBADD = \
libnm_libnm_static_la_LIBADD = \
libnm-core/nm-libnm-core-aux/libnm-libnm-core-aux.la \
libnm-core/nm-keyfile/libnm-keyfile.la \
libnm-core/libnm-core.la \
@@ -1631,8 +1631,8 @@ libnm_liblibnm_la_LIBADD = \
$(LIBUDEV_LIBS) \
$(NULL)
$(libnm_liblibnm_la_OBJECTS) : $(libnm_lib_h_pub_mkenums)
$(libnm_liblibnm_la_OBJECTS) : $(libnm_core_lib_h_pub_mkenums)
$(libnm_libnm_static_la_OBJECTS) : $(libnm_lib_h_pub_mkenums)
$(libnm_libnm_static_la_OBJECTS) : $(libnm_core_lib_h_pub_mkenums)
###############################################################################
@@ -1667,7 +1667,7 @@ EXTRA_libnm_libnm_la_DEPENDENCIES = \
libnm/libnm.ver
libnm_libnm_la_LIBADD = \
libnm/liblibnm.la \
libnm/libnm_static.la \
$(NULL)
libnm_libnm_la_LDFLAGS = \
@@ -1806,7 +1806,7 @@ libnm_tests_cppflags = \
$(NULL)
libnm_tests_ldadd = \
libnm/liblibnm.la \
libnm/libnm_static.la \
$(GLIB_LIBS) \
$(NULL)
@@ -5436,6 +5436,7 @@ EXTRA_DIST += \
po/meson.build \
\
shared/nm-default.h \
shared/nm-gassert-patch.h \
shared/nm-test-libnm-utils.h \
shared/nm-test-utils-impl.c \
shared/nm-utils/nm-compat.c \

View File

@@ -8,7 +8,7 @@ exe = executable(
include_directories: dispatcher_inc,
dependencies: [
libnm_nm_default_dep,
libnm_utils_base_dep,
libnm_glib_aux_dep,
],
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',

View File

@@ -8,11 +8,6 @@ libnm_core_nm_default_dep = declare_dependency(
dependencies: glib_nm_default_dep,
)
common_c_flags = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
]
libnm_core_headers = files(
'nm-connection.h',
'nm-core-types.h',
@@ -80,10 +75,8 @@ libnm_core_headers = files(
'nm-vpn-plugin-info.h',
)
enum_types = 'nm-core-enum-types'
libnm_core_enum_sources = gnome.mkenums_simple(
enum_types,
'nm-core-enum-types',
sources: libnm_core_headers + [nm_version_macro_header],
identifier_prefix: nm_id_prefix,
body_prefix: '#include "nm-default.h"',
@@ -101,29 +94,33 @@ libnm_libnm_core_intern = static_library(
libnm_core_nm_default_dep,
libnm_base_dep,
],
c_args: common_c_flags,
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
],
)
libnm_libnm_core_intern_dep = declare_dependency(
sources: [libnm_core_enum_sources[1], nm_version_macro_header],
include_directories: [libnm_core_inc, shared_inc],
dependencies: [
libnm_utils_base_dep,
libnm_glib_aux_dep,
libnm_base_dep,
],
link_with: libnm_libnm_core_intern,
)
deps = [
crypto_dep,
libnm_utils_base_dep,
]
libnm_crypto = static_library(
'nm-crypto',
sources: 'nm-crypto-@0@.c'.format(crypto),
dependencies: deps,
c_args: common_c_flags,
dependencies: [
crypto_dep,
libnm_glib_aux_dep,
],
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
],
)
libnm_core_settings_sources = files(
@@ -195,27 +192,24 @@ libnm_core_sources = libnm_core_settings_sources + files(
'nm-vpn-plugin-info.c',
)
deps = [
dl_dep,
libnm_systemd_shared_dep,
libnm_utils_base_dep,
uuid_dep,
]
links = [
libnm_crypto,
libnm_libnm_core_intern,
]
libnm_core_c_args = common_c_flags
libnm_core = static_library(
'nm-core',
sources: libnm_core_sources + libnm_core_enum_sources + nm_meta_setting_source + [nm_version_macro_header],
include_directories: top_inc,
dependencies: deps,
c_args: libnm_core_c_args,
link_with: links,
dependencies: [
dl_dep,
libnm_systemd_shared_dep,
libnm_glib_aux_dep,
uuid_dep,
],
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
],
link_with: [
libnm_crypto,
libnm_libnm_core_intern,
],
)
libnm_core_dep = declare_dependency(
@@ -225,18 +219,16 @@ libnm_core_dep = declare_dependency(
link_with: libnm_core,
)
c_flags = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
]
libnm_libnm_core_aux = static_library(
'nm-libnm-core-aux',
sources: files(
'nm-libnm-core-aux/nm-libnm-core-aux.c',
) + [libnm_core_enum_sources[1]],
dependencies: libnm_utils_base_dep,
c_args: c_flags,
dependencies: libnm_glib_aux_dep,
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_WITH_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
],
link_with: [
libnm_libnm_core_intern,
libnm_base,
@@ -258,7 +250,7 @@ nm_keyfile_source = files(
libnm_keyfile = static_library(
'nm-keyfile',
sources: nm_keyfile_source + [libnm_core_enum_sources[1]],
dependencies: libnm_utils_base_dep,
dependencies: libnm_glib_aux_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)',
@@ -273,10 +265,8 @@ libnm_keyfile_dep = declare_dependency(
link_with: libnm_keyfile,
)
enums_to_docbook = join_paths(source_root, 'tools', 'enums-to-docbook.pl')
docbooks = [
['nm-dbus-types', 'nm-dbus-interface.h', 'NetworkManager D-Bus API Types'],
['nm-dbus-types', 'nm-dbus-interface.h', 'NetworkManager D-Bus API Types'],
['nm-vpn-dbus-types', 'nm-vpn-dbus-interface.h', 'VPN Plugin D-Bus API Types'],
]
@@ -288,7 +278,13 @@ foreach docbook: docbooks
input: docbook[1],
output: output,
capture: true,
command: [perl, enums_to_docbook, docbook[0], docbook[2], '@INPUT@'],
command: [
perl,
join_paths(source_root, 'tools', 'enums-to-docbook.pl'),
docbook[0],
docbook[2],
'@INPUT@',
],
# FIXME: gtkdoc does not depend directly on this.
# https://github.com/mesonbuild/meson/pull/2806
build_by_default: true,

View File

@@ -1,30 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# test-cert.p12 created with:
#
# openssl pkcs12 -export \
# -in test_key_and_cert.pem \
# -inkey test_key_and_cert.pem \
# -certfile test_ca_cert.pem \
# -name "test-pkcs12" \
# -out test-cert.p12
enum_types = 'nm-core-tests-enum-types'
enum_sources = gnome.mkenums_simple(
enum_types,
'nm-core-tests-enum-types',
sources: 'test-general-enums.h',
identifier_prefix: nm_id_prefix,
body_prefix: '#include "nm-default.h"',
)
c_flags = [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
]
test_cert_dir = join_paths(meson.current_source_dir(), 'certs')
test_units = [
'test-compare',
'test-crypto',
@@ -45,7 +27,10 @@ foreach test_unit: test_units
libnm_core_nm_default_dep,
libnm_base_dep,
],
c_args: c_flags,
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
],
link_with: libnm_systemd_logging_stub,
)

View File

@@ -8,11 +8,6 @@ libnm_nm_default_dep = declare_dependency(
dependencies: libnm_core_nm_default_dep,
)
c_flags = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
]
libnm_headers = files(
'NetworkManager.h',
'nm-access-point.h',
@@ -70,14 +65,12 @@ install_headers(
subdir: libnm_name,
)
enum_types = 'nm-enum-types'
libnm_enum_sources = gnome.mkenums(
enum_types,
'nm-enum-types',
sources: libnm_headers + [nm_version_macro_header],
identifier_prefix: nm_id_prefix,
c_template: enum_types + '.c.template',
h_template: enum_types + '.h.template',
c_template: 'nm-enum-types.c.template',
h_template: 'nm-enum-types.h.template',
install_header: true,
install_dir: libnm_pkgincludedir,
)
@@ -137,39 +130,38 @@ libnm_sources = files(
'nm-wimax-nsp.c',
)
deps = [
libnmdbus_dep,
libnm_libnm_core_intern_dep,
libnm_nm_default_dep,
libnm_keyfile_dep,
libnm_udev_aux_dep,
libudev_dep,
]
liblibnm = static_library(
'libnm',
libnm_static = static_library(
'nm-static',
sources: libnm_sources + libnm_enum_sources,
dependencies: deps,
c_args: c_flags,
dependencies: [
libnmdbus_dep,
libnm_libnm_core_intern_dep,
libnm_nm_default_dep,
libnm_keyfile_dep,
libnm_udev_aux_dep,
libudev_dep,
],
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
],
link_with: libnm_systemd_logging_stub,
)
links = [
liblibnm,
libnm_core,
libnm_keyfile,
libnmdbus,
libnm_systemd_logging_stub,
libnm_utils_base,
]
linker_script = join_paths(meson.current_source_dir(), 'libnm.ver')
libnm = shared_library(
'nm',
version: libnm_version,
dependencies: libnm_nm_default_dep,
link_whole: links,
link_whole: [
libnm_static,
libnm_core,
libnm_keyfile,
libnmdbus,
libnm_systemd_logging_stub,
libnm_glib_aux,
],
link_args: '-Wl,--version-script,@0@'.format(linker_script),
link_depends: linker_script,
install: true,
@@ -213,7 +205,10 @@ if enable_introspection
symbol_prefix: nm_id_prefix.to_lower(),
header: 'NetworkManager.h',
export_packages: libnm_name,
extra_args: c_flags,
extra_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
],
install: true,
)
@@ -299,10 +294,6 @@ if enable_introspection
endif
if enable_tests
subdir('tests')
endif
libnm_libnm_aux = static_library(
'nm-libnm-aux',
sources: files(
@@ -323,3 +314,7 @@ libnm_libnm_aux_dep = declare_dependency(
include_directories: [shared_inc],
link_with: [libnm_libnm_aux],
)
if enable_tests
subdir('tests')
endif

View File

@@ -1,35 +1,35 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
test_units = [
['test-libnm', 30],
['test-nm-client', 90],
['test-remote-settings-client', 90],
['test-secret-agent', 90],
]
deps = [
libnm_core_dep,
libnm_nm_default_dep,
]
c_flags = [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
'test-libnm',
'test-nm-client',
'test-remote-settings-client',
'test-secret-agent',
]
foreach test_unit: test_units
exe = executable(
test_unit[0],
[test_unit[0] + '.c', nm_test_utils_impl_source, libnm_enum_sources[1]],
dependencies: deps,
c_args: c_flags,
link_with: liblibnm,
test_unit,
[
test_unit + '.c',
nm_test_utils_impl_source,
libnm_enum_sources[1],
],
dependencies: [
libnm_core_dep,
libnm_nm_default_dep,
],
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
],
link_with: libnm_static,
)
test(
test_unit[0],
test_unit,
test_script,
timeout: test_unit[1],
timeout: 90,
args: test_args + [exe.full_path()],
)
endforeach
@@ -40,5 +40,8 @@ libnm_vpn_plugin_utils_test = static_library(
sources: nm_vpn_plugin_utils_source + [libnm_enum_sources[1]],
include_directories: libnm_inc,
dependencies: libnm_nm_default_dep,
c_args: c_flags,
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
],
)

View File

@@ -56,7 +56,9 @@ nm_pkgstatedir = join_paths(nm_localstatedir, 'lib', nm_name)
nm_vpndir = join_paths(nm_libdir, nm_name)
nm_plugindir = join_paths(nm_libdir, nm_name, dist_version)
introspection_extra_cflags = ['-Wno-incompatible-pointer-types-discards-qualifiers']
introspection_extra_cflags = [
'-Wno-incompatible-pointer-types-discards-qualifiers',
]
libnm_name = 'libnm'

View File

@@ -2,9 +2,15 @@
shared_inc = include_directories('.')
nm_default_dep = declare_dependency(include_directories: [top_inc, shared_inc])
glib_nm_default_dep = declare_dependency(dependencies: [glib_dep, nm_default_dep])
glib_nm_default_dep = declare_dependency(
include_directories: [
top_inc,
shared_inc,
],
dependencies: [
glib_dep,
],
)
libc_siphash = static_library(
'c-siphash',
@@ -19,44 +25,37 @@ libc_rbtree = static_library(
c_args: '-std=c11',
)
sources = files(
'n-acd/src/n-acd.c',
'n-acd/src/n-acd-probe.c',
'n-acd/src/util/timer.c',
)
if enable_ebpf
sources += files('n-acd/src/n-acd-bpf.c')
n_acd_bpf_source = 'n-acd/src/n-acd-bpf.c'
else
sources += files('n-acd/src/n-acd-bpf-fallback.c')
n_acd_bpf_source = 'n-acd/src/n-acd-bpf-fallback.c'
endif
incs = include_directories(
'c-list/src',
'c-rbtree/src',
'c-siphash/src',
'c-stdaux/src',
)
c_flags = [
'-D_GNU_SOURCE',
'-DSO_ATTACH_BPF=50',
'-std=c11',
'-Wno-pointer-arith',
'-Wno-vla',
]
links = [
libc_rbtree,
libc_siphash,
]
libn_acd = static_library(
'n-acd',
sources: sources,
include_directories: incs,
c_args: c_flags,
link_with: links,
sources: files(
'n-acd/src/n-acd.c',
'n-acd/src/n-acd-probe.c',
'n-acd/src/util/timer.c',
n_acd_bpf_source,
),
include_directories: include_directories(
'c-list/src',
'c-rbtree/src',
'c-siphash/src',
'c-stdaux/src',
),
c_args: [
'-D_GNU_SOURCE',
'-DSO_ATTACH_BPF=50',
'-std=c11',
'-Wno-pointer-arith',
'-Wno-vla',
],
link_with: [
libc_rbtree,
libc_siphash,
],
)
libn_acd_dep = declare_dependency(
@@ -64,35 +63,29 @@ libn_acd_dep = declare_dependency(
link_with: libn_acd,
)
sources = files(
'n-dhcp4/src/n-dhcp4-c-connection.c',
'n-dhcp4/src/n-dhcp4-c-lease.c',
'n-dhcp4/src/n-dhcp4-client.c',
'n-dhcp4/src/n-dhcp4-c-probe.c',
'n-dhcp4/src/n-dhcp4-incoming.c',
'n-dhcp4/src/n-dhcp4-outgoing.c',
'n-dhcp4/src/n-dhcp4-socket.c',
'n-dhcp4/src/util/packet.c',
'n-dhcp4/src/util/socket.c',
)
incs = include_directories(
'c-list/src',
'c-siphash/src',
'c-stdaux/src',
)
c_flags = [
'-D_GNU_SOURCE',
'-Wno-declaration-after-statement',
'-Wno-pointer-arith',
]
libn_dhcp4 = static_library(
'n-dhcp4',
sources: sources,
c_args: c_flags,
include_directories: incs,
sources: files(
'n-dhcp4/src/n-dhcp4-c-connection.c',
'n-dhcp4/src/n-dhcp4-c-lease.c',
'n-dhcp4/src/n-dhcp4-client.c',
'n-dhcp4/src/n-dhcp4-c-probe.c',
'n-dhcp4/src/n-dhcp4-incoming.c',
'n-dhcp4/src/n-dhcp4-outgoing.c',
'n-dhcp4/src/n-dhcp4-socket.c',
'n-dhcp4/src/util/packet.c',
'n-dhcp4/src/util/socket.c',
),
c_args: [
'-D_GNU_SOURCE',
'-Wno-declaration-after-statement',
'-Wno-pointer-arith',
],
include_directories: include_directories(
'c-list/src',
'c-siphash/src',
'c-stdaux/src',
),
link_with: libc_siphash,
)
@@ -126,47 +119,40 @@ libnm_std_aux = static_library(
],
)
sources = files(
'nm-glib-aux/nm-dbus-aux.c',
'nm-glib-aux/nm-dedup-multi.c',
'nm-glib-aux/nm-enum-utils.c',
'nm-glib-aux/nm-errno.c',
'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-keyfile-aux.c',
'nm-glib-aux/nm-logging-base.c',
'nm-glib-aux/nm-random-utils.c',
'nm-glib-aux/nm-ref-string.c',
'nm-glib-aux/nm-secret-utils.c',
'nm-glib-aux/nm-shared-utils.c',
'nm-glib-aux/nm-time-utils.c',
)
c_flags = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
]
links = [
libc_siphash,
libnm_std_aux,
]
libnm_utils_base = static_library(
'nm-utils-base',
sources: sources,
libnm_glib_aux = static_library(
'nm-glib-aux',
sources: files(
'nm-glib-aux/nm-dbus-aux.c',
'nm-glib-aux/nm-dedup-multi.c',
'nm-glib-aux/nm-enum-utils.c',
'nm-glib-aux/nm-errno.c',
'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-keyfile-aux.c',
'nm-glib-aux/nm-logging-base.c',
'nm-glib-aux/nm-random-utils.c',
'nm-glib-aux/nm-ref-string.c',
'nm-glib-aux/nm-secret-utils.c',
'nm-glib-aux/nm-shared-utils.c',
'nm-glib-aux/nm-time-utils.c',
),
dependencies: glib_nm_default_dep,
c_args: c_flags,
link_with: links,
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
],
link_with: [
libc_siphash,
libnm_std_aux,
],
)
libnm_utils_base_dep = declare_dependency(
libnm_glib_aux_dep = declare_dependency(
dependencies: glib_nm_default_dep,
link_with: libnm_utils_base,
link_with: libnm_glib_aux,
)
libnm_udev_aux = static_library(
'nm-udev-aux',
sources: 'nm-udev-aux/nm-udev-utils.c',
@@ -174,7 +160,10 @@ libnm_udev_aux = static_library(
glib_nm_default_dep,
libudev_dep,
],
c_args: c_flags,
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
],
)
libnm_udev_aux_dep = declare_dependency(
@@ -187,13 +176,16 @@ libnm_base = static_library(
sources: files(
'nm-base/nm-ethtool-base.c',
),
dependencies: libnm_utils_base_dep,
c_args: c_flags,
dependencies: libnm_glib_aux_dep,
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB)',
],
)
libnm_base_dep = declare_dependency(
include_directories: shared_inc,
dependencies: libnm_utils_base_dep,
dependencies: libnm_glib_aux_dep,
link_with: libnm_base,
)
@@ -213,7 +205,7 @@ libnm_log_core = static_library(
libnm_log_core_dep = declare_dependency(
include_directories: shared_inc,
dependencies: [
libnm_utils_base_dep,
libnm_glib_aux_dep,
],
link_with: libnm_log_core,
)
@@ -237,73 +229,71 @@ libnm_platform = static_library(
libnm_platform_dep = declare_dependency(
include_directories: shared_inc,
dependencies: [
libnm_utils_base_dep,
libnm_glib_aux_dep,
],
link_with: libnm_platform,
)
sources = files(
'systemd/nm-sd-utils-shared.c',
'systemd/src/basic/alloc-util.c',
'systemd/src/basic/env-file.c',
'systemd/src/basic/env-util.c',
'systemd/src/basic/escape.c',
'systemd/src/basic/ether-addr-util.c',
'systemd/src/basic/extract-word.c',
'systemd/src/basic/fd-util.c',
'systemd/src/basic/fileio.c',
'systemd/src/basic/format-util.c',
'systemd/src/basic/fs-util.c',
'systemd/src/basic/hash-funcs.c',
'systemd/src/basic/hashmap.c',
'systemd/src/basic/hexdecoct.c',
'systemd/src/basic/hostname-util.c',
'systemd/src/basic/in-addr-util.c',
'systemd/src/basic/io-util.c',
'systemd/src/basic/memory-util.c',
'systemd/src/basic/mempool.c',
'systemd/src/basic/parse-util.c',
'systemd/src/basic/path-util.c',
'systemd/src/basic/prioq.c',
'systemd/src/basic/process-util.c',
'systemd/src/basic/random-util.c',
'systemd/src/basic/ratelimit.c',
'systemd/src/basic/signal-util.c',
'systemd/src/basic/socket-util.c',
'systemd/src/basic/stat-util.c',
'systemd/src/basic/string-table.c',
'systemd/src/basic/string-util.c',
'systemd/src/basic/strv.c',
'systemd/src/basic/strxcpyx.c',
'systemd/src/basic/time-util.c',
'systemd/src/basic/tmpfile-util.c',
'systemd/src/basic/utf8.c',
'systemd/src/basic/util.c',
'systemd/src/shared/dns-domain.c',
'systemd/src/shared/web-util.c',
)
incs = include_directories(
'systemd/sd-adapt-shared',
'systemd/src/basic',
'systemd/src/shared',
)
c_flags = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED',
]
libnm_systemd_shared = static_library(
'nm-systemd-shared',
sources: sources,
include_directories: incs,
sources: files(
'systemd/nm-sd-utils-shared.c',
'systemd/src/basic/alloc-util.c',
'systemd/src/basic/env-file.c',
'systemd/src/basic/env-util.c',
'systemd/src/basic/escape.c',
'systemd/src/basic/ether-addr-util.c',
'systemd/src/basic/extract-word.c',
'systemd/src/basic/fd-util.c',
'systemd/src/basic/fileio.c',
'systemd/src/basic/format-util.c',
'systemd/src/basic/fs-util.c',
'systemd/src/basic/hash-funcs.c',
'systemd/src/basic/hashmap.c',
'systemd/src/basic/hexdecoct.c',
'systemd/src/basic/hostname-util.c',
'systemd/src/basic/in-addr-util.c',
'systemd/src/basic/io-util.c',
'systemd/src/basic/memory-util.c',
'systemd/src/basic/mempool.c',
'systemd/src/basic/parse-util.c',
'systemd/src/basic/path-util.c',
'systemd/src/basic/prioq.c',
'systemd/src/basic/process-util.c',
'systemd/src/basic/random-util.c',
'systemd/src/basic/ratelimit.c',
'systemd/src/basic/signal-util.c',
'systemd/src/basic/socket-util.c',
'systemd/src/basic/stat-util.c',
'systemd/src/basic/string-table.c',
'systemd/src/basic/string-util.c',
'systemd/src/basic/strv.c',
'systemd/src/basic/strxcpyx.c',
'systemd/src/basic/time-util.c',
'systemd/src/basic/tmpfile-util.c',
'systemd/src/basic/utf8.c',
'systemd/src/basic/util.c',
'systemd/src/shared/dns-domain.c',
'systemd/src/shared/web-util.c',
),
include_directories: include_directories(
'systemd/sd-adapt-shared',
'systemd/src/basic',
'systemd/src/shared',
),
dependencies: glib_nm_default_dep,
c_args: c_flags,
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED',
],
)
libnm_systemd_shared_dep = declare_dependency(
include_directories: incs,
include_directories: include_directories(
'systemd/sd-adapt-shared',
'systemd/src/basic',
'systemd/src/shared',
),
dependencies: glib_dep,
link_with: libnm_systemd_shared,
)
@@ -312,7 +302,10 @@ libnm_systemd_logging_stub = static_library(
'nm-systemd-logging-stub',
sources: 'systemd/nm-logging-stub.c',
dependencies: glib_nm_default_dep,
c_args: c_flags,
c_args: [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED',
],
)
if enable_tests

View File

@@ -196,72 +196,7 @@
/*****************************************************************************/
#if NM_MORE_ASSERTS == 0
/* glib assertions (g_return_*(), g_assert*()) contain a textual representation
* of the checked statement. This part of the assertion blows up the size of the
* binary. Unless we compile a debug-build with NM_MORE_ASSERTS, drop these
* parts. Note that the failed assertion still prints the file and line where the
* assertion fails. That shall suffice. */
static inline void
_nm_g_return_if_fail_warning(const char *log_domain, const char *file, int line)
{
char file_buf[256 + 15];
g_snprintf(file_buf, sizeof(file_buf), "((%s:%d))", file, line);
g_return_if_fail_warning(log_domain, file_buf, "<dropped>");
}
#define g_return_if_fail_warning(log_domain, pretty_function, expression) \
_nm_g_return_if_fail_warning(log_domain, __FILE__, __LINE__)
#define g_assertion_message_expr(domain, file, line, func, expr) \
g_assertion_message_expr(domain, \
file, \
line, \
"<unknown-fcn>", \
(expr) ? "<dropped>" : NULL)
#undef g_return_val_if_reached
#define g_return_val_if_reached(val) \
G_STMT_START \
{ \
g_log(G_LOG_DOMAIN, \
G_LOG_LEVEL_CRITICAL, \
"file %s: line %d (%s): should not be reached", \
__FILE__, \
__LINE__, \
"<dropped>"); \
return (val); \
} \
G_STMT_END
#undef g_return_if_reached
#define g_return_if_reached() \
G_STMT_START \
{ \
g_log(G_LOG_DOMAIN, \
G_LOG_LEVEL_CRITICAL, \
"file %s: line %d (%s): should not be reached", \
__FILE__, \
__LINE__, \
"<dropped>"); \
return; \
} \
G_STMT_END
#define NM_ASSERT_G_RETURN_EXPR(expr) "<dropped>"
#define NM_ASSERT_NO_MSG 1
#else
#define NM_ASSERT_G_RETURN_EXPR(expr) "" expr ""
#define NM_ASSERT_NO_MSG 0
#endif
/*****************************************************************************/
#include "nm-gassert-patch.h"
#include "nm-std-aux/nm-std-aux.h"
#include "nm-std-aux/nm-std-utils.h"

76
shared/nm-gassert-patch.h Normal file
View File

@@ -0,0 +1,76 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2015 Red Hat, Inc.
*/
#ifndef __NM_GASSERT_PATCH_H__
#define __NM_GASSERT_PATCH_H__
/*****************************************************************************/
#if NM_MORE_ASSERTS == 0
/* glib assertions (g_return_*(), g_assert*()) contain a textual representation
* of the checked statement. This part of the assertion blows up the size of the
* binary. Unless we compile a debug-build with NM_MORE_ASSERTS, drop these
* parts. Note that the failed assertion still prints the file and line where the
* assertion fails. That shall suffice. */
static inline void
_nm_g_return_if_fail_warning(const char *log_domain, const char *file, int line)
{
char file_buf[256 + 15];
g_snprintf(file_buf, sizeof(file_buf), "((%s:%d))", file, line);
g_return_if_fail_warning(log_domain, file_buf, "<dropped>");
}
#define g_return_if_fail_warning(log_domain, pretty_function, expression) \
_nm_g_return_if_fail_warning(log_domain, __FILE__, __LINE__)
#define g_assertion_message_expr(domain, file, line, func, expr) \
g_assertion_message_expr(domain, file, line, "<unknown-fcn>", (expr) ? "<dropped>" : NULL)
#undef g_return_val_if_reached
#define g_return_val_if_reached(val) \
G_STMT_START \
{ \
g_log(G_LOG_DOMAIN, \
G_LOG_LEVEL_CRITICAL, \
"file %s: line %d (%s): should not be reached", \
__FILE__, \
__LINE__, \
"<dropped>"); \
return (val); \
} \
G_STMT_END
#undef g_return_if_reached
#define g_return_if_reached() \
G_STMT_START \
{ \
g_log(G_LOG_DOMAIN, \
G_LOG_LEVEL_CRITICAL, \
"file %s: line %d (%s): should not be reached", \
__FILE__, \
__LINE__, \
"<dropped>"); \
return; \
} \
G_STMT_END
#endif
/*****************************************************************************/
#if NM_MORE_ASSERTS == 0
#define NM_ASSERT_G_RETURN_EXPR(expr) "<dropped>"
#define NM_ASSERT_NO_MSG 1
#else
#define NM_ASSERT_G_RETURN_EXPR(expr) "" expr ""
#define NM_ASSERT_NO_MSG 0
#endif
/*****************************************************************************/
#endif /* __NM_GASSERT_PATCH_H__ */

View File

@@ -7,7 +7,7 @@ exe = executable(
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
],
dependencies: libnm_utils_base_dep,
dependencies: libnm_glib_aux_dep,
link_with: libnm_systemd_logging_stub,
)
@@ -27,7 +27,7 @@ if jansson_dep.found()
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
],
dependencies: [
libnm_utils_base_dep,
libnm_glib_aux_dep,
jansson_dep,
dl_dep,
],

View File

@@ -54,7 +54,7 @@ if enable_tests
executable(
test_unit,
'tests/' + test_unit + '.c',
dependencies: [ libnetwork_manager_test_dep, deps ],
dependencies: [ libNetworkManagerTest_dep, deps ],
c_args: test_c_flags,
)
endif

View File

@@ -9,7 +9,7 @@ foreach test_unit: test_units
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -54,7 +54,7 @@ if enable_tests
exe = executable(
test_unit,
'tests/' + test_unit + '.c',
dependencies: [ libnetwork_manager_test_dep, libnm_wifi_base_dep ],
dependencies: [ libNetworkManagerTest_dep, libnm_wifi_base_dep ],
c_args: test_c_flags,
)

View File

@@ -79,7 +79,7 @@ if enable_tests
test_unit,
['tests/' + test_unit + '.c'] + nm_service_providers_source,
include_directories: wwan_inc,
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -9,7 +9,7 @@ foreach test_unit: test_units
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -5,7 +5,7 @@ test_unit = 'test-dnsmasq-utils'
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -1,31 +1,25 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
sources = files(
'nmi-cmdline-reader.c',
'nmi-dt-reader.c',
'nmi-ibft-reader.c',
)
libnmi_core = static_library(
'nmi-core',
sources: sources,
sources: files(
'nmi-cmdline-reader.c',
'nmi-dt-reader.c',
'nmi-ibft-reader.c',
),
dependencies: daemon_nm_default_dep,
c_args: daemon_c_flags,
)
name = 'nm-initrd-generator'
links = [
libnetwork_manager_base,
libnmi_core,
]
executable(
name,
name + '.c',
'nm-initrd-generator',
'nm-initrd-generator.c',
dependencies: daemon_nm_default_dep,
c_args: daemon_c_flags,
link_with: links,
link_with: [
libNetworkManagerBase,
libnmi_core,
],
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
install: true,

View File

@@ -12,7 +12,7 @@ foreach test_unit : test_units
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: c_flags,
link_with: libnmi_core,
)

View File

@@ -23,139 +23,55 @@ core_plugins = []
daemon_c_flags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON']
sources = files(
'dhcp/nm-dhcp-client.c',
'dhcp/nm-dhcp-manager.c',
'dhcp/nm-dhcp-nettools.c',
'dhcp/nm-dhcp-systemd.c',
'dhcp/nm-dhcp-utils.c',
'dhcp/nm-dhcp-options.c',
'ndisc/nm-lndp-ndisc.c',
'ndisc/nm-ndisc.c',
'platform/wifi/nm-wifi-utils-nl80211.c',
'platform/wifi/nm-wifi-utils.c',
'platform/wpan/nm-wpan-utils.c',
'platform/nm-linux-platform.c',
'platform/nm-platform.c',
'platform/nmp-object.c',
'platform/nmp-rules-manager.c',
'main-utils.c',
'NetworkManagerUtils.c',
'nm-core-utils.c',
'nm-dbus-object.c',
'nm-dbus-utils.c',
'nm-netns.c',
'nm-l3-config-data.c',
'nm-l3-ipv4ll.c',
'nm-l3cfg.c',
'nm-ip-config.c',
'nm-ip4-config.c',
'nm-ip6-config.c',
)
deps = [
daemon_nm_default_dep,
libn_dhcp4_dep,
libnm_keyfile_dep,
libnm_core_dep,
libnm_systemd_shared_dep,
libnm_udev_aux_dep,
libsystemd_dep,
libudev_dep,
]
platform_wifi_wext_source = files()
if enable_wext
sources += files('platform/wifi/nm-wifi-utils-wext.c')
platform_wifi_wext_source += files('platform/wifi/nm-wifi-utils-wext.c')
endif
libnetwork_manager_base = static_library(
nm_name + 'Base',
sources: sources,
dependencies: deps,
libNetworkManagerBase = static_library(
'NetworkManagerBase',
sources: files(
'dhcp/nm-dhcp-client.c',
'dhcp/nm-dhcp-manager.c',
'dhcp/nm-dhcp-nettools.c',
'dhcp/nm-dhcp-systemd.c',
'dhcp/nm-dhcp-utils.c',
'dhcp/nm-dhcp-options.c',
'ndisc/nm-lndp-ndisc.c',
'ndisc/nm-ndisc.c',
'platform/wifi/nm-wifi-utils-nl80211.c',
'platform/wifi/nm-wifi-utils.c',
'platform/wpan/nm-wpan-utils.c',
'platform/nm-linux-platform.c',
'platform/nm-platform.c',
'platform/nmp-object.c',
'platform/nmp-rules-manager.c',
'main-utils.c',
'NetworkManagerUtils.c',
'nm-core-utils.c',
'nm-dbus-object.c',
'nm-dbus-utils.c',
'nm-netns.c',
'nm-l3-config-data.c',
'nm-l3-ipv4ll.c',
'nm-l3cfg.c',
'nm-ip-config.c',
'nm-ip4-config.c',
'nm-ip6-config.c',
) + platform_wifi_wext_source,
dependencies: [
daemon_nm_default_dep,
libn_dhcp4_dep,
libnm_keyfile_dep,
libnm_core_dep,
libnm_systemd_shared_dep,
libnm_udev_aux_dep,
libsystemd_dep,
libudev_dep,
],
c_args: daemon_c_flags,
)
sources = files(
'devices/nm-acd-manager.c',
'devices/nm-device-6lowpan.c',
'devices/nm-device-bond.c',
'devices/nm-device-bridge.c',
'devices/nm-device.c',
'devices/nm-device-dummy.c',
'devices/nm-device-ethernet.c',
'devices/nm-device-ethernet-utils.c',
'devices/nm-device-factory.c',
'devices/nm-device-generic.c',
'devices/nm-device-infiniband.c',
'devices/nm-device-ip-tunnel.c',
'devices/nm-device-macsec.c',
'devices/nm-device-macvlan.c',
'devices/nm-device-ppp.c',
'devices/nm-device-tun.c',
'devices/nm-device-veth.c',
'devices/nm-device-vlan.c',
'devices/nm-device-vrf.c',
'devices/nm-device-vxlan.c',
'devices/nm-device-wireguard.c',
'devices/nm-device-wpan.c',
'devices/nm-lldp-listener.c',
'dhcp/nm-dhcp-dhclient.c',
'dhcp/nm-dhcp-dhclient-utils.c',
'dhcp/nm-dhcp-dhcpcanon.c',
'dhcp/nm-dhcp-dhcpcd.c',
'dhcp/nm-dhcp-listener.c',
'dns/nm-dns-dnsmasq.c',
'dns/nm-dns-manager.c',
'dns/nm-dns-plugin.c',
'dns/nm-dns-systemd-resolved.c',
'dns/nm-dns-unbound.c',
'dnsmasq/nm-dnsmasq-manager.c',
'dnsmasq/nm-dnsmasq-utils.c',
'ppp/nm-ppp-manager-call.c',
'settings/plugins/keyfile/nms-keyfile-storage.c',
'settings/plugins/keyfile/nms-keyfile-plugin.c',
'settings/plugins/keyfile/nms-keyfile-reader.c',
'settings/plugins/keyfile/nms-keyfile-utils.c',
'settings/plugins/keyfile/nms-keyfile-writer.c',
'settings/nm-agent-manager.c',
'settings/nm-secret-agent.c',
'settings/nm-settings.c',
'settings/nm-settings-connection.c',
'settings/nm-settings-plugin.c',
'settings/nm-settings-storage.c',
'settings/nm-settings-utils.c',
'supplicant/nm-supplicant-config.c',
'supplicant/nm-supplicant-interface.c',
'supplicant/nm-supplicant-manager.c',
'supplicant/nm-supplicant-settings-verify.c',
'vpn/nm-vpn-connection.c',
'vpn/nm-vpn-manager.c',
'nm-active-connection.c',
'nm-act-request.c',
'nm-audit-manager.c',
'nm-auth-manager.c',
'nm-auth-utils.c',
'nm-dbus-manager.c',
'nm-checkpoint.c',
'nm-checkpoint-manager.c',
'nm-config.c',
'nm-config-data.c',
'nm-connectivity.c',
'nm-dcb.c',
'nm-dhcp-config.c',
'nm-dispatcher.c',
'nm-firewall-manager.c',
'nm-hostname-manager.c',
'nm-keep-alive.c',
'nm-manager.c',
'nm-pacrunner-manager.c',
'nm-policy.c',
'nm-proxy-config.c',
'nm-rfkill-manager.c',
'nm-session-monitor.c',
'nm-sleep-monitor.c',
)
nm_deps = [
daemon_nm_default_dep,
dl_dep,
@@ -165,12 +81,6 @@ nm_deps = [
logind_dep,
]
nm_links = [
libnetwork_manager_base,
libnm_systemd_core,
libnm_systemd_shared,
]
if enable_concheck
nm_deps += libcurl_dep
endif
@@ -187,12 +97,95 @@ if enable_selinux
nm_deps += selinux_dep
endif
libnetwork_manager = static_library(
nm_name,
sources: sources,
libNetworkManager = static_library(
'NetworkManager',
sources: files(
'devices/nm-acd-manager.c',
'devices/nm-device-6lowpan.c',
'devices/nm-device-bond.c',
'devices/nm-device-bridge.c',
'devices/nm-device.c',
'devices/nm-device-dummy.c',
'devices/nm-device-ethernet.c',
'devices/nm-device-ethernet-utils.c',
'devices/nm-device-factory.c',
'devices/nm-device-generic.c',
'devices/nm-device-infiniband.c',
'devices/nm-device-ip-tunnel.c',
'devices/nm-device-macsec.c',
'devices/nm-device-macvlan.c',
'devices/nm-device-ppp.c',
'devices/nm-device-tun.c',
'devices/nm-device-veth.c',
'devices/nm-device-vlan.c',
'devices/nm-device-vrf.c',
'devices/nm-device-vxlan.c',
'devices/nm-device-wireguard.c',
'devices/nm-device-wpan.c',
'devices/nm-lldp-listener.c',
'dhcp/nm-dhcp-dhclient.c',
'dhcp/nm-dhcp-dhclient-utils.c',
'dhcp/nm-dhcp-dhcpcanon.c',
'dhcp/nm-dhcp-dhcpcd.c',
'dhcp/nm-dhcp-listener.c',
'dns/nm-dns-dnsmasq.c',
'dns/nm-dns-manager.c',
'dns/nm-dns-plugin.c',
'dns/nm-dns-systemd-resolved.c',
'dns/nm-dns-unbound.c',
'dnsmasq/nm-dnsmasq-manager.c',
'dnsmasq/nm-dnsmasq-utils.c',
'ppp/nm-ppp-manager-call.c',
'settings/plugins/keyfile/nms-keyfile-storage.c',
'settings/plugins/keyfile/nms-keyfile-plugin.c',
'settings/plugins/keyfile/nms-keyfile-reader.c',
'settings/plugins/keyfile/nms-keyfile-utils.c',
'settings/plugins/keyfile/nms-keyfile-writer.c',
'settings/nm-agent-manager.c',
'settings/nm-secret-agent.c',
'settings/nm-settings.c',
'settings/nm-settings-connection.c',
'settings/nm-settings-plugin.c',
'settings/nm-settings-storage.c',
'settings/nm-settings-utils.c',
'supplicant/nm-supplicant-config.c',
'supplicant/nm-supplicant-interface.c',
'supplicant/nm-supplicant-manager.c',
'supplicant/nm-supplicant-settings-verify.c',
'vpn/nm-vpn-connection.c',
'vpn/nm-vpn-manager.c',
'nm-active-connection.c',
'nm-act-request.c',
'nm-audit-manager.c',
'nm-auth-manager.c',
'nm-auth-utils.c',
'nm-dbus-manager.c',
'nm-checkpoint.c',
'nm-checkpoint-manager.c',
'nm-config.c',
'nm-config-data.c',
'nm-connectivity.c',
'nm-dcb.c',
'nm-dhcp-config.c',
'nm-dispatcher.c',
'nm-firewall-manager.c',
'nm-hostname-manager.c',
'nm-keep-alive.c',
'nm-manager.c',
'nm-pacrunner-manager.c',
'nm-policy.c',
'nm-proxy-config.c',
'nm-rfkill-manager.c',
'nm-session-monitor.c',
'nm-sleep-monitor.c',
),
dependencies: nm_deps,
c_args: daemon_c_flags,
link_with: nm_links,
link_with: [
libNetworkManagerBase,
libnm_systemd_core,
libnm_systemd_shared,
],
)
executable(
@@ -206,7 +199,11 @@ executable(
libn_acd_dep,
],
c_args: daemon_c_flags,
link_with: nm_links,
link_with: [
libNetworkManagerBase,
libnm_systemd_core,
libnm_systemd_shared,
],
link_args: ldflags_linker_script_binary,
link_depends: linker_script_binary,
install: true,
@@ -219,23 +216,21 @@ if enable_tests
test_c_flags += ['-DREQUIRE_ROOT_TESTS=1']
endif
sources = files(
'ndisc/nm-fake-ndisc.c',
'platform/tests/test-common.c',
'platform/nm-fake-platform.c',
)
libnetwork_manager_test = static_library(
nm_name + 'Test',
sources: sources,
libNetworkManagerTest = static_library(
'NetworkManagerTest',
sources: files(
'ndisc/nm-fake-ndisc.c',
'platform/tests/test-common.c',
'platform/nm-fake-platform.c',
),
dependencies: daemon_nm_default_dep,
c_args: test_c_flags,
link_with: libnetwork_manager,
link_with: libNetworkManager,
)
libnetwork_manager_test_dep = declare_dependency(
libNetworkManagerTest_dep = declare_dependency(
dependencies: daemon_nm_default_dep,
link_with: libnetwork_manager_test,
link_with: libNetworkManagerTest,
)
subdir('dnsmasq/tests')
@@ -257,43 +252,48 @@ subdir('settings/plugins')
# NetworkManager binary
create_exports_networkmanager = join_paths(source_root, 'tools', 'create-exports-NetworkManager.sh')
symbol_map_name = 'NetworkManager.ver'
# libNetworkManager.a, as built by meson doesn't contain all symbols
# from libNetworkManagerBase.a and other static libraries, unless we
# add dependencies with link_whole, only supported in meson >= 0.46.
# Create an executable with full symbols that we use in place of the
# library to enumerate the symbols.
network_manager_all_sym = executable(
NetworkManager_all_sym = executable(
'NetworkManager-all-sym',
'main.c',
dependencies: nm_deps,
c_args: daemon_c_flags,
link_args: '-Wl,--no-gc-sections',
link_whole: [libnetwork_manager, libnetwork_manager_base, libnm_core],
link_whole: [
libNetworkManager,
libNetworkManagerBase,
libnm_core,
],
)
# this uses symbols from nm-full-symbols instead of libNetworkManager.a
ver_script = custom_target(
symbol_map_name,
output: symbol_map_name,
depends: [network_manager_all_sym, core_plugins],
command: [create_exports_networkmanager, '--called-from-build', source_root],
'NetworkManager.ver',
output: 'NetworkManager.ver',
depends: [
NetworkManager_all_sym,
core_plugins,
],
command: [
join_paths(source_root, 'tools', 'create-exports-NetworkManager.sh'),
'--called-from-build',
source_root,
],
)
ldflags = [
'-rdynamic',
'-Wl,--version-script,@0@'.format(ver_script.full_path()),
]
network_manager = executable(
nm_name,
NetworkManager = executable(
'NetworkManager',
'main.c',
dependencies: nm_deps,
c_args: daemon_c_flags,
link_with: libnetwork_manager,
link_args: ldflags,
link_with: libNetworkManager,
link_args: [
'-rdynamic',
'-Wl,--version-script,@0@'.format(ver_script.full_path()),
],
link_depends: ver_script,
install: true,
install_dir: nm_sbindir,
@@ -305,7 +305,7 @@ if enable_tests
test(
'sym/' + plugin_path.split('/')[-1],
network_manager,
NetworkManager,
args: '--version',
env: ['LD_BIND_NOW=1', 'LD_PRELOAD=' + plugin_path],
)

View File

@@ -5,7 +5,7 @@ test_unit = 'test-ndisc-fake'
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)
@@ -21,6 +21,6 @@ test = 'test-ndisc-linux'
exe = executable(
test,
test + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -22,7 +22,7 @@ foreach test_unit: test_units
exe = executable(
test_unit[0],
test_unit[1],
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_unit[2],
)
test(
@@ -38,6 +38,6 @@ name = 'monitor'
executable(
name,
name + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -5,7 +5,7 @@ test_unit = 'test-ifcfg-rh'
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
link_with: libnms_ifcfg_rh_core,
)

View File

@@ -5,7 +5,7 @@ test_unit = 'test-ifupdown'
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
link_with: libnms_ifupdown_core,
)

View File

@@ -5,7 +5,7 @@ test_unit = 'test-keyfile-settings'
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -5,7 +5,7 @@ test_unit = 'test-supplicant-config'
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -12,7 +12,7 @@ sources = files(
exe = executable(
test_unit,
sources,
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)

View File

@@ -17,7 +17,7 @@ foreach test_unit: test_units
exe = executable(
test_unit,
test_unit + '.c',
dependencies: libnetwork_manager_test_dep,
dependencies: libNetworkManagerTest_dep,
c_args: test_c_flags,
)