3 # Copyright (C) 2009 Kevin Ollivier All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 # WebCore build script for the waf build system
30 from settings import *
32 if build_port == "wx":
33 webcore_dirs.extend(['WebKit/wx', 'WebKit/wx/WebKitSupport'])
36 os.path.join(wk_root, 'Source', 'JavaScriptCore'),
37 os.path.join(wk_root, 'Source', 'JavaScriptCore', 'wtf', 'text'),
38 os.path.join(wk_root, 'Source', 'WebCore'),
39 os.path.join(wk_root, 'Source', 'WebCore', 'DerivedSources'),
40 os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'image-decoders'),
41 os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'win'),
42 os.path.join(wk_root, 'Source', 'WebCore', 'workers'),
43 os.path.join(output_dir),
46 if build_port == "wx":
47 wk_includes.append(os.path.join(wk_root, 'WebKit', 'wx'))
48 wk_includes.append(os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'wx', 'wxcode'))
50 if sys.platform.startswith("win"):
51 wk_includes.append(os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'win'))
52 wk_includes.append(os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'graphics', 'win'))
56 'bin/icuuc40.dll', 'bin/icudt40.dll', 'bin/icuin40.dll',
57 'bin/libcurl.dll', 'bin/libeay32.dll', 'bin/ssleay32.dll', 'bin/zlib1.dll',
58 'lib/sqlite3.dll', 'bin/libxml2.dll', 'bin/libxslt.dll', 'bin/iconv.dll',
63 if build_port == "wx":
64 webcore_sources['wx'] = ['Source/WebCore/platform/KillRingNone.cpp',
65 'Source/WebCore/bindings/cpp/WebDOMEventTarget.cpp']
68 # make sure platform/wx comes after this so we get the right
70 webcore_dirs.extend(['Source/WebCore/platform/wx/wxcode/win', 'Source/WebCore/plugins/win'])
71 webcore_sources['wx-win'] = [
72 'Source/WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp',
73 'Source/WebCore/platform/graphics/win/TransformationMatrixWin.cpp',
74 'Source/WebCore/platform/ScrollAnimatorWin.cpp',
75 # wxTimer on Windows has a bug that causes it to eat crashes in callbacks
76 # so we need to use the Win port's implementation until the wx bug fix is
77 # widely available (it was fixed in 2.8.10).
78 'Source/WebCore/platform/win/SharedTimerWin.cpp',
79 'Source/WebCore/platform/win/WebCoreInstanceHandle.cpp',
80 # Use the Windows plugin architecture
81 #'Source/WebCore/plugins/win/PluginDataWin.cpp',
82 'Source/WebCore/plugins/win/PluginDatabaseWin.cpp',
83 'Source/WebCore/plugins/win/PluginMessageThrottlerWin.cpp',
84 'Source/WebCore/plugins/win/PluginPackageWin.cpp',
85 'Source/WebCore/plugins/win/PluginViewWin.cpp',
87 elif sys.platform.startswith('darwin'):
88 webcore_dirs.append('Source/WebCore/plugins/mac')
89 webcore_dirs.append('Source/WebCore/platform/wx/wxcode/mac/carbon')
90 webcore_dirs.append('Source/WebCore/platform/mac')
91 webcore_dirs.append('Source/WebCore/platform/text/mac')
92 webcore_sources['wx-mac'] = [
93 'Source/WebCore/platform/mac/PurgeableBufferMac.cpp',
94 'Source/WebCore/platform/mac/WebCoreNSStringExtras.mm',
95 'Source/WebCore/platform/mac/WebCoreSystemInterface.mm',
96 'Source/WebCore/platform/graphics/cg/FloatSizeCG.cpp',
97 'Source/WebCore/platform/graphics/mac/ComplexTextController.cpp',
98 'Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp',
99 'Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp',
100 'Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp',
101 'Source/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm',
102 'Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp',
103 'Source/WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm',
104 'Source/WebCore/platform/text/mac/ShapeArabic.c',
105 'Source/WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm',
106 'Source/WebCore/plugins/mac/PluginPackageMac.cpp',
107 'Source/WebCore/plugins/mac/PluginViewMac.mm'
110 webcore_sources['wx-gtk'] = [
111 'Source/WebCore/plugins/PluginViewNone.cpp',
112 'Source/WebCore/plugins/PluginPackageNone.cpp'
114 webcore_dirs.append('Source/WebCore/platform/wx/wxcode/gtk')
117 from TaskGen import taskgen, feature, after
120 def generate_webcore_derived_sources():
121 # build the derived sources
122 derived_sources_dir = os.path.join(webcore_dir, 'DerivedSources')
124 if building_on_win32:
125 wc_dir = get_output('cygpath --unix "%s"' % wc_dir)
126 if not os.path.exists(derived_sources_dir):
127 os.mkdir(derived_sources_dir)
130 os.chdir(derived_sources_dir)
132 # DerivedSources.make expects Cygwin (i.e. Unix-style) python, so use that instead.
133 if building_on_win32:
134 oldpath = os.environ["PATH"]
135 os.environ["PATH"] = "/usr/bin" + os.pathsep + os.environ["PATH"]
136 os.system('make -f %s/DerivedSources.make WebCore=%s SOURCE_ROOT=%s all FEATURE_DEFINES="%s"' % (wc_dir, wc_dir, wc_dir, ' '.join(feature_defines)))
137 if building_on_win32:
138 os.environ["PATH"] = oldpath
141 def generate_jscore_derived_sources():
142 # build the derived sources
144 if building_on_win32:
145 js_dir = get_output('cygpath --unix "%s"' % js_dir)
146 derived_sources_dir = os.path.join(jscore_dir, 'DerivedSources')
147 if not os.path.exists(derived_sources_dir):
148 os.mkdir(derived_sources_dir)
151 os.chdir(derived_sources_dir)
153 # DerivedSources.make expects Cygwin (i.e. Unix-style) python, so use that instead.
154 if building_on_win32:
155 oldpath = os.environ["PATH"]
156 os.environ["PATH"] = "/usr/bin" + os.pathsep + os.environ["PATH"]
157 command = 'make -f %s/DerivedSources.make JavaScriptCore=%s BUILT_PRODUCTS_DIR=%s all FEATURE_DEFINES="%s"' % (js_dir, js_dir, js_dir, ' '.join(feature_defines))
159 if building_on_win32:
160 os.environ["PATH"] = oldpath
163 def set_options(opt):
164 common_set_options(opt)
167 common_configure(conf)
168 generate_jscore_derived_sources()
169 generate_webcore_derived_sources()
170 if build_port == "wx" and sys.platform.startswith('win'):
171 graphics_dir = os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'graphics')
172 # HACK ALERT: MSVC automatically adds the source file's directory as the first entry in the
173 # path. Unfortunately, that means when compiling these files we will end up including
174 # win/FontPlatformData.h, which breaks wx compilation. So we copy the files to the wx dir.
175 for afile in ['UniscribeController.h', 'UniscribeController.cpp', 'GlyphPageTreeNodeCairoWin.cpp']:
176 shutil.copy(os.path.join(graphics_dir, 'win', afile), os.path.join(graphics_dir, 'wx'))
178 webcore_out_dir = os.path.join(output_dir, 'WebCore')
179 if not os.path.exists(webcore_out_dir):
180 os.makedirs(webcore_out_dir)
181 shutil.copy('Source/WebCore/platform/mac/WebCoreSystemInterface.h', os.path.join(output_dir, 'WebCore', 'WebCoreSystemInterface.h'))
182 jscore_out_dir = os.path.join(output_dir, 'JavaScriptCore')
183 if not os.path.exists(jscore_out_dir):
184 os.makedirs(jscore_out_dir)
185 for api_file in glob.glob(os.path.join(jscore_dir, 'API/*.h')):
186 shutil.copy(api_file, os.path.join(jscore_out_dir, os.path.basename(api_file)))
188 if build_port == "wx" and Options.options.wxpython:
189 common_configure(conf)
190 conf.check_tool('swig', tooldir='WebKit/wx/bindings/python')
191 conf.check_swig_version('1.3.29')
197 # FIXME: Does this need to be Source/JavaScriptCore?
198 bld.add_subdirs('JavaScriptCore')
200 if sys.platform.startswith('darwin'):
201 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx']
202 TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx']
204 features = [build_port]
205 exclude_patterns = ['*AllInOne.cpp', '*Brew.cpp', '*CFNet.cpp', '*Chromium*.cpp',
206 '*Efl.cpp', '*Gtk.cpp', '*Haiku.cpp', '*Mac.cpp', '*None.cpp', '*Qt.cpp', '*Safari.cpp',
207 'test*bindings.*', '*WinCE.cpp', "WebDOMCanvas*.cpp", "WebDOMSVG*.cpp"]
208 if build_port == 'wx':
209 features.append('curl')
210 exclude_patterns.append('*Win.cpp')
212 if sys.platform.startswith('darwin'):
213 features.append('cf')
216 exclude_patterns.append('*CF.cpp')
218 full_dirs = get_dirs_for_features(wk_root, features=features, dirs=webcore_dirs)
220 jscore_dir = os.path.join(wk_root, 'Source', 'JavaScriptCore')
221 for item in os.listdir(jscore_dir):
222 fullpath = os.path.join(jscore_dir, item)
223 if os.path.isdir(fullpath) and not item == "os-win32" and not item == 'icu':
224 wk_includes.append(fullpath)
226 wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode'))
227 wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode', 'icu'))
228 wk_includes += common_includes + full_dirs
229 if sys.platform.startswith('darwin'):
230 wk_includes.append(os.path.join(webcore_dir, 'icu'))
233 if building_on_win32:
234 cxxflags.append('/FIWebCorePrefix.h')
236 cxxflags.extend(['-include', 'WebCorePrefix.h'])
238 webcore = bld.new_task_gen(
239 features = 'cc cxx cshlib',
240 includes = ' '.join(wk_includes),
241 source = ' '.join(flattenSources(webcore_sources.values())),
243 defines = ['WXMAKINGDLL_WEBKIT', 'BUILDING_WebCore'],
244 libpath = [output_dir],
246 uselib = 'WX ICU XML XSLT CURL SQLITE3 WKINTERFACE ' + get_config(),
247 uselib_local = 'jscore',
248 install_path = output_dir,
253 if build_port == 'wx':
254 excludes = get_excludes(webcore_dir, exclude_patterns)
255 excludes.extend(['UserStyleSheetLoader.cpp', 'RenderMediaControls.cpp'])
257 # intermediate sources
258 excludes.append('DocTypeStrings.cpp')
259 excludes.append('HTMLEntityNames.cpp')
260 excludes.append('tokenizer.cpp')
262 # Qt specific file in common sources
263 excludes.append('ContextShadow.cpp')
265 # FIXME: these three require headers that I can't seem to find in trunk.
266 # Investigate how to resolve these issues.
267 excludes.append('JSAbstractView.cpp')
268 excludes.append('JSPositionCallback.cpp')
269 excludes.append('JSInspectorController.cpp')
271 # The bindings generator seems to think these are ref-counted, while they aren't in trunk.
272 excludes.append('JSElementTimeControl.cpp')
273 excludes.append('JSSVGAnimatedPathData.cpp')
274 excludes.append('JSSVGAnimatedPoints.cpp')
275 excludes.append('JSSVGExternalResourcesRequired.cpp')
276 excludes.append('JSSVGFilterPrimitiveStandardAttributes.cpp')
277 excludes.append('JSSVGLocatable.cpp')
278 excludes.append('JSSVGStyleTable.cpp')
279 excludes.append('JSSVGTests.cpp')
280 excludes.append('JSSVGStylable.cpp')
281 excludes.append('JSSVGZoomAndPan.cpp')
283 # These are files that expect methods not in the base C++ class, usually XYZAnimated methods.
284 excludes.append('JSSVGFitToViewBox.cpp')
285 excludes.append('JSSVGLangSpace.cpp')
286 excludes.append('JSSVGTransformable.cpp')
287 excludes.append('JSSVGURIReference.cpp')
289 # These are C++ DOM Bindings that won't compile because they look for things not in trunk.
290 excludes.append('WebDOMEventTarget.cpp')
291 excludes.append('WebDOMAbstractView.cpp')
292 excludes.append('WebDOMBlobBuilder.cpp')
293 excludes.append('WebDOMEventListenerCustom.cpp')
294 excludes.append('WebDOMElementTimeControl.cpp')
295 excludes.append('WebDOMImageData.cpp')
296 excludes.append('WebDOMInspectorBackend.cpp')
297 excludes.append('WebDOMScriptProfile.cpp')
298 excludes.append('WebDOMScriptProfileNode.cpp')
299 excludes.append('WebNativeEventListener.cpp')
301 if building_on_win32:
302 excludes.append('SharedTimerWx.cpp')
303 excludes.append('RenderThemeWin.cpp')
304 excludes.append('KeyEventWin.cpp')
306 if building_on_win32 or sys.platform.startswith('darwin'):
307 excludes.append('GlyphMapWx.cpp')
308 excludes.append('AuthenticationCF.cpp')
309 excludes.append('LoaderRunLoopCF.cpp')
310 excludes.append('ResourceErrorCF.cpp')
312 if sys.platform.startswith('darwin'):
313 webcore.includes += ' WebKit/mac/WebCoreSupport WebCore/platform/mac'
314 webcore.source += " WebKit/mac/WebCoreSupport/WebSystemInterface.mm"
316 if building_on_win32:
317 for wxlib in bld.env['LIB_WX']:
318 wxlibname = os.path.join(bld.env['LIBPATH_WX'][0], wxlib + '_vc.dll')
319 if os.path.exists(wxlibname):
320 bld.install_files(webcore.install_path, [wxlibname])
322 for dep in windows_deps:
323 bld.install_files(webcore.install_path, [os.path.join(msvclibs_dir, dep)])
325 webcore.find_sources_in_dirs(full_dirs, excludes = excludes, exts=['.c', '.cpp'])
329 if build_port == "wx":
330 bld.add_subdirs(['Tools/DumpRenderTree', 'Tools/wx/browser', 'WebKit/wx/bindings/python'])