--- Portfile.orig	2008-08-26 09:24:16.000000000 -0400
+++ Portfile	2008-08-27 13:49:42.000000000 -0400
@@ -3,8 +3,8 @@
 PortSystem 1.0
 
 name			boost
-version			1.35.0
-revision		2
+version			1.36.0
+revision		0
 categories		devel
 maintainers		sanchom@gmail.com
 description		Collection of portable C++ source libraries
@@ -15,13 +15,11 @@
 master_sites		sourceforge
 distname		${name}_[strsed ${version} {g/[.]/_/}]
 use_bzip2		yes
-checksums		md5 dce952a7214e72d6597516bcac84048b
+checksums		md5 328bfec66c312150e4c2a78dcecb504b
 platforms		darwin
 use_parallel_build	yes
 
-patchfiles		patch-tools-build-v2-tools-darwin.jam \
-			patch-boost-serialization-utility.hpp \
-			patch-configure
+patchfiles		patch-configure
 
 depends_build		bin:bjam:boost-jam
 
@@ -31,11 +29,62 @@
 }
 
 platform darwin {
-	post-destroot {
 
+    destroot {
+        
+        # Rather than using
+        #
+        #   destroot.args	PREFIX=${destroot}${prefix} EPREFIX=${destroot}${prefix} \
+        #	    		    LIBDIR=${destroot}${prefix}/lib INCLUDEDIR=${destroot}${prefix}/include \
+        #		    	    install
+        #
+        # we use the following install script because boost's installer doesn't know how to handle mpi+python.
+        # See http://lists.boost.org/boost-build/2007/04/16338.php and http://lists.boost.org/boost-build/2007/04/16342.php
+        
+        # get the library version as it shows up in the library names:
+		# eg. 1_36
+		# this should be ...] 0 2] {_}] when 1_36_1 and later come out
+		set libver [join [lrange [split ${version} {.}] 0 1] {_}]
+		
+        # install the boost headers
+        xinstall -m 755 -d "${destroot}${prefix}/include/boost-${libver}"
+        system "cp -r ${worksrcpath}/boost ${destroot}${prefix}/include/boost-${libver}"
+        system "find ${destroot}${prefix}/include/boost-${libver} -type f -exec chmod 644 {} \\;"
+        system "find ${destroot}${prefix}/include/boost-${libver} -type d -exec chmod 755 {} \\;"
+        system "chown -R root:admin ${destroot}${prefix}/include/boost-${libver}"
+        
+        # install the shared libraries
+        foreach dylib [exec find "${worksrcpath}/bin.v2" -iname "*.dylib"] {
+            xinstall -m 755 "${dylib}" "${destroot}${prefix}/lib"
+        }
+
+        # install the static libraries
+        foreach slib [exec find "${worksrcpath}/bin.v2" -iname "*.a"] {
+            xinstall -m 644 "${slib}" "${destroot}${prefix}/lib"
+        }
+        
+        # python's mpi extension has an '.so' extension, and needs its installed-names changed
+        if { [variant_isset openmpi] && ( [variant_isset python24] || [variant_isset python25] ) } {
+            if { [variant_isset python24] } { set pyversion 2.4 }
+            if { [variant_isset python25] } { set pyversion 2.5 }
+            set spkg "${prefix}/lib/python${pyversion}/site-packages/"
+            xinstall -m 755 -d "${destroot}${spkg}"
+            foreach mpiso [exec find "${worksrcpath}/bin.v2/libs/mpi" -iname "mpi.so"] {
+                xinstall -m 755 "${mpiso}" "${destroot}${spkg}"
+                system "install_name_tool -id ${spkg}mpi.so ${destroot}${spkg}mpi.so"
+                foreach blib [regexp -all -inline -- {libboost_\S+\.dylib} [exec otool -L "${destroot}${spkg}mpi.so"] ] {
+                    system "install_name_tool -change ${blib} ${prefix}/lib/${blib} ${destroot}${spkg}mpi.so"
+                }
+            }
+        }
+                        
+    }
+    
+	post-destroot {
+	    
 		# get the library version as it shows up in the library names:
-		# eg. 1_35
-		# this should be ...] 0 2] {_}] when 1_35_1 and later come out
+		# eg. 1_36
+		# this should be ...] 0 2] {_}] when 1_36_1 and later come out
 		set libver [join [lrange [split ${version} {.}] 0 1] {_}]
 		
 		# ensure the identification name of the dynamic libraries agree
@@ -89,21 +138,38 @@
 		}
 		
 		# create a symbolic link in the include directory pointing to the current
-		# version of the boost include directory (e.g. boost-1_35/boost -> include/boost)
+		# version of the boost include directory (e.g. boost-1_36/boost -> include/boost)
 		system "cd  ${destroot}${prefix}/lib; ln -fs boost-${libver}/boost ${destroot}${prefix}/include/boost"
+		
 	}
-}
 
