package: adds pcre2 to base

This commit is contained in:
coolsnowwolf 2024-01-13 13:43:43 +08:00
parent 648202bb8a
commit ce521963da
6 changed files with 159 additions and 183 deletions

View File

@ -6,20 +6,21 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libselinux
PKG_VERSION:=3.3
PKG_RELEASE:=2
PKG_VERSION:=3.5
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/$(PKG_VERSION)
PKG_HASH:=acfdee27633d2496508c28727c3d41d3748076f66d42fccde2e6b9f3463a7057
HOST_BUILD_DEPENDS:=libsepol/host pcre/host
PKG_HASH:=9a3a3705ac13a2ccca2de6d652b6356fead10f36fb33115c185c5ccdf29eec19
PKG_LICENSE:=libselinux-1.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com>
PKG_CPE_ID:=cpe:/a:selinuxproject:libselinux
HOST_BUILD_DEPENDS:=libsepol/host musl-fts/host pcre/host
PKG_BUILD_FLAGS:=no-lto
HOST_BUILD_DEPENDS:=libsepol/host musl-fts/host pcre2/host
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
@ -72,7 +73,7 @@ define Package/libselinux
$(call Package/libselinux/Default)
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libsepol +libpcre +USE_MUSL:musl-fts
DEPENDS:=+libsepol +libpcre2 +USE_MUSL:musl-fts
endef
define Package/libselinux/description
@ -104,7 +105,7 @@ endef
$(foreach a,$(LIBSELINUX_UTILS),$(eval $(call GenUtilPkg,libselinux-$(a),$(a))))
# Needed to link libselinux utilities, which link against
# libselinux.so, which indirectly depends on libpcre.so, installed in
# libselinux.so, which indirectly depends on libpcre2.so, installed in
# $(STAGING_DIR_HOSTPKG).
HOST_LDFLAGS += -Wl,-rpath="$(STAGING_DIR_HOSTPKG)/lib"
@ -115,6 +116,7 @@ HOST_MAKE_FLAGS += \
ifeq ($(CONFIG_USE_MUSL),y)
MAKE_FLAGS += FTS_LDLIBS=-lfts
TARGET_CFLAGS += -D_LARGEFILE64_SOURCE
endif
MAKE_FLAGS += \

View File

@ -0,0 +1,30 @@
config PCRE2_JIT_ENABLED
bool
depends on PACKAGE_libpcre2 && (aarch64 || aarch64_be || arm || i386 || i686 || x86_64 || mips || mipsel || mips64 || mips64el || powerpc || powerpc64 || powerpcle || sparc)
default y if (arm || i686 || x86_64)
prompt "Enable JIT compiler support"
help
Enable JIT (Just-In-Time) compiler support.
Just-in-time compiling is a heavyweight optimization that can greatly
speed up pattern matching. However, it comes at the cost of extra
processing before the match is performed, so it is of most benefit when
the same pattern is going to be matched many times. This does not
necessarily mean many calls of a matching function; if the pattern is
not anchored, matching attempts may take place many times at various
positions in the subject, even for a single call. Therefore, if the
subject string is very long, it may still pay to use JIT even for
one-off matches. JIT support is available for all of the 8-bit, 16-bit
and 32-bit PCRE2 libraries and adds about 100KB to the resulting
libpcre2.so. JIT support applies only to the traditional Perl-compatible
matching function. It does not apply when the DFA matching function is
being used.
Enabling this option can give an about 10x performance increase on JIT
operations. It can be desireable for e.g. high performance Apache
mod_rewrite or HA-Proxy reqrep operations.
However, JIT should _only_ be enabled on architectures that are supported.
Enabling JIT on unsupported platforms will result in a compilation
failure. A list of supported architectures can be found here:
https://pcre.org/current/doc/html/pcre2jit.html#SEC2

109
package/libs/pcre2/Makefile Normal file
View File

