2017-02-02 04:58:13 +01:00
|
|
|
{ stdenv, fetchFromGitHub, autoconf, automake, libtool, pcre
|
2015-10-31 22:59:34 +01:00
|
|
|
, withCrypto ? true, openssl
|
|
|
|
, enableMagic ? true, file
|
|
|
|
, enableCuckoo ? true, jansson
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-01-28 15:25:35 +01:00
|
|
|
version = "3.7.1";
|
2015-10-31 22:59:34 +01:00
|
|
|
name = "yara-${version}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2017-02-02 04:58:13 +01:00
|
|
|
owner = "VirusTotal";
|
2015-10-31 22:59:34 +01:00
|
|
|
repo = "yara";
|
|
|
|
rev = "v${version}";
|
2018-01-28 15:25:35 +01:00
|
|
|
sha256 = "05smkn4ii8irx6ccnzrhwa39pkmrjyxjmfrwh6mhdd8iz51v5cgz";
|
2015-10-31 22:59:34 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
# FIXME: this is probably not the right way to make it work
|
|
|
|
# make[2]: *** No rule to make target 'libyara/.libs/libyara.a', needed by 'yara'. Stop.
|
|
|
|
prePatch = ''
|
|
|
|
cat >staticlibrary.patch <<EOF
|
|
|
|
--- a/Makefile.am 2015-11-01 11:39:12.000000000 +0100
|
|
|
|
+++ b/Makefile.am 2015-11-01 11:45:32.000000000 +0100
|
|
|
|
@@ -12 +12 @@
|
|
|
|
-yara_LDADD = libyara/.libs/libyara.a
|
2017-09-12 21:36:41 +02:00
|
|
|
+yara_LDADD = libyara/.libs/libyara${stdenv.hostPlatform.extensions.sharedLibrary}
|
2015-10-31 22:59:34 +01:00
|
|
|
@@ -15 +15 @@
|
|
|
|
-yarac_LDADD = libyara/.libs/libyara.a
|
2017-09-12 21:36:41 +02:00
|
|
|
+yarac_LDADD = libyara/.libs/libyara${stdenv.hostPlatform.extensions.sharedLibrary}
|
2015-10-31 22:59:34 +01:00
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
patches = [
|
|
|
|
"staticlibrary.patch"
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [ autoconf automake libtool pcre]
|
|
|
|
++ stdenv.lib.optionals withCrypto [ openssl ]
|
|
|
|
++ stdenv.lib.optionals enableMagic [ file ]
|
|
|
|
++ stdenv.lib.optionals enableCuckoo [ jansson ]
|
|
|
|
;
|
|
|
|
|
|
|
|
preConfigure = "./bootstrap.sh";
|
|
|
|
|
|
|
|
configureFlags = ""
|
|
|
|
+ stdenv.lib.optionalString withCrypto "--with-crypto "
|
|
|
|
+ stdenv.lib.optionalString enableMagic "--enable-magic "
|
|
|
|
+ stdenv.lib.optionalString enableCuckoo "--enable-cuckoo "
|
|
|
|
;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "The pattern matching swiss knife for malware researchers";
|
2017-11-22 00:22:08 +01:00
|
|
|
homepage = http://Virustotal.github.io/yara/;
|
2015-10-31 22:59:34 +01:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
|
|
|
};
|
|
|
|
}
|