Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

164 lines (127 sloc) 4.255 kB
# -*- mode: python; -*-
# scons file to build spidermonkey
# experimental
#
import os
import subprocess
AddOption( "--64",
dest="force64",
type="string",
nargs=0,
action="store",
help="whether to force 64 bit" )
coreFiles = [ "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" ]
force64 = GetOption( "force64" ) is not None
msarch = None
if force64:
msarch = "amd64"
env = Environment( MSVS_ARCH=msarch )
nix = False
def findVersion( root , choices ):
if not isinstance(root, list):
root = [root]
for r in root:
for c in choices:
if ( os.path.exists( r + c ) ):
return r + c
raise RuntimeError("can't find a version of [" + repr(root) + "] choices: " + repr(choices))
if "win32" == os.sys.platform:
for pathdir in env['ENV']['PATH'].split(os.pathsep):
if os.path.exists(os.path.join(pathdir, 'cl.exe')):
print( "found visual studio at " + pathdir )
break
else:
#use current environment
print "using current environment (PATH etc.) settings"
#print os.environ
env['ENV'] = dict(os.environ)
if force64:
env.Append( CPPDEFINES=["_AMD64_=1"] )
else:
env.Append( CPPDEFINES=["_X86_=1"] )
env.Append( CPPFLAGS= " /nologo /MT /W3 /Gm /EHsc /Zi /Od /Fp " )
env.Append( CPPDEFINES=[ "_WINDOWS" , "WIN32" , "XP_WIN" ] )
winSDKHome = findVersion( [ "C:/Program Files/Microsoft SDKs/Windows/", "C:/Program Files (x86)/Microsoft SDKs/Windows/" ] ,
[ "v6.0" , "v6.0a" , "v6.1", "v7.0A" ] )
env.Append( CPPPATH=[ winSDKHome + "/Include" ] )
if force64:
env.Append( LIBPATH=[ winSDKHome + "/Lib/x64" ] )
else:
env.Append( LIBPATH=[ winSDKHome + "/Lib" ] )
elif "darwin" == os.sys.platform:
nix = True
elif "sunos5" == os.sys.platform:
nix = True
env.Append( CPPDEFINES=["SVR4" , "SYSV" , "SOLARIS" , "HAVE_LOCALTIMER_" ] )
if force64:
env.Append( CPPDEFINES=[ "HAVE_VA_LIST_AS_ARRAY" ] )
if os.uname()[1].count( "joyent" ) >= 1:
print( "JOYENT" )
env["CC"] = "/opt/gcc/gcc44/bin/gcc"
env["CXX"] = "/opt/gcc/gcc44/bin/g++"
elif "freebsd7" == os.sys.platform:
nix = True
elif "linux2" == os.sys.platform:
nix = True
else:
print( "unknown platform: " + os.sys.platform )
Exit(-1)
if nix:
env.Append( CPPDEFINES=[ "XP_UNIX" ] )
if force64:
env.Append( CPPFLAGS=" -m64 " )
env.Append( LINKFLAGS=" -m64 " )
env.Append( CPPDEFINES=[ "JSFILE" , "EXPORT_JS_API" , "JS_C_STRINGS_ARE_UTF8" ] )
env.StaticLibrary( "js" , coreFiles )
jskwgen = str( env.Program( "jskwgen" , [ "jskwgen.c" ] )[0] )
jscpucfg = str( env.Program( "jscpucfg" , [ "jscpucfg.c" ] )[0] )
def buildAutoFile( target , source , env ):
outFile = str( target[0] )
cmd = str( source[0] )
if nix:
cmd = "./" + cmd
output = subprocess.Popen( [ cmd ], stdout=subprocess.PIPE).communicate()[0]
output = output.replace( '\r' , '\n' )
out = open( outFile , 'w' )
out.write( output )
return None
autoBuilder = Builder(
action = buildAutoFile ,
suffix = '.h')
env.Append( BUILDERS={ 'Auto' : autoBuilder } )
env.Auto( "jsautokw.h" , [ jskwgen ] )
env.Auto( "jsautocfg.h" , [ jscpucfg ] )
Jump to Line
Something went wrong with that request. Please try again.