xz: add from packages feed

Add xz (liblzma) to satisfy the dependency of exec-tools package

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
This commit is contained in:
Weijie Gao 2024-09-27 20:14:30 +08:00
parent 67531698ed
commit c58b592a30
3 changed files with 174 additions and 0 deletions

125
package/utils/xz/Makefile Normal file
View File

@ -0,0 +1,125 @@
#
# Copyright (C) 2013-2015 OpenWrt.org
# Copyright (C) 2017 Daniel Engberg <daniel.engberg.lists@pyret.net>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=xz
PKG_VERSION:=5.6.2
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/lzmautils
PKG_HASH:=e12aa03cbd200597bd4ce11d97be2d09a6e6d39a9311ce72c91ac7deacde3171
PKG_MAINTAINER:=
PKG_LICENSE:=Public-Domain LGPL-2.1-or-later GPL-2.0-or-later GPL-3.0-or-later
PKG_LICENSE_FILES:=COPYING
PKG_CPE_ID:=cpe:/a:tukaani:xz
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_BUILD_FLAGS:=lto
include $(INCLUDE_DIR)/package.mk
define Package/xz/Default
SUBMENU:=Compression
SECTION:=utils
CATEGORY:=Utilities
URL:=https://tukaani.org/xz
endef
define Package/xz-utils
$(call Package/xz/Default)
TITLE:=XZ Utils (meta)
MENU:=1
endef
define Package/liblzma
$(call Package/xz/Default)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libpthread
TITLE:=liblzma library from XZ Utils
endef
# $(1): package name & command in /usr/bin/
# $(2): package dependencies
# $(3): symbolic links to $(1) in /usr/bin/
define BuildSubPackage
define Package/$(1)
$(call Package/xz/Default)
DEPENDS:=xz-utils $(2)
TITLE:=$(1) utility from XZ Utils
$(if $(3),ALTERNATIVES:=$(foreach f,$(1) $(3),300:/usr/bin/$(f):/usr/libexec/$(1)-lzmautils))
endef
define Package/$(1)/description
Contains: $(1) $(3)
endef
define Package/$(1)/install
$(INSTALL_DIR) $$(1)$(if $(3),/usr/libexec,/usr/bin)
$(CP) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)$(if $(3),/usr/libexec/$(1)-lzmautils,/usr/bin/$(1))
endef
$$(eval $$(call BuildPackage,$(1)))
endef
TARGET_LDFLAGS += -Wl,--gc-sections
CONFIGURE_ARGS += \
--enable-small \
--enable-assume-ram=4 \
--disable-assembler \
--disable-debug \
--disable-doc \
--disable-rpath \
--disable-symbol-versions \
--disable-werror \
--with-pic
CONFIGURE_VARS += \
gl_cv_posix_shell=/bin/sh
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/lzma{,.h} \
$(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/liblzma.{a,so*} \
$(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/liblzma.pc \
$(1)/usr/lib/pkgconfig/
endef
define Package/xz-utils/install
true
endef
define Package/liblzma/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/liblzma.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,xz-utils))
$(eval $(call BuildPackage,liblzma))
$(eval $(call BuildSubPackage,lzmadec, +liblzma,))
$(eval $(call BuildSubPackage,lzmainfo, +liblzma,))
$(eval $(call BuildSubPackage,xz, +liblzma, lzcat lzma unlzma unxz xzcat))
$(eval $(call BuildSubPackage,xzdec, +liblzma,))
$(eval $(call BuildSubPackage,xzdiff, +xz, lzcmp lzdiff xzcmp))
$(eval $(call BuildSubPackage,xzgrep, +xz, lzegrep lzfgrep lzgrep xzegrep xzfgrep))
$(eval $(call BuildSubPackage,xzless, +xz, lzless))
$(eval $(call BuildSubPackage,xzmore, +xz, lzmore))

View File

@ -0,0 +1,13 @@
--- a/src/liblzma/liblzma.pc.in
+++ b/src/liblzma/liblzma.pc.in
@@ -3,8 +3,8 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
Name: liblzma
Description: General purpose data compression library

View File

@ -0,0 +1,36 @@
# Fix shared library building in XZ Utils 5.2.13, 5.4.7, and 5.6.2
#
# The releases were made with a development version of GNU Libtool
# (2.5.0+1+g38c166c8). The benefit is that there tend to be fixes that
# aren't in a stable release yet. At the same time there is a higher
# risk of new bugs. Unfortunately there was a bug that breaks building
# of shared libraries on some systems like mips64.
#
# This patch was made by taking the upstream commit to m4/libtool.m4
# and then running "autoconf" to update the generated "configure".
# This patch only modifies "configure" so that the changed timestamps
# won't cause the build system to regenerate more files, which would
# only work if one has all Autotools packages installed.
#
# https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=9a4a02615c9e7cbcfd690ed31874822a7d6aaea2
# https://lore.kernel.org/distributions/3299713.44csPzL39Z@pinacolada/
--- a/configure
+++ b/configure
@@ -9475,7 +9475,7 @@ do
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
- ac_cv_prog_FILECMD=":"
+ ac_cv_prog_FILECMD="file"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -9483,6 +9483,7 @@ done
done
IFS=$as_save_IFS
+ test -z "$ac_cv_prog_FILECMD" && ac_cv_prog_FILECMD=":"
fi ;;
esac
fi