@ -0,0 +1,109 @@
#
# Copyright (C) 2017 Shane Peelar
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=pcre2
PKG_VERSION:=10.42
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://github.com/PCRE2Project/pcre2/releases/download/$(PKG_NAME)-$(PKG_VERSION)
PKG_HASH:=8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840
PKG_MAINTAINER:=Shane Peelar <lookatyouhacker@gmail.com>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENCE
PKG_CPE_ID:=cpe:/a:pcre:pcre
PKG_CONFIG_DEPENDS:=\
CONFIG_PACKAGE_libpcre2-16 \
CONFIG_PACKAGE_libpcre2-32 \
CONFIG_PCRE2_JIT_ENABLED
PKG_BUILD_DEPENDS:=zlib
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libpcre2/default
SECTION:=libs
CATEGORY:=Libraries
URL:=https://www.pcre.org/
endef
define Package/libpcre2/config
source "$(SOURCE)/Config.in"
endef
define Package/libpcre2
$(call Package/libpcre2/default)
TITLE:=A Perl Compatible Regular Expression library
endef
define Package/libpcre2-16
$(call Package/libpcre2/default)
TITLE:=A Perl Compatible Regular Expression library (16bit support)
endef
define Package/libpcre2-32
$(call Package/libpcre2/default)
TITLE:=A Perl Compatible Regular Expression library (32bit support)
endef
CMAKE_HOST_OPTIONS += \
-DBUILD_SHARED_LIBS=OFF \
-DPCRE2_BUILD_PCRE2_8=ON \
-DPCRE2_BUILD_PCRE2_16=ON \
-DPCRE2_BUILD_PCRE2_32=ON \
-DPCRE2_DEBUG=OFF \
-DPCRE2_DISABLE_PERCENT_ZT=ON \
-DPCRE2_SUPPORT_JIT=OFF \
-DPCRE2_SHOW_REPORT=OFF \
-DPCRE2_BUILD_PCRE2GREP=OFF \
-DPCRE2_BUILD_TESTS=OFF \
-DPCRE2_STATIC_PIC=ON
CMAKE_OPTIONS += \
-DBUILD_SHARED_LIBS=ON \
-DPCRE2_BUILD_PCRE2_8=ON \
-DPCRE2_BUILD_PCRE2_16=O$(if $(CONFIG_PACKAGE_libpcre2-16),N,FF) \
-DPCRE2_BUILD_PCRE2_32=O$(if $(CONFIG_PACKAGE_libpcre2-32),N,FF) \
-DPCRE2_DEBUG=OFF \
-DPCRE2_DISABLE_PERCENT_ZT=ON \
-DPCRE2_SUPPORT_JIT=O$(if $(CONFIG_PCRE2_JIT_ENABLED),N,FF) \
-DPCRE2_SHOW_REPORT=OFF \
-DPCRE2_BUILD_PCRE2GREP=OFF \
-DPCRE2_BUILD_TESTS=OFF
define Build/InstallDev
$(call Build/InstallDev/cmake,$(1))
$(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' $(1)/usr/bin/pcre2-config
$(INSTALL_DIR) $(2)/bin
$(LN) ../../usr/bin/pcre2-config $(2)/bin/pcre2-config
endef
define Package/libpcre2/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcre2-{8,posix}.so* $(1)/usr/lib/
endef
define Package/libpcre2-16/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcre2-16.so* $(1)/usr/lib/
endef
define Package/libpcre2-32/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpcre2-32.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libpcre2))
$(eval $(call BuildPackage,libpcre2-16))
$(eval $(call BuildPackage,libpcre2-32))
$(eval $(call HostBuild))

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=f2fs-tools
PKG_VERSION:=1.15.0
PKG_RELEASE:=1
PKG_VERSION:=1.16.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/snapshot/
PKG_HASH:=147d471040b44900283ce2c935f1d35d13d7f40008e7cb8fab2b69f54da01a4f
PKG_HASH:=208c7a07e95383fbd7b466b5681590789dcb41f41bf197369c41a95383b57c5e
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0-only
@ -111,6 +111,10 @@ endif
CONFIGURE_VARS += \
ac_cv_file__git=no
ifneq ($(CONFIG_USE_MUSL),)
CONFIGURE_VARS += ac_cv_func_lseek64=yes
endif
define Package/libf2fs/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
@ -129,17 +133,16 @@ Package/mkf2fs-selinux/install = $(Package/mkf2fs/install)
define Package/f2fsck/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fsck.f2fs $(1)/usr/sbin
ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/defrag.f2fs
ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/dump.f2fs
ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/sload.f2fs
ln -s /usr/sbin/fsck.f2fs $(1)/usr/sbin/resize.f2fs
$(LN) ../sbin/fsck.f2fs $(1)/usr/sbin/defrag.f2fs
$(LN) ../sbin/fsck.f2fs $(1)/usr/sbin/dump.f2fs
$(LN) ../sbin/fsck.f2fs $(1)/usr/sbin/sload.f2fs
$(LN) ../sbin/fsck.f2fs $(1)/usr/sbin/resize.f2fs
endef
Package/f2fsck-selinux/install = $(Package/f2fsck/install)
define Package/f2fs-tools/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/f2fstat $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fibmap.f2fs $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/parse.f2fs $(1)/usr/sbin
endef

