summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2022-04-09 18:38:06 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-04-18 05:43:59 +0900
commitcd3c6322dbc6370448bafc216ee4e19e32a79d9e (patch)
treee9758764f8ea2d09f38b3217cfe2948cbd646549 /meson.build
parentbd4297e76128bfbb5a96fe5cabf736f3df2520e3 (diff)
downloadsystemd-cd3c6322dbc6370448bafc216ee4e19e32a79d9e.tar.gz
compression: add build-time option to select default
Compression and decompression are controlled by the same build flag, so if one wants to use, say, LZ4 to compress, ZSTD has to be disabled, which means one loses the ability to read zstd-compressed journals. Add a default-compression meson option, that allows to select any of the available compression algorithms as the default.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build24
1 files changed, 24 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index d60be1b050..723bc8dac1 100644
--- a/meson.build
+++ b/meson.build
@@ -1452,6 +1452,30 @@ conf.set10('HAVE_ZSTD', have_zstd)
conf.set10('HAVE_COMPRESSION', have_xz or have_lz4 or have_zstd)
+compression = get_option('default-compression')
+if compression == 'auto'
+ if have_zstd
+ compression = 'zstd'
+ elif have_lz4
+ compression = 'lz4'
+ elif have_xz
+ compression = 'xz'
+ else
+ compression = 'none'
+ endif
+elif compression == 'zstd' and not have_zstd
+ error('default-compression=zstd requires zstd')
+elif compression == 'lz4' and not have_lz4
+ error('default-compression=lz4 requires lz4')
+elif compression == 'xz' and not have_xz
+ error('default-compression=xz requires xz')
+endif
+conf.set('OBJECT_COMPRESSED_NONE', 0)
+conf.set('OBJECT_COMPRESSED_XZ', 1)
+conf.set('OBJECT_COMPRESSED_LZ4', 2)
+conf.set('OBJECT_COMPRESSED_ZSTD', 4)
+conf.set('DEFAULT_COMPRESSION', 'OBJECT_COMPRESSED_@0@'.format(compression.to_upper()))
+
want_xkbcommon = get_option('xkbcommon')
if want_xkbcommon != 'false' and not skip_deps
libxkbcommon = dependency('xkbcommon',