OLD | NEW |
| (Empty) |
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os | |
6 | |
7 Import(['env']) | |
8 | |
9 env = env.Clone() | |
10 env_res = env.Clone() | |
11 | |
12 # We use the SCons addRepository() call (an internal API that will | |
13 # at some point be made public) to "back" the build directory | |
14 # hierarchy with the source directory hierarchies in which we want to | |
15 # find the source .cpp and .h files. Think of this kind of like | |
16 # Make's VPATH, but applied to entire directory hierarchies. The | |
17 # upshot is that when searching for any file (source or target), | |
18 # SCons will search the subdirectory hierarchies under the following | |
19 # paths: | |
20 # | |
21 # webkit/Hammer/port/ | |
22 # webkit/port/ | |
23 # third_party/WebKit/WebCore/ | |
24 # | |
25 # SCons will replicate the compiler and linker -I and -L options so | |
26 # that the tools will find the right .h and library files. This comes | |
27 # at the cost of tripling the number of -I or -L options on a command | |
28 # line, but with the benefit that the build should "just work" | |
29 # regardless of which tree the file lives in, and regardless of whether | |
30 # or not the file involved is a generated file or checked-in source. | |
31 # | |
32 # (Note that because the build/SConscript.main file also calls | |
33 # addRepository() for the entire $OBJ_ROOT tree, that adds an | |
34 # extra -I or -L option for the webkit/port/ subdirectory, after the | |
35 # third_party/WebKit/WebCore/ in the above list. We'd like to | |
36 # eliminate that in the future, but that will require some | |
37 # deeper magic, and maybe a SCons modification.) | |
38 | |
39 port_dir = env.Dir('$WEBKIT_DIR/port') | |
40 port_dir.addRepository(env.Dir('$CHROME_SRC_DIR/webkit/port')) | |
41 port_dir.addRepository(env.Dir('$CHROME_SRC_DIR/third_party/WebKit/WebCore')) | |
42 | |
43 if env.Bit('windows'): | |
44 env['WEBKIT_PLATFORM_SUBDIR'] = 'win' | |
45 elif env.Bit('mac'): | |
46 env['WEBKIT_PLATFORM_SUBDIR'] = 'mac' | |
47 env.Append( | |
48 CCFLAGS = [ | |
49 '-Wno-reorder', | |
50 '-Wno-unused', | |
51 ], | |
52 ) | |
53 env.Prepend( | |
54 CPPPATH = [env.subst(x) for x in [ | |
55 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/graphics/cg', | |
56 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/loader/archive/cf', | |
57 ]] | |
58 ) | |
59 elif env.Bit('linux'): | |
60 env.Append( | |
61 CPPDEFINES = [ | |
62 # We want webkit to use pthreads rather than gthread. | |
63 'WTF_USE_PTHREADS=1', | |
64 ], | |
65 ) | |
66 | |
67 if env.Bit('posix'): | |
68 env.Append( | |
69 CCFLAGS = [ | |
70 '-Wno-parentheses', | |
71 ], | |
72 ) | |
73 | |
74 env.Append( | |
75 WEBCORE_DIR = '$THIRD_PARTY_WEBKIT_DIR/WebCore', | |
76 PENDING_DIR = "$WEBKIT_DIR/pending", | |
77 PORT_DIR = "$WEBKIT_DIR/port", | |
78 | |
79 JAVASCRIPTCORE_DIR = "$THIRD_PARTY_WEBKIT_DIR/JavaScriptCore", | |
80 WTF_DIR = "$JAVASCRIPTCORE_DIR/wtf", | |
81 KJS_DIR = "$JAVASCRIPTCORE_DIR/kjs", | |
82 PCRE_DIR = "$JAVASCRIPTCORE_DIR/pcre", | |
83 | |
84 V8BINDINGS_DIR = "$WEBKIT_DIR/V8Bindings", | |
85 DERIVED_DIR = env.Dir("$WEBKIT_DIR/V8Bindings/DerivedSources"), | |
86 SHARED_DIR = env.Dir("$WEBKIT_DIR/V8Bindings/SharedSources"), | |
87 | |
88 WEBKIT_DIR_PORT_INC = env.Dir("$CHROME_SRC_DIR/webkit/port"), | |
89 ) | |
90 | |
91 env.Prepend( | |
92 CPPPATH = [env.subst(x) for x in [ | |
93 | |
94 # We put our grit generated headers in a common place. This matches | |
95 # what we do in Visual Studios. | |
96 '$TARGET_ROOT/grit_derived_sources', | |
97 '$WEBKIT_DIR/build/JSConfig/WebCore', | |
98 | |
99 # TODO(sgk): This directory was at this point in the /I list | |
100 # in the Visual Studio build of the merged webkit. It breaks | |
101 # the Linux build because of the pthread.h file there. | |
102 # Leaving it out doesn't obviously break the Windows build, | |
103 # but for now I'm leaving it commented out here in case it | |
104 # introduced any hidden problems. | |
105 #'$WEBKIT_DIR/build/JavaScriptCore', | |
106 | |
107 '$ZLIB_DIR', | |
108 '$LIBPNG_DIR', | |
109 '$LIBJPEG_DIR', | |
110 '$LIBXSLT_DIR', | |
111 '$LIBXML_DIR/include', | |
112 '$LIBXML_DIR/DerivedSources/include', | |
113 '$ICU38_DIR/public/common', | |
114 '$ICU38_DIR/public/i18n', | |
115 '$SKIA_DIR/include', | |
116 '$SKIA_DIR/include/corecg', | |
117 '$SKIA_DIR/ext', | |
118 '$SKIA_DIR/platform', | |
119 '$NPAPI_DIR', | |
120 '$V8_DIR/include', | |
121 '$WEBKIT_DIR/V8Bindings/DerivedSources', | |
122 '$WEBKIT_DIR/V8Bindings/SharedSources', | |
123 | |
124 '$WEBKIT_DIR/pending', | |
125 '$WEBKIT_DIR_PORT_INC/bindings/v8', | |
126 '$WEBKIT_DIR_PORT_INC/bindings/v8/custom', | |
127 '$WEBKIT_DIR_PORT_INC/platform', | |
128 '$WEBKIT_DIR_PORT_INC/platform/$WEBKIT_PLATFORM_SUBDIR', | |
129 | |
130 '$JAVASCRIPTCORE_DIR', | |
131 '$JAVASCRIPTCORE_DIR/wtf', | |
132 '$JAVASCRIPTCORE_DIR/wtf/chromium', | |
133 | |
134 # Directories in third_party/WebKit/Webcore that we pull headers | |
135 # from. We don't have to list directories that are listed in the | |
136 # $WEBKIT_DIR_PORT_INC section above because they automatically fall | |
137 # back to third_party/WebKit/Webcore. | |
138 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/css', | |
139 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/dom', | |
140 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/editing', | |
141 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/history', | |
142 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/html', | |
143 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/inspector', | |
144 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/loader', | |
145 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/loader/appcache', | |
146 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/loader/archive', | |
147 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/loader/icon', | |
148 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/page', | |
149 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/page/animation', | |
150 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/page/chromium', | |
151 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform', | |
152 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/animation', | |
153 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/chromium', | |
154 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/graphics', | |
155 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/graphics/chromium', | |
156 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/graphics/skia', | |
157 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/graphics/opentype', | |
158 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/graphics/transforms
', | |
159 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/image-decoders/skia
', | |
160 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/image-encoders/skia
', | |
161 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/network', | |
162 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/network/chromium', | |
163 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/sql', | |
164 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/platform/text', | |
165 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/plugins', | |
166 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/rendering', | |
167 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/rendering/style', | |
168 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/storage', | |
169 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/style', | |
170 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/svg', | |
171 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/svg/animation', | |
172 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/svg/graphics', | |
173 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/workers', | |
174 '$CHROME_SRC_DIR/third_party/WebKit/WebCore/xml', | |
175 | |
176 '$CHROME_SRC_DIR', | |
177 ]], | |
178 ) | |
179 | |
180 env.Append( | |
181 CPPDEFINES = [ | |
182 'U_STATIC_IMPLEMENTATION', | |
183 '_SCL_SECURE_NO_DEPRECATE', | |
184 '_SCL_SECURE_NO_WARNINGS', | |
185 ['ENABLE_DASHBOARD_SUPPORT', '0'], | |
186 ['ENABLE_JAVASCRIPT_DEBUGGER', '0'], | |
187 ['ENABLE_JSC_MULTIPLE_THREADS', '0'], | |
188 ['ENABLE_ICONDATABASE', '0'], | |
189 ['ENABLE_DATABASE', '1'], | |
190 ['ENABLE_XSLT', '1'], | |
191 ['ENABLE_XPATH', '1'], | |
192 ['ENABLE_SVG', '1'], | |
193 ['ENABLE_SVG_ANIMATION', '1'], | |
194 ['ENABLE_SVG_AS_IMAGE', '1'], | |
195 ['ENABLE_SVG_USE', '1'], | |
196 ['ENABLE_SVG_FOREIGN_OBJECT', '1'], | |
197 ['ENABLE_SVG_FONTS', '1'], | |
198 ['WEBCORE_NAVIGATOR_PLATFORM', '"\\"Win32\\""'], | |
199 'USE_GOOGLE_URL_LIBRARY', | |
200 ['BUILDING_CHROMIUM__', '1'], | |
201 'CHROMIUM_BUILD', | |
202 '_SECURE_ATL', | |
203 | |
204 'LIBXSLT_STATIC', | |
205 'LIBXML_STATIC', | |
206 'PNG_USER_CONFIG', | |
207 'CHROME_PNG_WRITE_SUPPORT', | |
208 ['__PRETTY_FUNCTION__', '__FUNCTION__'], | |
209 'DISABLE_ACTIVEX_TYPE_CONVERSION_MPLAYER2', | |
210 | |
211 '__STD_C', | |
212 ['USE_SYSTEM_MALLOC', '1'], | |
213 ], | |
214 ) | |
215 | |
216 # This addRepository call causes our webkit/port include paths to include both | |
217 # webkit/port and third_party/WebKit/WebCore. | |
218 webkit_port_inc = env.Dir("$WEBKIT_DIR_PORT_INC") | |
219 webkit_port_inc.addRepository( | |
220 env.Dir('$CHROME_SRC_DIR/third_party/WebKit/WebCore')) | |
221 | |
222 # This list is the SConscripts that work on Windows and Linux. | |
223 sconscript_dirs = env.ChromiumLoadComponentSConscripts( | |
224 LOAD_NAMES = ['webkit'], | |
225 port = 'SConscript.port', | |
226 JavaScriptCore_pcre = 'SConscript.javascriptcore_pcre', | |
227 WebCore_config_h = 'build/JSConfig/SConscript', | |
228 JavaScriptCore = 'build/JavaScriptCore/SConscript', | |
229 webkit_resources = 'build/webkit_resources/SConscript', | |
230 webkit_strings = 'build/webkit_strings/SConscript', | |
231 bindings = 'build/port/SConscript', | |
232 V8Bindings = 'build/V8Bindings/SConscript', | |
233 WebCore = 'build/WebCore/SConscript', | |
234 WebKit = 'build/WebKit/SConscript', | |
235 default_plugin = 'default_plugin/SConscript', | |
236 glue = 'glue/SConscript', | |
237 npapi_test_plugin = 'glue/plugins/test/SConscript', | |
238 npapi_layout_test_plugin = 'tools/npapi_layout_test_plugin/SConscript', | |
239 test_shell = 'tools/test_shell/SConscript', | |
240 ) | |
241 | |
242 if env.Bit('windows'): | |
243 # These extra dirs aren't win32-specific, they're just the dirs that | |
244 # haven't yet been made portable. | |
245 sconscript_dirs.extend(env.ChromiumLoadComponentSConscripts( | |
246 LOAD_NAMES = ['webkit'], | |
247 activex_shim = 'activex_shim/SConscript', | |
248 npaxshim = 'activex_shim_dll/SConscript', | |
249 )) | |
250 | |
251 env.Append( | |
252 CPPDEFINES = [ | |
253 '_CRT_SECURE_NO_DEPRECATE', | |
254 '_CRT_NONSTDC_NO_WARNINGS', | |
255 '_CRT_NONSTDC_NO_DEPRECATE', | |
256 ['CRASH', '__debugbreak'], | |
257 ]) | |
258 | |
259 env.Prepend( | |
260 CPPPATH = [ | |
261 # Windows precompiled headers are here | |
262 '$WEBKIT_DIR/build', | |
263 | |
264 '$JAVASCRIPTCORE_DIR/os-win32', | |
265 ]) | |
266 else: | |
267 env.Append( | |
268 CXXFLAGS = ['-Wno-multichar'], | |
269 ) | |
270 | |
271 env.SConscript(sconscript_dirs, exports=['env', 'env_res']) | |
272 | |
273 # Setup alias for all webkit related targets. | |
274 # We'd like to do this as follows, but it leads to out-of-memory | |
275 # errors when SCons tries to use the entire contents of the | |
276 # directory tree as a huge content-signature string. | |
277 # Instead we're going to let all the subsidiary SConscript files | |
278 # add their own individual targets to the 'webkit' Alias. | |
279 #env.Alias('webkit', ['.', '$DESTINATION_ROOT/icudt38.dll']) | |
280 if env.Bit('windows'): | |
281 env.Alias('webkit', ['$DESTINATION_ROOT/icudt38.dll']) | |
282 | |
283 version = env.Command('$WEBKIT_DIR/build/WebCore/webkit_version.h', | |
284 ['$WEBCORE_DIR/Configurations/Version.xcconfig', | |
285 '$CHROME_SRC_DIR/webkit/build/webkit_version.py'], | |
286 "$PYTHON ${SOURCES[1]} ${SOURCES[0]} ${TARGET.dir}") | |
287 env.AlwaysBuild(version) | |
OLD | NEW |