tools/lzop: add `lzop` binaries
authorTony Butler <spudz76@gmail.com>
Tue, 29 Nov 2022 01:32:11 +0000 (17:32 -0800)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 16 Jan 2023 23:51:10 +0000 (23:51 +0000)
Depends: `tools/liblzo`

`lzop` is the standard executable for LZO compression

the initramfs generator offers the LZO option but there was no
executable to support it actually working

Signed-off-by: Tony Butler <spudz76@gmail.com>
tools/Makefile
tools/lzop/Makefile [new file with mode: 0644]
tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch [new file with mode: 0644]

index 67b09f3a803874c0b2a895c5250ae6d121f8007e..a8044dcf1fe3253b215492d1681b8e1d092fa52a 100644 (file)
@@ -23,6 +23,9 @@ endif
 ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),)
   BUILD_LZ4_TOOLS = y
 endif
+ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),)
+  BUILD_LZO_TOOLS = y
+endif
 
 tools-y += autoconf
 tools-y += autoconf-archive
@@ -66,6 +69,7 @@ tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS),y) += liblzo
 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_LZO_TOOLS),y) += lzop
 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
@@ -99,6 +103,7 @@ $(curdir)/liblzo/compile := $(curdir)/cmake/compile
 $(curdir)/libressl/compile := $(curdir)/pkgconf/compile
 $(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile
 $(curdir)/lzma-old/compile := $(curdir)/zlib/compile
+$(curdir)/lzop/compile := $(curdir)/cmake/compile $(curdir)/liblzo/compile
 $(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile
 $(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
 $(curdir)/meson/compile := $(curdir)/ninja/compile
diff --git a/tools/lzop/Makefile b/tools/lzop/Makefile
new file mode 100644 (file)
index 0000000..65bd7fe
--- /dev/null
@@ -0,0 +1,33 @@
+#
+# 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:=lzop
+PKG_VERSION:=1.04
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.lzop.org/download/
+PKG_HASH:=7e72b62a8a60aff5200a047eea0773a8fb205caf7acbe1774d95147f305a2f41
+
+PKG_LICENSE:=GPL-2.0-or-later
+PKG_LICENSE_FILES:=COPYING
+
+CMAKE_BINARY_SUBDIR:=openwrt-build
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_HOST_OPTIONS += \
+       -DENABLE_DOCS=ON \
+       -DBUILD_TESTING=OFF
+
+define Host/Uninstall
+       rm -f $(STAGING_DIR_HOST)/bin/lzop
+endef
+
+$(eval $(call HostBuild))
diff --git a/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch b/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch
new file mode 100644 (file)
index 0000000..01ebd33
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/CMakeLists.txt   2017-08-10 04:19:45.000000000 -0700
++++ b/CMakeLists.txt   2022-11-28 17:21:03.453548350 -0800
+@@ -50,6 +50,9 @@
+ project(lzop VERSION 1.04 LANGUAGES C)
++# configuration options
++option(ENABLE_DOCS     "Install documentation."    ON)
++
+ # install directories
+ if(NOT CMAKE_INSTALL_PREFIX)
+     message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined.")
+@@ -186,9 +189,11 @@
+ install(TARGETS lzop DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
++if(ENABLE_DOCS)
+ set(f AUTHORS COPYING NEWS README THANKS doc/lzop.html doc/lzop.man doc/lzop.pod doc/lzop.ps doc/lzop.tex doc/lzop.txt)
+ install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}")
+ install(FILES doc/lzop.1 DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man1")
++endif() # ENABLE_DOCS
+ endif() # CMAKE_INSTALL_FULL_LIBDIR