--- _orig/net/zabbix2/Portfile	2013-12-14 00:00:26.000000000 -0500
+++ net/zabbix2/Portfile	2014-05-16 18:37:18.000000000 -0400
@@ -4,10 +4,10 @@
 PortSystem          1.0
 
 name                zabbix2
-version             2.2.1
+version             2.2.3
 revision            0
 categories          net
-maintainers         nomaintainer
+maintainers         yahoo.fr:jul_bsd openmaintainer
 platforms           darwin
 
 license             GPL-2
@@ -18,7 +18,7 @@
                     performance monitoring solution. Zabbix offers advanced \
                     monitoring, alerting, and visualization features today \
                     which are missing in other monitoring systems, even some \
-                    of the best commercial ones. 
+                    of the best commercial ones.
 
 distname            zabbix-${version}
 livecheck.name      zabbix
@@ -28,9 +28,8 @@
     sourceforge:project/zabbix/ZABBIX%20Latest%20Stable/${version} \
     sourceforge:project/zabbix/ZABBIX%20Release%20Candidates/${version}
 
-checksums \
-    rmd160  24cfecc6825245b8a3ae15c23ffe38236cd37cd4 \
-    sha256  29c9e4cefb527bf929797b26a5a1d8a07c55675bfe6a86ff9ef8e46bd792c7fb
+checksums           rmd160  c5d4a156b90c50089dd1c8f91bcc3af054d3c97a \
+                    sha256  12a75762d474227f9af8b44abe48dd2660a76713335a37fc8147aca3c79844c1
 
 universal_variant   no
 
@@ -55,6 +54,9 @@
 
 startupitem.create      yes
 
+destroot.asroot         yes
+install.asroot          yes
+
 if { ${name} ne ${subport} } {
     startupitem.name        zabbix2-agentd
     startupitem.executable  \
@@ -66,12 +68,7 @@
 } else {
     depends_lib-append      port:fping \
                             port:curl \
-                            port:apache2 \
-                            port:php5 \
-                            port:php5-gd \
-                            port:php5-gettext \
-                            port:php5-mbstring \
-                            port:php5-sockets
+                            port:apache2
 
     configure.args-append   --enable-server \
                             --with-libcurl=${prefix}/bin/curl-config \
@@ -141,6 +138,37 @@
 
         eval $variant_line
     }
+    array set PHPLIST {
+        php53   {"PHP 5.3"            php53 }
+        php54   {"PHP 5.4"            php54 }
+        php55   {"PHP 5.5"            php55 }
+    }
+    set PHPLIST_KEYS [lsort [array names PHPLIST]]
+    foreach dbitem $PHPLIST_KEYS {
+        set this_key [lsearch -exact $PHPLIST_KEYS $dbitem]
+        set conf_list [lreplace $PHPLIST_KEYS $this_key $this_key]
+        set prms $PHPLIST($dbitem)
+        
+        set variant_line {variant $dbitem description \
+          "Use [lindex ${prms} 0] for PHP" }
+
+        foreach over ${conf_list} {
+            append variant_line " conflicts ${over}"
+        }
+
+        append variant_line { "
+            depends_lib-append      port:[lindex ${prms} 1] \
+                                    port:[lindex ${prms} 1]-gd \
+                                    port:[lindex ${prms} 1]-gettext \
+                                    port:[lindex ${prms} 1]-mbstring \
+                                    port:[lindex ${prms} 1]-sockets
+            ## no php configure option
+            #configure.args-append   --with-[lindex ${prms} 2]
+
+        " }
+
+        eval $variant_line
+    }
 
     if {![variant_isset mysql51] &&
         ![variant_isset mysql55] &&
@@ -152,7 +180,12 @@
         ![variant_isset pgsql83] &&
         ![variant_isset pgsql84] &&
         ![variant_isset sqlite3]} {
-        default_variants +mysql5
+        default_variants-append +mysql5
+    }
+    if {![variant_isset php53] &&
+        ![variant_isset php54] &&
+        ![variant_isset php55]} {
+        default_variants-append +php55
     }
 
 # Notify anyone with +agent_only installed of new zabbix2-agent port
@@ -298,7 +331,7 @@
 
 2) Setup the ZABBIX MySQL database
 
- For other databases, follow documentation from 
+ For other databases, follow documentation from
  https://www.zabbix.com/documentation/2.0/manual/appendix/install/db_scripts
 
 -Create the ZABBIX database
@@ -342,7 +375,7 @@
 
     sudo port load zabbix2
 
-   To start Zabbix manually, use: 
+   To start Zabbix manually, use:
     ${prefix}/share/zabbix/zabbix_server.init start (stop|status)
 
  !! Note: Your shared memory will likely need to be increased  !!
