Index: mongodb/Portfile
===================================================================
--- mongodb/Portfile	(revision 98032)
+++ mongodb/Portfile	(working copy)
@@ -5,7 +5,7 @@
 
 name                mongodb
 epoch               1
-version             2.0.7
+version             2.2.0
 license             AGPL-3
 categories          databases
 maintainers         ryandesign
@@ -19,20 +19,20 @@
 master_sites        http://downloads.mongodb.org/src/
 distname            ${name}-src-r${version}
 
-checksums           rmd160  7a80f463ea2f7f1de80972fcded3fbe982e6f8f0 \
-                    sha256  b204d94bc912692bdc154402fbfc2e5c4bd60b09dcbe244f3b2b7657f0a82736
+checksums           rmd160  08a411e74d3f66e5714f04d537e8c45bcd0fc2fe \
+                    sha256  084626e476ac747dfae143889c24a10f739cd54480af9bf253f50999f065608b
 
 depends_build       port:scons
 
-depends_lib         port:boost \
-                    port:pcre \
+depends_lib         port:pcre \
                     port:spidermonkey \
                     port:libpcap \
                     port:snappy
 
 patchfiles          patch-SConstruct.diff \
                     patch-distsrc-client-SConstruct.diff \
-                    patch-util-compress.cpp.diff
+                    patch-src-mongo-util-compress.cpp.diff \
+                    patch-use-system-sm.diff
 
 post-patch {
     reinplace "s|@@PREFIX@@|${prefix}|g" \
@@ -48,34 +48,20 @@
     compiler.blacklist clang
 }
 
