--- _orig/security/yara/Portfile	2013-07-15 12:03:51.000000000 -0400
+++ security/yara/Portfile	2015-02-15 11:55:41.000000000 -0500
@@ -1,36 +1,158 @@
 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
-# $Id: Portfile 105138 2013-04-11 21:29:42Z ryandesign@macports.org $
+# $Id$
 
 PortSystem              1.0
+PortGroup               github 1.0
 
-name                    yara
-version                 1.7
+github.setup			plusvic yara 3.3.0 v 
+revision                0
 categories              security
-license                 GPL-2+
 platforms               darwin
+license                 Apache-2.0
 maintainers             yendor.net:a.schuster \
                         openmaintainer
                         
-description             Malware identification and classification tool
+description             The pattern matching swiss knife for malware researchers
 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
+homepage                http://${github.author}.github.io/${github.project}/
+master_sites            https://github.com/${github.author}/${github.project}/archive/
+distname                v${version}
+checksums				rmd160  330de9de9294953a3a42032ccc5ae849f065ab5e \
+                        sha256  e5f4359082e35ff00ee94af9ee897bb0ab18abf49a2c4fe45968d7a848e5bd83
+
+# specifics for yara library and tools
+
+if {${subport} eq ${name}} {
+
+	worksrcdir				${github.project}-${version}
+	
+	pre-configure {
+	    if {${subport} ne "${name}1"} {
+	        system -W ${worksrcpath} "/bin/sh bootstrap.sh"
+	    }
+	}
+
+	use_configure           yes
+## Note: 2 lines, just to ensure correct build even when yara1 installed 
+##      (conflict seems to apply only on install, not build)(Not working)
+    configure.cppflags-delete   "-I${prefix}/include"
+    configure.cppflags-append   "-I./include -I${prefix}/include"
+
+	depends_build           port:automake \
+	                        port:libtool
+	
+	test.run                no
+	
+	variant cuckoo description {Add support for Cuckoo sandbox} {
+		depends_lib-append			port:jansson
+		configure.args-append		--enable-cuckoo
+	}
+
+	variant hash description {Add md5, sha1, and sha256 hash functions} {
+		depends_lib-append			port:openssl
+		configure.args-append		--enable-hash \
+									--with-crypto
+	}
+
+	variant magic description {Add filetype detection by libmagic} {
+		depends_lib-append			port:libmagic
+		configure.args-append		--enable-magic
+	}	
+	
+	variant math description {Add entropy tests and other helper functions} {
+		configure.args-append		--enable-math
+	}
 
-checksums               rmd160  12ca8b2eb7a8b7de3fae8d97e728d4847299d99a \
-                        sha256  fcee06a2f43ab65c88597de54d630a3beee925e7e84c890a8303f08a3fc85c91
+    conflicts  ${name}-devel ${name}1 ${name}31
+}
+
+
+# specifics for python bindings
 
-depends_lib             port:pcre
+set python.versions { 27 33 34}
 
-post-patch {
-    # fix use of inline for clang compatibility
-    reinplace "s|inline|static inline|g" ${worksrcpath}/libyara/scan.c
+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		${long_description}\
+			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}
+		test.target				tests.py
+    }
 }
 
-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
+#subport ${name}-devel {
+#    conflicts  ${name} ${name}1
+#
+#    version             20150213
+#    distname            4994a2cdff17e54b5e55507e494223abdca441dd
+#	worksrcdir			${github.project}-${distname}
+#
+#    checksums           rmd160  8552997c163449e40e24ececfa33e1804536d2a4 \
+#                        sha256  96547086306df8a793ec11e49e2c98ddbcc87cb8cf96e42a5344e1904896e56c
+#
+#	pre-configure {
+#	    if {${subport} ne "${name}1"} {
+#	        system -W ${worksrcpath} "/bin/sh bootstrap.sh"
+#	    }
+#	}
+#
+#    livecheck.type      none
+#}
+
+subport ${name}1 {
+    conflicts  ${name} ${name}-devel
+
+    version             1.7
+    license             GPL-2+
+    master_sites        googlecode:yara-project
+    distname            yara-${version}
+    checksums           rmd160  12ca8b2eb7a8b7de3fae8d97e728d4847299d99a \
+                        sha256  fcee06a2f43ab65c88597de54d630a3beee925e7e84c890a8303f08a3fc85c91
+
+    use_autoconf        no
+    use_automake        no
+    depends_lib-append  port:pcre
+    depends_build-delete       port:libtool
+    post-patch {
+        # fix use of inline for clang compatibility
+        reinplace "s|inline|static inline|g" ${worksrcpath}/libyara/scan.c
+    }
+
+    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
+    }
+
+    notes "
+Yara 1 is End Of Life and not supported anymore. It's recommended to move to latest Yara.
+"
+
+    livecheck.type          none
 }
+
