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

67 lines
1.8 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
, enableCuckoo ? true, jansson
2021-03-28 12:15:33 +01:00
, enableDex ? true
, enableDotNet ? true
, enableMacho ? true
, enableMagic ? true, file
2015-10-31 21:59:34 +00:00
}:
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 enableCuckoo "cuckoo")
2021-03-28 12:15:33 +01:00
(lib.enableFeature enableDex "dex")
(lib.enableFeature enableDotNet "dotnet")
(lib.enableFeature enableMacho "macho")
(lib.enableFeature enableMagic "magic")
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;
2021-04-12 18:53:11 +01:00
maintainers = with maintainers; [ fab ];
2020-05-24 06:41:26 +01:00
platforms = platforms.all;
2015-10-31 21:59:34 +00:00
};
}