tools/liblzo: add `liblzo` library

prerequisite of upcoming `tools/lzop` addition, and subsequent initramfs
and squashfs cleanups

same as `packages/lzo` modified to be a HOST/tools type build,
and should always be the same version and sources when either one is
bumped

because this (and `packages/lzo`) only provide liblzo and no
executables, use the clearer name `tools/liblzo`

Signed-off-by: Tony Butler <spudz76@gmail.com>
This commit is contained in:
Tony Butler 2022-11-28 17:06:46 -08:00 committed by Daniel Golle
parent 8b12966d20
commit 9a8509c2c5
3 changed files with 112 additions and 0 deletions

View File

@ -62,6 +62,7 @@ tools-y += sstrip
tools-y += zip tools-y += zip
tools-y += zlib tools-y += zlib
tools-y += zstd tools-y += zstd
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_B43_TOOLS),y) += b43-tools
tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_ISL),y) += isl 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_LZ4_TOOLS),y) += lz4
@ -94,6 +95,7 @@ $(curdir)/gengetopt/compile := $(curdir)/libtool/compile
$(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/gmp/compile := $(curdir)/libtool/compile
$(curdir)/isl/compile := $(curdir)/gmp/compile $(curdir)/isl/compile := $(curdir)/gmp/compile
$(curdir)/libdeflate/compile := $(curdir)/cmake/compile $(curdir)/libdeflate/compile := $(curdir)/cmake/compile
$(curdir)/liblzo/compile := $(curdir)/cmake/compile
$(curdir)/libressl/compile := $(curdir)/pkgconf/compile $(curdir)/libressl/compile := $(curdir)/pkgconf/compile
$(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile $(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile

42
tools/liblzo/Makefile Normal file
View File

@ -0,0 +1,42 @@
#
# 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:=lzo
PKG_VERSION:=2.10
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.oberhumer.com/opensource/lzo/download/
PKG_HASH:=c0f892943208266f9b6543b3ae308fab6284c5c90e627931446fb49b4221a072
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_SHARED=ON \
-DENABLE_TESTS=OFF \
-DENABLE_EXAMPLES=OFF \
-DENABLE_DOCS=ON \
-DBUILD_TESTING=OFF
define Host/Uninstall
rm -rf $(HOST_BUILD_PREFIX)/include/lzo
rm -f $(HOST_BUILD_PREFIX)/lib/liblzo2.a
rm -f $(HOST_BUILD_PREFIX)/lib/liblzo2.so.2.0.0
rm -f $(HOST_BUILD_PREFIX)/lib/liblzo2.so.2
rm -f $(HOST_BUILD_PREFIX)/lib/liblzo2.so
rm -f $(HOST_BUILD_PREFIX)/lib/pkgconfig/lzo2.pc
endef
$(eval $(call HostBuild))

View File

@ -0,0 +1,68 @@
--- a/CMakeLists.txt 2022-11-28 06:34:39.171209779 -0800
+++ b/CMakeLists.txt 2022-11-28 06:33:13.368239757 -0800
@@ -51,8 +51,11 @@
project(lzo VERSION 2.10 LANGUAGES C)
# configuration options
-option(ENABLE_STATIC "Build static LZO library." ON)
-option(ENABLE_SHARED "Build shared LZO library." OFF)
+option(ENABLE_STATIC "Build static LZO library." ON)
+option(ENABLE_SHARED "Build shared LZO library." OFF)
+option(ENABLE_TESTS "Build tests." ON)
+option(ENABLE_EXAMPLES "Build examples." ON)
+option(ENABLE_DOCS "Install documentation." ON)
if(NOT ENABLE_STATIC AND NOT ENABLE_SHARED)
set(ENABLE_STATIC ON)
endif()
@@ -127,14 +130,20 @@
endif()
endmacro()
# main test driver
+if(ENABLE_TESTS OR ENABLE_EXAMPLES)
lzo_add_executable(lzotest lzotest/lzotest.c)
+endif()
# examples
+if(ENABLE_EXAMPLES)
lzo_add_executable(dict examples/dict.c)
lzo_add_executable(lzopack examples/lzopack.c)
lzo_add_executable(overlap examples/overlap.c)
lzo_add_executable(precomp examples/precomp.c)
lzo_add_executable(precomp2 examples/precomp2.c)
+endif()
+if(ENABLE_TESTS OR ENABLE_EXAMPLES)
lzo_add_executable(simple examples/simple.c)
+endif()
# some boring internal test programs
if(0)
lzo_add_executable(align tests/align.c)
@@ -144,7 +153,7 @@
endif()
# miniLZO
-if(1)
+if(ENABLE_TESTS)
add_executable(testmini minilzo/testmini.c minilzo/minilzo.c)
target_include_directories(testmini PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/lzo") # needed for "lzoconf.h"
endif()
@@ -263,8 +272,10 @@
if(DEFINED CMAKE_INSTALL_FULL_LIBDIR)
-set(f AUTHORS COPYING NEWS THANKS doc/LZO.FAQ doc/LZO.TXT doc/LZOAPI.TXT)
-install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}")
+if(ENABLE_DOCS)
+ set(f AUTHORS COPYING NEWS THANKS doc/LZO.FAQ doc/LZO.TXT doc/LZOAPI.TXT)
+ install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}")
+endif()
set(f include/lzo/lzo1.h include/lzo/lzo1a.h include/lzo/lzo1b.h
include/lzo/lzo1c.h include/lzo/lzo1f.h include/lzo/lzo1x.h
@@ -285,7 +296,7 @@
)
endif()
-if(1)
+if(ENABLE_EXAMPLES)
set(f lzopack lzotest simple testmini) # examples
install(TARGETS ${f} DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/lzo/examples")
endif()