blob: cc0489e1465ac98b459712afa85eb222170e18e8 [file] [log] [blame]
import os
import sys
from subprocess import Popen, PIPE
# The keys in sources are the paths to the directories
# the values are an array of source files in those directories to compile
sources = {}
sources['API'] = [
'API/JSBase.cpp',
'API/JSCallbackConstructor.cpp',
'API/JSCallbackFunction.cpp',
'API/JSCallbackObject.cpp',
'API/JSClassRef.cpp',
'API/JSContextRef.cpp',
'API/JSObjectRef.cpp',
'API/JSProfilerPrivate.cpp',
'API/JSStringRef.cpp',
'API/JSValueRef.cpp',
'API/OpaqueJSString.cpp',
]
sources['bytecompiler'] = [
'bytecompiler/BytecodeGenerator.cpp',
]
sources['debugger'] = [
'debugger/Debugger.cpp',
'debugger/DebuggerCallFrame.cpp',
]
sources['parser'] = [
'parser/Lexer.cpp',
'parser/Nodes.cpp',
'parser/Parser.cpp',
]
sources['pcre'] = [
'pcre/pcre_compile.cpp',
'pcre/pcre_exec.cpp',
'pcre/pcre_tables.cpp',
'pcre/pcre_ucp_searchfuncs.cpp',
'pcre/pcre_xclass.cpp',
]
sources['profiler'] = [
'profiler/HeavyProfile.cpp',
'profiler/Profile.cpp',
'profiler/ProfileGenerator.cpp',
'profiler/ProfileNode.cpp',
'profiler/Profiler.cpp',
'profiler/TreeProfile.cpp',
]
sources['runtime'] = [
'runtime/ArgList.cpp',
'runtime/Arguments.cpp',
'runtime/ArrayConstructor.cpp',
'runtime/ArrayPrototype.cpp',
'runtime/BooleanConstructor.cpp',
'runtime/BooleanObject.cpp',
'runtime/BooleanPrototype.cpp',
'runtime/CallData.cpp',
'runtime/Collector.cpp',
'runtime/CommonIdentifiers.cpp',
'runtime/ConstructData.cpp',
'runtime/DateConstructor.cpp',
'runtime/DateInstance.cpp',
'runtime/DateMath.cpp',
'runtime/DatePrototype.cpp',
'runtime/Error.cpp',
'runtime/ErrorConstructor.cpp',
'runtime/ErrorInstance.cpp',
'runtime/ErrorPrototype.cpp',
'runtime/ExecState.cpp',
'runtime/FunctionConstructor.cpp',
'runtime/FunctionPrototype.cpp',
'runtime/GetterSetter.cpp',
'runtime/GlobalEvalFunction.cpp',
'runtime/Identifier.cpp',
'runtime/InitializeThreading.cpp',
'runtime/InternalFunction.cpp',
'runtime/interpreter.cpp',
'runtime/JSActivation.cpp',
'runtime/JSArray.cpp',
'runtime/JSCell.cpp',
'runtime/JSFunction.cpp',
'runtime/JSGlobalData.cpp',
'runtime/JSGlobalObject.cpp',
'runtime/JSGlobalObjectFunctions.cpp',
'runtime/JSImmediate.cpp',
'runtime/JSLock.cpp',
'runtime/JSNotAnObject.cpp',
'runtime/JSNumberCell.cpp',
'runtime/JSObject.cpp',
'runtime/JSPropertyNameIterator.cpp',
'runtime/JSStaticScopeObject.cpp',
'runtime/JSString.cpp',
'runtime/JSValue.cpp',
'runtime/JSVariableObject.cpp',
'runtime/JSWrapperObject.cpp',
'runtime/Lookup.cpp',
'runtime/MathObject.cpp',
'runtime/NativeErrorConstructor.cpp',
'runtime/NativeErrorPrototype.cpp',
'runtime/NumberConstructor.cpp',
'runtime/NumberObject.cpp',
'runtime/NumberPrototype.cpp',
'runtime/ObjectConstructor.cpp',
'runtime/ObjectPrototype.cpp',
'runtime/Operations.cpp',
'runtime/PropertyNameArray.cpp',
'runtime/PropertySlot.cpp',
'runtime/PrototypeFunction.cpp',
'runtime/RegExp.cpp',
'runtime/RegExpConstructor.cpp',
'runtime/RegExpObject.cpp',
'runtime/RegExpPrototype.cpp',
'runtime/ScopeChain.cpp',
'runtime/SmallStrings.cpp',
'runtime/StringConstructor.cpp',
'runtime/StringObject.cpp',
'runtime/StringPrototype.cpp',
'runtime/Structure.cpp',
'runtime/StructureChain.cpp',
'runtime/UString.cpp',
]
sources['bytecode'] = [
'bytecode/CodeBlock.cpp',
'bytecode/Opcode.cpp',
]
sources['interpreter'] = [
'interpreter/Interpreter.cpp',
]
sources['VM'] = [
'VM/CTI.cpp',
'VM/ExceptionHelpers.cpp',
'VM/RegisterFile.cpp',
'VM/SamplingTool.cpp',
]
sources['wrec'] = [
'wrec/CharacterClassConstructor.cpp',
'wrec/WREC.cpp'
]
sources['wtf'] = [
'wtf/Assertions.cpp',
'wtf/FastMalloc.cpp',
'wtf/HashTable.cpp',
'wtf/MainThread.cpp',
'wtf/RefCountedLeakCounter.cpp',
'wtf/TCSystemAlloc.cpp',
'wtf/dtoa.cpp',
]
sources['wtf/unicode'] = [
'wtf/unicode/CollatorDefault.cpp',
'wtf/unicode/UTF8.cpp',
]
sources['wtf/unicode/icu'] = [
'wtf/unicode/icu/CollatorICU.cpp',
]
env = Environment()
if env['PLATFORM'] == 'darwin':
sources['API'].append('API/JSStringRefCF.cpp')
sources['profiler'].append('profiler/ProfilerServer.mm')
sources['wtf'].append('wtf/ThreadingPthreads.cpp')
sources['wtf/mac'] = ['wtf/mac/MainThreadMac.mm']
elif env['PLATFORM'] == 'win32':
sources['API'].append('API/JSStringRefBSTR.cpp')
sources['wtf'].append('wtf/ThreadingWin.cpp')
sources['wtf/win'] = ['wtf/win/MainThreadWin.cpp']
derived_sources_path = 'DerivedSources/JavaScriptCore/'
def DerivedSources(path):
return derived_sources_path + path
derived_sources_results = map(DerivedSources, [
'ArrayPrototype.lut.h',
'DatePrototype.lut.h',
'MathObject.lut.h',
'NumberConstructor.lut.h',
'RegExpConstructor.lut.h',
'RegExpObject.lut.h',
'StringPrototype.lut.h'
'chartables.c',
'grammar.cpp',
'grammar.h',
'lexer.lut.h',
])
derived_sources_sources = [
'runtime/ArrayPrototype.cpp',
'runtime/DatePrototype.cpp',
'runtime/MathObject.cpp',
'runtime/NumberConstructor.cpp',
'runtime/RegExpConstructor.cpp',
'runtime/RegExpObject.cpp',
'runtime/StringPrototype.cpp',
'parser/Grammar.y',
'parser/Lexer.cpp',
]
# Generate DerivedSources
env.Command(derived_sources_results, derived_sources_sources, './make-generated-sources.sh')
sources[derived_sources_path] = [DerivedSources('grammar.cpp')]
# Handle os-version specific build settings
if env['PLATFORM'] == 'darwin':
version_pieces = Popen(["sw_vers", "-productVersion"], stdout = PIPE).communicate()[0].split('.')
if map(int, version_pieces)[:2] > (10, 5):
# Dtrace doesn't exist in Tiger, and was broken in Leopard
env.Command(DerivedSources('TracingDtrace.h'), 'runtime/Tracing.d', '/usr/sbin/dtrace -h -o $TARGET -s $SOURCE')
# This build file builds the Chromium port for now, support for
# others could be added later.
env['CPPDEFINES'] = 'BUILDING_CHROMIUM__'
# Scons out-of-the-box only supports precompiled headers for MSVC
# remove this when we fix Scons to understand GCC precompiled headers
if env['CC'] == 'gcc':
env['CCFLAGS'] = '-include JavaScriptCorePrefix.h'
env['PCH'] = 'JavaScriptCorePrefix.h'
if env['PLATFORM'] == 'darwin':
env['FRAMEWORKS'] = ['CoreFoundation', 'Foundation']
env['LIBS'] = ['icucore']
include_paths = ['.', '..', 'ForwardingHeaders', 'icu'] + sources.keys()
env['CPPPATH'] = include_paths
env.SharedLibrary("JavaScriptCore", sources.values())
# Build the jsc testing shell
shell_sources = ['jsc.cpp']
build_directory = '.' # This should be changed to point to wherever JavaScriptCore gets built to
env = Environment(CPPPATH = include_paths, LIBS = ['JavaScriptCore', 'edit'], LIBPATH = [build_directory])
env.Program('jsc', shell_sources)