aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTony Butler <spudz76@gmail.com>2022-11-28 16:01:26 -0800
committerDaniel Golle <daniel@makrotopia.org>2023-01-16 23:51:10 +0000
commit8b12966d20bf10316752b3678d3999f83e564c60 (patch)
treeec1786d1a7c0126ae3f9bdc1be3b4c706c8c29f0 /tools
parent539b52068a079801fe0955f7cf5f39e536a08803 (diff)
downloadupstream-8b12966d20bf10316752b3678d3999f83e564c60.tar.gz
upstream-8b12966d20bf10316752b3678d3999f83e564c60.tar.bz2
upstream-8b12966d20bf10316752b3678d3999f83e564c60.zip
tools/lz4: add `lz4` binaries
same as `packages/liblz4` modified to be a HOST/tools type build with unified liblz4 (this is also the dev package for liblz4) the image initramfs generator offers the LZ4 option but there was no executable to support it actually working Signed-off-by: Tony Butler <spudz76@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile4
-rw-r--r--tools/lz4/Makefile49
-rw-r--r--tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch60
-rw-r--r--tools/lz4/patches/002-makefile-install-links-from-same-dir.patch71
4 files changed, 184 insertions, 0 deletions
diff --git a/tools/Makefile b/tools/Makefile
index c7c7d00756..46283e8d81 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -20,6 +20,9 @@ endif
ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_BRCMSMAC_USE_FW_FROM_WL),)
BUILD_B43_TOOLS = y
endif
+ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),)
+ BUILD_LZ4_TOOLS = y
+endif
tools-y += autoconf
tools-y += autoconf-archive
@@ -61,6 +64,7 @@ tools-y += zlib
tools-y += zstd
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_B43_TOOLS),y) += b43-tools
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_ISL),y) += isl
+tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZ4_TOOLS),y) += lz4
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_TOOLCHAIN),y) += gmp mpc mpfr
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini),y) += genext2fs
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_ath79),y) += lzma-old squashfs
diff --git a/tools/lz4/Makefile b/tools/lz4/Makefile
new file mode 100644
index 0000000000..c5d4f6f16b
--- /dev/null
+++ b/tools/lz4/Makefile
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2022 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=lz4
+PKG_VERSION:=1.9.4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/lz4/lz4/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b
+
+PKG_LICENSE:=BSD-2-Clause
+PKG_LICENSE_FILES:=LICENSE lib/LICENSE
+
+HOST_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/host-build.mk
+
+# Always optimize for speed
+HOST_CFLAGS := $(filter-out -O%,$(HOST_CFLAGS)) -O3
+
+HOST_MAKE_FLAGS+=PREFIX=$(HOST_BUILD_PREFIX) \
+ ENABLE_DOCS=1
+
+define Host/Configure
+endef
+
+define Host/Compile
+ $(call Host/Compile/Default,default)
+endef
+
+define Host/Install
+ $(call Host/Compile/Default,install)
+endef
+
+define Host/Uninstall
+ $(call Host/Compile/Default,uninstall)
+ $(call Host/Compile/Default,clean)
+endef
+
+define Host/Clean
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch b/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch
new file mode 100644
index 0000000000..5d6dca33f3
--- /dev/null
+++ b/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch
@@ -0,0 +1,60 @@
++++ a/programs/Makefile 2022-08-15 15:45:31.000000000 -0700
+--- b/programs/Makefile 2022-11-28 16:34:21.315593784 -0800
+@@ -66,6 +66,7 @@
+ MD2ROFF = ronn
+ MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="lz4 $(LZ4_VERSION)"
+
++ENABLE_DOCS ?= 1
+
+ default: lz4-release
+
+@@ -120,6 +121,7 @@
+ lz4c32 : $(SRCFILES)
+ $(CC) $(FLAGS) $^ -o $@$(EXT)
+
++ifeq ($(ENABLE_DOCS),1)
+ lz4.1: lz4.1.md $(LIBVER_SRC)
+ cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | $(SED) -n '/^\.\\\".*/!p' > $@
+
+@@ -130,6 +132,7 @@
+
+ preview-man: clean-man man
+ man ./lz4.1
++endif
+
+ clean:
+ ifeq ($(WINBASED),yes)
+@@ -172,16 +175,19 @@
+
+ install: lz4
+ @echo Installing binaries in $(DESTDIR)$(bindir)
+- $(INSTALL_DIR) $(DESTDIR)$(bindir)/ $(DESTDIR)$(man1dir)/
++ $(INSTALL_DIR) $(DESTDIR)$(bindir)/
+ $(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT)
+ $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT)
+ $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT)
+ $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT)
++ifeq ($(ENABLE_DOCS),1)
+ @echo Installing man pages in $(DESTDIR)$(man1dir)
++ $(INSTALL_DIR) $(DESTDIR)$(man1dir)/
+ $(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1
+ $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1
+ $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1
+ $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1
++endif
+ @echo lz4 installation completed
+
+ uninstall:
+@@ -189,10 +195,12 @@
+ $(RM) $(DESTDIR)$(bindir)/unlz4$(EXT)
+ $(RM) $(DESTDIR)$(bindir)/lz4$(EXT)
+ $(RM) $(DESTDIR)$(bindir)/lz4c$(EXT)
++ifeq ($(ENABLE_DOCS),1)
+ $(RM) $(DESTDIR)$(man1dir)/lz4.1
+ $(RM) $(DESTDIR)$(man1dir)/lz4c.1
+ $(RM) $(DESTDIR)$(man1dir)/lz4cat.1
+ $(RM) $(DESTDIR)$(man1dir)/unlz4.1
++endif
+ @echo lz4 programs successfully uninstalled
+
+ endif
diff --git a/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch b/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch
new file mode 100644
index 0000000000..159dc67f1a
--- /dev/null
+++ b/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch
@@ -0,0 +1,71 @@
+diff -ur a/lib/Makefile b/lib/Makefile
+--- a/lib/Makefile 2022-12-04 23:49:06.336839263 -0800
++++ b/lib/Makefile 2022-12-05 00:00:59.172307488 -0800
+@@ -195,8 +195,8 @@
+ $(INSTALL_PROGRAM) dll/$(LIBLZ4_EXP) $(DESTDIR)$(libdir)
+ else
+ $(INSTALL_PROGRAM) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)
+- $(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR)
+- $(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT)
++ (cd $(DESTDIR)$(libdir) && $(LN_SF) liblz4.$(SHARED_EXT_VER) liblz4.$(SHARED_EXT_MAJOR))
++ (cd $(DESTDIR)$(libdir) && $(LN_SF) liblz4.$(SHARED_EXT_MAJOR) liblz4.$(SHARED_EXT))
+ endif
+ endif
+ @echo Installing headers in $(DESTDIR)$(includedir)
+diff -ur a/Makefile b/Makefile
+--- a/Makefile 2022-12-04 23:49:06.336839263 -0800
++++ b/Makefile 2022-12-04 23:42:09.693836654 -0800
+@@ -77,12 +77,12 @@
+
+ .PHONY: clean
+ clean:
+- $(MAKE) -C $(LZ4DIR) $@ > $(VOID)
+- $(MAKE) -C $(PRGDIR) $@ > $(VOID)
+- $(MAKE) -C $(TESTDIR) $@ > $(VOID)
+- $(MAKE) -C $(EXDIR) $@ > $(VOID)
+- $(MAKE) -C $(FUZZDIR) $@ > $(VOID)
+- $(MAKE) -C contrib/gen_manual $@ > $(VOID)
++ $(MAKE) -C $(LZ4DIR) $@
++ $(MAKE) -C $(PRGDIR) $@
++ $(MAKE) -C $(TESTDIR) $@
++ $(MAKE) -C $(EXDIR) $@
++ $(MAKE) -C $(FUZZDIR) $@
++ $(MAKE) -C contrib/gen_manual $@
+ $(RM) lz4$(EXT)
+ $(RM) -r $(CMAKE_BUILD_DIR)
+ @echo Cleaning completed
+diff -ur a/programs/Makefile b/programs/Makefile
+--- a/programs/Makefile 2022-12-04 23:49:06.336839263 -0800
++++ b/programs/Makefile 2022-12-04 23:42:30.849582910 -0800
+@@ -138,7 +138,7 @@
+ ifeq ($(WINBASED),yes)
+ $(RM) *.rc
+ endif
+- $(MAKE) -C $(LZ4DIR) $@ > $(VOID)
++ $(MAKE) -C $(LZ4DIR) $@
+ $(RM) core *.o *.test tmp* \
+ lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) lz4-wlib$(EXT) \
+ unlz4$(EXT) lz4cat$(EXT)
+@@ -177,16 +177,16 @@
+ @echo Installing binaries in $(DESTDIR)$(bindir)
+ $(INSTALL_DIR) $(DESTDIR)$(bindir)/
+ $(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT)
+- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT)
+- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT)
+- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT)
++ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) lz4c$(EXT))
++ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) lz4cat$(EXT))
++ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) unlz4$(EXT))
+ ifeq ($(ENABLE_DOCS),1)
+ @echo Installing man pages in $(DESTDIR)$(man1dir)
+ $(INSTALL_DIR) $(DESTDIR)$(man1dir)/
+ $(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1
+- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1
+- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1
+- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1
++ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 lz4c.1)
++ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 lz4cat.1)
++ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 unlz4.1)
+ endif
+ @echo lz4 installation completed
+