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, libcap,
libm], libm],
c_args : ['-fvisibility=default'], c_args : ['-fvisibility=default'],
install : false) build_by_default : false)
############################################################ ############################################################
@ -443,4 +443,5 @@ libbasic_gcrypt = static_library(
basic_gcrypt_sources, basic_gcrypt_sources,
include_directories : basic_includes, include_directories : basic_includes,
dependencies : [libgcrypt], dependencies : [libgcrypt],
c_args : ['-fvisibility=default']) c_args : ['-fvisibility=default'],
build_by_default : false)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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