Commit c67ebc8a authored by Thomas Haller's avatar Thomas Haller

build/meson: add intermediate shared/nm-utils base library

Like also done for autotools, create and use intermediate libraries
from "shared/nm-utils/".

Also, replace "shared_dep" by "shared_nm_utils_base_dep". We don't
need super fine-grained selection of what we link. We can always
link in "shared/libnm-utils-base.a", and let the linker throw away
unsed parts.
parent 15995c97
Pipeline #17647 passed with stages
in 19 minutes and 55 seconds
......@@ -13,7 +13,7 @@ cflags = clients_cflags + [
libnmc_base = static_library(
'nmc-base',
sources: shared_files_clients_common + files(
sources: files(
'nm-client-utils.c',
'nm-secret-agent-simple.c',
'nm-vpn-helpers.c',
......
......@@ -140,9 +140,11 @@ libnm_core_enum = gnome.mkenums(
deps = [
dl_dep,
libudev_dep,
shared_dep,
uuid_dep,
glib_dep,
shared_c_siphash_dep,
shared_nm_utils_base_dep,
shared_nm_utils_udev_dep,
]
cflags = [
......@@ -185,7 +187,6 @@ 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_files_libnm_core
libnm_core_sources_all += [version_header]
libnm_core = static_library(
......@@ -200,7 +201,7 @@ nm_core_dep = declare_dependency(
sources: libnm_core_enum[1],
include_directories: libnm_core_inc,
dependencies: [
shared_dep,
shared_nm_utils_base_dep,
shared_c_siphash_dep,
libnm_systemd_shared_dep,
],
......
......@@ -5,7 +5,7 @@ dbus_binding_tool = find_program('dbus-binding-tool')
common_deps = [
dbus_dep,
dbus_glib_dep,
shared_dep,
shared_nm_utils_base_dep,
]
common_cflags = [
......@@ -91,8 +91,6 @@ libnm_glib_vpn_enum = gnome.mkenums(
install_dir: libnm_glib_pkgincludedir,
)
deps = common_deps + [libnm_util_dep]
linker_script = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver')
libnm_glib_vpn = shared_library(
......@@ -110,7 +108,7 @@ libnm_glib_vpn = shared_library(
),
] + libnm_glib_vpn_enum,
version: libnm_glib_vpn_version,
dependencies: deps,
dependencies: common_deps + [libnm_util_dep],
c_args: cflags,
link_args: [
'-Wl,--version-script,@0@'.format(linker_script),
......@@ -135,7 +133,7 @@ pkg.generate(
variables: 'exec_prefix=${prefix}',
)
libnm_glib_sources = shared_files_libnm_glib + files(
libnm_glib_sources = files(
'nm-access-point.c',
'nm-active-connection.c',
'nm-client.c',
......@@ -189,18 +187,17 @@ libnm_glib_enum = gnome.mkenums(
install_dir: libnm_glib_pkgincludedir,
)
deps = common_deps + [
libnm_util_dep,
libudev_dep,
]
linker_script = join_paths(meson.current_source_dir(), 'libnm-glib.ver')
libnm_glib = shared_library(
'nm-glib',
sources: libnm_glib_sources + libnm_glib_enum + [nm_secret_agent_glue],
version: libnm_glib_version,
dependencies: deps,
dependencies: common_deps + [
libnm_util_dep,
libudev_dep,
shared_nm_utils_udev_dep,
],
c_args: cflags,
link_whole: libdeprecated_nm_glib,
link_args: [
......@@ -229,27 +226,23 @@ pkg.generate(
if enable_introspection
gir_sources = libnm_glib_sources + headers + libnm_glib_enum
deps = [
dbus_glib_dep,
libnm_glib_dep,
libnm_util_gir_dep,
]
gir_includes = [
'DBusGLib-1.0',
'Gio-2.0',
]
libnm_glib_gir = gnome.generate_gir(
libnm_glib,
sources: gir_sources,
dependencies: deps,
dependencies: [
dbus_glib_dep,
libnm_glib_dep,
libnm_util_gir_dep,
],
nsversion: nm_gir_version,
namespace: 'NMClient',
identifier_prefix: nm_id_prefix,
symbol_prefix: nm_id_prefix.to_lower(),
export_packages: [libnm_glib_name, libnm_glib_vpn_name],
includes: gir_includes,
includes: [
'DBusGLib-1.0',
'Gio-2.0',
],
extra_args: cflags + [
'--include-uninstalled=' + libnm_util_gir[0].full_path(),
],
......@@ -259,12 +252,10 @@ endif
name = libnm_glib_name + '-test'
deps = common_deps + [libnm_util_dep]
executable(
name,
name + '.c',
dependencies: deps,
dependencies: common_deps + [libnm_util_dep],
c_args: cflags,
link_with: libnm_glib,
)
......
......@@ -3,7 +3,7 @@ deps = [
dbus_glib_dep,
libnm_glib_dep,
libnm_util_dep,
shared_dep,
shared_nm_utils_base_dep,
]
test_units = [
......
......@@ -89,12 +89,11 @@ sources = files(
'nm-utils.c',
'nm-value-transforms.c',
)
sources += shared_files_libnm_util
deps = [
dbus_dep,
dbus_glib_dep,
shared_dep,
shared_nm_utils_base_dep,
uuid_dep,
]
......@@ -202,7 +201,7 @@ sources = files(
)
deps = [
shared_dep,
shared_nm_utils_base_dep,
]
libtest_crypto = static_library(
......
......@@ -2,7 +2,7 @@ deps = [
dbus_dep,
dbus_glib_dep,
libnm_util_dep,
shared_dep,
shared_nm_utils_base_dep,
]
cflags = common_cflags + [
......
......@@ -4,7 +4,7 @@ sources = files('nm-libnm-utils.c')
deps = [
libnmdbus_dep,
shared_dep,
shared_nm_utils_base_dep,
]
cflags = [
......@@ -149,7 +149,7 @@ libnm_sources = files(
deps = [
dl_dep,
libudev_dep,
shared_dep,
shared_nm_utils_base_dep,
uuid_dep,
libnm_systemd_shared_no_logging_dep,
]
......
......@@ -81,37 +81,37 @@ shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c')
shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c')
shared_files_time_utils = files('nm-utils/nm-time-utils.c')
shared_files_libnm_core = files('''
nm-utils/c-list-util.c
nm-utils/nm-dedup-multi.c
nm-utils/nm-enum-utils.c
nm-utils/nm-errno.c
nm-utils/nm-hash-utils.c
nm-utils/nm-io-utils.c
nm-utils/nm-random-utils.c
nm-utils/nm-secret-utils.c
nm-utils/nm-shared-utils.c
nm-utils/nm-udev-utils.c
'''.split())
shared_files_clients_common = files('''
nm-utils/nm-enum-utils.c
nm-utils/nm-hash-utils.c
nm-utils/nm-random-utils.c
nm-utils/nm-shared-utils.c
'''.split())
shared_files_libnm_util = files('''
nm-utils/nm-shared-utils.c
'''.split())
shared_files_libnm_glib = files('''
nm-utils/nm-udev-utils.c
'''.split())
shared_dep = declare_dependency(
###############################################################################
shared_nm_utils_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(
'nm-utils-base',
sources: files('nm-utils/c-list-util.c',
'nm-utils/nm-dedup-multi.c',
'nm-utils/nm-enum-utils.c',
'nm-utils/nm-errno.c',
'nm-utils/nm-hash-utils.c',
'nm-utils/nm-io-utils.c',
'nm-utils/nm-random-utils.c',
'nm-utils/nm-secret-utils.c',
'nm-utils/nm-shared-utils.c',
'nm-utils/nm-time-utils.c'),
c_args: shared_nm_utils_c_args,
include_directories: [
top_inc,
shared_inc,
],
dependencies: [
glib_dep,
],
)
shared_nm_utils_base_dep = declare_dependency(
link_with: shared_nm_utils_base,
include_directories: [
top_inc,
shared_inc,
......@@ -119,26 +119,44 @@ shared_dep = declare_dependency(
dependencies: glib_dep,
)
shared_nm_utils_udev = static_library(
'nm-utils-udev',
sources: files('nm-utils/nm-udev-utils.c'),
c_args: shared_nm_utils_c_args,
include_directories: [
top_inc,
shared_inc,
],
dependencies: [
glib_dep,
shared_nm_utils_base_dep,
libudev_dep,
],
)
shared_nm_utils_udev_dep = declare_dependency(
link_with: shared_nm_utils_udev,
include_directories: [
top_inc,
shared_inc,
],
dependencies: [
glib_dep,
shared_nm_utils_base_dep,
libudev_dep,
],
)
###############################################################################
test_shared_general = executable(
'nm-utils/tests/test-shared-general',
[ 'nm-utils/tests/test-shared-general.c',
'nm-utils/c-list-util.c',
'nm-utils/nm-dedup-multi.c',
'nm-utils/nm-enum-utils.c',
'nm-utils/nm-hash-utils.c',
'nm-utils/nm-io-utils.c',
'nm-utils/nm-random-utils.c',
'nm-utils/nm-secret-utils.c',
'nm-utils/nm-shared-utils.c',
'nm-utils/nm-time-utils.c',
],
[ 'nm-utils/tests/test-shared-general.c', ],
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)',
],
dependencies: shared_dep,
dependencies: shared_nm_utils_base_dep,
link_with: shared_c_siphash,
)
test(
......@@ -188,7 +206,7 @@ libnm_systemd_shared = static_library(
'systemd/sd-adapt-shared',
'systemd/src/basic',
),
dependencies: shared_dep,
dependencies: shared_nm_utils_base_dep,
c_args: [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED',
'-DG_LOG_DOMAIN="libnm"',
......@@ -201,7 +219,7 @@ libnm_systemd_shared_dep = declare_dependency(
'systemd/src/basic',
),
dependencies: [
shared_dep,
shared_nm_utils_base_dep,
],
link_with: [
libnm_systemd_shared,
......@@ -217,7 +235,7 @@ libnm_systemd_logging_stub = static_library(
'systemd/sd-adapt-shared',
'systemd/src/basic',
),
dependencies: shared_dep,
dependencies: shared_nm_utils_base_dep,
c_args: [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_SYSTEMD_SHARED',
'-DG_LOG_DOMAIN="libnm"',
......
......@@ -45,8 +45,6 @@ sources = files(
'nm-logging.c',
)
sources += shared_files_time_utils
deps = [
libsystemd_dep,
libudev_dep,
......
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