--- /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/science/root/Portfile	2011-12-08 21:00:29.000000000 +0000
+++ science/root/Portfile	2011-12-10 18:39:06.000000000 +0000
@@ -1,11 +1,11 @@
 # -*- 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 87844 2011-12-08 20:33:56Z pixilla@macports.org $
+# $Id: Portfile 86663 2011-10-31 16:08:47Z macsforever2000@macports.org $
 
 PortSystem          1.0
 
 name                root
 version             5.32.00
-revision            0
+revision            1
 categories          science
 maintainers         gmail.com:mattiafrancescomoro hep.phy.cam.ac.uk:jonesc
 license             LGPL-2.1+
@@ -40,9 +40,10 @@
 
 patchfiles          patch-configure.diff
 
-if {${configure.compiler} == "clang"} {
-    configure.compiler llvm-gcc-4.2
-}
+# Clang seems OK now, with the new --with-clang option below
+# if {${configure.compiler} == "clang"} {
+#      configure.compiler llvm-gcc-4.2
+# }
 
 post-patch {
     reinplace "s|-lfreetype| \`freetype-config --libs\`|g" ${worksrcpath}/config/root-config.in
@@ -53,11 +54,19 @@
 }
 
 pre-configure {
-    configure.args-append \
-                    --with-cc=${configure.cc} \
-                    --with-cxx=${configure.cxx} \
-                    --with-ld=${configure.cxx} \
-                    --with-f77=${configure.f77}
+    if {${configure.compiler} == "clang"} {
+        configure.args-append --with-clang
+    } else {
+        if {${configure.compiler} == "macports-clang-3.1"} {
+            configure.args-append --with-clang
+        } else {
+            configure.args-append \
+             --with-cc=${configure.cc} \
+             --with-cxx=${configure.cxx} \
+             --with-ld=${configure.cxx} \
+             --with-f77=${configure.f77}
+        }
+    }
     # the build type (32 or 64 bit) -must- be for first argument
     if {${build_arch} == "i386" || ${build_arch} == "ppc"} {
        configure.pre_args macosx --prefix=${prefix}
@@ -84,8 +93,6 @@
                     --disable-opengl \
                     --disable-pythia6 \
                     --disable-pythia8 \
-                    --disable-qt \
-                    --disable-qtgsi \
                     --disable-roofit \
                     --disable-ssl \
                     --disable-xml \
@@ -100,9 +107,20 @@
                     --disable-ruby \
                     --disable-minuit2 \
                     --disable-tmva \
+                    --disable-qt \
+                    --disable-qtgsi \
+                    --disable-bonjour \
+                    --disable-gviz \
+                    --disable-soversion \
                     --with-x11-libdir=${prefix}/lib \
                     --with-xpm-libdir=${prefix}/lib \
-                    --enable-builtin-ftgl 
+                    --enable-builtin-ftgl \
+                    --enable-mathmore \
+                    --enable-genvector \
+                    --enable-memstat \
+                    --enable-unuran \
+                    --enable-reflex \
+                    --enable-table
 
 pre-build {
     build.args      CC=${configure.cc} \
@@ -112,7 +130,28 @@
 
 universal_variant   no
 
-default_variants    +ssl +xml +gsl +minuit2 +tmva +roofit
+default_variants    +ssl +xml +gsl +minuit2 +tmva +roofit +graphviz +opengl +soversion
+
+variant soversion description {Builds port with soversion support} {
+    configure.args-delete   --disable-soversion
+    configure.args-append   --enable-soversion
+}
+
+variant graphviz description {Builds port with graphviz support} {
+    configure.args-delete   --disable-gviz
+    configure.args-append   --enable-gviz \
+                            --with-gviz-incdir="${prefix}/include/graphviz" \
+                            --with-gviz-libdir="${prefix}/lib"
+    depends_lib-append      port:graphviz
+}
+
+variant avahi description {Builds port with avahi support} {
+    configure.args-delete   --disable-bonjour
+    configure.args-append   --enable-bonjour \
+                            --with-avahi-incdir="${prefix}/include" \
+                            --with-avahi-libdir="${prefix}/lib"
+    depends_lib-append      port:avahi
+}
 
 variant fftw3 description {Builds port with fftw3 support} {
     configure.args-delete   --disable-fftw3
@@ -177,12 +216,8 @@
 
 variant opengl description {Builds port with opengl support} {
     configure.args-delete   --disable-opengl
-    configure.args-append   --enable-opengl \
-                            --with-opengl-incdir="${prefix}/include" \
-                            --with-opengl-libdir="${prefix}/lib" \
-                            --with-glew-incdir="${prefix}/include" \
-                            --with-glew-libdir="${prefix}/lib"
-    depends_lib-append      port:glew port:mesa
+    configure.args-delete   --disable-builtin-glew
+    configure.args-append   --enable-opengl --enable-builtin-glew
 }
 
 variant python26 conflicts python32 python31 python27 description {Builds port with python 2.6 support} {
@@ -272,7 +307,10 @@
 
     configure.env-append    QTDIR=${prefix}/libexec/qt4-x11
     configure.args-delete   --disable-qt
-    configure.args-append   --enable-qt
+    configure.args-delete   --disable-qtgsi
+    configure.args-append   --enable-qt --enable-qtgsi \
+                            --with-qt-incdir="${prefix}/include" \
+                            --with-qt-libdir="${prefix}/lib"
     depends_lib-append      port:qt4-x11
 }
 
@@ -296,7 +334,11 @@
     }
 
     configure.args-delete   --disable-qt
-    configure.args-append   --enable-qt
+    configure.args-delete   --disable-qtgsi
+    configure.args-append   --enable-qt --enable-qtgsi \
+                            --with-qt-incdir="${prefix}/include" \
+                            --with-qt-libdir="${prefix}/lib"
+    depends_lib-append      port:qt4-mac
 
     post-configure {
         # patch up the Makefile.config to handle the QTLIB frameworks correctly
@@ -331,21 +373,36 @@
     depends_lib-append      port:pythia
 }
 
-variant gcc44 conflicts gcc45 gcc46 description {Compile using MacPorts gcc 4.4} {
+variant gcc43 conflicts gcc44 gcc45 gcc46 description {Compile using MacPorts gcc 4.3} {
+    configure.compiler      macports-gcc-4.3
+    depends_lib-append      port:gcc43
+}
+
+variant gcc44 conflicts gcc43 gcc45 gcc46 description {Compile using MacPorts gcc 4.4} {
     configure.compiler      macports-gcc-4.4
     depends_lib-append      port:gcc44
 }
 
-variant gcc45 conflicts gcc44 gcc46 description {Compile using MacPorts gcc 4.5} {
+variant gcc45 conflicts gcc43 gcc44 gcc46 description {Compile using MacPorts gcc 4.5} {
     configure.compiler      macports-gcc-4.5
     depends_lib-append      port:gcc45
 }
 
-variant gcc46 conflicts gcc44 gcc45 description {Compile using MacPorts gcc 4.6} {
+variant gcc46 conflicts gcc43 gcc44 gcc45 description {Compile using MacPorts gcc 4.6} {
     configure.compiler      macports-gcc-4.6
     depends_lib-append      port:gcc46
 }
 
+# variant clang31 conflicts gcc43 gcc44 gcc45 gcc46 description {EXPERIMENTAL - Compile using MacPorts clang 3.1} {
+#     configure.compiler      macports-clang-3.1
+#     depends_lib-append      port:clang-3.1
+#     configure.args-append   --with-llvm-config="${prefix}/bin/llvm-config"
+# }
+
+# variant cling description {EXPERIMENTAL - Enable cling interpreter backend. Requires clang31 variant as well.} {
+#     configure.args-append --enable-cling
+# }
+
 # Build issues. 
 # variant kerberos5 description {Builds port with kerberos5 support} {
 #     configure.args-delete   --disable-krb5
