summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-11-16 13:17:32 -0500
committerEliot Horowitz <eliot@10gen.com>2011-11-16 13:17:32 -0500
commite82af25e9cf6a5dd2883506fae938e4b39560ae6 (patch)
treede0e9e7b9632b3afa40581ef68058ecdc7582ec6
parenta695bea89c338f6f458abc258eee16f415edeae1 (diff)
downloadmongo-e82af25e9cf6a5dd2883506fae938e4b39560ae6.tar.gz
scons flag to use each library externally --use-system-(prcre|boost) SERVER-3829
currently supported: --use-system-all --use-system-pcre --use-system-sm Conflicts: SConstruct
-rw-r--r--SConstruct33
-rw-r--r--third_party/pcre.py3
-rw-r--r--third_party/sm.py22
-rw-r--r--third_party/snappy.py3
4 files changed, 48 insertions, 13 deletions
diff --git a/SConstruct b/SConstruct
index edf150d7456..4f2aa3fe998 100644
--- a/SConstruct
+++ b/SConstruct
@@ -32,6 +32,16 @@ def findSettingsSetup():
sys.path.append( ".." )
sys.path.append( "../../" )
+def getThirdPartyShortNames():
+ lst = []
+ for x in os.listdir( "third_party" ):
+ if not x.endswith( ".py" ) or x.find( "#" ) >= 0:
+ continue
+
+ lst.append( x.rpartition( "." )[0] )
+ return lst
+
+
# --- options ----
options = {}
@@ -172,6 +182,11 @@ add_option( "heapcheck", "link to heap-checking malloc-lib and look for memory l
add_option("smokedbprefix", "prefix to dbpath et al. for smoke tests", 1 , False )
+for shortName in getThirdPartyShortNames():
+ add_option( "use-system-" + shortName , "use system version of library " + shortName , 0 , True )
+
+add_option( "use-system-all" , "use all system libraries " + shortName , 0 , True )
+
# --- environment setup ---
def removeIfInList( lst , thing ):
@@ -760,21 +775,20 @@ if not windows:
keyfile = "jstests/libs/key%s" % keysuffix
os.chmod( keyfile , stat.S_IWUSR|stat.S_IRUSR )
-for x in os.listdir( "third_party" ):
- if not x.endswith( ".py" ) or x.find( "#" ) >= 0:
- continue
-
- shortName = x.rpartition( "." )[0]
- path = "third_party/%s" % x
-
-
+moduleFiles = {}
+for shortName in getThirdPartyShortNames():
+ path = "third_party/%s.py" % shortName
myModule = imp.load_module( "third_party_%s" % shortName , open( path , "r" ) , path , ( ".py" , "r" , imp.PY_SOURCE ) )
fileLists = { "commonFiles" : commonFiles , "serverOnlyFiles" : serverOnlyFiles , "scriptingFiles" : scriptingFiles }
options_topass["windows"] = windows
options_topass["nix"] = nix
- myModule.configure( env , fileLists , options_topass )
+ if has_option( "use-system-" + shortName ) or has_option( "use-system-all" ):
+ print( "using system version of: " + shortName )
+ myModule.configureSystem( env , fileLists , options_topass )
+ else:
+ myModule.configure( env , fileLists , options_topass )
coreServerFiles += scriptingFiles
@@ -1169,6 +1183,7 @@ elif not onlyServer:
shellEnv = doConfigure( shellEnv , shell=True )
shellEnv.Prepend( LIBS=[ "mongoshellfiles"] )
+
mongo = shellEnv.Program( "mongo" , coreShellFiles )
diff --git a/third_party/pcre.py b/third_party/pcre.py
index a2007223931..ad9d6bb5f41 100644
--- a/third_party/pcre.py
+++ b/third_party/pcre.py
@@ -31,6 +31,9 @@ def configure( env , fileLists , options ):
myenv.Append( CPPDEFINES=["HAVE_CONFIG_H"] )
fileLists["commonFiles"] += [ myenv.Object(f) for f in getFiles() ]
+def configureSystem( env , fileLists , options ):
+
+ env.Append( LIBS=[ "pcrecpp" ] )
if __name__ == "__main__":
diff --git a/third_party/sm.py b/third_party/sm.py
index 53e7984b8ae..9927be88b78 100644
--- a/third_party/sm.py
+++ b/third_party/sm.py
@@ -42,15 +42,20 @@ root = "third_party/js-1.7"
def r(x):
return "%s/%s" % ( root , x )
-def configure( env , fileLists , options ):
- if not options["usesm"]:
- return
-
+def configureBasics( env , fileLists , options ):
if options["windows"]:
env.Append( CPPDEFINES=[ "XP_WIN" ] )
else:
env.Append( CPPDEFINES=[ "XP_UNIX" ] )
+
+
+def configure( env , fileLists , options ):
+ if not options["usesm"]:
+ return
+
+ configureBasics( env , fileLists , options )
+
env.Prepend( CPPPATH=[root] )
myenv = env.Clone()
@@ -98,3 +103,12 @@ def configure( env , fileLists , options ):
myenv.Auto( r("jsautocfg.h") , [ jscpucfg ] )
myenv.Depends( r("jsscan.c") , r("jsautokw.h") )
+
+
+def configureSystem( env , fileLists , options ):
+ if not options["usesm"]:
+ return
+
+ configureBasics( env , fileLists , options )
+
+ env.Append( LIBS=[ "js" ] )
diff --git a/third_party/snappy.py b/third_party/snappy.py
index c70cb28c52e..e53ee632bbd 100644
--- a/third_party/snappy.py
+++ b/third_party/snappy.py
@@ -9,3 +9,6 @@ def configure( env , fileLists , options ):
files = ["third_party/snappy/snappy.cc", "third_party/snappy/snappy-sinksource.cc"]
fileLists["serverOnlyFiles"] += [ myenv.Object(f) for f in files ]
+
+def configureSystem( env , fileLists , options ):
+ configure( env , fileLists , options )