summaryrefslogtreecommitdiff
blob: 19e846a09a830ddf3ff3629b4dddeadbdf6636ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{9..11} )

inherit cmake flag-o-matic python-any-r1

DESCRIPTION="High-performance regular expression matching library"
SRC_URI="https://github.com/intel/hyperscan/archive/v${PV}.tar.gz -> ${P}.tar.gz"
HOMEPAGE="
	https://www.hyperscan.io/
	https://github.com/intel/hyperscan
"

LICENSE="BSD"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
IUSE="cpu_flags_x86_avx2 cpu_flags_x86_ssse3"

RDEPEND="dev-libs/boost:="
DEPEND="${RDEPEND}"
BDEPEND="
	${PYTHON_DEPS}
	dev-util/ragel
"

# We can't default this to on as it's against the expectation of
# how CPU_FLAGS_* work for users.
REQUIRED_USE="cpu_flags_x86_ssse3"

src_prepare() {
	# Respect user -O flags
	sed -i '/set(OPT_CX*_FLAG/d' CMakeLists.txt || die

	# upstream workaround
	append-cxxflags -Wno-redundant-move
	cmake_src_prepare
}

src_configure() {
	use cpu_flags_x86_ssse3 && append-flags -mssse3
	use cpu_flags_x86_avx2  && append-flags -mavx2

	local mycmakeargs=(
		-DBUILD_SHARED_LIBS=ON
		-DBUILD_STATIC_AND_SHARED=OFF
		-DBUILD_EXAMPLES=OFF
		-DFAT_RUNTIME=false
	)
	cmake_src_configure
}

src_test() {
	"${BUILD_DIR}"/bin/unit-hyperscan || die
}

pkg_postinst() {
	if has_version '<mail-filter/rspamd-3.5'; then
		elog "There is known issue with <mail-filter/rspamd-3.5 when hyperscan version changes."
		elog "Known workaround is to remove hyperscan databases ${EROOT}/var/lib/rspamd/*.hs*"
		elog "See https://github.com/rspamd/rspamd/issues/4409 for more information."
	fi
}