1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00

meson: stop building out convenience libraries by default

The meson default for static_library() are:
build_by_default=true, install=false. We never interact with the
static libraries, and we only care about them as a stepping-stone towards
the installable executables or libraries. Thus let's only build them if
they are a dependency of something else we are building.

While at it, let's drop install:false, since this appears to be the default.

This change would have fixed the issue with lib_import_common failing
to build too: we wouldn't attempt to build it.

In practice this changes very little, because we generally only declare static
libraries where there's something in the default target that will make use of
them. But it seems to be a better pattern to set build_by_default to false.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-12-16 10:58:44 +01:00
parent b93f018f57
commit 03f7ddf0bf
16 changed files with 32 additions and 18 deletions

View File

@ -428,7 +428,7 @@ libbasic = static_library(
libcap,
libm],
c_args : ['-fvisibility=default'],
install : false)
build_by_default : false)
############################################################
@ -443,4 +443,5 @@ libbasic_gcrypt = static_library(
basic_gcrypt_sources,
include_directories : basic_includes,
dependencies : [libgcrypt],
c_args : ['-fvisibility=default'])
c_args : ['-fvisibility=default'],
build_by_default : false)

View File

@ -184,7 +184,8 @@ libcore = static_library(
libapparmor,
libselinux,
libmount,
libacl])
libacl],
build_by_default : false)
core_includes = [includes, include_directories('.')]

View File

@ -45,7 +45,8 @@ if conf.get('ENABLE_IMPORTD') == 1
include_directories : includes,
dependencies : [libbzip2,
libxz,
libz])
libz],
build_by_default : false)
install_data('org.freedesktop.import1.conf',
install_dir : dbuspolicydir)

View File

@ -31,7 +31,7 @@ libsystemd_journal_remote = static_library(
libgnutls,
libxz,
liblz4],
install : false)
build_by_default : false)
systemd_journal_remote_sources = files('''
journal-remote-main.c

View File

@ -36,7 +36,7 @@ libjournal_core = static_library(
sources,
include_directories : includes,
dependencies: threads,
install : false)
build_by_default : false)
journal_includes = [includes, include_directories('.')]

View File

@ -49,7 +49,8 @@ sources = files('''
libsystemd_network = static_library(
'systemd-network',
sources,
include_directories : includes)
include_directories : includes,
build_by_default : false)
libsystemd_network_includes = [includes, include_directories('.')]

View File

@ -166,12 +166,12 @@ libsystemd_c_args = ['-fvisibility=default']
libsystemd_static = static_library(
'systemd_static',
libsystemd_sources,
install : false,
include_directories : libsystemd_includes,
c_args : libsystemd_c_args,
link_with : libbasic,
dependencies : [threads,
librt],
c_args : libsystemd_c_args)
build_by_default : false)
libsystemd_sym = files('libsystemd.sym')
libsystemd_sym_path = meson.current_source_dir() / 'libsystemd.sym'

View File

@ -28,7 +28,8 @@ libudev_basic = static_library(
'udev-basic',
libudev_sources,
include_directories : includes,
c_args : ['-fvisibility=default'])
c_args : ['-fvisibility=default'],
build_by_default : false)
libudev_static = static_library(
'udev_static',

View File

@ -50,7 +50,8 @@ liblogind_core = static_library(
'logind-core',
liblogind_core_sources,
include_directories : includes,
dependencies : [libacl])
dependencies : libacl,
build_by_default : false)
loginctl_sources = files('''
loginctl.c

View File

@ -24,7 +24,8 @@ libmachine_core = static_library(
'machine-core',
libmachine_core_sources,
include_directories : includes,
dependencies : [threads])
dependencies : threads,
build_by_default : false)
if conf.get('ENABLE_MACHINED') == 1
install_data('org.freedesktop.machine1.conf',

View File

@ -235,7 +235,8 @@ libnetworkd_core = static_library(
'networkd-core',
sources,
include_directories : network_includes,
link_with : [networkd_link_with])
link_with : networkd_link_with,
build_by_default : false)
if conf.get('ENABLE_NETWORKD') == 1
install_data('org.freedesktop.network1.conf',

View File

@ -45,7 +45,8 @@ libnspawn_core = static_library(
include_directories : includes,
dependencies : [libacl,
libseccomp,
libselinux])
libselinux],
build_by_default : false)
systemd_nspawn_sources = files('nspawn.c')

View File

@ -120,7 +120,8 @@ basic_dns_sources += custom_target(
libsystemd_resolve_core = static_library(
'systemd-resolve-core',
basic_dns_sources,
include_directories : includes)
include_directories : includes,
build_by_default : false)
systemd_resolved_sources += custom_target(
'resolved_gperf.c',

View File

@ -459,7 +459,8 @@ libshared_static = static_library(
shared_sources,
include_directories : includes,
dependencies : libshared_deps,
c_args : ['-fvisibility=default'])
c_args : ['-fvisibility=default'],
build_by_default : false)
libshared = shared_library(
libshared_name,

View File

@ -32,7 +32,8 @@ libtimesyncd_core = static_library(
'timesyncd-core',
sources,
include_directories : includes,
link_with : [timesyncd_link_with])
link_with : timesyncd_link_with,
build_by_default : false)
custom_target(
'timesyncd.conf',

View File

@ -115,7 +115,9 @@ libudevd_core = static_library(
keyboard_keys_from_name_h,
include_directories : udev_includes,
link_with : udev_link_with,
dependencies : [libblkid, libkmod])
dependencies : [libblkid,
libkmod],
build_by_default : false)
udev_progs = [['ata_id/ata_id.c'],
['cdrom_id/cdrom_id.c'],