-destroot.args		PREFIX=${destroot}${prefix} EPREFIX=${destroot}${prefix} \
-			LIBDIR=${destroot}${prefix}/lib INCLUDEDIR=${destroot}${prefix}/include \
-			install
+}
 
 configure.args		--without-libraries=python --without-icu --with-bjam=${prefix}/bin/bjam
 
+variant gcc42 description conflicts gcc43 {Build with gcc42} { 
+    configure.compiler macports-gcc-4.2 
+    depends_lib-append port:gcc42 
+    post-configure { 
+        # This gives us many "unrecognized option '-no-cpp-precomp'" warnings; they appear harmless 
+        system "perl -ne 's@using darwin ;@using darwin : : ${prefix}/bin/g++-mp-4.2 ;@; print;' < user-config.jam > tmp.jam" 
+        system "mv tmp.jam user-config.jam" 
+    } 
+} 
+
+variant gcc43 description conflicts gcc42 {Build with gcc43} { 
+    configure.compiler macports-gcc-4.3 
+    depends_lib-append port:gcc43 
+    post-configure { 
+        # This gives us many "unrecognized option '-no-cpp-precomp'" warnings; they appear harmless 
+        system "perl -ne 's@using darwin ;@using darwin : : ${prefix}/bin/g++-mp-4.3 ;@; print;' < user-config.jam > tmp.jam" 
+        system "mv tmp.jam user-config.jam" 
+    } 
+}
+ 	
 variant python24 conflicts python25 {
 	set pyversion		2.4
 	depends_lib-append      lib:libpython${pyversion}:python[strsed ${pyversion} {g/[.]//}]
-
 	configure.args-delete	--without-libraries=python
 	configure.args-append   --with-python=python${pyversion}
 }
@@ -111,28 +177,24 @@
 variant python25 conflicts python24 {
 	set pyversion		2.5
 	depends_lib-append      lib:libpython${pyversion}:python[strsed ${pyversion} {g/[.]//}]
-
 	configure.args-delete	--without-libraries=python
 	configure.args-append   --with-python=python${pyversion}
 }
 
 variant icu {
 	depends_lib-append	port:icu
-
 	configure.args-delete	--without-icu
 	configure.args-append	--with-icu=${prefix}
 }
 
 variant graphml {
 	depends_lib-append	port:expat
-
 	configure.env-append	EXPAT_INCLUDE=${prefix}/include EXPAT_LIBPATH=${prefix}/lib
 	build.env-append	    EXPAT_INCLUDE=${prefix}/include EXPAT_LIBPATH=${prefix}/lib
 }
 
 variant openmpi {
 	depends_lib-append	port:openmpi
-
     post-configure {
         set config [open user-config.jam a]
         puts ${config} "using mpi : ${prefix}/bin/openmpicxx ;"
@@ -153,8 +215,6 @@
     }
 }
 
-# Should no longer conflict with icu in version 1.35.1, see:
-# http://svn.boost.org/trac/boost/ticket/1928
-variant complete conflicts icu description {Build all library types (debug, static, single-threaded)} {
+variant complete description {Build all library types (debug, static, single-threaded)} {
     patchfiles-append   patch-build-type-Jamroot
 }
