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

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

No review, build fix only.

Fix the JSC Chromium Mac build by adding JavaScriptCore/icu into the include path

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