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 # wxWebKit build script for the waf build system 27 28 from settings import * 29 30 webkit_dirs = ['.', 'WebKitSupport'] 31 include_paths = webkit_dirs + common_includes + ['.', '..', 32 wk_root, 33 os.path.join(wk_root, 'JavaScriptCore'), 34 os.path.join(wk_root, 'WebCore'), 35 os.path.join(output_dir), 36 os.path.join(wk_root, 'WebCore', 'page', 'wx'), 37 os.path.join(wk_root, 'WebCore', 'platform', 'network', 'curl'), 38 os.path.join(wk_root, 'WebCore', 'platform', 'wx'), 39 os.path.join(wk_root, 'WebCore', 'platform', 'bridge', 'wx'), 40 os.path.join(wk_root, 'WebCore', 'platform', 'graphics', 'wx'), 41 ] 42 43 windows_deps = [ 44 'lib/pthreadVC2.dll', 45 'bin/icuuc40.dll', 'bin/icudt40.dll', 'bin/icuin40.dll', 46 'bin/libcurl.dll', 'bin/libeay32.dll', 'bin/ssleay32.dll', 'bin/zlib1.dll', 47 'lib/sqlite3.dll', 'bin/libxml2.dll', 'bin/libxslt.dll', 'bin/iconv.dll', 48 ] 49 50 webcore_include_dirs = [] 51 for dir in webcore_dirs + ['DerivedSources']: 52 include_paths.append(os.path.join(wk_root, 'WebCore', dir)) 53 54 js_include_dirs = [os.path.join(wk_root, 'JavaScriptCore', 'assembler')] 55 for dir in jscore_dirs: 56 js_include_dirs.append(os.path.join(wk_root, 'JavaScriptCore', dir)) 57 58 def set_options(opt): 59 common_set_options(opt) 60 61 def configure(conf): 62 common_configure(conf) 63 64 def pre_build(bld): 65 """ 66 The wxWebKit library should be rebuilt if jscore or webcore changes, 67 so we make those static libs as dependencies. 68 """ 69 70 ext = '.a' 71 if sys.platform.startswith('win'): 72 ext = '.lib' 73 74 libjscore = os.path.join(output_dir, 'libjscore%s' % ext) 75 libwebcore = os.path.join(output_dir, 'libwebcore%s' % ext) 76 77 assert os.path.exists(libjscore) 78 assert os.path.exists(libwebcore) 79 80 bld.env.CXXDEPS_JSCORE = Utils.h_file(libjscore) 81 bld.env.CXXDEPS_WEBCORE = Utils.h_file(libwebcore) 82 83 def build(bld): 84 bld.add_pre_fun(pre_build) 85 86 bld.env.LIBDIR = output_dir 87 88 obj = bld.new_task_gen( 89 features = 'cxx cshlib implib', 90 includes = ' '.join(include_paths + js_include_dirs), 91 target = 'wxwebkit', 92 defines = ['WXMAKINGDLL_WEBKIT'], 93 uselib = 'WX CURL ICU XSLT XML SQLITE3 WEBCORE JSCORE ' + get_config(), 94 libpath = [output_dir], 95 uselib_local = '', 96 install_path = output_dir) 97 98 obj.find_sources_in_dirs(webkit_dirs) 99 100 if building_on_win32: 101 for wxlib in bld.env['LIB_WX']: 102 wxlibname = os.path.join(bld.env['LIBPATH_WX'][0], wxlib + '_vc.dll') 103 if os.path.exists(wxlibname): 104 bld.install_files(obj.install_path, [wxlibname]) 105 106 for dep in windows_deps: 107 bld.install_files(obj.install_path, [os.path.join(msvclibs_dir, dep)]) 108