meson: slightly disentangle code dependencies

But, still sd-id128 is used in src/basic.
This commit is contained in:
Yu Watanabe 2021-01-04 23:36:00 +09:00
parent b61016f207
commit 8d40961c3c
12 changed files with 103 additions and 91 deletions

View file

@ -1616,32 +1616,23 @@ public_programs = []
tests = [] tests = []
fuzzers = [] fuzzers = []
includes = include_directories('src/basic', basic_includes = include_directories(
'src/boot', 'src/basic',
'src/core', 'src/systemd',
'src/home', '.')
'src/journal',
'src/journal-remote', libsystemd_includes = [basic_includes, include_directories(
'src/libsystemd-network', 'src/libsystemd/sd-bus',
'src/libsystemd/sd-bus', 'src/libsystemd/sd-device',
'src/libsystemd/sd-device', 'src/libsystemd/sd-event',
'src/libsystemd/sd-event', 'src/libsystemd/sd-hwdb',
'src/libsystemd/sd-hwdb', 'src/libsystemd/sd-id128',
'src/libsystemd/sd-id128', 'src/libsystemd/sd-journal',
'src/libsystemd/sd-journal', 'src/libsystemd/sd-netlink',
'src/libsystemd/sd-netlink', 'src/libsystemd/sd-network',
'src/libsystemd/sd-network', 'src/libsystemd/sd-resolve')]
'src/libsystemd/sd-resolve',
'src/login', includes = [libsystemd_includes, include_directories('src/shared')]
'src/nspawn',
'src/resolve',
'src/shared',
'src/shutdown',
'src/systemd',
'src/timesync',
'src/udev',
'src/xdg-autostart-generator',
'.')
subdir('po') subdir('po')
subdir('catalog') subdir('catalog')
@ -1656,7 +1647,7 @@ libsystemd = shared_library(
'systemd', 'systemd',
disable_mempool_c, disable_mempool_c,
version : libsystemd_version, version : libsystemd_version,
include_directories : includes, include_directories : libsystemd_includes,
link_args : ['-shared', link_args : ['-shared',
'-Wl,--version-script=' + libsystemd_sym_path], '-Wl,--version-script=' + libsystemd_sym_path],
link_with : [libbasic, link_with : [libbasic,
@ -1680,7 +1671,7 @@ install_libsystemd_static = static_library(
basic_sources, basic_sources,
basic_gcrypt_sources, basic_gcrypt_sources,
disable_mempool_c, disable_mempool_c,
include_directories : includes, include_directories : libsystemd_includes,
build_by_default : static_libsystemd != 'false', build_by_default : static_libsystemd != 'false',
install : static_libsystemd != 'false', install : static_libsystemd != 'false',
install_dir : rootlibdir, install_dir : rootlibdir,
@ -1789,7 +1780,7 @@ test_dlopen = executable(
foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'], foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']], ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
['mymachines', 'ENABLE_NSS_MYMACHINES'], ['mymachines', 'ENABLE_NSS_MYMACHINES'],
['resolve', 'ENABLE_NSS_RESOLVE']] ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
condition = tuple[1] == '' or conf.get(tuple[1]) == 1 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
if condition if condition
@ -1805,12 +1796,14 @@ foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
endforeach endforeach
endif endif
incs = tuple.length() > 3 ? tuple[3] : includes
nss = shared_library( nss = shared_library(
'nss_' + module, 'nss_' + module,
sources, sources,
disable_mempool_c, disable_mempool_c,
version : '2', version : '2',
include_directories : includes, include_directories : incs,
# Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
link_args : ['-Wl,-z,nodelete', link_args : ['-Wl,-z,nodelete',
'-shared', '-shared',
@ -1865,7 +1858,7 @@ meson.add_install_script(meson_make_symlink,
public_programs += executable( public_programs += executable(
'systemd-analyze', 'systemd-analyze',
systemd_analyze_sources, systemd_analyze_sources,
include_directories : includes, include_directories : core_includes,
link_with : [libcore, link_with : [libcore,
libshared], libshared],
dependencies : [versiondep, dependencies : [versiondep,
@ -2013,7 +2006,7 @@ if conf.get('ENABLE_RESOLVE') == 1
executable( executable(
'systemd-resolved', 'systemd-resolved',
systemd_resolved_sources, systemd_resolved_sources,
include_directories : includes, include_directories : resolve_includes,
link_with : [libshared, link_with : [libshared,
libbasic_gcrypt, libbasic_gcrypt,
libsystemd_resolve_core], libsystemd_resolve_core],
@ -2265,7 +2258,7 @@ if conf.get('ENABLE_HOMED') == 1
executable( executable(
'systemd-homed', 'systemd-homed',
systemd_homed_sources, systemd_homed_sources,
include_directories : includes, include_directories : home_includes,
link_with : [libshared], link_with : [libshared],
dependencies : [threads, dependencies : [threads,
libcrypt, libcrypt,
@ -3236,7 +3229,7 @@ if conf.get('ENABLE_NETWORKD') == 1
executable( executable(
'systemd-networkd', 'systemd-networkd',
systemd_networkd_sources, systemd_networkd_sources,
include_directories : network_include_dir, include_directories : network_includes,
link_with : [libnetworkd_core, link_with : [libnetworkd_core,
libsystemd_network, libsystemd_network,
networkd_link_with], networkd_link_with],
@ -3249,8 +3242,7 @@ if conf.get('ENABLE_NETWORKD') == 1
'systemd-networkd-wait-online', 'systemd-networkd-wait-online',
systemd_networkd_wait_online_sources, systemd_networkd_wait_online_sources,
include_directories : includes, include_directories : includes,
link_with : [libnetworkd_core, link_with : [networkd_link_with],
networkd_link_with],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
@ -3258,7 +3250,7 @@ if conf.get('ENABLE_NETWORKD') == 1
public_programs += executable( public_programs += executable(
'networkctl', 'networkctl',
networkctl_sources, networkctl_sources,
include_directories : includes, include_directories : libsystemd_network_includes,
link_with : [libsystemd_network, link_with : [libsystemd_network,
networkd_link_with], networkd_link_with],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,

View file

@ -381,7 +381,7 @@ run_target(
libbasic = static_library( libbasic = static_library(
'basic', 'basic',
basic_sources, basic_sources,
include_directories : includes, include_directories : basic_includes,
dependencies : [versiondep, dependencies : [versiondep,
threads, threads,
libcap, libcap,
@ -403,6 +403,6 @@ basic_gcrypt_sources = files(
libbasic_gcrypt = static_library( libbasic_gcrypt = static_library(
'basic-gcrypt', 'basic-gcrypt',
basic_gcrypt_sources, basic_gcrypt_sources,
include_directories : includes, include_directories : basic_includes,
dependencies : [libgcrypt], dependencies : [libgcrypt],
c_args : ['-fvisibility=default']) c_args : ['-fvisibility=default'])

View file

@ -158,6 +158,8 @@ libcore = static_library(
libmount, libmount,
libacl]) libacl])
core_includes = [includes, include_directories('.')]
systemd_sources = files('main.c') systemd_sources = files('main.c')
in_files = [['macros.systemd', rpmmacrosdir], in_files = [['macros.systemd', rpmmacrosdir],

View file

@ -1,5 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
home_includes = [includes, include_directories('.')]
systemd_homework_sources = files(''' systemd_homework_sources = files('''
home-util.c home-util.c
home-util.h home-util.h

View file

@ -24,7 +24,7 @@ endif
libsystemd_journal_remote = static_library( libsystemd_journal_remote = static_library(
'systemd-journal-remote', 'systemd-journal-remote',
libsystemd_journal_remote_sources, libsystemd_journal_remote_sources,
include_directories : includes, include_directories : journal_includes,
dependencies : [threads, dependencies : [threads,
libmicrohttpd, libmicrohttpd,
libgnutls, libgnutls,

View file

@ -35,6 +35,8 @@ libjournal_core = static_library(
include_directories : includes, include_directories : includes,
install : false) install : false)
journal_includes = [includes, include_directories('.')]
systemd_journald_sources = files(''' systemd_journald_sources = files('''
journald.c journald.c
journald-server.h journald-server.h

View file

@ -47,3 +47,5 @@ libsystemd_network = static_library(
'systemd-network', 'systemd-network',
sources, sources,
include_directories : includes) include_directories : includes)
libsystemd_network_includes = [includes, include_directories('.')]

View file

@ -164,7 +164,7 @@ libsystemd_static = static_library(
'systemd_static', 'systemd_static',
libsystemd_sources, libsystemd_sources,
install : false, install : false,
include_directories : includes, include_directories : libsystemd_includes,
link_with : libbasic, link_with : libbasic,
dependencies : [threads, dependencies : [threads,
librt], librt],

View file

@ -207,12 +207,12 @@ else
libbasic_gcrypt] libbasic_gcrypt]
endif endif
network_include_dir = [includes, include_directories(['.', 'netdev', 'tc'])] network_includes = [libsystemd_network_includes, include_directories(['.', 'netdev', 'tc'])]
libnetworkd_core = static_library( libnetworkd_core = static_library(
'networkd-core', 'networkd-core',
sources, sources,
include_directories : network_include_dir, include_directories : network_includes,
link_with : [networkd_link_with]) link_with : [networkd_link_with])
if conf.get('ENABLE_NETWORKD') == 1 if conf.get('ENABLE_NETWORKD') == 1
@ -243,14 +243,14 @@ fuzzers += [
libsystemd_network, libsystemd_network,
networkd_link_with], networkd_link_with],
[threads], [threads],
network_include_dir], network_includes],
[['src/network/fuzz-network-parser.c'], [['src/network/fuzz-network-parser.c'],
[libnetworkd_core, [libnetworkd_core,
libsystemd_network, libsystemd_network,
networkd_link_with], networkd_link_with],
[threads], [threads],
network_include_dir], network_includes],
] ]
tests += [ tests += [
@ -258,19 +258,19 @@ tests += [
[libnetworkd_core, [libnetworkd_core,
libsystemd_network], libsystemd_network],
[], [],
network_include_dir], network_includes],
[['src/network/test-network.c'], [['src/network/test-network.c'],
[libnetworkd_core, [libnetworkd_core,
libsystemd_network], libsystemd_network],
[threads], [threads],
network_include_dir], network_includes],
[['src/network/test-network-tables.c'], [['src/network/test-network-tables.c'],
[libnetworkd_core, [libnetworkd_core,
libsystemd_network], libsystemd_network],
[threads], [threads],
network_include_dir], network_includes],
[['src/network/generator/test-network-generator.c', [['src/network/generator/test-network-generator.c',
'src/network/generator/network-generator.c', 'src/network/generator/network-generator.c',

View file

@ -1,5 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
resolve_includes = [includes, include_directories('.')]
basic_dns_sources = files(''' basic_dns_sources = files('''
resolved-dns-dnssec.c resolved-dns-dnssec.c
resolved-dns-dnssec.h resolved-dns-dnssec.h
@ -206,5 +208,5 @@ tests += [
[['src/resolve/test-dnssec-complex.c', [['src/resolve/test-dnssec-complex.c',
'src/resolve/dns-type.c'], 'src/resolve/dns-type.c'],
[], [], [], '', 'manual'], [], [], resolve_includes, '', 'manual'],
] ]

View file

@ -52,15 +52,20 @@ tests += [
libseccomp, libseccomp,
libselinux, libselinux,
libmount, libmount,
libblkid]], libblkid],
core_includes],
[['src/test/test-emergency-action.c'], [['src/test/test-emergency-action.c'],
[libcore, [libcore,
libshared]], libshared],
[],
core_includes],
[['src/test/test-chown-rec.c'], [['src/test/test-chown-rec.c'],
[libcore, [libcore,
libshared]], libshared],
[],
core_includes],
[['src/test/test-dlopen-so.c']], [['src/test/test-dlopen-so.c']],
@ -72,7 +77,8 @@ tests += [
libseccomp, libseccomp,
libselinux, libselinux,
libmount, libmount,
libblkid]], libblkid],
core_includes],
[['src/test/test-ns.c'], [['src/test/test-ns.c'],
[libcore, [libcore,
@ -83,7 +89,7 @@ tests += [
libselinux, libselinux,
libmount, libmount,
libblkid], libblkid],
[], '', 'manual'], core_includes, '', 'manual'],
[['src/test/test-loopback.c'], [['src/test/test-loopback.c'],
[libcore, [libcore,
@ -93,11 +99,10 @@ tests += [
libseccomp, libseccomp,
libselinux, libselinux,
libmount, libmount,
libblkid]], libblkid],
core_includes],
[['src/test/test-dns-domain.c'], [['src/test/test-dns-domain.c']],
[libcore,
libshared]],
[['src/test/test-boot-timestamps.c'], [['src/test/test-boot-timestamps.c'],
[], [], [], 'ENABLE_EFI'], [], [], [], 'ENABLE_EFI'],
@ -112,7 +117,8 @@ tests += [
libseccomp, libseccomp,
libselinux, libselinux,
libmount, libmount,
libblkid]], libblkid],
core_includes],
[['src/test/test-load-fragment.c'], [['src/test/test-load-fragment.c'],
[libcore, [libcore,
@ -122,7 +128,8 @@ tests += [
libseccomp, libseccomp,
libselinux, libselinux,
libmount, libmount,
libblkid]], libblkid],
core_includes],
[['src/test/test-serialize.c']], [['src/test/test-serialize.c']],
@ -258,7 +265,8 @@ tests += [
[libcore, [libcore,
libshared], libshared],
[threads, [threads,
libblkid]], libblkid],
core_includes],
[['src/test/test-verbs.c']], [['src/test/test-verbs.c']],
@ -284,7 +292,7 @@ tests += [
libshared], libshared],
[threads, [threads,
libblkid], libblkid],
[], '', '', [], false], core_includes, '', '', [], false],
[['src/test/test-selinux.c']], [['src/test/test-selinux.c']],
@ -299,7 +307,8 @@ tests += [
librt, librt,
libseccomp, libseccomp,
libselinux, libselinux,
libblkid]], libblkid],
core_includes],
[['src/test/test-bpf-firewall.c'], [['src/test/test-bpf-firewall.c'],
[libcore, [libcore,
@ -309,7 +318,8 @@ tests += [
librt, librt,
libseccomp, libseccomp,
libselinux, libselinux,
libblkid]], libblkid],
core_includes],
[['src/test/test-watch-pid.c'], [['src/test/test-watch-pid.c'],
[libcore, [libcore,
@ -319,7 +329,8 @@ tests += [
librt, librt,
libseccomp, libseccomp,
libselinux, libselinux,
libblkid]], libblkid],
core_includes],
[['src/test/test-hashmap.c', [['src/test/test-hashmap.c',
'src/test/test-hashmap-plain.c', 'src/test/test-hashmap-plain.c',
@ -345,10 +356,7 @@ tests += [
[['src/test/test-unaligned.c']], [['src/test/test-unaligned.c']],
[['src/test/test-tables.c', [['src/test/test-tables.c'],
'src/shared/test-tables.h',
'src/journal/journald-server.c',
'src/journal/journald-server.h'],
[libcore, [libcore,
libjournal_core, libjournal_core,
libudevd_core, libudevd_core,
@ -359,7 +367,7 @@ tests += [
libxz, libxz,
liblz4, liblz4,
libblkid], libblkid],
libudevd_core_includes], [core_includes, journal_includes, udev_includes]],
[['src/test/test-prioq.c']], [['src/test/test-prioq.c']],
@ -406,11 +414,15 @@ tests += [
[['src/test/test-cgroup-cpu.c'], [['src/test/test-cgroup-cpu.c'],
[libcore, [libcore,
libshared]], libshared],
[],
core_includes],
[['src/test/test-cgroup-unit-default.c'], [['src/test/test-cgroup-unit-default.c'],
[libcore, [libcore,
libshared]], libshared],
[],
core_includes],
[['src/test/test-cgroup-mask.c'], [['src/test/test-cgroup-mask.c'],
[libcore, [libcore,
@ -420,7 +432,8 @@ tests += [
libseccomp, libseccomp,
libselinux, libselinux,
libmount, libmount,
libblkid]], libblkid],
core_includes],
[['src/test/test-varlink.c'], [['src/test/test-varlink.c'],
[], [],
@ -454,7 +467,7 @@ tests += [
libselinux, libselinux,
libmount, libmount,
libblkid], libblkid],
[], '', 'timeout=120'], core_includes, '', 'timeout=120'],
[['src/test/test-execute.c'], [['src/test/test-execute.c'],
[libcore, [libcore,
@ -465,7 +478,7 @@ tests += [
libselinux, libselinux,
libmount, libmount,
libblkid], libblkid],
[], '', 'timeout=360'], core_includes, '', 'timeout=360'],
[['src/test/test-siphash24.c']], [['src/test/test-siphash24.c']],
@ -474,7 +487,8 @@ tests += [
[['src/test/test-install.c'], [['src/test/test-install.c'],
[libcore, [libcore,
libshared], libshared],
[], [], '', 'manual'], [],
core_includes, '', 'manual'],
[['src/test/test-watchdog.c']], [['src/test/test-watchdog.c']],
@ -486,7 +500,8 @@ tests += [
libseccomp, libseccomp,
libselinux, libselinux,
libmount, libmount,
libblkid]], libblkid],
core_includes],
[['src/test/test-conf-files.c']], [['src/test/test-conf-files.c']],
@ -516,7 +531,7 @@ tests += [
libkmod, libkmod,
libacl, libacl,
libselinux], libselinux],
[], '', 'manual', '-DLOG_REALM=LOG_REALM_UDEV'], udev_includes, '', 'manual', '-DLOG_REALM=LOG_REALM_UDEV'],
[['src/test/test-udev-util.c']], [['src/test/test-udev-util.c']],
@ -547,15 +562,7 @@ tests += [
[libdl]], [libdl]],
[['src/test/test-nscd-flush.c'], [['src/test/test-nscd-flush.c'],
[libcore, [], [], [], 'ENABLE_NSCD', 'manual'],
libshared],
[threads,
librt,
libseccomp,
libselinux,
libmount,
libblkid],
[], 'ENABLE_NSCD', 'manual'],
] ]
############################################################ ############################################################
@ -861,7 +868,9 @@ tests += [
[['src/analyze/test-verify.c', 'src/analyze/analyze-verify.c', 'src/analyze/analyze-verify.h'], [['src/analyze/test-verify.c', 'src/analyze/analyze-verify.c', 'src/analyze/analyze-verify.h'],
[libcore, [libcore,
libshared]], libshared],
[],
core_includes],
[['src/login/test-inhibit.c'], [['src/login/test-inhibit.c'],
[], [], [], '', 'manual'], [], [], [], '', 'manual'],

View file

@ -105,13 +105,13 @@ endif
############################################################ ############################################################
libudevd_core_includes = [includes, include_directories('net')] udev_includes = [includes, include_directories('net', '.')]
libudevd_core = static_library( libudevd_core = static_library(
'udev-core', 'udev-core',
libudevd_core_sources, libudevd_core_sources,
link_config_gperf_c, link_config_gperf_c,
keyboard_keys_from_name_h, keyboard_keys_from_name_h,
include_directories : libudevd_core_includes, include_directories : udev_includes,
c_args : ['-DLOG_REALM=LOG_REALM_UDEV'], c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
link_with : udev_link_with, link_with : udev_link_with,
dependencies : [libblkid, libkmod]) dependencies : [libblkid, libkmod])
@ -177,7 +177,8 @@ fuzzers += [
[libudevd_core, [libudevd_core,
libshared], libshared],
[threads, [threads,
libacl]], libacl],
udev_includes],
[['src/udev/fido_id/fuzz-fido-id-desc.c', [['src/udev/fido_id/fuzz-fido-id-desc.c',
'src/udev/fido_id/fido_id_desc.c']], 'src/udev/fido_id/fido_id_desc.c']],