From 0f89517d418ff907fd9cf51f5313974812ceb305 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 24 Nov 2019 00:45:03 +0100 Subject: Fix: Move LZO compressor from libsquashfs to libcommon The liblzo2 library is licensed under GPLv2, so it is not possible to distribute binaries of libsquashfs that link against liblzo2 under LGPL. This commit moves the LZO compressor implementation to libcommon, where this isn't a problem, since the tools themselves are licensed under GPLv3. It removes the ability of libsquashfs to read or generate LZO compressed SquashFS images, but the tools still can. Signed-off-by: David Oberhollenzer --- difftool/Makemodule.am | 2 +- difftool/sqfsdiff.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'difftool') diff --git a/difftool/Makemodule.am b/difftool/Makemodule.am index e43f35d..e827a8b 100644 --- a/difftool/Makemodule.am +++ b/difftool/Makemodule.am @@ -2,6 +2,6 @@ sqfsdiff_SOURCES = difftool/sqfsdiff.c difftool/sqfsdiff.h difftool/util.c sqfsdiff_SOURCES += difftool/compare_dir.c difftool/node_compare.c sqfsdiff_SOURCES += difftool/compare_files.c difftool/super.c sqfsdiff_SOURCES += difftool/extract.c difftool/options.c -sqfsdiff_LDADD = libcommon.a libsquashfs.la libutil.la +sqfsdiff_LDADD = libcommon.a libsquashfs.la libutil.la $(LZO_LIBS) bin_PROGRAMS += sqfsdiff diff --git a/difftool/sqfsdiff.c b/difftool/sqfsdiff.c index 7479938..1c80812 100644 --- a/difftool/sqfsdiff.c +++ b/difftool/sqfsdiff.c @@ -22,7 +22,14 @@ static int open_sfqs(sqfs_state_t *state, const char *path) goto fail_file; } - if (!sqfs_compressor_exists(state->super.compression_id)) { + ret = sqfs_compressor_exists(state->super.compression_id); + +#ifdef WITH_LZO + if (state->super.compression_id == SQFS_COMP_LZO) + ret = true; +#endif + + if (!ret) { fprintf(stderr, "%s: unknown compressor used.\n", path); goto fail_file; @@ -33,6 +40,12 @@ static int open_sfqs(sqfs_state_t *state, const char *path) SQFS_COMP_FLAG_UNCOMPRESS); state->cmp = sqfs_compressor_create(&state->cfg); + +#ifdef WITH_LZO + if (state->super.compression_id == SQFS_COMP_LZO && state->cmp == NULL) + state->cmp = lzo_compressor_create(&state->cfg); +#endif + if (state->cmp == NULL) { fprintf(stderr, "%s: error creating compressor.\n", path); goto fail_file; -- cgit v1.2.3