-pre-configure {
-    # https://trac.macports.org/ticket/35118
-    # https://jira.mongodb.org/browse/SERVER-4314
-    set boost_version_int [exec awk {/#define BOOST_VERSION/ {print $3}} ${prefix}/include/boost/version.hpp]
-    scan ${boost_version_int} {%1d%3d%2d} boost_major boost_minor boost_patch
-    set boost_version "${boost_major}.${boost_minor}.${boost_patch}"
-    if {[vercmp ${boost_version} 1.50] >= 0} {
-        ui_error "mongodb ${version} requires boost 1.49.0 or older but you have boost ${boost_version}."
-        ui_error "To downgrade boost, see https://trac.macports.org/wiki/howto/InstallingOlderPort"
-        ui_error "or more specifically https://trac.macports.org/ticket/35118#comment:12"
-        ui_error "After installing boost 1.49.0, install mongodb without upgrading dependencies, i.e.:"
-        ui_error "    sudo port -n install mongodb"
-        return -code error "boost ${boost_version} is too new"
-    }
-}
-
 build.env           TERM=xterm \
                     CFLAGS="[get_canonical_archflags cc]" \
                     CPPFLAGS="-I${prefix}/include/js" \
                     CXXFLAGS="[get_canonical_archflags cxx]" \
-                    LINKFLAGS="[get_canonical_archflags ld] -lpcre"
+                    LINKFLAGS="[get_canonical_archflags ld]"
 
 build.cmd           scons
 build.target        all mongobridge mongosniff
 build.args          --cxx=${configure.cxx} \
                     --full \
-                    --use-system-all \
-                    --usesm
+                    --use-system-pcre \
+                    --use-system-snappy \
+                    --use-system-sm \
+                    --extralib=pcre,pcrecpp,snappy,js
 
 eval destroot.env   [option build.env]
 destroot.args       ${build.args}
Index: mongodb/files/patch-SConstruct.diff
===================================================================
--- mongodb/files/patch-SConstruct.diff	(revision 98032)
+++ mongodb/files/patch-SConstruct.diff	(working copy)
@@ -1,6 +1,8 @@
---- SConstruct.orig	2012-05-08 09:51:28.000000000 -0500
-+++ SConstruct	2012-05-13 18:54:07.000000000 -0500
-@@ -503,21 +503,15 @@
+diff --git SConstruct SConstruct
+index 1792804..ab051d3 100644
+--- SConstruct
++++ SConstruct
+@@ -486,21 +486,14 @@ if "darwin" == os.sys.platform:
      darwin = True
      platform = "osx" # prettier than darwin
  
@@ -12,38 +14,19 @@
      nix = True
  
 -    if force64:
--        env.Append( CPPPATH=["/usr/64/include"] )
--        env.Append( LIBPATH=["/usr/64/lib"] )
--        if installDir == DEFAULT_INSTALL_DIR and not distBuild:
--            installDir = "/usr/64/"
+-       env.Append( EXTRACPPPATH=["/usr/64/include"] )
+-       env.Append( EXTRALIBPATH=["/usr/64/lib"] )
+-       if installDir == DEFAULT_INSTALL_DIR:
+-           installDir = "/usr/64/"
 -    else:
--        env.Append( CPPPATH=filterExists(["/sw/include" , "/opt/local/include"]) )
--        env.Append( LIBPATH=filterExists(["/sw/lib/", "/opt/local/lib"]) )
+-       env.Append( EXTRACPPPATH=filterExists(["/sw/include" , "/opt/local/include"]) )
+-       env.Append( EXTRALIBPATH=filterExists(["/sw/lib/", "/opt/local/lib"]) )
 +    env.Append( CPPPATH=["@@PREFIX@@/include"] )
 +    env.Append( LIBPATH=["@@PREFIX@@/lib"] )
 +    env["CFLAGS"] = os.getenv("CFLAGS")
 +    env["CPPFLAGS"] = os.getenv("CPPFLAGS")
 +    env["CXXFLAGS"] = os.getenv("CXXFLAGS")
 +    env["LINKFLAGS"] = os.getenv("LINKFLAGS")
-+
  
- elif "linux2" == os.sys.platform or "linux3" == os.sys.platform:
+ elif os.sys.platform.startswith("linux"):
      linux = True
-@@ -700,7 +694,7 @@
-         env["CXX"] = "distcc " + env["CXX"]
-         
-     # -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used. 
--    env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch" )
-+    env.Append( CPPFLAGS=" -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch " )
-     # env.Append( " -Wconversion" ) TODO: this doesn't really work yet
-     if linux:
-         env.Append( CPPFLAGS=" -Werror " )
-@@ -995,7 +989,7 @@
- 
-         myCheckLib( "tcmalloc" , True );  # if successful, appedded 'tcmalloc' to myenv[ LIBS ]
-         myenv.Append( CPPDEFINES=[ "HEAP_CHECKING" ] )
--        myenv.Append( CPPFLAGS="-fno-omit-frame-pointer" )
-+        myenv.Append( CPPFLAGS=" -fno-omit-frame-pointer " )
- 
-     # FIXME doConfigure() is being called twice, in the case of the shell. So if it is called 
-     # with shell==True, it'd be on its second call and it would need to rearrange the libraries'
Index: mongodb/files/patch-distsrc-client-SConstruct.diff
===================================================================
--- mongodb/files/patch-distsrc-client-SConstruct.diff	(revision 98032)
+++ mongodb/files/patch-distsrc-client-SConstruct.diff	(working copy)
@@ -1,11 +1,13 @@
---- distsrc/client/SConstruct.orig	2011-09-11 09:09:34.000000000 -0500
-+++ distsrc/client/SConstruct	2011-09-13 03:50:05.000000000 -0500
-@@ -39,7 +39,7 @@
- linux = False
+diff --git distsrc/client/SConstruct distsrc/client/SConstruct
+index abc93ca..cd30518 100755
+--- distsrc/client/SConstruct
++++ distsrc/client/SConstruct
+@@ -47,7 +47,7 @@ linux = False
+ win = False
  
- if "darwin" == os.sys.platform:
+ if "darwin" == sys.platform:
 -    addExtraLibs( "/opt/local/" )
 +    addExtraLibs( "@@PREFIX@@/" )
      nix = True
- elif "linux2" == os.sys.platform or "linux3" == os.sys.platform:
+ elif sys.platform in ("linux2", "linux3"):
      nix = True
Index: mongodb/files/patch-src-mongo-util-compress.cpp.diff
===================================================================
--- mongodb/files/patch-src-mongo-util-compress.cpp.diff	(revision 0)
+++ mongodb/files/patch-src-mongo-util-compress.cpp.diff	(working copy)
@@ -0,0 +1,13 @@
+diff --git src/mongo/util/compress.cpp src/mongo/util/compress.cpp
+index 8bde468..6b999c8 100644
+--- src/mongo/util/compress.cpp
++++ src/mongo/util/compress.cpp
+@@ -2,7 +2,7 @@
+ 
+ #include "mongo/util/compress.h"
+ 
+-#include "third_party/snappy/snappy.h"
++#include <snappy.h>
+ 
+ namespace mongo {
+ 
Index: mongodb/files/patch-use-system-sm.diff
===================================================================
--- mongodb/files/patch-use-system-sm.diff	(revision 0)
+++ mongodb/files/patch-use-system-sm.diff	(working copy)
@@ -0,0 +1,28 @@
+diff --git src/mongo/SConscript src/mongo/SConscript
+index 06022a1..e1dd08f 100644
+--- src/mongo/SConscript
++++ src/mongo/SConscript
+@@ -175,7 +175,7 @@ env.CppUnitTest('bson_template_evaluator_test', ['scripting/bson_template_evalua
+ 
+ if usesm:
+     env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_spidermonkey.cpp'],
+-                      LIBDEPS=['$BUILD_DIR/third_party/js-1.7/js', 'bson_template_evaluator'])
++                      LIBDEPS=['$BUILD_DIR/third_party/shim_spidermonkey', 'bson_template_evaluator'])
+ elif usev8:
+     env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_v8.cpp',
+                                                              'scripting/v8_db.cpp',
+diff --git src/third_party/SConscript src/third_party/SConscript
+index 5a53571..e4d7a63 100644
+--- src/third_party/SConscript
++++ src/third_party/SConscript
+@@ -33,6 +33,10 @@ else:
+     env.StaticLibrary('shim_snappy', ['shim_snappy.cpp'], LIBDEPS=['snappy/snappy'])
+ 
+ if use_system_version_of_library("sm"):
++    if windows:
++        env.Append(CPPDEFINES=['XP_WIN'])
++    else:
++        env.Append(CPPDEFINES=['XP_UNIX'])
+     env.StaticLibrary("shim_spidermonkey", ['shim_spidermonkey.cpp'], SYSLIBDEPS=['js'])
+ else:
+     if windows:
Index: mongodb/files/patch-util-compress.cpp.diff
===================================================================
--- mongodb/files/patch-util-compress.cpp.diff	(revision 98032)
+++ mongodb/files/patch-util-compress.cpp.diff	(working copy)
@@ -1,10 +0,0 @@
---- util/compress.cpp.orig	2011-10-21 19:52:16.000000000 -0500
-+++ util/compress.cpp	2011-10-27 19:30:16.000000000 -0500
-@@ -1,6 +1,6 @@
- // @file compress.cpp
- 
--#include "../third_party/snappy/snappy.h"
-+#include <snappy.h>
- #include "compress.h"
- #include <string>
- #include <string.h>
