[145484] trunk/dports/security/yara

khindenburg at macports.org khindenburg at macports.org
Sat Feb 6 22:03:12 PST 2016


Revision: 145484
          https://trac.macports.org/changeset/145484
Author:   khindenburg at macports.org
Date:     2016-02-06 22:03:12 -0800 (Sat, 06 Feb 2016)
Log Message:
-----------
yara: update to 3.4.0 #44816
    - move to github
    - add python subports

Modified Paths:
--------------
    trunk/dports/security/yara/Portfile

Added Paths:
-----------
    trunk/dports/security/yara/files/
    trunk/dports/security/yara/files/patch-261.diff

Modified: trunk/dports/security/yara/Portfile
===================================================================
--- trunk/dports/security/yara/Portfile	2016-02-07 05:34:32 UTC (rev 145483)
+++ trunk/dports/security/yara/Portfile	2016-02-07 06:03:12 UTC (rev 145484)
@@ -3,34 +3,79 @@
 
 PortSystem              1.0
 
-name                    yara
-version                 1.7
+PortGroup               github 1.0
+
+github.setup            plusvic yara 3.4.0 v
 categories              security
 license                 GPL-2+
 platforms               darwin
 maintainers             yendor.net:a.schuster \
                         openmaintainer
-                        
+
 description             Malware identification and classification tool
 long_description \
     YARA is a tool aimed at helping malware researchers to identify and \
     classify malware samples.
 
-homepage                http://code.google.com/p/yara-project/
-master_sites            googlecode:yara-project
+checksums               rmd160  7453926c9deee005bda62dc252f37fe4bf769cd6 \
+                        sha256  43a597a48b1a5b39ea43de016db697c8d77d652e21e12848f166d9afaec1c5b6
 
-checksums               rmd160  12ca8b2eb7a8b7de3fae8d97e728d4847299d99a \
-                        sha256  fcee06a2f43ab65c88597de54d630a3beee925e7e84c890a8303f08a3fc85c91
+if {${subport} eq ${name}} {
+    # https://github.com/plusvic/yara/pull/261
+    patchfiles          patch-261.diff
+    patch.pre_args      -p1
 
-depends_lib             port:pcre
+    depends_build       port:autoconf \
+                        port:automake \
+                        port:libtool
 
-post-patch {
-    # fix use of inline for clang compatibility
-    reinplace "s|inline|static inline|g" ${worksrcpath}/libyara/scan.c
+    depends_lib         port:libmagic \
+                        port:jansson \
+                        path:lib/libssl.dylib:openssl \
+                        port:pcre
+
+    pre-configure {
+        system -W ${worksrcpath} "./bootstrap.sh"
+    }
+
+    configure.cflags-append -std=gnu89
+    configure.args-append   --with-crypto \
+                            --enable-cuckoo \
+                            --enable-magic \
 }
 
-variant re2 description "uses re2 library instead of pcre for regular expression parsing" {
-    configure.args-append   --with-re2
-    depends_lib-append      port:re2
-    depends_lib-delete      port:pcre
+set python.versions {27 34 35}
+
+foreach v ${python.versions} {
+    set python.version         ${v}
+    set python.branch          [string range ${python.version} 0 end-1].[string index ${python.version} end]
+    set python.bin             ${prefix}/bin/python${python.branch}
+    set python.prefix          ${frameworks_dir}/Python.framework/Versions/${python.branch}
+
+    subport py${python.version}-${name} {
+        categories              security python
+        description             ${name} bindings for python ${python.branch}
+        long_description        Malware identification and classification tool. \
+                                    This subport provides bindings for python ${python.branch}
+
+        worksrcdir              ${github.project}-${version}/yara-python
+
+        depends_lib-append      port:${name} \
+                                port:python${python.version}
+
+        use_configure           no
+
+        build.cmd               ${python.bin} setup.py --no-user-cfg
+        build.target            build
+
+        destroot.cmd            ${python.bin} setup.py --no-user-cfg
+        destroot.destdir        --prefix=${python.prefix} --root=${destroot}
+
+        test.run                yes
+        test.cmd                ${python.bin} tests.py
+        test.env                PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
+        test.target
+
+        livecheck.type          none
+    }
 }

Added: trunk/dports/security/yara/files/patch-261.diff
===================================================================
--- trunk/dports/security/yara/files/patch-261.diff	                        (rev 0)
+++ trunk/dports/security/yara/files/patch-261.diff	2016-02-07 06:03:12 UTC (rev 145484)
@@ -0,0 +1,48 @@
+diff --git a/libyara/modules/math.c b/libyara/modules/math.c
+index 2365032..c2d1e34 100644
+--- a/libyara/modules/math.c
++++ b/libyara/modules/math.c
+@@ -42,7 +42,9 @@ define_function(string_entropy)
+   if (data == NULL)
+     return_float(UNDEFINED);
+ 
+-  for (int i = 0; i < s->length; i++)
++  int i;
++
++  for (i = 0; i < s->length; i++)
+   {
+     uint8_t c = s->c_string[i];
+     data[c] += 1;
+@@ -50,7 +52,7 @@ define_function(string_entropy)
+ 
+   double entropy = 0.0;
+ 
+-  for (int i = 0; i < 256; i++)
++  for (i = 0; i < 256; i++)
+   {
+     if (data[i] != 0)
+     {
+diff --git a/yara.c b/yara.c
+index 61fb234..42fb739 100644
+--- a/yara.c
++++ b/yara.c
+@@ -1014,7 +1014,9 @@ int main(
+     thread_args.rules = rules;
+     thread_args.start_time = start_time;
+ 
+-    for (int i = 0; i < threads; i++)
++    int i;
++
++    for (i = 0; i < threads; i++)
+     {
+       if (create_thread(&thread[i], scanning_thread, (void*) &thread_args))
+       {
+@@ -1033,7 +1035,7 @@ int main(
+     file_queue_finish();
+ 
+     // Wait for scan threads to finish
+-    for (int i = 0; i < threads; i++)
++    for (i = 0; i < threads; i++)
+       thread_join(&thread[i]);
+ 
+     file_queue_destroy();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160206/94cd440a/attachment.html>


More information about the macports-changes mailing list