Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rspamd: add hyperscan, drop obsoleted dependencies #49915

Merged
merged 7 commits into from Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 69 additions & 0 deletions pkgs/development/libraries/hyperscan/default.nix
@@ -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"
andir marked this conversation as resolved.
Show resolved Hide resolved
];

prePatch = ''
sed -i '/examples/d' CMakeLists.txt
'';

postInstall = ''
mkdir -p $dev/lib
andir marked this conversation as resolved.
Show resolved Hide resolved
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;
};
}
31 changes: 23 additions & 8 deletions pkgs/servers/mail/rspamd/default.nix
@@ -1,33 +1,48 @@
{ 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"
"-DRUNDIR=/var/run/rspamd"
"-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 ];
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -10201,6 +10201,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; };
} //
Expand Down