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
|
---|
3 | sources = {}
|
---|
4 | sources['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 | ]
|
---|
17 | sources['bytecompiler'] = [
|
---|
18 | 'bytecompiler/BytecodeGenerator.cpp',
|
---|
19 | ]
|
---|
20 | sources['debugger'] = [
|
---|
21 | 'debugger/Debugger.cpp',
|
---|
22 | 'debugger/DebuggerActivation.cpp',
|
---|
23 | 'debugger/DebuggerCallFrame.cpp',
|
---|
24 | ]
|
---|
25 | sources['parser'] = [
|
---|
26 | 'parser/Lexer.cpp',
|
---|
27 | 'parser/Nodes.cpp',
|
---|
28 | 'parser/Parser.cpp',
|
---|
29 | ]
|
---|
30 | sources['pcre'] = [
|
---|
31 | 'pcre/pcre_compile.cpp',
|
---|
32 | 'pcre/pcre_exec.cpp',
|
---|
33 | 'pcre/pcre_tables.cpp',
|
---|
34 | 'pcre/pcre_ucp_searchfuncs.cpp',
|
---|
35 | 'pcre/pcre_xclass.cpp',
|
---|
36 | ]
|
---|
37 | sources['profiler'] = [
|
---|
38 | 'profiler/HeavyProfile.cpp',
|
---|
39 | 'profiler/Profile.cpp',
|
---|
40 | 'profiler/ProfileGenerator.cpp',
|
---|
41 | 'profiler/ProfileNode.cpp',
|
---|
42 | 'profiler/Profiler.cpp',
|
---|
43 | 'profiler/TreeProfile.cpp',
|
---|
44 | ]
|
---|
45 | sources['runtime'] = [
|
---|
46 | 'runtime/ArgList.cpp',
|
---|
47 | 'runtime/Arguments.cpp',
|
---|
48 | 'runtime/ArrayConstructor.cpp',
|
---|
49 | 'runtime/ArrayPrototype.cpp',
|
---|
50 | 'runtime/BooleanConstructor.cpp',
|
---|
51 | 'runtime/BooleanObject.cpp',
|
---|
52 | 'runtime/BooleanPrototype.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/TimeoutChecker.cpp',
|
---|
118 | 'runtime/UString.cpp',
|
---|
119 | ]
|
---|
120 | sources['bytecode'] = [
|
---|
121 | 'bytecode/CodeBlock.cpp',
|
---|
122 | 'bytecode/StructureStubInfo.cpp',
|
---|
123 | 'bytecode/JumpTable.cpp',
|
---|
124 | 'bytecode/Opcode.cpp',
|
---|
125 | 'bytecode/SamplingTool.cpp',
|
---|
126 | ]
|
---|
127 | sources['interpreter'] = [
|
---|
128 | 'interpreter/CallFrame.cpp',
|
---|
129 | 'interpreter/Interpreter.cpp',
|
---|
130 | 'interpreter/RegisterFile.cpp',
|
---|
131 | ]
|
---|
132 | sources['jit'] = [
|
---|
133 | 'jit/ExecutableAllocator.cpp',
|
---|
134 | 'jit/JIT.cpp',
|
---|
135 | ]
|
---|
136 | sources['wrec'] = [
|
---|
137 | 'wrec/CharacterClass.cpp',
|
---|
138 | 'wrec/CharacterClassConstructor.cpp',
|
---|
139 | 'wrec/WREC.cpp',
|
---|
140 | 'wrec/WRECFunctors.cpp',
|
---|
141 | 'wrec/WRECGenerator.cpp',
|
---|
142 | 'wrec/WRECParser.cpp',
|
---|
143 | ]
|
---|
144 | sources['wtf'] = [
|
---|
145 | 'wtf/Assertions.cpp',
|
---|
146 | 'wtf/ByteArray.cpp',
|
---|
147 | 'wtf/CurrentTime.cpp',
|
---|
148 | 'wtf/FastMalloc.cpp',
|
---|
149 | 'wtf/HashTable.cpp',
|
---|
150 | 'wtf/RandomNumber.cpp',
|
---|
151 | 'wtf/RefCountedLeakCounter.cpp',
|
---|
152 | 'wtf/Threading.cpp',
|
---|
153 | 'wtf/TypeTraits.cpp',
|
---|
154 | 'wtf/dtoa.cpp',
|
---|
155 | ]
|
---|
156 | sources['wtf/unicode'] = [
|
---|
157 | 'wtf/unicode/CollatorDefault.cpp',
|
---|
158 | 'wtf/unicode/UTF8.cpp',
|
---|
159 | ]
|
---|
160 | sources['wtf/unicode/icu'] = [
|
---|
161 | 'wtf/unicode/icu/CollatorICU.cpp',
|
---|
162 | ]
|
---|
163 |
|
---|
164 | env = Environment()
|
---|
165 |
|
---|
166 | building_on_win32 = env['PLATFORM'] == 'win32' or env['PLATFORM'] == 'cygwin'
|
---|
167 |
|
---|
168 | # Scons uses gcc when building under cygwin by default
|
---|
169 | # We also have to manually force 8.0 or Scons will try and
|
---|
170 | # look up what version to use using the registry and fail
|
---|
171 | # due to lack of cygwin-python registry support
|
---|
172 | if env['PLATFORM'] == 'cygwin':
|
---|
173 | env['MSVS_VERSION'] = '8.0'
|
---|
174 | # Some systems have PROGRAMFILES, some have ProgramFiles
|
---|
175 | # Scons msvc tool only expects 'ProgramFiles'
|
---|
176 | import os
|
---|
177 | if os.getenv('PROGRAMFILES') and not os.getenv('ProgramFiles'):
|
---|
178 | os.environ['ProgramFiles'] = os.getenv('PROGRAMFILES')
|
---|
179 |
|
---|
180 | env.Tool('msvc')
|
---|
181 | env.Tool('mslink')
|
---|
182 | env.Tool('mslib')
|
---|
183 |
|
---|
184 | # Scons is failing to carry the %PATH% value through correctly
|
---|
185 | # Hack IncrediBuild into our path so cl.exe doesn't crash
|
---|
186 | if env['PLATFORM'] == 'win32':
|
---|
187 | env.AppendENVPath('PATH', 'c:/Program Files/Xoreax/IncrediBuild')
|
---|
188 |
|
---|
189 | if env['PLATFORM'] == 'darwin':
|
---|
190 | sources['API'].append('API/JSStringRefCF.cpp')
|
---|
191 | sources['profiler'].append('profiler/ProfilerServer.mm')
|
---|
192 | sources['wtf'].append('wtf/ThreadingPthreads.cpp')
|
---|
193 | sources['wtf'].append('wtf/MainThread.cpp')
|
---|
194 | sources['wtf/mac'] = ['wtf/mac/MainThreadMac.mm']
|
---|
195 | sources['wtf'].append('wtf/TCSystemAlloc.cpp')
|
---|
196 | sources['jit'].append('jit/ExecutableAllocatorPosix.cpp')
|
---|
197 | elif building_on_win32:
|
---|
198 | sources['wtf'].append('wtf/ThreadingNone.cpp')
|
---|
199 | sources['jit'].append('jit/ExecutableAllocatorWin.cpp')
|
---|
200 | env.Append(CPPDEFINES = ['ENABLE_JSC_MULTIPLE_THREADS=0'])
|
---|
201 |
|
---|
202 | derived_sources_path = 'DerivedSources/JavaScriptCore/'
|
---|
203 | def DerivedSources(path):
|
---|
204 | return derived_sources_path + path
|
---|
205 |
|
---|
206 | derived_sources_results = map(DerivedSources, [
|
---|
207 | 'ArrayPrototype.lut.h',
|
---|
208 | 'DatePrototype.lut.h',
|
---|
209 | 'MathObject.lut.h',
|
---|
210 | 'NumberConstructor.lut.h',
|
---|
211 | 'RegExpConstructor.lut.h',
|
---|
212 | 'RegExpObject.lut.h',
|
---|
213 | 'StringPrototype.lut.h'
|
---|
214 | 'chartables.c',
|
---|
215 | 'grammar.cpp',
|
---|
216 | 'grammar.h',
|
---|
217 | 'lexer.lut.h',
|
---|
218 | ])
|
---|
219 |
|
---|
220 | derived_sources_sources = [
|
---|
221 | 'runtime/ArrayPrototype.cpp',
|
---|
222 | 'runtime/DatePrototype.cpp',
|
---|
223 | 'runtime/MathObject.cpp',
|
---|
224 | 'runtime/NumberConstructor.cpp',
|
---|
225 | 'runtime/RegExpConstructor.cpp',
|
---|
226 | 'runtime/RegExpObject.cpp',
|
---|
227 | 'runtime/StringPrototype.cpp',
|
---|
228 | 'parser/Grammar.y',
|
---|
229 | 'parser/Lexer.cpp',
|
---|
230 | ]
|
---|
231 |
|
---|
232 | # Generate DerivedSources
|
---|
233 | # Make sure Windows knows where bash (and all the other cygwin commands) live
|
---|
234 | if env['PLATFORM'] == 'win32':
|
---|
235 | env.AppendENVPath('PATH', 'C:/cygwin/bin')
|
---|
236 | env.Command(derived_sources_results, derived_sources_sources, 'bash make-generated-sources.sh')
|
---|
237 | sources[derived_sources_path] = [DerivedSources('Grammar.cpp')]
|
---|
238 |
|
---|
239 | # Handle os-version specific build settings
|
---|
240 | if env['PLATFORM'] == 'darwin':
|
---|
241 | from subprocess import Popen, PIPE
|
---|
242 | version_pieces = Popen(["sw_vers", "-productVersion"], stdout = PIPE).communicate()[0].split('.')
|
---|
243 | if map(int, version_pieces)[:2] > (10, 5):
|
---|
244 | # Dtrace doesn't exist in Tiger, and was broken in Leopard
|
---|
245 | env.Command(DerivedSources('TracingDtrace.h'), 'runtime/Tracing.d', '/usr/sbin/dtrace -h -o $TARGET -s $SOURCE')
|
---|
246 |
|
---|
247 | # This build file builds the Chromium port for now, support for
|
---|
248 | # others could be added later.
|
---|
249 | env.Append(CPPDEFINES = ['BUILDING_CHROMIUM__'])
|
---|
250 |
|
---|
251 | # I'm not certain how many of these windows defines are actually required.
|
---|
252 | if building_on_win32:
|
---|
253 | env.Append(CPPDEFINES = ['_WIN32_WINNT=0x0600', 'WINVER=0x0600', 'WIN32', '_WINDOWS', 'NOMINMAX', 'UNICODE', '_UNICODE', '__STD_C', '_HAS_EXCEPTIONS=0'])
|
---|
254 |
|
---|
255 | # Scons out-of-the-box only supports precompiled headers for MSVC
|
---|
256 | # remove this when we fix Scons to understand GCC precompiled headers
|
---|
257 | if env['CC'] == 'gcc':
|
---|
258 | env['CCFLAGS'] = '-include JavaScriptCorePrefix.h'
|
---|
259 | # Turns out the MSVC PCH support is badly broken
|
---|
260 | # env['PCH'] = 'JavaScriptCorePrefix.h'
|
---|
261 | # env['PCHSTOP'] = 'JavaScriptCorePrefix.h'
|
---|
262 |
|
---|
263 | if env['PLATFORM'] == 'darwin':
|
---|
264 | env['FRAMEWORKS'] = ['CoreFoundation', 'Foundation']
|
---|
265 | env['LIBS'] = ['icucore']
|
---|
266 | # Apple does not ship the ICU headers with Mac OS X, so WebKit includes a copy of 3.2 headers
|
---|
267 | env.Append(CPPPATH = 'icu')
|
---|
268 |
|
---|
269 | webkit_libraries_path = "../WebKitLibraries/win/"
|
---|
270 | def WebKitLibraries(path):
|
---|
271 | return webkit_libraries_path + path
|
---|
272 |
|
---|
273 | include_paths = ['.', '..', 'ForwardingHeaders'] + sources.keys()
|
---|
274 | env.Append(CPPPATH = include_paths)
|
---|
275 | if building_on_win32:
|
---|
276 | env.Append(CPPPATH = ['os-win32', WebKitLibraries('include')])
|
---|
277 | env.Prepend(LIBPATH = [WebKitLibraries('lib')])
|
---|
278 | env.Append(LIBS = ['icuin', 'icuuc', 'user32', 'winmm'])
|
---|
279 |
|
---|
280 | # Save off a copy of the environment for use with jsc
|
---|
281 | jsc_env = env.Clone()
|
---|
282 |
|
---|
283 | if building_on_win32:
|
---|
284 | env.StaticLibrary("JavaScriptCore", sources.values())
|
---|
285 | else:
|
---|
286 | env.SharedLibrary("JavaScriptCore", sources.values())
|
---|
287 |
|
---|
288 |
|
---|
289 | env = jsc_env
|
---|
290 |
|
---|
291 | # Build the jsc testing shell
|
---|
292 | shell_sources = ['jsc.cpp']
|
---|
293 | build_directory = '.' # This should be changed to point to wherever JavaScriptCore gets built to
|
---|
294 |
|
---|
295 | # It's hacky to re-use the same environment from JavaScriptCore
|
---|
296 | # but it makes building on windows easier for now
|
---|
297 | env['CPPPATH'] = include_paths
|
---|
298 | env['LIBS'] = ['JavaScriptCore']
|
---|
299 | env['LIBPATH'] = [build_directory]
|
---|
300 |
|
---|
301 | if env['PLATFORM'] == 'darwin':
|
---|
302 | env.Append(LIBS = ['edit'])
|
---|
303 | env.Append(CPPPATH = 'icu')
|
---|
304 | elif building_on_win32:
|
---|
305 | env.Append(CPPPATH = ['os-win32', WebKitLibraries('include')])
|
---|
306 | env.Prepend(LIBPATH = [WebKitLibraries('lib')])
|
---|
307 | env.Append(LIBS = ['icuin', 'icuuc', 'user32', 'winmm'])
|
---|
308 |
|
---|
309 | env.Program('jsc', shell_sources)
|
---|