1 { lib, stdenv, fetchFromGitHub, cmake, ragel, python3
2 , util-linux, fetchpatch
4 , withStatic ? false # build only shared libs by default, build static+shared if true
7 # NOTICE: pkg-config, pcap and pcre intentionally omitted from build inputs
8 # pcap used only in examples, pkg-config used only to check for pcre
9 # which is fixed 8.41 version requirement (nixpkgs have 8.42+, and
10 # I not see any reason (for now) to backport 8.41.
12 stdenv.mkDerivation rec {
16 src = fetchFromGitHub {
19 sha256 = "sha256-AJAjaXVnGqIlMk+gb6lpTLUdZr8nxn2XSW4fj6j/cmk=";
23 outputs = [ "out" "dev" ];
25 buildInputs = [ boost ];
28 # Consider simply using busybox for these
29 # Need at least: rev, sed, cut, nm
37 ++ lib.optional (withStatic) "-DBUILD_STATIC_AND_SHARED=ON"
38 ++ lib.optional (!withStatic) "-DBUILD_SHARED_LIBS=ON";
42 # part of https://github.com/intel/hyperscan/pull/336
43 url = "https://github.com/intel/hyperscan/commit/e2c4010b1fc1272cab816ba543940b3586e68a0c.patch";
44 sha256 = "sha256-doVNwROL6MTcgOW8jBwGTnxe0zvxjawiob/g6AvXLak=";
49 sed -i '/examples/d' CMakeLists.txt
50 substituteInPlace libhs.pc.in \
51 --replace "libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" "libdir=@CMAKE_INSTALL_LIBDIR@" \
52 --replace "includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" "includedir=@CMAKE_INSTALL_INCLUDEDIR@"
56 description = "High-performance multiple regex matching library";
58 Hyperscan is a high-performance multiple regex matching library.
59 It follows the regular expression syntax of the commonly-used
60 libpcre library, but is a standalone library with its own C API.
62 Hyperscan uses hybrid automata techniques to allow simultaneous
63 matching of large numbers (up to tens of thousands) of regular
64 expressions and for the matching of regular expressions across
67 Hyperscan is typically used in a DPI library stack.
70 homepage = "https://www.hyperscan.io/";
71 maintainers = with maintainers; [ avnik ];
72 platforms = [ "x86_64-linux" ]; # can't find nm on darwin ; might build on aarch64 but untested
73 license = licenses.bsd3;