2019-05-12 09:44:06 +02:00
|
|
|
{ stdenv, fetchFromGitHub, cmake, ragel, python3
|
|
|
|
, coreutils, gnused, utillinux
|
2018-11-08 17:00:15 +01:00
|
|
|
, boost
|
2019-05-12 09:44:06 +02:00
|
|
|
, withStatic ? false # build only shared libs by default, build static+shared if true
|
2018-11-08 17:00:15 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
# NOTICE: pkgconfig, pcap and pcre intentionally omitted from build inputs
|
|
|
|
# pcap used only in examples, pkgconfig used only to check for pcre
|
|
|
|
# which is fixed 8.41 version requirement (nixpkgs have 8.42+, and
|
|
|
|
# I not see any reason (for now) to backport 8.41.
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "hyperscan";
|
2019-11-02 05:40:32 +01:00
|
|
|
version = "5.2.1";
|
2018-11-08 17:00:15 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "intel";
|
2019-05-12 09:44:06 +02:00
|
|
|
repo = pname;
|
2019-11-02 05:40:32 +01:00
|
|
|
sha256 = "09dgvmjhdbrfgrsmjljl4wn06a8zlv9sd4d4l6h6bfbz57d35f95";
|
2018-11-08 17:00:15 +01:00
|
|
|
rev = "v${version}";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
buildInputs = [ boost ];
|
2019-05-12 09:44:06 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake ragel python3
|
|
|
|
# Consider simply using busybox for these
|
|
|
|
# Need at least: rev, sed, cut, nm
|
|
|
|
coreutils gnused utillinux
|
|
|
|
];
|
2018-11-08 17:00:15 +01:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DFAT_RUNTIME=ON"
|
|
|
|
"-DBUILD_AVX512=ON"
|
2019-05-12 09:44:06 +02:00
|
|
|
]
|
|
|
|
++ stdenv.lib.optional (withStatic) "-DBUILD_STATIC_AND_SHARED=ON"
|
|
|
|
++ stdenv.lib.optional (!withStatic) "-DBUILD_SHARED_LIBS=ON";
|
2018-11-08 17:00:15 +01:00
|
|
|
|
2019-05-12 09:44:06 +02:00
|
|
|
postPatch = ''
|
2018-11-08 17:00:15 +01:00
|
|
|
sed -i '/examples/d' CMakeLists.txt
|
2019-05-12 09:44:06 +02:00
|
|
|
substituteInPlace libhs.pc.in \
|
|
|
|
--replace "libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" "libdir=@CMAKE_INSTALL_LIBDIR@" \
|
|
|
|
--replace "includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@"
|
2018-11-08 17:00:15 +01:00
|
|
|
'';
|
|
|
|
|
2019-05-12 09:44:06 +02:00
|
|
|
meta = with stdenv.lib; {
|
2018-11-08 17:00:15 +01:00
|
|
|
description = "High-performance multiple regex matching library";
|
|
|
|
longDescription = ''
|
|
|
|
Hyperscan is a high-performance multiple regex matching library.
|
|
|
|
It follows the regular expression syntax of the commonly-used
|
|
|
|
libpcre library, but is a standalone library with its own C API.
|
|
|
|
|
|
|
|
Hyperscan uses hybrid automata techniques to allow simultaneous
|
|
|
|
matching of large numbers (up to tens of thousands) of regular
|
|
|
|
expressions and for the matching of regular expressions across
|
|
|
|
streams of data.
|
|
|
|
|
|
|
|
Hyperscan is typically used in a DPI library stack.
|
|
|
|
'';
|
|
|
|
|
2019-05-12 09:44:06 +02:00
|
|
|
homepage = "https://www.hyperscan.io/";
|
|
|
|
maintainers = with maintainers; [ avnik ];
|
|
|
|
platforms = [ "x86_64-linux" ]; # can't find nm on darwin ; might build on aarch64 but untested
|
|
|
|
license = licenses.bsd3;
|
2018-11-08 17:00:15 +01:00
|
|
|
};
|
|
|
|
}
|