|
1 #! /usr/bin/env python |
|
2 |
|
3 # Copyright (C) 2009 Kevin Ollivier All rights reserved. |
|
4 # |
|
5 # Redistribution and use in source and binary forms, with or without |
|
6 # modification, are permitted provided that the following conditions |
|
7 # are met: |
|
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. |
|
13 # |
|
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. |
|
25 # |
|
26 # WebCore build script for the waf build system |
|
27 |
|
28 from settings import * |
|
29 |
|
30 webcore_sources = {} |
|
31 |
|
32 if build_port == "wx": |
|
33 webcore_sources['wx'] = ['platform/KillRingNone.cpp'] |
|
34 if building_on_win32: |
|
35 # make sure platform/wx comes after this so we get the right |
|
36 # FontPlatformData.h |
|
37 webcore_dirs.extend(['platform/wx/wxcode/win', 'plugins/win']) |
|
38 webcore_sources['wx-win'] = [ |
|
39 'platform/graphics/win/TransformationMatrixWin.cpp', |
|
40 # wxTimer on Windows has a bug that causes it to eat crashes in callbacks |
|
41 # so we need to use the Win port's implementation until the wx bug fix is |
|
42 # widely available (it was fixed in 2.8.10). |
|
43 'platform/win/SharedTimerWin.cpp', |
|
44 'platform/win/WebCoreInstanceHandle.cpp', |
|
45 # Use the Windows plugin architecture |
|
46 'plugins/win/PluginDataWin.cpp', |
|
47 'plugins/win/PluginDatabaseWin.cpp', |
|
48 'plugins/win/PluginMessageThrottlerWin.cpp', |
|
49 'plugins/win/PluginPackageWin.cpp', |
|
50 'plugins/win/PluginViewWin.cpp', |
|
51 ] |
|
52 elif sys.platform.startswith('darwin'): |
|
53 webcore_dirs.append('plugins/mac') |
|
54 webcore_dirs.append('platform/wx/wxcode/mac/carbon') |
|
55 webcore_dirs.append('platform/mac') |
|
56 webcore_dirs.append('platform/text/mac') |
|
57 webcore_sources['wx-mac'] = [ |
|
58 'platform/mac/PurgeableBufferMac.cpp', |
|
59 'platform/mac/WebCoreNSStringExtras.mm', |
|
60 'platform/mac/WebCoreSystemInterface.mm', |
|
61 'platform/graphics/cg/FloatSizeCG.cpp', |
|
62 'platform/graphics/mac/ComplexTextController.cpp', |
|
63 'platform/graphics/mac/ComplexTextControllerCoreText.cpp', |
|
64 'platform/graphics/mac/ComplexTextControllerATSUI.cpp', |
|
65 'platform/graphics/mac/GlyphPageTreeNodeMac.cpp', |
|
66 'platform/graphics/mac/SimpleFontDataATSUI.mm', |
|
67 'platform/graphics/mac/SimpleFontDataCoreText.cpp', |
|
68 'platform/graphics/wx/FontPlatformDataWxMac.mm', |
|
69 'platform/text/mac/ShapeArabic.c', |
|
70 'platform/wx/wxcode/mac/carbon/fontprops.mm', |
|
71 'plugins/wx/PluginDataWx.cpp', |
|
72 'plugins/mac/PluginPackageMac.cpp', |
|
73 'plugins/mac/PluginViewMac.mm' |
|
74 ] |
|
75 else: |
|
76 webcore_sources['wx-gtk'] = [ |
|
77 'plugins/PluginDataNone.cpp', |
|
78 'plugins/PluginViewNone.cpp', |
|
79 'plugins/PluginPackageNone.cpp' |
|
80 ] |
|
81 webcore_dirs.append('platform/wx/wxcode/gtk') |
|
82 |
|
83 import TaskGen |
|
84 from TaskGen import taskgen, feature, after |
|
85 import Task, ccroot |
|
86 |
|
87 def generate_webcore_derived_sources(): |
|
88 # build the derived sources |
|
89 derived_sources_dir = os.path.join(webcore_dir, 'DerivedSources') |
|
90 wc_dir = webcore_dir |
|
91 if building_on_win32: |
|
92 wc_dir = get_output('cygpath --unix "%s"' % wc_dir) |
|
93 if not os.path.exists(derived_sources_dir): |
|
94 os.mkdir(derived_sources_dir) |
|
95 |
|
96 olddir = os.getcwd() |
|
97 os.chdir(derived_sources_dir) |
|
98 |
|
99 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))) |
|
100 os.chdir(olddir) |
|
101 |
|
102 def set_options(opt): |
|
103 common_set_options(opt) |
|
104 |
|
105 def configure(conf): |
|
106 common_configure(conf) |
|
107 generate_webcore_derived_sources() |
|
108 if sys.platform.startswith('win'): |
|
109 graphics_dir = os.path.join(wk_root, 'WebCore', 'platform', 'graphics') |
|
110 # HACK ALERT: MSVC automatically adds the source file's directory as the first entry in the |
|
111 # path. Unfortunately, that means when compiling these files we will end up including |
|
112 # win/FontPlatformData.h, which breaks wx compilation. So we copy the files to the wx dir. |
|
113 for afile in ['UniscribeController.h', 'UniscribeController.cpp', 'GlyphPageTreeNodeCairoWin.cpp']: |
|
114 shutil.copy(os.path.join(graphics_dir, 'win', afile), os.path.join(graphics_dir, 'wx')) |
|
115 |
|
116 def build(bld): |
|
117 import Options |
|
118 |
|
119 import TaskGen |
|
120 |
|
121 if sys.platform.startswith('darwin'): |
|
122 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx'] |
|
123 TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx'] |
|
124 |
|
125 wk_includes = ['.', '..', 'DerivedSources', |
|
126 wk_root, |
|
127 os.path.join(wk_root, 'JavaScriptCore'), |
|
128 os.path.join(wk_root, 'WebCore'), |
|
129 'platform/image-decoders', |
|
130 'platform/win', |
|
131 'platform/wx/wxcode', |
|
132 'workers', |
|
133 ] |
|
134 |
|
135 features = [build_port] |
|
136 exclude_patterns = ['*AllInOne.cpp', '*Brew.cpp', '*CFNet.cpp', '*Chromium*.cpp', |
|
137 '*Gtk.cpp', '*Mac.cpp', '*None.cpp', '*Qt.cpp', '*Safari.cpp', |
|
138 'test*bindings.*', '*Wince.cpp'] |
|
139 if build_port == 'wx': |
|
140 features.append('curl') |
|
141 if not building_on_win32: |
|
142 exclude_patterns.append('*Win.cpp') |
|
143 |
|
144 if sys.platform.startswith('darwin'): |
|
145 features.append('cf') |
|
146 bld.install_files(os.path.join(output_dir, 'WebCore'), 'platform/mac/WebCoreSystemInterface.h') |
|
147 else: |
|
148 exclude_patterns.append('*CF.cpp') |
|
149 |
|
150 full_dirs = get_dirs_for_features(webcore_dir, features=features, dirs=webcore_dirs) |
|
151 |
|
152 jscore_dir = os.path.join(wk_root, 'JavaScriptCore') |
|
153 for item in os.listdir(jscore_dir): |
|
154 fullpath = os.path.join(jscore_dir, item) |
|
155 if os.path.isdir(fullpath) and not item == "os-win32" and not item == 'icu': |
|
156 wk_includes.append(fullpath) |
|
157 |
|
158 wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode')) |
|
159 wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode', 'icu')) |
|
160 wk_includes += common_includes + full_dirs |
|
161 if sys.platform.startswith('darwin'): |
|
162 wk_includes.append(os.path.join(webcore_dir, 'icu')) |
|
163 |
|
164 cxxflags = [] |
|
165 if building_on_win32: |
|
166 cxxflags.append('/FIWebCorePrefix.h') |
|
167 else: |
|
168 cxxflags.extend(['-include', 'WebCorePrefix.h']) |
|
169 |
|
170 webcore = bld.new_task_gen( |
|
171 features = 'cc cxx cstaticlib', |
|
172 includes = ' '.join(wk_includes), |
|
173 source = ' '.join(flattenSources(webcore_sources.values())), |
|
174 cxxflags = cxxflags, |
|
175 target = 'webcore', |
|
176 uselib = 'WX ICU XML XSLT CURL SQLITE3 ' + get_config(), |
|
177 uselib_local = '', |
|
178 install_path = output_dir, |
|
179 ) |
|
180 |
|
181 excludes = [] |
|
182 |
|
183 if build_port == 'wx': |
|
184 excludes = get_excludes(webcore_dir, exclude_patterns) |
|
185 excludes.extend(['UserStyleSheetLoader.cpp', 'RenderMediaControls.cpp']) |
|
186 |
|
187 |
|
188 # FIXME: undo this once these classes are fully implemented |
|
189 excludes.append('SocketStreamErrorBase.cpp') |
|
190 excludes.append('SocketStreamHandleBase.cpp') |
|
191 |
|
192 # intermediate sources |
|
193 excludes.append('CSSValueKeywords.c') |
|
194 excludes.append('CSSPropertyNames.cpp') |
|
195 excludes.append('tokenizer.cpp') |
|
196 |
|
197 # FIXME: these three require headers that I can't seem to find in trunk. |
|
198 # Investigate how to resolve these issues. |
|
199 excludes.append('JSAbstractView.cpp') |
|
200 excludes.append('JSPositionCallback.cpp') |
|
201 excludes.append('JSInspectorController.cpp') |
|
202 |
|
203 # The bindings generator seems to think these are ref-counted, while they aren't in trunk. |
|
204 excludes.append('JSElementTimeControl.cpp') |
|
205 excludes.append('JSSVGAnimatedPathData.cpp') |
|
206 excludes.append('JSSVGAnimatedPoints.cpp') |
|
207 excludes.append('JSSVGExternalResourcesRequired.cpp') |
|
208 excludes.append('JSSVGFilterPrimitiveStandardAttributes.cpp') |
|
209 excludes.append('JSSVGLocatable.cpp') |
|
210 excludes.append('JSSVGStyleTable.cpp') |
|
211 excludes.append('JSSVGTests.cpp') |
|
212 excludes.append('JSSVGStylable.cpp') |
|
213 excludes.append('JSSVGZoomAndPan.cpp') |
|
214 |
|
215 # These are files that expect methods not in the base C++ class, usually XYZAnimated methods. |
|
216 excludes.append('JSSVGFitToViewBox.cpp') |
|
217 excludes.append('JSSVGLangSpace.cpp') |
|
218 excludes.append('JSSVGTransformable.cpp') |
|
219 excludes.append('JSSVGURIReference.cpp') |
|
220 |
|
221 if building_on_win32: |
|
222 excludes.append('SharedTimerWx.cpp') |
|
223 excludes.append('RenderThemeWin.cpp') |
|
224 excludes.append('KeyEventWin.cpp') |
|
225 |
|
226 if building_on_win32 or sys.platform.startswith('darwin'): |
|
227 excludes.append('GlyphMapWx.cpp') |
|
228 excludes.append('AuthenticationCF.cpp') |
|
229 excludes.append('LoaderRunLoopCF.cpp') |
|
230 excludes.append('ResourceErrorCF.cpp') |
|
231 |
|
232 webcore.find_sources_in_dirs(full_dirs, excludes = excludes, exts=['.c', '.cpp']) |