0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

SCons: Build spidermonkey using a SConscript, instead of the third-party tools crud.

Get rid of the third-party tools crud.
This commit is contained in:
Andy Schwerin 2012-03-26 10:33:16 -04:00
parent fba1ca674b
commit 9d92f4014f
6 changed files with 106 additions and 161 deletions

View File

@ -50,15 +50,6 @@ def findSettingsSetup():
sys.path.append( ".." )
sys.path.append( "../../" )
def getThirdPartyShortNames():
lst = []
for x in os.listdir( "src/third_party" ):
if not x.endswith( ".py" ) or x.find( "#" ) >= 0:
continue
lst.append( _rpartition( x, "." )[0] )
return lst
# --- options ----
@ -207,15 +198,14 @@ add_option( "gcov" , "compile with flags for gcov" , 0 , True )
add_option("smokedbprefix", "prefix to dbpath et al. for smoke tests", 1 , False )
add_option("smokeauth", "run smoke tests with --auth", 0 , False )
for shortName in getThirdPartyShortNames():
add_option( "use-system-" + shortName , "use system version of library " + shortName , 0 , True )
add_option( "use-system-pcre", "use system version of pcre library", 0, True )
add_option( "use-system-boost", "use system version of boost libraries", 0, True )
add_option( "use-system-snappy", "use system version of snappy library", 0, True )
add_option( "use-system-sm", "use system version of spidermonkey library", 0, True )
add_option( "use-system-all" , "use all system libraries", 0 , True )
add_option( "use-cpu-profiler",
@ -746,24 +736,6 @@ if not windows:
keyfile = "jstests/libs/key%s" % keysuffix
os.chmod( keyfile , stat.S_IWUSR|stat.S_IRUSR )
moduleFiles = {}
commonFiles = []
serverOnlyFiles = []
scriptingFiles = []
for shortName in getThirdPartyShortNames():
path = "src/third_party/%s.py" % shortName
myModule = imp.load_module( "src/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
if use_system_version_of_library(shortName):
print( "using system version of: " + shortName )
myModule.configureSystem( env , fileLists , options_topass )
else:
myModule.configure( env , fileLists , options_topass )
if not use_system_version_of_library("pcre"):
env.Prepend(CPPPATH=[ '$BUILD_DIR/third_party/pcre-${PCRE_VERSION}' ])
@ -774,11 +746,6 @@ if not use_system_version_of_library("boost"):
env.Append( CPPPATH=['$EXTRACPPPATH'],
LIBPATH=['$EXTRALIBPATH'] )
env['MONGO_COMMON_FILES'] = commonFiles
env['MONGO_SERVER_ONLY_FILES' ] = serverOnlyFiles
env['MONGO_SCRIPTING_FILES'] = scriptingFiles
env['MONGO_MODULE_FILES'] = moduleFiles
# --- check system ---
def doConfigure(myenv):

View File

@ -68,8 +68,6 @@ commonFiles = [ "pch.cpp",
"client/distlock.cpp",
"s/shardconnection.cpp"]
commonFiles += env['MONGO_COMMON_FILES']
env.StaticLibrary('mongocommon', commonFiles,
LIBDEPS=['$BUILD_DIR/third_party/pcrecpp',
'$BUILD_DIR/third_party/murmurhash3/murmurhash3',
@ -128,20 +126,26 @@ coreServerFiles = [ "util/version.cpp",
"db/commands/isself.cpp",
"db/security_common.cpp",
"db/security_commands.cpp",
"scripting/engine.cpp",
"scripting/utils.cpp",
"scripting/bench.cpp",
] + env['MONGO_SCRIPTING_FILES']
]
if "win32" == os.sys.platform:
coreServerFiles.append( "util/ntservice.cpp" )
scripting_common_files = [ "scripting/engine.cpp",
"scripting/utils.cpp",
"scripting/bench.cpp",
]
if usesm:
coreServerFiles.append( "scripting/engine_spidermonkey.cpp" )
env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_spidermonkey.cpp'],
LIBDEPS=['$BUILD_DIR/third_party/js-1.7/js'])
elif usev8:
coreServerFiles.append( Glob( "scripting/*v8*.cpp" ) )
env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_v8.cpp',
'scripting/v8_db.cpp',
'scripting/v8_utils.cpp',
'scripting/v8_wrapper.cpp'])
else:
coreServerFiles.append( "scripting/engine_none.cpp" )
env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_none.cpp'])
mmapFiles = [ "util/mmap.cpp" ]
@ -251,7 +255,7 @@ serverOnlyFiles = [ "db/curop.cpp",
"db/commands/pipeline_command.cpp",
"db/commands/pipeline_d.cpp",
"db/commands/document_source_cursor.cpp",
"db/driverHelpers.cpp" ] + env['MONGO_SERVER_ONLY_FILES']
"db/driverHelpers.cpp" ]
env.Library( "dbcmdline", "db/cmdline.cpp" )
@ -317,7 +321,7 @@ if has_option( 'use-cpu-profiler' ):
coreServerFiles.append( 'db/commands/cpuprofile.cpp' )
env.Append( LIBS=['profiler'] )
env.StaticLibrary("coreserver", coreServerFiles, LIBDEPS=["mongocommon"])
env.StaticLibrary("coreserver", coreServerFiles, LIBDEPS=["mongocommon", "scripting"])
# main db target
mongod = env.Install( '#/', env.Program( "mongod", mongodOnlyFiles,

View File

@ -1,6 +1,6 @@
# -*- mode: python -*-
Import( "env use_system_version_of_library" )
Import( "env use_system_version_of_library windows" )
env.SConscript( [
"murmurhash3/SConscript",
@ -31,3 +31,14 @@ else:
env.Append(CPPPATH='$BUILD_DIR/third_party/snappy')
env.SConscript('snappy/SConscript')
env.StaticLibrary('mongo_snappy', ['mongo_snappy.cpp'], LIBDEPS=['snappy/snappy'])
if use_system_version_of_library("sm"):
env.StaticLibrary("mongo_spidermonkey", ['mongo_spidermonkey.cpp'], SYSLIBDEPS=['js'])
else:
if windows:
env.Append(CPPDEFINES=['XP_WIN'])
else:
env.Append(CPPDEFINES=['XP_UNIX'])
env.Append(CPPPATH='$BUILD_DIR/third_party/js-1.7')
env.SConscript('js-1.7/SConscript')
env.StaticLibrary('mongo_spidermonkey', ['mongo_spidermonkey.cpp'], LIBDEPS=['js-1.7/js'])

74
src/third_party/js-1.7/SConscript vendored Normal file
View File

@ -0,0 +1,74 @@
# -*- mode: python -*-
Import("env windows linux darwin solaris")
def removeIfPresent(lst, item):
try:
lst.remove(item)
except ValueError:
pass
env = env.Clone()
env.Append(CPPDEFINES=["JSFILE", "EXPORT_JS_API", "JS_C_STRINGS_ARE_UTF8"])
for to_remove in ['-Werror', '/TP', '/O2', '/Gy']:
removeIfPresent(env['CCFLAGS'], to_remove)
if windows:
env.Append(CCFLAGS=['/wd4748'])
removeIfPresent(env['CPPDEFINES'], 'NDEBUG')
if linux or darwin:
env.Append(CPPDEFINES=['HAVE_VA_COPY', 'VA_COPY=va_copy'])
elif solaris:
env.Append(CPPDEFINES=['SOLARIS', 'HAVE_VA_LIST_AS_ARRAY', 'SVR4', 'SYSV', 'HAVE_LOCALTIME_R'])
env.Program('jskwgen', 'jskwgen.c')
env.Program('jscpucfg', 'jscpucfg.c')
env.Command('jsautokw.h', ['${PROGREFIX}jskwgen${PROGSUFFIX}'],
'$SOURCE >$TARGET')
env.Command('jsautocfg.h', ['${PROGREFIX}jscpucfg${PROGSUFFIX}'],
'$SOURCE >$TARGET')
env.StaticLibrary(
"js",
[ "jsapi.c",
"jsarena.c",
"jsarray.c",
"jsatom.c",
"jsbool.c",
"jscntxt.c",
"jsdate.c",
"jsdbgapi.c",
"jsdhash.c",
"jsdtoa.c",
"jsemit.c",
"jsexn.c",
"jsfun.c",
"jsgc.c",
"jshash.c",
"jsiter.c",
"jsinterp.c",
"jslock.c",
"jslog2.c",
"jslong.c",
"jsmath.c",
"jsnum.c",
"jsobj.c",
"jsopcode.c",
"jsparse.c",
"jsprf.c",
"jsregexp.c",
"jsscan.c",
"jsscope.c",
"jsscript.c",
"jsstr.c",
"jsutil.c",
"jsxdrapi.c",
"jsxml.c",
"prmjtime.c",
])

View File

@ -0,0 +1,3 @@
// This file intentionally blank. mongo_spidermonkey.cpp is part of the
// third_party/mongo_spidermonkey library, which is just a placeholder for forwarding
// library dependencies.

114
src/third_party/sm.py vendored
View File

@ -1,114 +0,0 @@
import os
import buildscripts.utils
basicFiles = [ "jsapi.c" ,
"jsarena.c" ,
"jsarray.c" ,
"jsatom.c" ,
"jsbool.c" ,
"jscntxt.c" ,
"jsdate.c" ,
"jsdbgapi.c" ,
"jsdhash.c" ,
"jsdtoa.c" ,
"jsemit.c" ,
"jsexn.c" ,
"jsfun.c" ,
"jsgc.c" ,
"jshash.c" ,
"jsiter.c" ,
"jsinterp.c" ,
"jslock.c" ,
"jslog2.c" ,
"jslong.c" ,
"jsmath.c" ,
"jsnum.c" ,
"jsobj.c" ,
"jsopcode.c" ,
"jsparse.c" ,
"jsprf.c" ,
"jsregexp.c" ,
"jsscan.c" ,
"jsscope.c" ,
"jsscript.c" ,
"jsstr.c" ,
"jsutil.c" ,
"jsxdrapi.c" ,
"jsxml.c" ,
"prmjtime.c" ]
root = "$BUILD_DIR/third_party/js-1.7"
def r(x):
return "%s/%s" % ( root , x )
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()
myenv.Append( CPPDEFINES=[ "JSFILE" , "EXPORT_JS_API" , "JS_C_STRINGS_ARE_UTF8" ] )
myenv["CPPFLAGS"] = myenv["CPPFLAGS"].replace( "-Werror" , "" )
if options["windows"]:
myenv["CPPFLAGS"] = myenv["CPPFLAGS"].replace( "/TP" , "" )
myenv["CPPFLAGS"] = myenv["CPPFLAGS"].replace( "/O2" , "" )
myenv["CPPFLAGS"] = myenv["CPPFLAGS"].replace( "/Gy" , "" )
myenv.Append( CPPFLAGS=" /wd4748 " )
if "NDEBUG" in myenv["CPPDEFINES"]:
myenv["CPPDEFINES"].remove( "NDEBUG" )
if os.sys.platform.startswith( "linux" ) or os.sys.platform == "darwin":
myenv["CPPDEFINES"] += [ "HAVE_VA_COPY" , "VA_COPY=va_copy" ]
elif "sunos5" == os.sys.platform:
myenv.Append( CPPDEFINES=[ "SOLARIS" , "HAVE_VA_LIST_AS_ARRAY" , "SVR4" , "SYSV" , "HAVE_LOCALTIME_R" ] )
fileLists["scriptingFiles"] += [ myenv.Object(root + "/" + f) for f in basicFiles ]
jskwgen = str( myenv.Program( r("jskwgen") , [ r("jskwgen.c") ] )[0] )
jscpucfg = str( myenv.Program( r("jscpucfg") , [ r("jscpucfg.c") ] )[0] )
def buildAutoFile( target , source , env ):
outFile = str( target[0] )
cmd = str( source[0] )
if options["nix"]:
cmd = "./" + cmd
output = buildscripts.utils.execsys( cmd )[0]
output = output.replace( '\r' , '\n' )
out = open( outFile , 'w' )
out.write( output )
return None
autoBuilder = myenv.Builder( action = buildAutoFile , suffix = '.h')
myenv.Append( BUILDERS={ 'Auto' : autoBuilder } )
myenv.Auto( r("jsautokw.h") , [ jskwgen ] )
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" ] )