3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/security/yara/default.nix

60 lines
1.6 KiB
Nix
Raw Normal View History

{ lib, stdenv
2021-02-27 13:59:08 +00:00
, fetchpatch
2020-05-24 06:41:26 +01:00
, fetchFromGitHub
, autoreconfHook
, pcre
, pkg-config
, protobufc
2015-10-31 21:59:34 +00:00
, withCrypto ? true, openssl
, enableMagic ? true, file
, enableCuckoo ? true, jansson
}:
stdenv.mkDerivation rec {
2021-02-27 13:59:08 +00:00
version = "4.0.5";
pname = "yara";
2015-10-31 21:59:34 +00:00
src = fetchFromGitHub {
2017-02-02 03:58:13 +00:00
owner = "VirusTotal";
2015-10-31 21:59:34 +00:00
repo = "yara";
rev = "v${version}";
2021-02-27 13:59:08 +00:00
sha256 = "1gkdll2ygdlqy1f27a5b84gw2bq75ss7acsx06yhiss90qwdaalq";
2015-10-31 21:59:34 +00:00
};
2020-05-24 06:41:26 +01:00
nativeBuildInputs = [ autoreconfHook pkg-config ];
2019-11-10 14:26:49 +00:00
2020-05-24 06:41:26 +01:00
buildInputs = [ pcre protobufc ]
2021-01-15 09:19:50 +00:00
++ lib.optionals withCrypto [ openssl ]
++ lib.optionals enableMagic [ file ]
++ lib.optionals enableCuckoo [ jansson ]
2015-10-31 21:59:34 +00:00
;
preConfigure = "./bootstrap.sh";
2021-02-27 13:59:08 +00:00
# If static builds are disabled, `make all-am` will fail to find libyara.a and
# cause a build failure. It appears that somewhere between yara 4.0.1 and
# 4.0.5, linking the yara binaries dynamically against libyara.so was broken.
#
# This was already fixed in yara master. Backport the patch to yara 4.0.5.
patches = [
(fetchpatch {
name = "fix-build-with-no-static.patch";
url = "https://github.com/VirusTotal/yara/commit/52e6866023b9aca26571c78fb8759bc3a51ba6dc.diff";
sha256 = "074cf99j0rqiyacp60j1hkvjqxia7qwd11xjqgcr8jmfwihb38nr";
})
];
2018-07-25 22:44:21 +01:00
configureFlags = [
2021-01-15 09:19:50 +00:00
(lib.withFeature withCrypto "crypto")
(lib.enableFeature enableMagic "magic")
(lib.enableFeature enableCuckoo "cuckoo")
2018-07-25 22:44:21 +01:00
];
2015-10-31 21:59:34 +00:00
meta = with lib; {
2015-10-31 21:59:34 +00:00
description = "The pattern matching swiss knife for malware researchers";
2020-05-24 06:41:26 +01:00
homepage = "http://Virustotal.github.io/yara/";
license = licenses.asl20;
platforms = platforms.all;
2015-10-31 21:59:34 +00:00
};
}