Merge pull request #10652 from gladiac1337/pcre2-jit-co

pcre2: Update to v10.34 & add JIT-support for select architectures
This commit is contained in:
Rosen Penev 2019-12-30 21:51:14 -08:00 committed by GitHub
commit ae23ebdd28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 3 deletions

30
libs/pcre2/Config.in Normal file
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

View file

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=pcre2
PKG_VERSION:=10.32
PKG_VERSION:=10.34
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/pcre/$(PKG_NAME)/$(PKG_VERSION)
PKG_HASH:=f29e89cc5de813f45786580101aaee3984a65818631d4ddbda7b32f699b87c2e
PKG_HASH:=74c473ffaba9e13db6951fd146e0143fe9887852ce73406a03277af1d9b798ca
PKG_MAINTAINER:=Shane Peelar <lookatyouhacker@gmail.com>
PKG_LICENSE:=BSD-3-Clause
@ -25,6 +25,9 @@ PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
PKG_CONFIG_DEPENDS:=\
CONFIG_PCRE2_JIT_ENABLED
include $(INCLUDE_DIR)/package.mk
define Package/libpcre2/default
@ -33,6 +36,10 @@ define Package/libpcre2/default
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
@ -53,7 +60,8 @@ TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--enable-pcre2-16 \
--enable-pcre2-32
--enable-pcre2-32 \
$(if $(CONFIG_PCRE2_JIT_ENABLED),--enable-jit,--disable-jit)
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS)"