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