Merge pull request #49915 from avnik/rspamd

rspamd: add hyperscan, drop obsoleted dependencies
This commit is contained in:
Renaud 2018-12-03 07:40:07 +01:00 committed by GitHub
commit 550b275bac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 8 deletions

View file

@ -0,0 +1,69 @@
{ lib, stdenv, fetchFromGitHub, cmake, ragel, python27
, boost
}:
# 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 {
name = "${pname}-${version}";
pname = "hyperscan";
version = "5.0.0";
src = fetchFromGitHub {
owner = "intel";
repo = "hyperscan";
sha256 = "017dxg0n3gn9i4j27rcvpnp4rkqgycqni6x5d15dqpidl7zg7059";
rev = "v${version}";
};
outputs = [ "out" "dev" ];
buildInputs = [ boost ];
nativeBuildInputs = [ cmake ragel python27 ];
cmakeFlags = [
"-DFAT_RUNTIME=ON"
"-DBUILD_AVX512=ON"
"-DBUILD_STATIC_AND_SHARED=ON"
];
prePatch = ''
sed -i '/examples/d' CMakeLists.txt
'';
postInstall = ''
mkdir -p $dev/lib
mv $out/lib/*.a $dev/lib/
ln -sf $out/lib/libhs.so $dev/lib/
ln -sf $out/lib/libhs_runtime.so $dev/lib/
'';
postFixup = ''
sed -i "s,$out/include,$dev/include," $dev/lib/pkgconfig/libhs.pc
sed -i "s,$out/lib,$dev/lib," $dev/lib/pkgconfig/libhs.pc
'';
meta = {
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.
'';
homepage = https://www.hyperscan.io/;
maintainers = with lib.maintainers; [ avnik ];
platforms = [ "x86_64-linux" "x86_64-darwin" ];
license = lib.licenses.bsd3;
};
}

View file

@ -1,22 +1,34 @@
{ stdenv, fetchFromGitHub, cmake, perl
, file, glib, gmime, libevent, luajit, openssl, pcre, pkgconfig, sqlite, ragel, icu, libfann }:
{ stdenv, lib, fetchFromGitHub, cmake, perl
, file, glib, libevent, luajit, openssl, pcre, pkgconfig, sqlite, ragel, icu
, hyperscan, libfann, gd, jemalloc, openblas
, withFann ? true
, withGd ? false
, withBlas ? true
, withHyperscan ? stdenv.isx86_64
}:
assert withHyperscan -> stdenv.isx86_64;
let libmagic = file; # libmagic provided by file package ATM
in
stdenv.mkDerivation rec {
name = "rspamd-${version}";
version = "1.8.1";
version = "1.8.2";
src = fetchFromGitHub {
owner = "vstakhov";
owner = "rspamd";
repo = "rspamd";
rev = version;
sha256 = "1cgnychv8yz7a6mjg3b12nzs4gl0xqg9agl7m6faihnh7gqx4xld";
sha256 = "0al4d8h3ssxcx191d4crywz7dsp61lklc9m5z36a90a8w97v76bv";
};
nativeBuildInputs = [ cmake pkgconfig perl ];
buildInputs = [ glib gmime libevent libmagic luajit openssl pcre sqlite ragel icu libfann ];
buildInputs = [ glib libevent libmagic luajit openssl pcre sqlite ragel icu jemalloc ]
++ lib.optional withFann libfann
++ lib.optional withGd gd
++ lib.optional withHyperscan hyperscan
++ lib.optional withBlas openblas;
cmakeFlags = [
"-DDEBIAN_BUILD=ON"
@ -24,10 +36,13 @@ stdenv.mkDerivation rec {
"-DDBDIR=/var/lib/rspamd"
"-DLOGDIR=/var/log/rspamd"
"-DLOCAL_CONFDIR=/etc/rspamd"
];
"-DENABLE_JEMALLOC=ON"
] ++ lib.optional withFann "-DENABLE_FANN=ON"
++ lib.optional withHyperscan "-DENABLE_HYPERSCAN=ON"
++ lib.optional withGd "-DENABLE_GD=ON";
meta = with stdenv.lib; {
homepage = https://github.com/vstakhov/rspamd;
homepage = https://rspamd.com;
license = licenses.asl20;
description = "Advanced spam filtering system";
maintainers = with maintainers; [ avnik fpletz ];

View file

@ -10203,6 +10203,8 @@ with pkgs;
hyena = callPackage ../development/libraries/hyena { mono = mono4; };
hyperscan = callPackage ../development/libraries/hyperscan { };
icu58 = callPackage (import ../development/libraries/icu/58.nix fetchurl) ({
nativeBuildRoot = buildPackages.icu58.override { buildRootOnly = true; };
} //