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
28 from settings import *
32 if build_port == "wx":
33 webcore_sources['wx'] = ['platform/KillRingNone.cpp', 'bindings/cpp/WebDOMEventTarget.cpp']
36 # make sure platform/wx comes after this so we get the right
38 webcore_dirs.extend(['platform/wx/wxcode/win', 'plugins/win'])
39 webcore_sources['wx-win'] = [
40 'platform/graphics/win/TransformationMatrixWin.cpp',
41 # wxTimer on Windows has a bug that causes it to eat crashes in callbacks
42 # so we need to use the Win port's implementation until the wx bug fix is
43 # widely available (it was fixed in 2.8.10).
44 'platform/win/SharedTimerWin.cpp',
45 'platform/win/WebCoreInstanceHandle.cpp',
46 # Use the Windows plugin architecture
47 'plugins/win/PluginDataWin.cpp',
48 'plugins/win/PluginDatabaseWin.cpp',
49 'plugins/win/PluginMessageThrottlerWin.cpp',
50 'plugins/win/PluginPackageWin.cpp',
51 'plugins/win/PluginViewWin.cpp',
53 elif sys.platform.startswith('darwin'):
54 webcore_dirs.append('plugins/mac')
55 webcore_dirs.append('platform/wx/wxcode/mac/carbon')
56 webcore_dirs.append('platform/mac')
57 webcore_dirs.append('platform/text/mac')
58 webcore_sources['wx-mac'] = [
59 'platform/mac/PurgeableBufferMac.cpp',
60 'platform/mac/WebCoreNSStringExtras.mm',
61 'platform/mac/WebCoreSystemInterface.mm',
62 'platform/graphics/cg/FloatSizeCG.cpp',
63 'platform/graphics/mac/ComplexTextController.cpp',
64 'platform/graphics/mac/ComplexTextControllerCoreText.cpp',
65 'platform/graphics/mac/ComplexTextControllerATSUI.cpp',
66 'platform/graphics/mac/GlyphPageTreeNodeMac.cpp',
67 'platform/graphics/mac/SimpleFontDataATSUI.mm',
68 'platform/graphics/mac/SimpleFontDataCoreText.cpp',
69 'platform/graphics/wx/FontPlatformDataWxMac.mm',
70 'platform/text/mac/ShapeArabic.c',
71 'platform/wx/wxcode/mac/carbon/fontprops.mm',
72 'plugins/mac/PluginPackageMac.cpp',
73 'plugins/mac/PluginViewMac.mm'
76 webcore_sources['wx-gtk'] = [
77 'plugins/PluginViewNone.cpp',
78 'plugins/PluginPackageNone.cpp'
80 webcore_dirs.append('platform/wx/wxcode/gtk')
83 from TaskGen import taskgen, feature, after
86 def generate_webcore_derived_sources():
87 # build the derived sources
88 derived_sources_dir = os.path.join(webcore_dir, 'DerivedSources')
91 wc_dir = get_output('cygpath --unix "%s"' % wc_dir)
92 if not os.path.exists(derived_sources_dir):
93 os.mkdir(derived_sources_dir)
96 os.chdir(derived_sources_dir)
98 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)))
101 def set_options(opt):
102 common_set_options(opt)
105 common_configure(conf)
106 generate_webcore_derived_sources()
107 if sys.platform.startswith('win'):
108 graphics_dir = os.path.join(wk_root, 'WebCore', 'platform', 'graphics')
109 # HACK ALERT: MSVC automatically adds the source file's directory as the first entry in the
110 # path. Unfortunately, that means when compiling these files we will end up including
111 # win/FontPlatformData.h, which breaks wx compilation. So we copy the files to the wx dir.
112 for afile in ['UniscribeController.h', 'UniscribeController.cpp', 'GlyphPageTreeNodeCairoWin.cpp']:
113 shutil.copy(os.path.join(graphics_dir, 'win', afile), os.path.join(graphics_dir, 'wx'))
120 if sys.platform.startswith('darwin'):
121 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx']
122 TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx']
124 wk_includes = ['.', '..', 'DerivedSources',
126 os.path.join(wk_root, 'JavaScriptCore'),
127 os.path.join(wk_root, 'JavaScriptCore', 'wtf', 'text'),
128 os.path.join(wk_root, 'WebCore'),
129 os.path.join(wk_root, 'WebKit/wx'),
130 'platform/image-decoders',
132 'platform/wx/wxcode',
136 features = [build_port]
137 exclude_patterns = ['*AllInOne.cpp', '*Brew.cpp', '*CFNet.cpp', '*Chromium*.cpp',
138 '*Efl.cpp', '*Gtk.cpp', '*Haiku.cpp', '*Mac.cpp', '*None.cpp', '*Qt.cpp', '*Safari.cpp',
139 'test*bindings.*', '*Wince.cpp', "WebDOMCanvas*.cpp", "WebDOMSVG*.cpp"]
140 if build_port == 'wx':
141 features.append('curl')
142 if not building_on_win32:
143 exclude_patterns.append('*Win.cpp')
145 if sys.platform.startswith('darwin'):
146 features.append('cf')
147 bld.install_files(os.path.join(output_dir, 'WebCore'), 'platform/mac/WebCoreSystemInterface.h')
149 exclude_patterns.append('*CF.cpp')
151 full_dirs = get_dirs_for_features(webcore_dir, features=features, dirs=webcore_dirs)
153 jscore_dir = os.path.join(wk_root, 'JavaScriptCore')
154 for item in os.listdir(jscore_dir):
155 fullpath = os.path.join(jscore_dir, item)
156 if os.path.isdir(fullpath) and not item == "os-win32" and not item == 'icu':
157 wk_includes.append(fullpath)
159 wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode'))
160 wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode', 'icu'))
161 wk_includes += common_includes + full_dirs
162 if sys.platform.startswith('darwin'):
163 wk_includes.append(os.path.join(webcore_dir, 'icu'))
166 if building_on_win32:
167 cxxflags.append('/FIWebCorePrefix.h')
169 cxxflags.extend(['-include', 'WebCorePrefix.h'])
171 webcore = bld.new_task_gen(
172 features = 'cc cxx cstaticlib',
173 includes = ' '.join(wk_includes),
174 source = ' '.join(flattenSources(webcore_sources.values())),
176 defines = ['WXMAKINGDLL_WEBKIT'],
178 uselib = 'WX ICU XML XSLT CURL SQLITE3 ' + get_config(),
180 install_path = output_dir,
185 if build_port == 'wx':
186 excludes = get_excludes(webcore_dir, exclude_patterns)
187 excludes.extend(['UserStyleSheetLoader.cpp', 'RenderMediaControls.cpp'])
189 # intermediate sources
190 excludes.append('CSSValueKeywords.cpp')
191 excludes.append('CSSPropertyNames.cpp')
192 excludes.append('tokenizer.cpp')
194 # FIXME: these three require headers that I can't seem to find in trunk.
195 # Investigate how to resolve these issues.
196 excludes.append('JSAbstractView.cpp')
197 excludes.append('JSPositionCallback.cpp')
198 excludes.append('JSInspectorController.cpp')
200 # The bindings generator seems to think these are ref-counted, while they aren't in trunk.
201 excludes.append('JSElementTimeControl.cpp')
202 excludes.append('JSSVGAnimatedPathData.cpp')
203 excludes.append('JSSVGAnimatedPoints.cpp')
204 excludes.append('JSSVGExternalResourcesRequired.cpp')
205 excludes.append('JSSVGFilterPrimitiveStandardAttributes.cpp')
206 excludes.append('JSSVGLocatable.cpp')
207 excludes.append('JSSVGStyleTable.cpp')
208 excludes.append('JSSVGTests.cpp')
209 excludes.append('JSSVGStylable.cpp')
210 excludes.append('JSSVGZoomAndPan.cpp')
212 # These are files that expect methods not in the base C++ class, usually XYZAnimated methods.
213 excludes.append('JSSVGFitToViewBox.cpp')
214 excludes.append('JSSVGLangSpace.cpp')
215 excludes.append('JSSVGTransformable.cpp')
216 excludes.append('JSSVGURIReference.cpp')
218 # These are C++ DOM Bindings that won't compile because they look for things not in trunk.
219 excludes.append('WebDOMEventTarget.cpp')
220 excludes.append('WebDOMAbstractView.cpp')
221 excludes.append('WebDOMBlobBuilder.cpp')
222 excludes.append('WebDOMEventListenerCustom.cpp')
223 excludes.append('WebDOMElementTimeControl.cpp')
224 excludes.append('WebDOMImageData.cpp')
225 excludes.append('WebDOMInspectorBackend.cpp')
226 excludes.append('WebDOMScriptProfile.cpp')
227 excludes.append('WebDOMScriptProfileNode.cpp')
228 excludes.append('WebNativeEventListener.cpp')
230 if building_on_win32:
231 excludes.append('SharedTimerWx.cpp')
232 excludes.append('RenderThemeWin.cpp')
233 excludes.append('KeyEventWin.cpp')
235 if building_on_win32 or sys.platform.startswith('darwin'):
236 excludes.append('GlyphMapWx.cpp')
237 excludes.append('AuthenticationCF.cpp')
238 excludes.append('LoaderRunLoopCF.cpp')
239 excludes.append('ResourceErrorCF.cpp')
241 webcore.find_sources_in_dirs(full_dirs, excludes = excludes, exts=['.c', '.cpp'])