mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
scons flag to use each library externally --use-system-(prcre|boost) SERVER-3829
currently supported: --use-system-all --use-system-pcre --use-system-sm
This commit is contained in:
parent
2009565604
commit
4c2600d332
37
SConstruct
37
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 ):
|
||||
@ -763,21 +778,20 @@ if not windows:
|
||||
os.chmod( keyfile , stat.S_IWUSR|stat.S_IRUSR )
|
||||
|
||||
moduleFiles = {}
|
||||
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
|
||||
|
||||
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, "moduleFiles" : moduleFiles }
|
||||
|
||||
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
|
||||
|
||||
@ -1174,7 +1188,12 @@ elif not onlyServer:
|
||||
shellEnv = doConfigure( shellEnv , shell=True )
|
||||
|
||||
shellEnv.Prepend( LIBS=[ "mongoshellfiles"] )
|
||||
mongo = shellEnv.Program( "mongo" , moduleFiles["pcre"] + coreShellFiles )
|
||||
|
||||
shellFilesToUse = coreShellFiles
|
||||
if "pcre" in moduleFiles:
|
||||
shellFilesToUse += moduleFiles["pcre"]
|
||||
|
||||
mongo = shellEnv.Program( "mongo" , shellFilesToUse )
|
||||
|
||||
|
||||
# ---- RUNNING TESTS ----
|
||||
|
3
third_party/pcre.py
vendored
3
third_party/pcre.py
vendored
@ -32,6 +32,9 @@ def configure( env , fileLists , options ):
|
||||
fileLists["commonFiles"] += [ myenv.Object(f) for f in getFiles() ]
|
||||
fileLists["moduleFiles"]["pcre"] = [ myenv.Object(f) for f in getFiles() ]
|
||||
|
||||
def configureSystem( env , fileLists , options ):
|
||||
|
||||
env.Append( LIBS=[ "pcrecpp" ] )
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
22
third_party/sm.py
vendored
22
third_party/sm.py
vendored
@ -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" ] )
|
||||
|
3
third_party/snappy.py
vendored
3
third_party/snappy.py
vendored
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user