Index: /trunk/dports/science/mpich2-devel/Portfile
===================================================================
--- /trunk/dports/science/mpich2-devel/Portfile	(revision 98583)
+++ /trunk/dports/science/mpich2-devel/Portfile	(revision 98584)
@@ -6,6 +6,7 @@
 name                mpich2-devel
 set pkgname         mpich2
-version             1.5rc3
+version             1.5
 revision            0
+epoch               20121008
 license             BSD
 categories          science parallel net
@@ -29,6 +30,6 @@
 
 checksums   \
-    rmd160  7a21996f3b8ab0dfa9f72335f53a4b3c120f0b84 \
-    sha256  31beae6f6344f600ed43ad8bbcca21a04fbbfc225608e7c51e7ab2e83fd9e9fc
+    rmd160  69572f5c435aec1ef37af197f7509cfc073ce53a \
+    sha256  7175926fc2e4230f00201e880318c08de4f949c0dbe167fe1b2e256ac79d5f66
 
 depends_lib-append  port:libxml2
Index: /trunk/dports/science/mpich2/Portfile
===================================================================
--- /trunk/dports/science/mpich2/Portfile	(revision 98583)
+++ /trunk/dports/science/mpich2/Portfile	(revision 98584)
@@ -5,6 +5,9 @@
 
 name                mpich2
-version             1.4.1p1
-revision            1
+set pkgname         mpich2
+version             1.5
+revision            0
+# Added to keep in line with mpich2-devel
+epoch               20121008 
 license             BSD
 categories          science parallel net
@@ -25,13 +28,17 @@
 homepage            http://www.mcs.anl.gov/research/projects/mpich2/
 master_sites        ${homepage}downloads/tarballs/${version}/
+distname            ${pkgname}-${version}
 
