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