From 03f7ddf0bf170c00e6d53bf039b6566113f6c936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 16 Dec 2021 10:58:44 +0100 Subject: [PATCH] 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. --- src/basic/meson.build | 5 +++-- src/core/meson.build | 3 ++- src/import/meson.build | 3 ++- src/journal-remote/meson.build | 2 +- src/journal/meson.build | 2 +- src/libsystemd-network/meson.build | 3 ++- src/libsystemd/meson.build | 4 ++-- src/libudev/meson.build | 3 ++- src/login/meson.build | 3 ++- src/machine/meson.build | 3 ++- src/network/meson.build | 3 ++- src/nspawn/meson.build | 3 ++- src/resolve/meson.build | 3 ++- src/shared/meson.build | 3 ++- src/timesync/meson.build | 3 ++- src/udev/meson.build | 4 +++- 16 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/basic/meson.build b/src/basic/meson.build index 891235ff42..229ac97c69 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build @@ -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) diff --git a/src/core/meson.build b/src/core/meson.build index 92a811f2f0..d229d46779 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -184,7 +184,8 @@ libcore = static_library( libapparmor, libselinux, libmount, - libacl]) + libacl], + build_by_default : false) core_includes = [includes, include_directories('.')] diff --git a/src/import/meson.build b/src/import/meson.build index e48e49293e..23f0858817 100644 --- a/src/import/meson.build +++ b/src/import/meson.build @@ -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) diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index b9f8b472cb..168d0ed6a3 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -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 diff --git a/src/journal/meson.build b/src/journal/meson.build index 383ed355fd..eb66bfd584 100644 --- a/src/journal/meson.build +++ b/src/journal/meson.build @@ -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('.')] diff --git a/src/libsystemd-network/meson.build b/src/libsystemd-network/meson.build index 54248a1e6e..a7838cdaa1 100644 --- a/src/libsystemd-network/meson.build +++ b/src/libsystemd-network/meson.build @@ -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('.')] diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build index 73c0228248..124393d3e6 100644 --- a/src/libsystemd/meson.build +++ b/src/libsystemd/meson.build @@ -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' diff --git a/src/libudev/meson.build b/src/libudev/meson.build index 488ae62480..e94b43d9b7 100644 --- a/src/libudev/meson.build +++ b/src/libudev/meson.build @@ -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', diff --git a/src/login/meson.build b/src/login/meson.build index a583025a1b..a78c2bc2dd 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -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 diff --git a/src/machine/meson.build b/src/machine/meson.build index 9b9ad1d8a9..ef858a5988 100644 --- a/src/machine/meson.build +++ b/src/machine/meson.build @@ -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', diff --git a/src/network/meson.build b/src/network/meson.build index 04a5f966bb..5857439c5a 100644 --- a/src/network/meson.build +++ b/src/network/meson.build @@ -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', diff --git a/src/nspawn/meson.build b/src/nspawn/meson.build index d465b3d804..11ac404e99 100644 --- a/src/nspawn/meson.build +++ b/src/nspawn/meson.build @@ -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') diff --git a/src/resolve/meson.build b/src/resolve/meson.build index 4d717f1964..0580fbeec6 100644 --- a/src/resolve/meson.build +++ b/src/resolve/meson.build @@ -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', diff --git a/src/shared/meson.build b/src/shared/meson.build index 562d984fc3..5dc58a863d 100644 --- a/src/shared/meson.build +++ b/src/shared/meson.build @@ -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, diff --git a/src/timesync/meson.build b/src/timesync/meson.build index 6d6ddeb285..83dd7c8f67 100644 --- a/src/timesync/meson.build +++ b/src/timesync/meson.build @@ -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', diff --git a/src/udev/meson.build b/src/udev/meson.build index 0b692df3d8..cd0bb6653f 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -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'],