git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #49915 from avnik/rspamd

rspamd: add hyperscan, drop obsoleted dependencies

commit550b275bacb52a00a630f5b56677bbf1d1109efa authorRenaud <c0bw3b@users.noreply.github.com> dateMon 3 Dec 2018, 07:40 (8 years ago) parent3008c2a2fd6de3
3 files changed+94−8
pkgs/development/libraries/hyperscan/default.nix+69 pkgs/servers/mail/rspamd/default.nix+23−8 pkgs/top-level/all-packages.nix+2
pkgs/development/libraries/hyperscan/default.nixnew file+69
@@ -0,0 +1,69 @@
1+{ lib, stdenv, fetchFromGitHub, cmake, ragel, python27
2+, boost
3+}:
4+
5+# NOTICE: pkgconfig, pcap and pcre intentionally omitted from build inputs
6+# pcap used only in examples, pkgconfig used only to check for pcre
7+# which is fixed 8.41 version requirement (nixpkgs have 8.42+, and
8+# I not see any reason (for now) to backport 8.41.
9+
10+stdenv.mkDerivation rec {
11+ name = "${pname}-${version}";
12+ pname = "hyperscan";
13+ version = "5.0.0";
14+
15+ src = fetchFromGitHub {
16+ owner = "intel";
17+ repo = "hyperscan";
18+ sha256 = "017dxg0n3gn9i4j27rcvpnp4rkqgycqni6x5d15dqpidl7zg7059";
19+ rev = "v${version}";
20+ };
21+
22+ outputs = [ "out" "dev" ];
23+
24+ buildInputs = [ boost ];
25+ nativeBuildInputs = [ cmake ragel python27 ];
26+
27+ cmakeFlags = [
28+ "-DFAT_RUNTIME=ON"
29+ "-DBUILD_AVX512=ON"
30+ "-DBUILD_STATIC_AND_SHARED=ON"
31+ ];
32+
33+ prePatch = ''
34+ sed -i '/examples/d' CMakeLists.txt
35+ '';
36+
37+ postInstall = ''
38+ mkdir -p $dev/lib
39+ mv $out/lib/*.a $dev/lib/
40+ ln -sf $out/lib/libhs.so $dev/lib/
41+ ln -sf $out/lib/libhs_runtime.so $dev/lib/
42+ '';
43+
44+ postFixup = ''
45+ sed -i "s,$out/include,$dev/include," $dev/lib/pkgconfig/libhs.pc
46+ sed -i "s,$out/lib,$dev/lib," $dev/lib/pkgconfig/libhs.pc
47+ '';
48+
49+ meta = {
50+ description = "High-performance multiple regex matching library";
51+ longDescription = ''
52+ Hyperscan is a high-performance multiple regex matching library.
53+ It follows the regular expression syntax of the commonly-used
54+ libpcre library, but is a standalone library with its own C API.
55+
56+ Hyperscan uses hybrid automata techniques to allow simultaneous
57+ matching of large numbers (up to tens of thousands) of regular
58+ expressions and for the matching of regular expressions across
59+ streams of data.
60+
61+ Hyperscan is typically used in a DPI library stack.
62+ '';
63+
64+ homepage = https://www.hyperscan.io/;
65+ maintainers = with lib.maintainers; [ avnik ];
66+ platforms = [ "x86_64-linux" "x86_64-darwin" ];
67+ license = lib.licenses.bsd3;
68+ };
69+}
pkgs/servers/mail/rspamd/default.nix+23−8
@@ -1,22 +1,34 @@
1−{ stdenv, fetchFromGitHub, cmake, perl
2−, file, glib, gmime, libevent, luajit, openssl, pcre, pkgconfig, sqlite, ragel, icu, libfann }:
1+{ stdenv, lib, fetchFromGitHub, cmake, perl
2+, file, glib, libevent, luajit, openssl, pcre, pkgconfig, sqlite, ragel, icu
3+, hyperscan, libfann, gd, jemalloc, openblas
4+, withFann ? true
5+, withGd ? false
6+, withBlas ? true
7+, withHyperscan ? stdenv.isx86_64
8+}:
9+
10+assert withHyperscan -> stdenv.isx86_64;
311
412let libmagic = file; # libmagic provided by file package ATM
513in
614
715stdenv.mkDerivation rec {
816 name = "rspamd-${version}";
9− version = "1.8.1";
17+ version = "1.8.2";
1018
1119 src = fetchFromGitHub {
12− owner = "vstakhov";
20+ owner = "rspamd";
1321 repo = "rspamd";
1422 rev = version;
15− sha256 = "1cgnychv8yz7a6mjg3b12nzs4gl0xqg9agl7m6faihnh7gqx4xld";
23+ sha256 = "0al4d8h3ssxcx191d4crywz7dsp61lklc9m5z36a90a8w97v76bv";
1624 };
1725
1826 nativeBuildInputs = [ cmake pkgconfig perl ];
19− buildInputs = [ glib gmime libevent libmagic luajit openssl pcre sqlite ragel icu libfann ];
27+ buildInputs = [ glib libevent libmagic luajit openssl pcre sqlite ragel icu jemalloc ]
28+ ++ lib.optional withFann libfann
29+ ++ lib.optional withGd gd
30+ ++ lib.optional withHyperscan hyperscan
31+ ++ lib.optional withBlas openblas;
2032
2133 cmakeFlags = [
2234 "-DDEBIAN_BUILD=ON"
@@ -24,10 +36,13 @@ stdenv.mkDerivation rec {
2436 "-DDBDIR=/var/lib/rspamd"
2537 "-DLOGDIR=/var/log/rspamd"
2638 "-DLOCAL_CONFDIR=/etc/rspamd"
27− ];
39+ "-DENABLE_JEMALLOC=ON"
40+ ] ++ lib.optional withFann "-DENABLE_FANN=ON"
41+ ++ lib.optional withHyperscan "-DENABLE_HYPERSCAN=ON"
42+ ++ lib.optional withGd "-DENABLE_GD=ON";
2843
2944 meta = with stdenv.lib; {
30− homepage = https://github.com/vstakhov/rspamd;
45+ homepage = https://rspamd.com;
3146 license = licenses.asl20;
3247 description = "Advanced spam filtering system";
3348 maintainers = with maintainers; [ avnik fpletz ];
pkgs/top-level/all-packages.nix+2
@@ -10203,6 +10203,8 @@ with pkgs;
1020310203
1020410204 hyena = callPackage ../development/libraries/hyena { mono = mono4; };
1020510205
10206+ hyperscan = callPackage ../development/libraries/hyperscan { };
10207+
1020610208 icu58 = callPackage (import ../development/libraries/icu/58.nix fetchurl) ({
1020710209 nativeBuildRoot = buildPackages.icu58.override { buildRootOnly = true; };
1020810210 } //