commit:     67f5c22e9566299ac05f869410599f337136e146
Author:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 29 09:23:30 2023 +0000
Commit:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
CommitDate: Wed Nov 29 21:12:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67f5c22e

dev-libs/vectorscan: new package, add 5.4.11

vectorscan is more portable drop-in replacement of hyperscan.

Signed-off-by: Petr Vaněk <arkamar <AT> gentoo.org>

 dev-libs/vectorscan/Manifest                 |  1 +
 dev-libs/vectorscan/metadata.xml             | 24 +++++++++
 dev-libs/vectorscan/vectorscan-5.4.11.ebuild | 74 ++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)

diff --git a/dev-libs/vectorscan/Manifest b/dev-libs/vectorscan/Manifest
new file mode 100644
index 000000000000..7919322c4dca
--- /dev/null
+++ b/dev-libs/vectorscan/Manifest
@@ -0,0 +1 @@
+DIST vectorscan-5.4.11.tar.gz 1895332 BLAKE2B 
a8f5a1230af0ddf7d9fb9299769ec1736d37ac3284f6a98b1e650af461206cf459eac35d13a47beb6683786c6529539b2d082edf426e7d4890ed11804c76268b
 SHA512 
ed74e441c1106a90b344898320d20b74726db86af338dee8c908db941a88e73355ca87c6d64e212eb860bf76a96121021ebaabd48ce359b47634caaee9df3e5e

diff --git a/dev-libs/vectorscan/metadata.xml b/dev-libs/vectorscan/metadata.xml
new file mode 100644
index 000000000000..45e25fefd6d7
--- /dev/null
+++ b/dev-libs/vectorscan/metadata.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Petr Vaněk</name>
+       </maintainer>
+       <longdescription>
+               A fork of Intel's Hyperscan, modified to run on more platforms.
+               Currently ARM NEON/ASIMD is 100% functional, and Power VSX are 
in
+               development. ARM SVE2 support is in ongoing with access to 
hardware now.
+               More platforms will follow in the future.
+
+               Vectorscan follows Intel's API and internal algorithms where
+               possible, but will not hesitate to make code changes where it 
is thought
+               of giving better performance or better portability.
+       </longdescription>
+       <slots>
+               <subslots>libhs soname version</subslots>
+       </slots>
+       <upstream>
+               <remote-id type="github">VectorCamp/vectorscan</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/dev-libs/vectorscan/vectorscan-5.4.11.ebuild 
b/dev-libs/vectorscan/vectorscan-5.4.11.ebuild
new file mode 100644
index 000000000000..b047e39dd69f
--- /dev/null
+++ b/dev-libs/vectorscan/vectorscan-5.4.11.ebuild
@@ -0,0 +1,74 @@
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake edo flag-o-matic
+
+DESCRIPTION="A portable fork of the high-performance regular expression 
matching library"
+HOMEPAGE="
+       https://www.vectorcamp.gr/vectorscan/
+       https://github.com/VectorCamp/vectorscan
+"
+SRC_URI="
+       
https://github.com/VectorCamp/vectorscan/archive/refs/tags/${PN}/${PV}.tar.gz
+               -> ${P}.tar.gz
+"
+
+S="${WORKDIR}/${PN}-${P}"
+
+LICENSE="BSD"
+SLOT="0/5"
+KEYWORDS="~amd64"
+IUSE="cpu_flags_x86_avx2 cpu_flags_x86_sse4_2"
+
+DEPEND="
+       dev-libs/boost:=
+"
+RDEPEND="
+       ${DEPEND}
+       !dev-libs/hyperscan
+"
+BDEPEND="
+       dev-util/ragel
+       virtual/pkgconfig
+"
+
+REQUIRED_USE="
+       x86? ( cpu_flags_x86_sse4_2 )
+       amd64? ( cpu_flags_x86_sse4_2 )
+"
+
+src_prepare() {
+       local sedargs=(
+               # Respect user -m flags (march/mtune)
+               -e '/set(ARCH_CX*_FLAG/d'
+               # Respect user -O flags
+               -e '/set(OPT_CX*_FLAG/d'
+       )
+       sed -i "${sedargs[@]}" CMakeLists.txt cmake/cflags-x86.cmake || die
+       cmake_src_prepare
+}
+
+src_configure() {
+       use cpu_flags_x86_avx2 && append-flags -mavx2
+       use cpu_flags_x86_sse4_2 && append-flags -msse4.2
+
+       local mycmakeargs=(
+               -DBUILD_BENCHMARKS=OFF
+               -DBUILD_EXAMPLES=OFF
+               -DBUILD_SHARED_LIBS=ON
+
+               -DBUILD_AVX2=$(usex cpu_flags_x86_avx2)
+
+               -DUSE_CPU_NATIVE=OFF
+       )
+       cmake_src_configure
+}
+
+src_test() {
+       # The unit target cannot be used currently due to a bug in it,
+       # see https://github.com/VectorCamp/vectorscan/issues/202
+       #cmake_build unit
+       edo "${BUILD_DIR}/bin/unit-hyperscan"
+}

Reply via email to