From f589b58808cbc059d144512814a2bf888d081fcf Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 1 Jul 2023 05:41:41 -0400 Subject: [PATCH] hyperscan: new package for speeding up regex ops Hyperscan is a high performance regular expression matching library from Intel that runs on x86 platforms and offers support for Perl Compatible Regular Expressions (PCRE) syntax, simultaneous matching of groups of regular expressions, and streaming operations. This has utility in speeding up snort3. Signed-off-by: John Audia (cherry picked from commit 1db5c5461778223c661ae9206f3c5d6929081b84) --- libs/hyperscan/Makefile | 82 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 libs/hyperscan/Makefile diff --git a/libs/hyperscan/Makefile b/libs/hyperscan/Makefile new file mode 100644 index 0000000000..ce106afa87 --- /dev/null +++ b/libs/hyperscan/Makefile @@ -0,0 +1,82 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=hyperscan +PKG_VERSION:=5.4.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/intel/hyperscan/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=32b0f24b3113bbc46b6bfaa05cf7cf45840b6b59333d078cc1f624e4c40b2b99 + +PKG_MAINTAINER:=John Audia +PKG_LICENSE:=BSD-3-Clause BSD-2-Clause BSL-1.0 +PKG_LICENSE_FILES:=LICENSE +PKG_BUILD_DEPENDS:=ragel/host python3/host boost/host + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +# A minimum of SSSE3 support is required to use hyperscan +# We need to define the C(XX)FLAGS to avoid -march=native being +# used as this is hardcoded by upstream, see: +# https://github.com/intel/hyperscan/blob/master/doc/dev-reference/getting_started.rst +CMAKE_OPTIONS += \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_C_FLAGS="-march=x86-64-v2" \ + -DCMAKE_CXX_FLAGS="-march=x86-64-v2" \ + -Wno-dev + +define Package/hyperscan-headers + CATEGORY:=Libraries + SECTION:=libs + TITLE:=Hyperscan Headers + URL:=https://github.com/intel/hyperscan + DEPENDS:=@TARGET_x86_64 +endef + +define Package/hyperscan-runtime + CATEGORY:=Libraries + SECTION:=libs + TITLE:=Hyperscan Runtime + URL:=https://github.com/intel/hyperscan + DEPENDS:=@TARGET_x86_64 +libstdcpp +endef + +define Package/hyperscan-headers/description + This package contains the headers for Hyperscan. +endef + +define Package/hyperscan-runtime/description + This package contains the shared objects for Hyperscan. +endef + +# This installs files into ./staging_dir/. so that you can cross compile from the host +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include/hs + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/hs/* $(1)/usr/include/hs/ + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libhs* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(INSTALL_DATA) $(PKG_BUILD_DIR)/libhs.pc $(1)/usr/lib/pkgconfig/libhs.pc +endef + +# These install files on the target. Compare with Build/InstallDev +define Package/hyperscan-headers/install + $(INSTALL_DIR) $(1)/usr/include/hs + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/hs/*.h $(1)/usr/include/hs/ +endef + +define Package/hyperscan-runtime/install + $(INSTALL_DIR) $(1)/usr/lib + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libhs* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,hyperscan-headers)) +$(eval $(call BuildPackage,hyperscan-runtime)) -- 2.30.2