Merge pull request #232314 from tnias/pyperscan

This commit is contained in:
Sandro 2023-05-24 17:15:05 +02:00 committed by GitHub
commit e1761a43dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,60 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, ragel
, util-linux
, python3
, boost
, enableShared ? !stdenv.hostPlatform.isStatic
}:
stdenv.mkDerivation rec {
pname = "vectorscan";
version = "5.4.9";
src = fetchFromGitHub {
owner = "VectorCamp";
repo = "vectorscan";
rev = "vectorscan/${version}";
hash = "sha256-V5Qgr8aH1H+ZoJ0IZ52HIDRZq+yIwHjLf3gU/ZhjjlY=";
};
nativeBuildInputs = [
cmake
ragel
util-linux
python3
];
buildInputs = [
boost
];
cmakeFlags = lib.optional enableShared "-DBUILD_STATIC_AND_SHARED=ON"
++ [ "-DFAT_RUNTIME=${if stdenv.hostPlatform.isLinux then "ON" else "OFF"}" ]
++ lib.optional stdenv.hostPlatform.avx2Support "-DBUILD_AVX2=ON"
++ lib.optional stdenv.hostPlatform.avx512Support "-DBUILD_AVX512=ON"
;
meta = with lib; {
description = "A portable fork of the high-performance regular expression matching library";
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/";
changelog = "https://github.com/VectorCamp/vectorscan/blob/${src.rev}/CHANGELOG.md";
platforms = platforms.unix;
license = with licenses; [ bsd3 /* and */ bsd2 /* and */ licenses.boost ];
maintainers = with maintainers; [ tnias vlaci ];
};
}

View File

@ -0,0 +1,51 @@
{ lib
, stdenv
, fetchFromGitHub
, buildPythonPackage
, rustPlatform
, pytestCheckHook
, libiconv
, vectorscan
}:
buildPythonPackage rec {
pname = "pyperscan";
version = "0.2.2";
format = "pyproject";
src = fetchFromGitHub {
owner = "vlaci";
repo = "pyperscan";
rev = "v${version}";
hash = "sha256-ioNGEmWy+lEzazF1RzMFS06jYLNYll3QSlWAF0AoU7Y=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
name = "${pname}-${version}";
hash = "sha256-2zppyxJ+XaI/JCkp7s27/jgtSbwxnI4Yil5KT8WgrVI=";
};
nativeBuildInputs = with rustPlatform; [
bindgenHook
cargoSetupHook
maturinBuildHook
];
checkInputs = [ pytestCheckHook ];
buildInputs = [ vectorscan ] ++ lib.optional stdenv.isDarwin libiconv;
# Disable default features to use the system vectorscan library instead of a vendored one.
maturinBuildFlags = [ "--no-default-features" ];
pythonImportsCheck = [ "pyperscan" ];
meta = with lib; {
description = "a hyperscan binding for Python, which supports vectorscan";
homepage = "https://github.com/vlaci/pyperscan";
platforms = platforms.unix;
license = with licenses; [ asl20 /* or */ mit ];
maintainers = with maintainers; [ tnias vlaci ];
};
}

View File

@ -13475,6 +13475,8 @@ with pkgs;
vcstool = callPackage ../development/tools/vcstool { };
vectorscan = callPackage ../development/libraries/vectorscan { };
verco = callPackage ../applications/version-management/verco { };
verilator = callPackage ../applications/science/electronics/verilator { };

View File

@ -9018,6 +9018,8 @@ self: super: with self; {
pyperclip = callPackage ../development/python-modules/pyperclip { };
pyperscan = callPackage ../development/python-modules/pyperscan { };
pyperf = callPackage ../development/python-modules/pyperf { };
pyphen = callPackage ../development/python-modules/pyphen { };