package: adds pcre2 to base

This commit is contained in:
coolsnowwolf 2024-01-13 13:44:14 +08:00
parent 10b901b876
commit 4e2a9c59fd
4 changed files with 34 additions and 140 deletions

View File

@ -1,30 +0,0 @@
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

View File

@ -1,109 +0,0 @@
#
# 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

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=acl
PKG_VERSION:=2.3.1
PKG_RELEASE:=$(AUTORELEASE)
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://git.savannah.nongnu.org/cgit/acl.git/snapshot

View File

@ -0,0 +1,33 @@
From 2b42f64737adf6a2ddd491213580d6e9cdd2f5af Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 10 Nov 2022 18:04:15 -0800
Subject: [PATCH] chacl: Use portable version of dirent and readdir
Using 64bit versions on 32bit architectures should be enabled with
--enable-largefile, this makes it portable across musl and glibc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
tools/chacl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/tools/chacl.c
+++ b/tools/chacl.c
@@ -320,7 +320,7 @@ walk_dir(acl_t acl, acl_t dacl, const ch
{
int failed = 0;
DIR *dir;
- struct dirent64 *d;
+ struct dirent *d;
char *name;
if ((dir = opendir(fname)) == NULL) {
@@ -332,7 +332,7 @@ walk_dir(acl_t acl, acl_t dacl, const ch
return(0); /* got a file, not an error */
}
- while ((d = readdir64(dir)) != NULL) {
+ while ((d = readdir(dir)) != NULL) {
/* skip "." and ".." entries */
if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0)
continue;