package/lz4: add option to install library only (without lz4 binary)
PATCH 1/1 package/lz4: add option to install library only (without lz4 binary)
Often lz4 is used as a library, and not as a standalone program. Excluding lz4 binary will save some space in this case.
--- package/Config.in | 2 +- package/lz4/Config.in | 9 +++++++++ package/lz4/lz4.mk | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
package/Config.in +1 -1
@@ -70,7 +70,6 @@ menu "Compressors and decompressors" source "package/bzip2/Config.in" source "package/gzip/Config.in" source "package/lrzip/Config.in" - source "package/lz4/Config.in" source "package/lzip/Config.in" source "package/lzop/Config.in" source "package/p7zip/Config.in"
@@ -1289,6 +1288,7 @@ menu "Compression and decompression" source "package/libmspack/Config.in" source "package/libsquish/Config.in" source "package/libzip/Config.in" + source "package/lz4/Config.in" source "package/lzo/Config.in" source "package/minizip/Config.in" source "package/snappy/Config.in"
package/lz4/Config.in +9 -0
@@ -8,3 +8,12 @@ config BR2_PACKAGE_LZ4 speed limits on multi-core systems. http://www.lz4.org/ + +if BR2_PACKAGE_LZ4 +config BR2_PACKAGE_LZ4_PROGS + bool "lz4 programs" + default y + help + lz4, lz4c, unlz4 and lz4cat binaries + +endif
package/lz4/lz4.mk +14 -0
@@ -32,22 +32,36 @@ define HOST_LZ4_INSTALL_CMDS install -C $(@D) endef +ifeq ($(BR2_PACKAGE_LZ4_PROGS),y) define LZ4_BUILD_CMDS $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(LZ4_MAKE_OPTS) \ -C $(@D) lib $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(LZ4_MAKE_OPTS) \ -C $(@D) lz4 endef +else +define LZ4_BUILD_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(LZ4_MAKE_OPTS) \ + -C $(@D) lib +endef +endif define LZ4_INSTALL_STAGING_CMDS $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) DESTDIR=$(STAGING_DIR) \ PREFIX=/usr $(LZ4_MAKE_OPTS) install -C $(@D) endef +ifeq ($(BR2_PACKAGE_LZ4_PROGS),y) define LZ4_INSTALL_TARGET_CMDS $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) DESTDIR=$(TARGET_DIR) \ PREFIX=/usr $(LZ4_MAKE_OPTS) install -C $(@D) endef +else +define LZ4_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) DESTDIR=$(TARGET_DIR) \ + PREFIX=/usr $(LZ4_MAKE_OPTS) install -C $(@D)/lib +endef +endif $(eval $(generic-package)) $(eval $(host-generic-package))
Signature · 1 line
2.26.2
PATCH 1/1 package/lz4: add option to install library only (without lz4 binary)
I did quick check of packages that have BR2_PACKAGE_LZ4 in their dependencies. It seems that they all need liblz4, not lz4 binary.
PATCH 1/1 package/lz4: add option to install library only (without lz4 binary)
In reply to Ed SpiridonovQuoted 3 lines · Ed Spiridonov
Often lz4 is used as a library, and not as a standalone program. Excluding lz4 binary will save some space in this case.
Something wrong with this patch?
PATCH 1/1 package/lz4: add option to install library only (without lz4 binary)
In reply to Ed SpiridonovQuoted 9 lines · On Sat, 23 May 2020 20:34:25 +0300 Ed Spiridonov <[email protected]> wrote:
Often lz4 is used as a library, and not as a standalone program. Excluding lz4 binary will save some space in this case.
Signed-off-by Ed Spiridonov <[email protected]>--- package/Config.in | 2 +- package/lz4/Config.in | 9 +++++++++ package/lz4/lz4.mk | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
Thanks, I have applied to master, after doing a number of changes. See:
https://git.buildroot.org/buildroot/commit/?id=2acb27e298c54935f890111fc5897a11350b913b
I have also complained to upstream lz4 about the fact that their program is linked statically against their library, which doubles the storage consumption:
https://github.com/lz4/lz4/issues/888
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com