2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2024-06-05 15:53:02 +00:00
|
|
|
, pkg-config
|
2023-07-15 17:15:38 +00:00
|
|
|
, ragel
|
|
|
|
, util-linux
|
|
|
|
, python3
|
2024-06-05 15:53:02 +00:00
|
|
|
, boost184
|
|
|
|
, sqlite
|
|
|
|
, pcre
|
2023-07-15 17:15:38 +00:00
|
|
|
, enableShared ? !stdenv.hostPlatform.isStatic
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "vectorscan";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "5.4.11";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "VectorCamp";
|
|
|
|
repo = "vectorscan";
|
|
|
|
rev = "vectorscan/${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-wz2oIhau/vjnri3LOyPZSCFAWg694FTLVt7+SZYEsL4=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2024-06-05 15:53:02 +00:00
|
|
|
pkg-config
|
2023-07-15 17:15:38 +00:00
|
|
|
ragel
|
|
|
|
python3
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optional stdenv.hostPlatform.isLinux util-linux;
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2024-06-05 15:53:02 +00:00
|
|
|
boost184
|
|
|
|
sqlite
|
|
|
|
pcre
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# FAT_RUNTIME bundles optimized implementations for different CPU extensions and uses CPUID to
|
|
|
|
# transparently select the fastest for the current hardware.
|
|
|
|
# This feature is only available on linux for x86, x86_64, and aarch64.
|
|
|
|
#
|
|
|
|
# If FAT_RUNTIME is not available, we fall back to building for a single extension based
|
|
|
|
# on stdenv.hostPlatform.
|
|
|
|
#
|
|
|
|
# For generic builds (e.g. x86_64) this can mean using an implementation not optimized for the
|
|
|
|
# potentially available more modern hardware extensions (e.g. x86_64 with AVX512).
|
|
|
|
cmakeFlags = [ (if enableShared then "-DBUILD_SHARED_LIBS=ON" else "BUILD_STATIC_LIBS=ON") ]
|
|
|
|
++
|
|
|
|
(if lib.elem stdenv.hostPlatform.system [ "x86_64-linux" "i686-linux" ] then
|
|
|
|
[ "-DBUILD_AVX2=ON" "-DBUILD_AVX512=ON" "-DBUILD_AVX512VBMI=ON" "-DFAT_RUNTIME=ON" ]
|
|
|
|
else
|
2024-09-26 11:04:55 +00:00
|
|
|
(if (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) then
|
2024-06-05 15:53:02 +00:00
|
|
|
[ "-DBUILD_SVE=ON" "-DBUILD_SVE2=ON" "-DBUILD_SVE2_BITPERM=ON" "-DFAT_RUNTIME=ON" ]
|
|
|
|
else
|
|
|
|
[ "-DFAT_RUNTIME=OFF" ]
|
|
|
|
++ lib.optional stdenv.hostPlatform.avx2Support "-DBUILD_AVX2=ON"
|
|
|
|
++ lib.optional stdenv.hostPlatform.avx512Support "-DBUILD_AVX512=ON"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
./bin/unit-hyperscan
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Portable fork of the high-performance regular expression matching library";
|
2023-07-15 17:15:38 +00:00
|
|
|
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 will be implemented when hardware becomes accessible to the
|
|
|
|
developers. More platforms will follow in the future, on demand/request.
|
|
|
|
|
|
|
|
Vectorscan will follow 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. In addition, the code will be
|
|
|
|
gradually simplified and made more uniform and all architecture specific
|
|
|
|
code will be abstracted away.
|
|
|
|
'';
|
|
|
|
homepage = "https://www.vectorcamp.gr/vectorscan/";
|
2023-10-09 19:29:22 +00:00
|
|
|
changelog = "https://github.com/VectorCamp/vectorscan/blob/${src.rev}/CHANGELOG-vectorscan.md";
|
2023-07-15 17:15:38 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
license = with licenses; [ bsd3 /* and */ bsd2 /* and */ licenses.boost ];
|
|
|
|
maintainers = with maintainers; [ tnias vlaci ];
|
|
|
|
};
|
|
|
|
}
|