• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
28from settings import *
29
30webcore_sources = {}
31
32if build_port == "wx":
33    webcore_sources['plugins'] = [  'plugins/PluginDataNone.cpp',
34                                    'plugins/PluginPackageNone.cpp',
35                                    'plugins/PluginViewNone.cpp'
36                                  ]
37
38    if building_on_win32:
39        webcore_dirs.append('platform/wx/wxcode/win')
40        webcore_sources['wx-win'] = [
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               'page/win/PageWin.cpp',
46
47        ]
48    elif sys.platform.startswith('darwin'):
49        webcore_dirs.append('platform/wx/wxcode/mac/carbon')
50        webcore_sources['wx-mac'] = [
51               'platform/mac/PurgeableBufferMac.cpp',
52        ]
53    else:
54        webcore_dirs.append('platform/wx/wxcode/gtk')
55
56from TaskGen import taskgen, feature, after
57import Task, ccroot
58
59def generate_webcore_derived_sources():
60    # build the derived sources
61    derived_sources_dir = os.path.join(webcore_dir, 'DerivedSources')
62    wc_dir = webcore_dir
63    if building_on_win32:
64        wc_dir = get_output('cygpath --unix "%s"' % wc_dir)
65    if not os.path.exists(derived_sources_dir):
66        os.mkdir(derived_sources_dir)
67
68    olddir = os.getcwd()
69    os.chdir(derived_sources_dir)
70
71    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)))
72    os.chdir(olddir)
73
74def set_options(opt):
75    common_set_options(opt)
76
77def configure(conf):
78    common_configure(conf)
79
80def build(bld):
81    import Options
82
83    generate_webcore_derived_sources()
84
85    wk_includes = ['.', '..', 'DerivedSources',
86                wk_root,
87                os.path.join(wk_root, 'JavaScriptCore'),
88                os.path.join(wk_root, 'WebCore'),
89                'platform/image-decoders',
90                'platform/wx/wxcode',
91                'workers',
92        ]
93
94    features = [build_port]
95    if build_port == 'wx':
96        features.append('curl')
97
98    full_dirs = get_dirs_for_features(webcore_dir, features=features, dirs=webcore_dirs)
99
100    jscore_dir = os.path.join(wk_root, 'JavaScriptCore')
101    for item in os.listdir(jscore_dir):
102        fullpath = os.path.join(jscore_dir, item)
103        if os.path.isdir(fullpath) and not item == "os-win32" and not item == 'icu':
104            wk_includes.append(fullpath)
105
106    wk_includes += common_includes + full_dirs
107
108    cxxflags = []
109    if building_on_win32:
110        cxxflags.append('/FIWebCorePrefix.h')
111    else:
112        cxxflags.extend(['-include', 'WebCorePrefix.h'])
113
114    webcore = bld.new_task_gen(
115        features = 'cc cxx cstaticlib',
116        includes = ' '.join(wk_includes),
117        source = ' '.join(flattenSources(webcore_sources.values())),
118        cxxflags = cxxflags,
119        target = 'webcore',
120        uselib = 'WX ICU XML XSLT CURL ' + waf_configname,
121        uselib_local = '',
122        install_path = output_dir,
123        )
124
125    excludes = []
126    if build_port == 'wx':
127        excludes = get_excludes(webcore_dir, ['*None.cpp', '*CF.cpp', '*Qt.cpp', '*Win.cpp', '*Wince.cpp', '*Gtk.cpp', '*Mac.cpp', '*Safari.cpp', '*Chromium*.cpp','*SVG*.cpp', '*AllInOne.cpp', 'test*bindings.*'])
128        excludes.extend(['UserStyleSheetLoader.cpp', 'RenderMediaControls.cpp'])
129
130        # intermediate sources
131        excludes.append('CSSValueKeywords.c')
132        excludes.append('CSSPropertyNames.cpp')
133        excludes.append('tokenizer.cpp')
134
135        # FIXME: these three require headers that I can't seem to find in trunk.
136        # Investigate how to resolve these issues.
137        excludes.append('JSAbstractView.cpp')
138        excludes.append('JSPositionCallback.cpp')
139        excludes.append('JSDOMStringList.cpp')
140        excludes.append('JSInspectorController.cpp')
141        if building_on_win32:
142            excludes.append('SharedTimerWx.cpp')
143
144    webcore.find_sources_in_dirs(full_dirs, excludes = excludes, exts=['.c', '.cpp'])
145