View File

@ -1,88 +0,0 @@
From 9af8ee5baceab59d46154c96da62b52935f363fe Mon Sep 17 00:00:00 2001
From: Nick Hainke <vincent@systemli.org>
Date: Mon, 27 Jun 2022 20:43:11 +0200
Subject: [PATCH] configure.ac: fix AC_ARG_WITH
In the new version the configuration no longer respects the
--without/--with blkid/selinux parameters. Add the tests for
"with_blkid" and "with_selinux" back to configure.ac as described
in the manual.
Link: https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/External-Software.html
Fixes: c48335416a09 ("configure.ac: Enable cross-compilation")
Signed-off-by: Nick Hainke <vincent@systemli.org>
---
configure.ac | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
--- a/configure.ac
+++ b/configure.ac
@@ -39,12 +39,16 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign
# Test configure options.
AC_ARG_WITH([selinux],
- AS_HELP_STRING([--without-selinux],
- [Ignore presence of libselinux and disable selinux support]))
+ [AS_HELP_STRING([--without-selinux],
+ [Ignore presence of libselinux and disable selinux support])],
+ [],
+ [with_selinux=check])
AC_ARG_WITH([blkid],
- AS_HELP_STRING([--without-blkid],
- [Ignore presence of libblkid and disable blkid support]))
+ [AS_HELP_STRING([--without-blkid],
+ [Ignore presence of libblkid and disable blkid support])],
+ [],
+ [with_blkid=check])
# Checks for programs.
AC_PROG_CC
@@ -55,11 +59,17 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
[$PATH:/sbin])
# Checks for libraries.
-AC_CHECK_LIB([blkid], [blkid_probe_all],
- [AC_SUBST([libblkid_LIBS], ["-lblkid"])
- AC_DEFINE([HAVE_LIBBLKID], [1],
- [Define if you have libblkid])
- ], [], [])
+AS_IF([test "x$with_blkid" != xno],
+ [AC_CHECK_LIB([blkid], [blkid_probe_all],
+ [AC_SUBST([libblkid_LIBS], ["-lblkid"])
+ AC_DEFINE([HAVE_LIBBLKID], [1],
+ [Define if you have libblkid])
+ ],
+ [if test "x$with_blkid" != xcheck; then
+ AC_MSG_FAILURE(
+ [--with-blkid was given, but test for blkid failed])
+ fi
+ ], -lblkid)])
AC_CHECK_LIB([lzo2], [main],
[AC_SUBST([liblzo2_LIBS], ["-llzo2"])
@@ -73,11 +83,17 @@ AC_CHECK_LIB([lz4], [main],
[Define if you have liblz4])
], [], [])
-AC_CHECK_LIB([selinux], [getcon],
- [AC_SUBST([libselinux_LIBS], ["-lselinux"])
- AC_DEFINE([HAVE_LIBSELINUX], [1],
- [Define if you have libselinux])
- ], [], [])
+AS_IF([test "x$with_selinux" != xno],
+ [AC_CHECK_LIB([selinux], [getcon],
+ [AC_SUBST([libselinux_LIBS], ["-lselinux"])
+ AC_DEFINE([HAVE_LIBSELINUX], [1],
+ [Define if you have libselinux])
+ ],
+ [if test "x$with_selinux" != xcheck; then
+ AC_MSG_FAILURE(
+ [--with-selinux was given, but test for selinux failed])
+ fi
+ ], -lselinux)])
AC_CHECK_LIB([uuid], [uuid_clear],
[AC_SUBST([libuuid_LIBS], ["-luuid"])

View File

@ -1,80 +0,0 @@
From 821a1d3fcce31c234512a8f4dc4fc97dfbd7ae32 Mon Sep 17 00:00:00 2001
From: Nick Hainke <vincent@systemli.org>
Date: Mon, 4 Jul 2022 09:46:10 +0200
Subject: [PATCH] configure.ac: fix cross compilation
AC_CHECK_LIB seems to not work correctly with OpenWrt. Add possibility
to disable lz4 and lzo2 manually.
Fixes errors in the form of:
Package f2fsck is missing dependencies for the following libraries:
liblz4.so.1
liblzo2.so.2
Signed-off-by: Nick Hainke <vincent@systemli.org>
---
configure.ac | 44 ++++++++++++++++++++++++++++++++++----------
1 file changed, 34 insertions(+), 10 deletions(-)
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,18 @@ AC_ARG_WITH([blkid],
[],
[with_blkid=check])
+AC_ARG_WITH([lzo2],
+ [AS_HELP_STRING([--without-lzo2],
+ [Ignore presence of liblzo2 and disable lzo2 support])],
+ [],
+ [with_lzo2=check])
+
+AC_ARG_WITH([lz4],
+ [AS_HELP_STRING([--without-lz4],
+ [Ignore presence of liblz4 and disable lz4 support])],
+ [],
+ [with_lz4=check])
+
# Checks for programs.
AC_PROG_CC
AM_PROG_AR
@@ -71,17 +83,29 @@ AS_IF([test "x$with_blkid" != xno],
fi
], -lblkid)])
-AC_CHECK_LIB([lzo2], [main],
- [AC_SUBST([liblzo2_LIBS], ["-llzo2"])
- AC_DEFINE([HAVE_LIBLZO2], [1],
- [Define if you have liblzo2])
- ], [], [])
-
-AC_CHECK_LIB([lz4], [main],
- [AC_SUBST([liblz4_LIBS], ["-llz4"])
- AC_DEFINE([HAVE_LIBLZ4], [1],
- [Define if you have liblz4])
- ], [], [])
+AS_IF([test "x$with_lzo2" != xno],
+ [AC_CHECK_LIB([lzo2], [main],
+ [AC_SUBST([liblzo2_LIBS], ["-llzo2"])
+ AC_DEFINE([HAVE_LIBLZO2], [1],
+ [Define if you have liblzo2])
+ ],
+ [if test "x$with_lzo2" != xcheck; then
+ AC_MSG_FAILURE(
+ [--with-lzo2 was given, but test for lzo2 failed])
+ fi
+ ], -llzo2)])
+
+AS_IF([test "x$with_lz4" != xno],
+ [AC_CHECK_LIB([lz4], [main],
+ [AC_SUBST([liblz4_LIBS], ["-llz4"])
+ AC_DEFINE([HAVE_LIBLZ4], [1],
+ [Define if you have liblz4])
+ ],
+ [if test "x$with_lz4" != xcheck; then
+ AC_MSG_FAILURE(
+ [--with-lz4 was given, but test for lz4 failed])
+ fi
+ ], -llz4)])
AS_IF([test "x$with_selinux" != xno],
[AC_CHECK_LIB([selinux], [getcon],