diff options
author | Matteo Croce <teknoraver@meta.com> | 2024-02-27 21:28:14 +0100 |
---|---|---|
committer | Matteo Croce <teknoraver@meta.com> | 2024-03-05 12:37:21 +0100 |
commit | 3fc72d54132151c131301fc7954e0b44cdd3c860 (patch) | |
tree | 728c155c4fac5c52ca571615b753cefa4b5306c2 /meson.build | |
parent | move dlfcn-util into basic (diff) | |
download | systemd-3fc72d54132151c131301fc7954e0b44cdd3c860.tar.xz systemd-3fc72d54132151c131301fc7954e0b44cdd3c860.zip |
dynamically load compression libraries
Dynamically load liblz4, libzstd and liblzma with dlopen().
This helps to reduce the size of the initrd image when these libraries
are not really needed.
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/meson.build b/meson.build index d4e89eae01..dc7e2b9a7b 100644 --- a/meson.build +++ b/meson.build @@ -1371,16 +1371,19 @@ conf.set10('HAVE_BZIP2', libbzip2.found()) libxz = dependency('liblzma', required : get_option('xz')) conf.set10('HAVE_XZ', libxz.found()) +libxz_cflags = libxz.partial_dependency(includes: true, compile_args: true) liblz4 = dependency('liblz4', version : '>= 1.3.0', required : get_option('lz4')) conf.set10('HAVE_LZ4', liblz4.found()) +liblz4_cflags = liblz4.partial_dependency(includes: true, compile_args: true) libzstd = dependency('libzstd', version : '>= 1.4.0', required : get_option('zstd')) conf.set10('HAVE_ZSTD', libzstd.found()) +libzstd_cflags = libzstd.partial_dependency(includes: true, compile_args: true) conf.set10('HAVE_COMPRESSION', libxz.found() or liblz4.found() or libzstd.found()) @@ -1951,8 +1954,7 @@ libsystemd = shared_library( link_args : ['-shared', '-Wl,--version-script=' + libsystemd_sym_path], link_with : [libbasic, - libbasic_gcrypt, - libbasic_compress], + libbasic_gcrypt], link_whole : [libsystemd_static], dependencies : [librt, threads, @@ -1969,7 +1971,6 @@ install_libsystemd_static = static_library( libsystemd_sources, basic_sources, basic_gcrypt_sources, - basic_compress_sources, fundamental_sources, include_directories : libsystemd_includes, build_by_default : static_libsystemd != 'false', @@ -1981,12 +1982,12 @@ install_libsystemd_static = static_library( libcap, libdl, libgcrypt, - liblz4, + liblz4_cflags, libmount, libopenssl, librt, - libxz, - libzstd, + libxz_cflags, + libzstd_cflags, threads, userspace], c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC'])) |