source: webkit/trunk/JavaScriptCore/JavaScriptCore.scons@ 39784

Last change on this file since 39784 was 39784, checked in by [email protected], 16 years ago

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=23207
Moved currentTime() to from WebCore to WTF.

File size: 9.8 KB
Line 
1# The keys in sources are the paths to the directories
2# the values are an array of source files in those directories to compile
3sources = {}
4sources['API'] = [
5 'API/JSBase.cpp',
6 'API/JSCallbackConstructor.cpp',
7 'API/JSCallbackFunction.cpp',
8 'API/JSCallbackObject.cpp',
9 'API/JSClassRef.cpp',
10 'API/JSContextRef.cpp',
11 'API/JSObjectRef.cpp',
12 'API/JSProfilerPrivate.cpp',
13 'API/JSStringRef.cpp',
14 'API/JSValueRef.cpp',
15 'API/OpaqueJSString.cpp',
16]
17sources['bytecompiler'] = [
18 'bytecompiler/BytecodeGenerator.cpp',
19]
20sources['debugger'] = [
21 'debugger/Debugger.cpp',
22 'debugger/DebuggerCallFrame.cpp',
23]
24sources['parser'] = [
25 'parser/Lexer.cpp',
26 'parser/Nodes.cpp',
27 'parser/Parser.cpp',
28]
29sources['pcre'] = [
30 'pcre/pcre_compile.cpp',
31 'pcre/pcre_exec.cpp',
32 'pcre/pcre_tables.cpp',
33 'pcre/pcre_ucp_searchfuncs.cpp',
34 'pcre/pcre_xclass.cpp',
35]
36sources['profiler'] = [
37 'profiler/HeavyProfile.cpp',
38 'profiler/Profile.cpp',
39 'profiler/ProfileGenerator.cpp',
40 'profiler/ProfileNode.cpp',
41 'profiler/Profiler.cpp',
42 'profiler/TreeProfile.cpp',
43]
44sources['runtime'] = [
45 'runtime/ArgList.cpp',
46 'runtime/Arguments.cpp',
47 'runtime/ArrayConstructor.cpp',
48 'runtime/ArrayPrototype.cpp',
49 'runtime/BooleanConstructor.cpp',
50 'runtime/BooleanObject.cpp',
51 'runtime/BooleanPrototype.cpp',
52 'runtime/ByteArray.cpp',
53 'runtime/CallData.cpp',
54 'runtime/Collector.cpp',
55 'runtime/Completion.cpp',
56 'runtime/CommonIdentifiers.cpp',
57 'runtime/ConstructData.cpp',
58 'runtime/DateConstructor.cpp',
59 'runtime/DateInstance.cpp',
60 'runtime/DateMath.cpp',
61 'runtime/DatePrototype.cpp',
62 'runtime/Error.cpp',
63 'runtime/ErrorConstructor.cpp',
64 'runtime/ErrorInstance.cpp',
65 'runtime/ErrorPrototype.cpp',
66 'runtime/ExceptionHelpers.cpp',
67 'runtime/FunctionConstructor.cpp',
68 'runtime/FunctionPrototype.cpp',
69 'runtime/GetterSetter.cpp',
70 'runtime/GlobalEvalFunction.cpp',
71 'runtime/Identifier.cpp',
72 'runtime/InitializeThreading.cpp',
73 'runtime/InternalFunction.cpp',
74 'runtime/JSActivation.cpp',
75 'runtime/JSArray.cpp',
76 'runtime/JSByteArray.cpp',
77 'runtime/JSCell.cpp',
78 'runtime/JSFunction.cpp',
79 'runtime/JSGlobalData.cpp',
80 'runtime/JSGlobalObject.cpp',
81 'runtime/JSGlobalObjectFunctions.cpp',
82 'runtime/JSImmediate.cpp',
83 'runtime/JSLock.cpp',
84 'runtime/JSNotAnObject.cpp',
85 'runtime/JSNumberCell.cpp',
86 'runtime/JSObject.cpp',
87 'runtime/JSPropertyNameIterator.cpp',
88 'runtime/JSStaticScopeObject.cpp',
89 'runtime/JSString.cpp',
90 'runtime/JSValue.cpp',
91 'runtime/JSVariableObject.cpp',
92 'runtime/JSWrapperObject.cpp',
93 'runtime/Lookup.cpp',
94 'runtime/MathObject.cpp',
95 'runtime/NativeErrorConstructor.cpp',
96 'runtime/NativeErrorPrototype.cpp',
97 'runtime/NumberConstructor.cpp',
98 'runtime/NumberObject.cpp',
99 'runtime/NumberPrototype.cpp',
100 'runtime/ObjectConstructor.cpp',
101 'runtime/ObjectPrototype.cpp',
102 'runtime/Operations.cpp',
103 'runtime/PropertyNameArray.cpp',
104 'runtime/PropertySlot.cpp',
105 'runtime/PrototypeFunction.cpp',
106 'runtime/RegExp.cpp',
107 'runtime/RegExpConstructor.cpp',
108 'runtime/RegExpObject.cpp',
109 'runtime/RegExpPrototype.cpp',
110 'runtime/ScopeChain.cpp',
111 'runtime/SmallStrings.cpp',
112 'runtime/StringConstructor.cpp',
113 'runtime/StringObject.cpp',
114 'runtime/StringPrototype.cpp',
115 'runtime/Structure.cpp',
116 'runtime/StructureChain.cpp',
117 'runtime/UString.cpp',
118]
119sources['bytecode'] = [
120 'bytecode/CodeBlock.cpp',
121 'bytecode/StructureStubInfo.cpp',
122 'bytecode/JumpTable.cpp',
123 'bytecode/Opcode.cpp',
124 'bytecode/SamplingTool.cpp',
125]
126sources['interpreter'] = [
127 'interpreter/CallFrame.cpp',
128 'interpreter/Interpreter.cpp',
129 'interpreter/RegisterFile.cpp',
130]
131sources['jit'] = [
132 'jit/ExecutableAllocator.cpp',
133 'jit/JIT.cpp',
134]
135sources['wrec'] = [
136 'wrec/CharacterClass.cpp',
137 'wrec/CharacterClassConstructor.cpp',
138 'wrec/WREC.cpp',
139 'wrec/WRECFunctors.cpp',
140 'wrec/WRECGenerator.cpp',
141 'wrec/WRECParser.cpp',
142]
143sources['wtf'] = [
144 'wtf/Assertions.cpp',
145 'wtf/CurrentTime.cpp',
146 'wtf/FastMalloc.cpp',
147 'wtf/HashTable.cpp',
148 'wtf/RandomNumber.cpp',
149 'wtf/RefCountedLeakCounter.cpp',
150 'wtf/Threading.cpp',
151 'wtf/dtoa.cpp',
152]
153sources['wtf/unicode'] = [
154 'wtf/unicode/CollatorDefault.cpp',
155 'wtf/unicode/UTF8.cpp',
156]
157sources['wtf/unicode/icu'] = [
158 'wtf/unicode/icu/CollatorICU.cpp',
159]
160
161env = Environment()
162
163building_on_win32 = env['PLATFORM'] == 'win32' or env['PLATFORM'] == 'cygwin'
164
165# Scons uses gcc when building under cygwin by default
166# We also have to manually force 8.0 or Scons will try and
167# look up what version to use using the registry and fail
168# due to lack of cygwin-python registry support
169if env['PLATFORM'] == 'cygwin':
170 env['MSVS_VERSION'] = '8.0'
171 # Some systems have PROGRAMFILES, some have ProgramFiles
172 # Scons msvc tool only expects 'ProgramFiles'
173 import os
174 if os.getenv('PROGRAMFILES') and not os.getenv('ProgramFiles'):
175 os.environ['ProgramFiles'] = os.getenv('PROGRAMFILES')
176
177 env.Tool('msvc')
178 env.Tool('mslink')
179 env.Tool('mslib')
180
181# Scons is failing to carry the %PATH% value through correctly
182# Hack IncrediBuild into our path so cl.exe doesn't crash
183if env['PLATFORM'] == 'win32':
184 env.AppendENVPath('PATH', 'c:/Program Files/Xoreax/IncrediBuild')
185
186if env['PLATFORM'] == 'darwin':
187 sources['API'].append('API/JSStringRefCF.cpp')
188 sources['profiler'].append('profiler/ProfilerServer.mm')
189 sources['wtf'].append('wtf/ThreadingPthreads.cpp')
190 sources['wtf'].append('wtf/MainThread.cpp')
191 sources['wtf/mac'] = ['wtf/mac/MainThreadMac.mm']
192 sources['wtf'].append('wtf/TCSystemAlloc.cpp')
193 sources['jit'].append('jit/ExecutableAllocatorPosix.cpp')
194elif building_on_win32:
195 sources['wtf'].append('wtf/ThreadingNone.cpp')
196 sources['jit'].append('jit/ExecutableAllocatorWin.cpp')
197 env.Append(CPPDEFINES = ['ENABLE_JSC_MULTIPLE_THREADS=0'])
198
199derived_sources_path = 'DerivedSources/JavaScriptCore/'
200def DerivedSources(path):
201 return derived_sources_path + path
202
203derived_sources_results = map(DerivedSources, [
204 'ArrayPrototype.lut.h',
205 'DatePrototype.lut.h',
206 'MathObject.lut.h',
207 'NumberConstructor.lut.h',
208 'RegExpConstructor.lut.h',
209 'RegExpObject.lut.h',
210 'StringPrototype.lut.h'
211 'chartables.c',
212 'grammar.cpp',
213 'grammar.h',
214 'lexer.lut.h',
215])
216
217derived_sources_sources = [
218 'runtime/ArrayPrototype.cpp',
219 'runtime/DatePrototype.cpp',
220 'runtime/MathObject.cpp',
221 'runtime/NumberConstructor.cpp',
222 'runtime/RegExpConstructor.cpp',
223 'runtime/RegExpObject.cpp',
224 'runtime/StringPrototype.cpp',
225 'parser/Grammar.y',
226 'parser/Lexer.cpp',
227]
228
229# Generate DerivedSources
230# Make sure Windows knows where bash (and all the other cygwin commands) live
231if env['PLATFORM'] == 'win32':
232 env.AppendENVPath('PATH', 'C:/cygwin/bin')
233env.Command(derived_sources_results, derived_sources_sources, 'bash make-generated-sources.sh')
234sources[derived_sources_path] = [DerivedSources('Grammar.cpp')]
235
236# Handle os-version specific build settings
237if env['PLATFORM'] == 'darwin':
238 from subprocess import Popen, PIPE
239 version_pieces = Popen(["sw_vers", "-productVersion"], stdout = PIPE).communicate()[0].split('.')
240 if map(int, version_pieces)[:2] > (10, 5):
241 # Dtrace doesn't exist in Tiger, and was broken in Leopard
242 env.Command(DerivedSources('TracingDtrace.h'), 'runtime/Tracing.d', '/usr/sbin/dtrace -h -o $TARGET -s $SOURCE')
243
244# This build file builds the Chromium port for now, support for
245# others could be added later.
246env.Append(CPPDEFINES = ['BUILDING_CHROMIUM__'])
247
248# I'm not certain how many of these windows defines are actually required.
249if building_on_win32:
250 env.Append(CPPDEFINES = ['_WIN32_WINNT=0x0600', 'WINVER=0x0600', 'WIN32', '_WINDOWS', 'NOMINMAX', 'UNICODE', '_UNICODE', '__STD_C', '_HAS_EXCEPTIONS=0'])
251
252# Scons out-of-the-box only supports precompiled headers for MSVC
253# remove this when we fix Scons to understand GCC precompiled headers
254if env['CC'] == 'gcc':
255 env['CCFLAGS'] = '-include JavaScriptCorePrefix.h'
256# Turns out the MSVC PCH support is badly broken
257# env['PCH'] = 'JavaScriptCorePrefix.h'
258# env['PCHSTOP'] = 'JavaScriptCorePrefix.h'
259
260if env['PLATFORM'] == 'darwin':
261 env['FRAMEWORKS'] = ['CoreFoundation', 'Foundation']
262 env['LIBS'] = ['icucore']
263 # Apple does not ship the ICU headers with Mac OS X, so WebKit includes a copy of 3.2 headers
264 env.Append(CPPPATH = 'icu')
265
266webkit_libraries_path = "../WebKitLibraries/win/"
267def WebKitLibraries(path):
268 return webkit_libraries_path + path
269
270include_paths = ['.', '..', 'ForwardingHeaders'] + sources.keys()
271env.Append(CPPPATH = include_paths)
272if building_on_win32:
273 env.Append(CPPPATH = ['os-win32', WebKitLibraries('include')])
274 env.Prepend(LIBPATH = [WebKitLibraries('lib')])
275 env.Append(LIBS = ['icuin', 'icuuc', 'user32', 'winmm'])
276
277# Save off a copy of the environment for use with jsc
278jsc_env = env.Clone()
279
280if building_on_win32:
281 env.StaticLibrary("JavaScriptCore", sources.values())
282else:
283 env.SharedLibrary("JavaScriptCore", sources.values())
284
285
286env = jsc_env
287
288# Build the jsc testing shell
289shell_sources = ['jsc.cpp']
290build_directory = '.' # This should be changed to point to wherever JavaScriptCore gets built to
291
292# It's hacky to re-use the same environment from JavaScriptCore
293# but it makes building on windows easier for now
294env['CPPPATH'] = include_paths
295env['LIBS'] = ['JavaScriptCore']
296env['LIBPATH'] = [build_directory]
297
298if env['PLATFORM'] == 'darwin':
299 env.Append(LIBS = ['edit'])
300 env.Append(CPPPATH = 'icu')
301elif building_on_win32:
302 env.Append(CPPPATH = ['os-win32', WebKitLibraries('include')])
303 env.Prepend(LIBPATH = [WebKitLibraries('lib')])
304 env.Append(LIBS = ['icuin', 'icuuc', 'user32', 'winmm'])
305
306env.Program('jsc', shell_sources)
Note: See TracBrowser for help on using the repository browser.