12 , enableShared ? !stdenv.hostPlatform.isStatic
15 stdenv.mkDerivation rec {
19 src = fetchFromGitHub {
22 rev = "vectorscan/${version}";
23 hash = "sha256-wz2oIhau/vjnri3LOyPZSCFAWg694FTLVt7+SZYEsL4=";
31 ] ++ lib.optional stdenv.hostPlatform.isLinux util-linux;
39 # FAT_RUNTIME bundles optimized implementations for different CPU extensions and uses CPUID to
40 # transparently select the fastest for the current hardware.
41 # This feature is only available on linux for x86, x86_64, and aarch64.
43 # If FAT_RUNTIME is not available, we fall back to building for a single extension based
44 # on stdenv.hostPlatform.
46 # For generic builds (e.g. x86_64) this can mean using an implementation not optimized for the
47 # potentially available more modern hardware extensions (e.g. x86_64 with AVX512).
48 cmakeFlags = [ (if enableShared then "-DBUILD_SHARED_LIBS=ON" else "BUILD_STATIC_LIBS=ON") ]
50 (if lib.elem stdenv.hostPlatform.system [ "x86_64-linux" "i686-linux" ] then
51 [ "-DBUILD_AVX2=ON" "-DBUILD_AVX512=ON" "-DBUILD_AVX512VBMI=ON" "-DFAT_RUNTIME=ON" ]
53 (if (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) then
54 [ "-DBUILD_SVE=ON" "-DBUILD_SVE2=ON" "-DBUILD_SVE2_BITPERM=ON" "-DFAT_RUNTIME=ON" ]
56 [ "-DFAT_RUNTIME=OFF" ]
57 ++ lib.optional stdenv.hostPlatform.avx2Support "-DBUILD_AVX2=ON"
58 ++ lib.optional stdenv.hostPlatform.avx512Support "-DBUILD_AVX512=ON"
72 description = "Portable fork of the high-performance regular expression matching library";
74 A fork of Intel's Hyperscan, modified to run on more platforms. Currently
75 ARM NEON/ASIMD is 100% functional, and Power VSX are in development.
76 ARM SVE2 will be implemented when hardware becomes accessible to the
77 developers. More platforms will follow in the future, on demand/request.
79 Vectorscan will follow Intel's API and internal algorithms where possible,
80 but will not hesitate to make code changes where it is thought of giving
81 better performance or better portability. In addition, the code will be
82 gradually simplified and made more uniform and all architecture specific
83 code will be abstracted away.
85 homepage = "https://www.vectorcamp.gr/vectorscan/";
86 changelog = "https://github.com/VectorCamp/vectorscan/blob/${src.rev}/CHANGELOG-vectorscan.md";
87 platforms = platforms.unix;
88 license = with licenses; [ bsd3 /* and */ bsd2 /* and */ licenses.boost ];
89 maintainers = with maintainers; [ tnias vlaci ];