-checksums           md5     b470666749bcb4a0449a072a18e2c204 \
-                    sha1    8dcc8888fb27232eb8f76c11cc890f1c3c483804 \
-                    rmd160  1d355cc07b8675af77b1c255fd10696844447298
+checksums   \
+    rmd160  69572f5c435aec1ef37af197f7509cfc073ce53a \
+    sha256  7175926fc2e4230f00201e880318c08de4f949c0dbe167fe1b2e256ac79d5f66
+
+depends_lib-append  port:libxml2
 
 # Don't build if lammpi is around.
 pre-configure {
     if {[file exists ${prefix}/etc/lammpi/lam-helpfile]} {
-        ui_error "Cannot co-exist with lammpi; please deactivate lammpi before configuring."
+        ui_error \
+    "Cannot co-exist with lammpi; please deactivate lammpi before configuring."
         return -code error
     }
@@ -40,63 +47,57 @@
 pre-build {
     if {[file exists ${prefix}/etc/lammpi/lam-helpfile]} {
-        ui_error "Cannot co-exist with lammpi; please deactivate lammpi before building."
+        ui_error \
+    "Cannot co-exist with lammpi; please deactivate lammpi before building."
         return -code error
     }
 }
 
-# Puts all entries in <prefix>/share into appropriate mpich2 subdirs
-destroot.args       PACKAGE=mpich2
-patchfiles          patch-src-util-createshlib.in
+configure.args      --disable-dependency-tracking \
+                    --disable-f77 \
+                    --disable-fc \
+                    --disable-silent-rules \
+                    --enable-alloca \
+                    --enable-base-cache \
+                    --enable-cache \
+                    --enable-cxx \
+                    --enable-fast=O2 \
+                    --enable-shared \
+                    --enable-smpcoll \
+                    --includedir=${prefix}/include/${pkgname} \
+                    --with-device=ch3:nemesis \
+                    --with-mpe \
+                    --with-pm=hydra \
+                    --with-thread-package=posix \
+                    "F90FLAGS='' F90=''" \
+                    MPICH2LIB_CPPFLAGS=-I${prefix}/include
 
-# the default include-dir conflicts with openmpi!
-configure.args      --with-thread-package=posix \
-                    --enable-timer-type=mach_absolute_time \
-                    --enable-cxx \
-                    --mandir=${prefix}/share/man \
-                    --docdir=${prefix}/share/doc/${name} \
-                    --htmldir=${prefix}/share/doc/${name} \
-                    --includedir=${prefix}/include/${name} \
-                    --disable-f77 --disable-fc \
-                    --with-mpe \
-                    --with-device=ch3:nemesis \
-                    "F90FLAGS='' F90=''" \
-                    --with-pm=hydra \
-                    --enable-shared \
-                    --enable-cache \
-                    --enable-smpcoll \
-                    --enable-base-cache
+platform darwin {
+    configure.args-append   --enable-timer-type=mach_absolute_time
+}
 
-build.args-append   VERBOSE=1
+
+# We're making compiler wrappers here... don't default to -O2 for wrappers.
+# Actual library code is compiled with -O2 via --enable-fast=O2 configure arg
+configure.cflags-delete     -O2
+configure.cxxflags-delete   -O2
+configure.fflags-delete     -O2
+configure.fcflags-delete    -O2
+configure.cppflags-delete   -I${prefix}/include
 
 universal_variant   no
-use_parallel_build  no
 conflicts           lammpi \
-                    mpich2-devel
-
-# Fixes for the beta DESTDIR support in 1.4.1. Should go away in 1.5 branch.
-post-patch {
-    reinplace -E "s|fix=\\\$\\\{DESTDIR\\\}|fix=|g" \
-        ${worksrcpath}/Makefile.in
-    reinplace -E "s|dir=\\\$\\\{DESTDIR\\\}|dir=|g" \
-        ${worksrcpath}/Makefile.in
-}
+                    mpich2
 
 post-destroot {
-    reinplace -E "s|${destroot}||g" ${destroot}${prefix}/bin/mpicxx \
-                                    ${destroot}${prefix}/bin/mpicc \
-                                    ${destroot}${prefix}/etc/mpicxx.conf \
-                                    ${destroot}${prefix}/etc/mpicc.conf
-    if {[ variant_isset gcc43 ] ||
-        [ variant_isset gcc44 ] ||
-        [ variant_isset gcc45 ] ||
-        [ variant_isset gcc46 ] ||
-        [ variant_isset gcc47 ]} {
-        reinplace -E "s|${destroot}||g" ${destroot}${prefix}/bin/mpif77 \
-                                        ${destroot}${prefix}/bin/mpif90 \
-                                        ${destroot}${prefix}/etc/mpif77.conf \
-                                        ${destroot}${prefix}/etc/mpif90.conf
-    }
+    # Move examples directories to preferred location
+    move ${destroot}${prefix}/share/examples \
+      ${destroot}${prefix}/share/doc/${pkgname}/examples
 
+    # Remove un-needed (in MacPorts) binaries
     file delete ${destroot}${prefix}/sbin/mpeuninstall
+    file delete ${destroot}${prefix}/sbin/mpecheckinstall
+
+    # That's what man pages are for
+    delete ${destroot}${prefix}/share/doc/www4
 }
 
@@ -105,6 +106,6 @@
 
 variant gcc47 description {
-    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc47
-} conflicts gcc43 gcc44 gcc45 gcc46 llvm clang {
+    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc47 port
+} conflicts gcc43 gcc44 gcc45 gcc46 llvm clang clang31 {
     depends_lib-append      port:gcc47
     configure.compiler      macports-gcc-4.7
@@ -112,6 +113,6 @@
 
 variant gcc46 description {
-    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc46
-} conflicts gcc43 gcc44 gcc45 gcc47 llvm clang {
+    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc46 port
+} conflicts gcc43 gcc44 gcc45 gcc47 llvm clang clang31 {
     depends_lib-append      port:gcc46
     configure.compiler      macports-gcc-4.6
@@ -119,6 +120,6 @@
 
 variant gcc45 description {
-    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc45
-} conflicts gcc43 gcc44 gcc46 gcc47 llvm clang {
+    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc45 port
+} conflicts gcc43 gcc44 gcc46 gcc47 llvm clang clang31 {
     depends_lib-append      port:gcc45
     configure.compiler      macports-gcc-4.5
@@ -126,6 +127,6 @@
 
 variant gcc44 description {
-    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc44
-} conflicts gcc43 gcc45 gcc46 gcc47 llvm clang {
+    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc44 port
+} conflicts gcc43 gcc45 gcc46 gcc47 llvm clang clang31 {
     depends_lib-append      port:gcc44
     configure.compiler      macports-gcc-4.4
@@ -133,6 +134,6 @@
 
 variant gcc43 description {
-    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc43
-} conflicts gcc44 gcc45 gcc46 gcc47 llvm clang {
+    Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc43 port
+} conflicts gcc44 gcc45 gcc46 gcc47 llvm clang clang31 {
     depends_lib-append      port:gcc43
     configure.compiler      macports-gcc-4.3
@@ -150,5 +151,5 @@
 variant llvm description {
     Use llvm-gcc
-} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 clang {
+} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 clang clang31 {
     configure.compiler      llvm-gcc-4.2
 }
@@ -156,9 +157,15 @@
 variant clang description {
     Use clang
-} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 llvm {
+} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 llvm clang31 {
     configure.compiler      clang
-    configure.cxx           clang++
-    configure.cflags-append -w
-    configure.cxxflags-append -w
+}
+
+variant clang31 description {
+    Use clang 3.1 from MacPorts
+} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 llvm clang {
+    depends_lib-append      port:clang-3.1
+    configure.compiler      clang
+    configure.cc            ${prefix}/bin/clang-mp-3.1
+    configure.cxx           ${prefix}/bin/clang++-mp-3.1
 }
 
@@ -170,15 +177,11 @@
 }
 
-platform darwin {
-    configure.args-append   --enable-sharedlibs=osx-gcc
-}
-
-variant default_mpi description {
-    Install as defalt MPI -- conflict with OpenMPI
-} {
-    configure.args-delete   --includedir=${prefix}/include/${name}
-    conflicts-append        openmpi
+variant tuned description {Build with more optimizations)} {
+    configure.args-delete       --enable-fast=O2
+    configure.args-append       --enable-fast=all \
+                                MPICH2LIB_CFLAGS='-fomit-frame-pointer -O2'
 }
 
 livecheck.type      regex
-livecheck.regex     ${name}-(\[0-9.p\]+)${extract.suffix}
+livecheck.regex     ${pkgname}-(\[0-9.pbrc\]+)${extract.suffix}
+livecheck.url       ${homepage}downloads/index.php?s=downloads
