From a3a47476c5ceed1688e37a5af8a5a988b504832e Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 11 Jun 2019 15:04:59 +0200 Subject: Cleanup dependency handling Always try to gather all compressor libraries available, but only complain about missing a one if it has been *explicitly* selected. If a compressor has been explicityl disabled, we can still turn it off after checking. Also, rework gensquashfs to set the default compressor based on what's available. Signed-off-by: David Oberhollenzer --- lib/comp/compressor.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib') diff --git a/lib/comp/compressor.c b/lib/comp/compressor.c index 44b3643..6dff416 100644 --- a/lib/comp/compressor.c +++ b/lib/comp/compressor.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-3.0-or-later */ #include +#include #include #include "internal.h" @@ -127,3 +128,21 @@ void compressor_print_help(E_SQFS_COMPRESSOR id) helpfuns[id](); } + +E_SQFS_COMPRESSOR compressor_get_default(void) +{ +#if defined(WITH_XZ) + return SQFS_COMP_XZ; +#elif defined(WITH_ZSTD) + return SQFS_COMP_ZSTD; +#elif defined(WITH_GZIP) + return SQFS_COMP_GZIP; +#elif defined(WITH_LZO) + return SQFS_COMP_LZO; +#elif defined(WITH_LZ4) + return SQFS_COMP_LZ4; +#else + fputs("No compressor implementation available!\n", stderr); + exit(EXIT_FAILURE); +#endif +} -- cgit v1.2.3