diff --git a/libs/pcre2/Config.in b/libs/pcre2/Config.in new file mode 100644 index 000000000..8777a4e84 --- /dev/null +++ b/libs/pcre2/Config.in @@ -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 diff --git a/libs/pcre2/Makefile b/libs/pcre2/Makefile index 3c8490305..c8f7a5c80 100644 --- a/libs/pcre2/Makefile +++ b/libs/pcre2/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=pcre2 PKG_VERSION:=10.32 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/pcre/$(PKG_NAME)/$(PKG_VERSION) @@ -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)"