kevino@webkit.org | 289ba9c | 2010-08-16 19:12:19 +0000 | [diff] [blame] | 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 | import Options |
| 29 | |
| 30 | from settings import * |
| 31 | |
commit-queue@webkit.org | eb10ce7 | 2010-08-26 03:25:24 +0000 | [diff] [blame] | 32 | if build_port == "wx": |
| 33 | webcore_dirs.extend(['WebKit/wx', 'WebKit/wx/WebKitSupport']) |
kevino@webkit.org | 289ba9c | 2010-08-16 19:12:19 +0000 | [diff] [blame] | 34 | |
| 35 | wk_includes = ['.', 'WebCore', 'WebCore/DerivedSources', |
| 36 | os.path.join(wk_root, 'JavaScriptCore'), |
| 37 | os.path.join(wk_root, 'JavaScriptCore', 'wtf', 'text'), |
| 38 | os.path.join(wk_root, 'WebCore'), |
kevino@webkit.org | 289ba9c | 2010-08-16 19:12:19 +0000 | [diff] [blame] | 39 | os.path.join(output_dir), |
| 40 | 'WebCore/platform/image-decoders', |
| 41 | 'WebCore/platform/win', |
kevino@webkit.org | 289ba9c | 2010-08-16 19:12:19 +0000 | [diff] [blame] | 42 | 'WebCore/workers', |
| 43 | ] |
| 44 | |
commit-queue@webkit.org | eb10ce7 | 2010-08-26 03:25:24 +0000 | [diff] [blame] | 45 | if build_port == "wx": |
| 46 | wk_includes.append(os.path.join(wk_root, 'WebKit/wx')) |
| 47 | wk_includes.append('WebCore/platform/wx/wxcode') |
| 48 | |
kevino@webkit.org | 289ba9c | 2010-08-16 19:12:19 +0000 | [diff] [blame] | 49 | if sys.platform.startswith("win"): |
| 50 | wk_includes.append(os.path.join(wk_root, 'WebCore','platform','win')) |
| 51 | |
| 52 | windows_deps = [ |
| 53 | 'lib/pthreadVC2.dll', |
| 54 | 'bin/icuuc40.dll', 'bin/icudt40.dll', 'bin/icuin40.dll', |
| 55 | 'bin/libcurl.dll', 'bin/libeay32.dll', 'bin/ssleay32.dll', 'bin/zlib1.dll', |
| 56 | 'lib/sqlite3.dll', 'bin/libxml2.dll', 'bin/libxslt.dll', 'bin/iconv.dll', |
| 57 | ] |
| 58 | |
| 59 | webcore_sources = {} |
| 60 | |
| 61 | if build_port == "wx": |
| 62 | webcore_sources['wx'] = ['WebCore/platform/KillRingNone.cpp', 'WebCore/bindings/cpp/WebDOMEventTarget.cpp'] |
| 63 | |
| 64 | if building_on_win32: |
| 65 | # make sure platform/wx comes after this so we get the right |
| 66 | # FontPlatformData.h |
| 67 | webcore_dirs.extend(['WebCore/platform/wx/wxcode/win', 'WebCore/plugins/win']) |
| 68 | webcore_sources['wx-win'] = [ |
| 69 | 'WebCore/platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp', |
| 70 | 'WebCore/platform/graphics/win/TransformationMatrixWin.cpp', |
| 71 | # wxTimer on Windows has a bug that causes it to eat crashes in callbacks |
| 72 | # so we need to use the Win port's implementation until the wx bug fix is |
| 73 | # widely available (it was fixed in 2.8.10). |
| 74 | 'WebCore/platform/win/SharedTimerWin.cpp', |
| 75 | 'WebCore/platform/win/WebCoreInstanceHandle.cpp', |
| 76 | # Use the Windows plugin architecture |
| 77 | #'WebCore/plugins/win/PluginDataWin.cpp', |
| 78 | 'WebCore/plugins/win/PluginDatabaseWin.cpp', |
| 79 | 'WebCore/plugins/win/PluginMessageThrottlerWin.cpp', |
| 80 | 'WebCore/plugins/win/PluginPackageWin.cpp', |
| 81 | 'WebCore/plugins/win/PluginViewWin.cpp', |
| 82 | ] |
| 83 | elif sys.platform.startswith('darwin'): |
| 84 | webcore_dirs.append('WebCore/plugins/mac') |
| 85 | webcore_dirs.append('WebCore/platform/wx/wxcode/mac/carbon') |
| 86 | webcore_dirs.append('WebCore/platform/mac') |
| 87 | webcore_dirs.append('WebCore/platform/text/mac') |
| 88 | webcore_sources['wx-mac'] = [ |
| 89 | 'WebCore/platform/mac/PurgeableBufferMac.cpp', |
| 90 | 'WebCore/platform/mac/WebCoreNSStringExtras.mm', |
| 91 | 'WebCore/platform/mac/WebCoreSystemInterface.mm', |
| 92 | 'WebCore/platform/graphics/cg/FloatSizeCG.cpp', |
| 93 | 'WebCore/platform/graphics/mac/ComplexTextController.cpp', |
| 94 | 'WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp', |
| 95 | 'WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp', |
| 96 | 'WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp', |
| 97 | 'WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm', |
| 98 | 'WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp', |
| 99 | 'WebCore/platform/graphics/wx/FontPlatformDataWxMac.mm', |
| 100 | 'WebCore/platform/text/mac/ShapeArabic.c', |
| 101 | 'WebCore/platform/wx/wxcode/mac/carbon/fontprops.mm', |
| 102 | 'WebCore/plugins/mac/PluginPackageMac.cpp', |
| 103 | 'WebCore/plugins/mac/PluginViewMac.mm' |
| 104 | ] |
| 105 | else: |
| 106 | webcore_sources['wx-gtk'] = [ |
| 107 | 'WebCore/plugins/PluginViewNone.cpp', |
| 108 | 'WebCore/plugins/PluginPackageNone.cpp' |
| 109 | ] |
| 110 | webcore_dirs.append('WebCore/platform/wx/wxcode/gtk') |
| 111 | |
| 112 | import TaskGen |
| 113 | from TaskGen import taskgen, feature, after |
| 114 | import Task, ccroot |
| 115 | |
| 116 | def generate_webcore_derived_sources(): |
| 117 | # build the derived sources |
| 118 | derived_sources_dir = os.path.join(webcore_dir, 'DerivedSources') |
| 119 | wc_dir = webcore_dir |
| 120 | if building_on_win32: |
| 121 | wc_dir = get_output('cygpath --unix "%s"' % wc_dir) |
| 122 | if not os.path.exists(derived_sources_dir): |
| 123 | os.mkdir(derived_sources_dir) |
| 124 | |
| 125 | olddir = os.getcwd() |
| 126 | os.chdir(derived_sources_dir) |
| 127 | |
| 128 | # DerivedSources.make expects Cygwin (i.e. Unix-style) python, so use that instead. |
| 129 | if building_on_win32: |
| 130 | oldpath = os.environ["PATH"] |
| 131 | os.environ["PATH"] = "/usr/bin" + os.pathsep + os.environ["PATH"] |
| 132 | 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))) |
| 133 | if building_on_win32: |
| 134 | os.environ["PATH"] = oldpath |
| 135 | os.chdir(olddir) |
| 136 | |
| 137 | def generate_jscore_derived_sources(): |
| 138 | # build the derived sources |
| 139 | js_dir = jscore_dir |
| 140 | if building_on_win32: |
| 141 | js_dir = get_output('cygpath --unix "%s"' % js_dir) |
| 142 | derived_sources_dir = os.path.join(jscore_dir, 'DerivedSources') |
| 143 | if not os.path.exists(derived_sources_dir): |
| 144 | os.mkdir(derived_sources_dir) |
| 145 | |
| 146 | olddir = os.getcwd() |
| 147 | os.chdir(derived_sources_dir) |
| 148 | |
| 149 | # DerivedSources.make expects Cygwin (i.e. Unix-style) python, so use that instead. |
| 150 | if building_on_win32: |
| 151 | oldpath = os.environ["PATH"] |
| 152 | os.environ["PATH"] = "/usr/bin" + os.pathsep + os.environ["PATH"] |
| 153 | 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)) |
| 154 | os.system(command) |
| 155 | if building_on_win32: |
| 156 | os.environ["PATH"] = oldpath |
| 157 | os.chdir(olddir) |
| 158 | |
| 159 | def set_options(opt): |
| 160 | common_set_options(opt) |
| 161 | |
| 162 | def configure(conf): |
| 163 | common_configure(conf) |
| 164 | generate_jscore_derived_sources() |
| 165 | generate_webcore_derived_sources() |
commit-queue@webkit.org | eb10ce7 | 2010-08-26 03:25:24 +0000 | [diff] [blame] | 166 | if build_port == "wx" and sys.platform.startswith('win'): |
kevino@webkit.org | 289ba9c | 2010-08-16 19:12:19 +0000 | [diff] [blame] | 167 | graphics_dir = os.path.join(wk_root, 'WebCore', 'platform', 'graphics') |
| 168 | # HACK ALERT: MSVC automatically adds the source file's directory as the first entry in the |
| 169 | # path. Unfortunately, that means when compiling these files we will end up including |
| 170 | # win/FontPlatformData.h, which breaks wx compilation. So we copy the files to the wx dir. |
| 171 | for afile in ['UniscribeController.h', 'UniscribeController.cpp', 'GlyphPageTreeNodeCairoWin.cpp']: |
| 172 | shutil.copy(os.path.join(graphics_dir, 'win', afile), os.path.join(graphics_dir, 'wx')) |
| 173 | |
| 174 | webcore_out_dir = os.path.join(output_dir, 'WebCore') |
| 175 | if not os.path.exists(webcore_out_dir): |
| 176 | os.makedirs(webcore_out_dir) |
| 177 | shutil.copy('WebCore/platform/mac/WebCoreSystemInterface.h', os.path.join(output_dir, 'WebCore', 'WebCoreSystemInterface.h')) |
| 178 | jscore_out_dir = os.path.join(output_dir, 'JavaScriptCore') |
| 179 | if not os.path.exists(jscore_out_dir): |
| 180 | os.makedirs(jscore_out_dir) |
| 181 | for api_file in glob.glob(os.path.join(jscore_dir, 'API/*.h')): |
| 182 | shutil.copy(api_file, os.path.join(jscore_out_dir, os.path.basename(api_file))) |
| 183 | |
| 184 | if Options.options.wxpython: |
| 185 | common_configure(conf) |
| 186 | conf.check_tool('swig', tooldir='WebKit/wx/bindings/python') |
| 187 | conf.check_swig_version('1.3.29') |
| 188 | |
| 189 | def build(bld): |
| 190 | import TaskGen |
| 191 | global wk_includes |
| 192 | |
| 193 | bld.add_subdirs('JavaScriptCore') |
| 194 | |
| 195 | if sys.platform.startswith('darwin'): |
| 196 | TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx'] |
| 197 | TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx'] |
| 198 | |
| 199 | features = [build_port] |
| 200 | exclude_patterns = ['*AllInOne.cpp', '*Brew.cpp', '*CFNet.cpp', '*Chromium*.cpp', |
| 201 | '*Efl.cpp', '*Gtk.cpp', '*Haiku.cpp', '*Mac.cpp', '*None.cpp', '*Qt.cpp', '*Safari.cpp', |
| 202 | 'test*bindings.*', '*Wince.cpp', "WebDOMCanvas*.cpp", "WebDOMSVG*.cpp"] |
| 203 | if build_port == 'wx': |
| 204 | features.append('curl') |
| 205 | exclude_patterns.append('*Win.cpp') |
| 206 | |
| 207 | if sys.platform.startswith('darwin'): |
| 208 | features.append('cf') |
| 209 | |
| 210 | else: |
| 211 | exclude_patterns.append('*CF.cpp') |
| 212 | |
| 213 | full_dirs = get_dirs_for_features(wk_root, features=features, dirs=webcore_dirs) |
| 214 | |
| 215 | jscore_dir = os.path.join(wk_root, 'JavaScriptCore') |
| 216 | for item in os.listdir(jscore_dir): |
| 217 | fullpath = os.path.join(jscore_dir, item) |
| 218 | if os.path.isdir(fullpath) and not item == "os-win32" and not item == 'icu': |
| 219 | wk_includes.append(fullpath) |
| 220 | |
| 221 | wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode')) |
| 222 | wk_includes.append(os.path.join(jscore_dir, 'wtf', 'unicode', 'icu')) |
| 223 | wk_includes += common_includes + full_dirs |
| 224 | if sys.platform.startswith('darwin'): |
| 225 | wk_includes.append(os.path.join(webcore_dir, 'icu')) |
| 226 | |
| 227 | cxxflags = [] |
| 228 | if building_on_win32: |
| 229 | cxxflags.append('/FIWebCorePrefix.h') |
| 230 | else: |
| 231 | cxxflags.extend(['-include', 'WebCorePrefix.h']) |
| 232 | |
| 233 | webcore = bld.new_task_gen( |
| 234 | features = 'cc cxx cshlib', |
| 235 | includes = ' '.join(wk_includes), |
| 236 | source = ' '.join(flattenSources(webcore_sources.values())), |
| 237 | cxxflags = cxxflags, |
| 238 | defines = ['WXMAKINGDLL_WEBKIT', 'BUILDING_WebCore'], |
| 239 | libpath = [output_dir], |
| 240 | target = 'wxwebkit', |
| 241 | uselib = 'WX ICU XML XSLT CURL SQLITE3 WKINTERFACE ' + get_config(), |
| 242 | uselib_local = 'jscore', |
| 243 | install_path = output_dir, |
| 244 | ) |
| 245 | |
| 246 | excludes = [] |
| 247 | |
| 248 | if build_port == 'wx': |
| 249 | excludes = get_excludes(webcore_dir, exclude_patterns) |
| 250 | excludes.extend(['UserStyleSheetLoader.cpp', 'RenderMediaControls.cpp']) |
| 251 | |
| 252 | # intermediate sources |
| 253 | excludes.append('ColorData.cpp') |
| 254 | excludes.append('CSSValueKeywords.cpp') |
| 255 | excludes.append('CSSPropertyNames.cpp') |
| 256 | excludes.append('DocTypeStrings.cpp') |
| 257 | excludes.append('HTMLEntityNames.cpp') |
| 258 | excludes.append('tokenizer.cpp') |
| 259 | |
| 260 | # FIXME: these three require headers that I can't seem to find in trunk. |
| 261 | # Investigate how to resolve these issues. |
| 262 | excludes.append('JSAbstractView.cpp') |
| 263 | excludes.append('JSPositionCallback.cpp') |
| 264 | excludes.append('JSInspectorController.cpp') |
| 265 | |
| 266 | # The bindings generator seems to think these are ref-counted, while they aren't in trunk. |
| 267 | excludes.append('JSElementTimeControl.cpp') |
| 268 | excludes.append('JSSVGAnimatedPathData.cpp') |
| 269 | excludes.append('JSSVGAnimatedPoints.cpp') |
| 270 | excludes.append('JSSVGExternalResourcesRequired.cpp') |
| 271 | excludes.append('JSSVGFilterPrimitiveStandardAttributes.cpp') |
| 272 | excludes.append('JSSVGLocatable.cpp') |
| 273 | excludes.append('JSSVGStyleTable.cpp') |
| 274 | excludes.append('JSSVGTests.cpp') |
| 275 | excludes.append('JSSVGStylable.cpp') |
| 276 | excludes.append('JSSVGZoomAndPan.cpp') |
| 277 | |
| 278 | # These are files that expect methods not in the base C++ class, usually XYZAnimated methods. |
| 279 | excludes.append('JSSVGFitToViewBox.cpp') |
| 280 | excludes.append('JSSVGLangSpace.cpp') |
| 281 | excludes.append('JSSVGTransformable.cpp') |
| 282 | excludes.append('JSSVGURIReference.cpp') |
| 283 | |
| 284 | # These are C++ DOM Bindings that won't compile because they look for things not in trunk. |
| 285 | excludes.append('WebDOMEventTarget.cpp') |
| 286 | excludes.append('WebDOMAbstractView.cpp') |
| 287 | excludes.append('WebDOMBlobBuilder.cpp') |
| 288 | excludes.append('WebDOMEventListenerCustom.cpp') |
| 289 | excludes.append('WebDOMElementTimeControl.cpp') |
| 290 | excludes.append('WebDOMImageData.cpp') |
| 291 | excludes.append('WebDOMInspectorBackend.cpp') |
| 292 | excludes.append('WebDOMScriptProfile.cpp') |
| 293 | excludes.append('WebDOMScriptProfileNode.cpp') |
| 294 | excludes.append('WebNativeEventListener.cpp') |
| 295 | |
| 296 | if building_on_win32: |
| 297 | excludes.append('SharedTimerWx.cpp') |
| 298 | excludes.append('RenderThemeWin.cpp') |
| 299 | excludes.append('KeyEventWin.cpp') |
| 300 | |
| 301 | if building_on_win32 or sys.platform.startswith('darwin'): |
| 302 | excludes.append('GlyphMapWx.cpp') |
| 303 | excludes.append('AuthenticationCF.cpp') |
| 304 | excludes.append('LoaderRunLoopCF.cpp') |
| 305 | excludes.append('ResourceErrorCF.cpp') |
| 306 | |
| 307 | if sys.platform.startswith('darwin'): |
| 308 | webcore.includes += ' WebKit/mac/WebCoreSupport WebCore/platform/mac' |
| 309 | webcore.source += " WebKit/mac/WebCoreSupport/WebSystemInterface.mm" |
| 310 | |
| 311 | webcore.find_sources_in_dirs(full_dirs, excludes = excludes, exts=['.c', '.cpp']) |
| 312 | |
| 313 | bld.add_group() |
| 314 | |
commit-queue@webkit.org | eb10ce7 | 2010-08-26 03:25:24 +0000 | [diff] [blame] | 315 | if build_port == "wx": |
| 316 | bld.add_subdirs(['WebKitTools/DumpRenderTree', 'WebKitTools/wx/browser', 'WebKit/wx/bindings/python']) |