10bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch#! /usr/bin/env python 20bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 30bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# Copyright (C) 2009 Kevin Ollivier All rights reserved. 40bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# 50bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# Redistribution and use in source and binary forms, with or without 60bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# modification, are permitted provided that the following conditions 70bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# are met: 80bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# 1. Redistributions of source code must retain the above copyright 90bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# notice, this list of conditions and the following disclaimer. 100bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# 2. Redistributions in binary form must reproduce the above copyright 110bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# notice, this list of conditions and the following disclaimer in the 120bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# documentation and/or other materials provided with the distribution. 130bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# 140bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 150bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 160bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 170bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 180bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 190bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 200bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 210bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 220bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 230bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 240bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 250bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# 260bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch# wxWebKit build script for the waf build system 270bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 280bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochfrom settings import * 290bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 300bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochwebkit_dirs = ['.', 'WebKitSupport'] 310bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochinclude_paths = webkit_dirs + common_includes + ['.', '..', 320bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch wk_root, 33cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'JavaScriptCore'), 34cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'WebCore'), 35cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'WebCore', 'bindings', 'wx'), 36cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'WebCore', 'DerivedSources'), 370bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch os.path.join(output_dir), 38cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'WebCore', 'page', 'wx'), 39cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'network', 'curl'), 40cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'wx'), 41cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'bridge', 'wx'), 42cad810f21b803229eb11403f9209855525a25d57Steve Block os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'graphics', 'wx'), 430bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch] 440bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 455af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeif sys.platform.startswith("win"): 46cad810f21b803229eb11403f9209855525a25d57Steve Block include_paths.append(os.path.join(wk_root, 'Source', 'WebCore','platform','win')) 475af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke 48231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockwindows_deps = [ 49231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 'lib/pthreadVC2.dll', 50231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 'bin/icuuc40.dll', 'bin/icudt40.dll', 'bin/icuin40.dll', 51231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 'bin/libcurl.dll', 'bin/libeay32.dll', 'bin/ssleay32.dll', 'bin/zlib1.dll', 52231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 'lib/sqlite3.dll', 'bin/libxml2.dll', 'bin/libxslt.dll', 'bin/iconv.dll', 53231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ] 54231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 550bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochwebcore_include_dirs = [] 560bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochfor dir in webcore_dirs + ['DerivedSources']: 57cad810f21b803229eb11403f9209855525a25d57Steve Block include_paths.append(os.path.join(wk_root, 'Source', 'WebCore', dir)) 580bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 59cad810f21b803229eb11403f9209855525a25d57Steve Blockjs_include_dirs = [os.path.join(wk_root, 'Source', 'JavaScriptCore', 'assembler')] 600bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochfor dir in jscore_dirs: 61cad810f21b803229eb11403f9209855525a25d57Steve Block js_include_dirs.append(os.path.join(wk_root, 'Source', 'JavaScriptCore', dir)) 620bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 630bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochdef set_options(opt): 640bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch common_set_options(opt) 650bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 660bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochdef configure(conf): 670bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch common_configure(conf) 680bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 69231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Blockdef pre_build(bld): 70231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block """ 71231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block The wxWebKit library should be rebuilt if jscore or webcore changes, 72231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block so we make those static libs as dependencies. 73231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block """ 74231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 75231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ext = '.a' 76231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if sys.platform.startswith('win'): 77231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block ext = '.lib' 78231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 79231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block libjscore = os.path.join(output_dir, 'libjscore%s' % ext) 80231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block libwebcore = os.path.join(output_dir, 'libwebcore%s' % ext) 81231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 82231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block assert os.path.exists(libjscore) 83231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block assert os.path.exists(libwebcore) 84231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 85231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bld.env.CXXDEPS_JSCORE = Utils.h_file(libjscore) 86231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bld.env.CXXDEPS_WEBCORE = Utils.h_file(libwebcore) 87231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 880bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdochdef build(bld): 8921939df44de1705786c545cd1bf519d47250322dBen Murdoch 9021939df44de1705786c545cd1bf519d47250322dBen Murdoch import TaskGen 9121939df44de1705786c545cd1bf519d47250322dBen Murdoch 9221939df44de1705786c545cd1bf519d47250322dBen Murdoch if sys.platform.startswith('darwin'): 9321939df44de1705786c545cd1bf519d47250322dBen Murdoch TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx'] 9421939df44de1705786c545cd1bf519d47250322dBen Murdoch TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx'] 9521939df44de1705786c545cd1bf519d47250322dBen Murdoch 96231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bld.add_pre_fun(pre_build) 97231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 98231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bld.env.LIBDIR = output_dir 99231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 1000bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch obj = bld.new_task_gen( 1010bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch features = 'cxx cshlib implib', 1020bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch includes = ' '.join(include_paths + js_include_dirs), 1030bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch target = 'wxwebkit', 1040bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch defines = ['WXMAKINGDLL_WEBKIT'], 105231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block uselib = 'WX CURL ICU XSLT XML SQLITE3 WEBCORE JSCORE ' + get_config(), 1060bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch libpath = [output_dir], 1070bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch uselib_local = '', 1080bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch install_path = output_dir) 1090bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch 11021939df44de1705786c545cd1bf519d47250322dBen Murdoch exts = ['.c', '.cpp'] 11121939df44de1705786c545cd1bf519d47250322dBen Murdoch if sys.platform.startswith('darwin'): 11221939df44de1705786c545cd1bf519d47250322dBen Murdoch exts.append('.mm') 113cad810f21b803229eb11403f9209855525a25d57Steve Block obj.includes += '../mac/WebCoreSupport ../../Source/WebCore/platform/mac' 11406ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen obj.source = "../mac/WebCoreSupport/WebSystemInterface.mm" 1150bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch obj.find_sources_in_dirs(webkit_dirs) 116231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 117231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if building_on_win32: 118231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block for wxlib in bld.env['LIB_WX']: 119231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block wxlibname = os.path.join(bld.env['LIBPATH_WX'][0], wxlib + '_vc.dll') 120231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block if os.path.exists(wxlibname): 121231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bld.install_files(obj.install_path, [wxlibname]) 122231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block 123231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block for dep in windows_deps: 124231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block bld.install_files(obj.install_path, [os.path.join(msvclibs_dir, dep)]) 125