summaryrefslogtreecommitdiffstats
path: root/WebKitTools/wx/build
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-08 17:19:54 +0100
committerSteve Block <steveblock@google.com>2009-10-20 00:41:58 +0100
commit231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch)
treea6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebKitTools/wx/build
parente196732677050bd463301566a68a643b6d14b907 (diff)
downloadexternal_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebKitTools/wx/build')
-rw-r--r--WebKitTools/wx/build/build_utils.py21
-rw-r--r--WebKitTools/wx/build/settings.py152
-rw-r--r--WebKitTools/wx/build/waf_extensions.py7
-rw-r--r--WebKitTools/wx/build/wxpresets.py54
4 files changed, 186 insertions, 48 deletions
diff --git a/WebKitTools/wx/build/build_utils.py b/WebKitTools/wx/build/build_utils.py
index f6daf3a..0a795a8 100644
--- a/WebKitTools/wx/build/build_utils.py
+++ b/WebKitTools/wx/build/build_utils.py
@@ -23,8 +23,11 @@
#
# Helper functions for the WebKit build.
+import commands
import glob
import os
+import platform
+import shutil
import sys
import urllib
import urlparse
@@ -35,8 +38,11 @@ def get_output(command):
"""
Windows-compatible function for getting output from a command.
"""
- f = os.popen(command)
- return f.read().strip()
+ if sys.platform.startswith('win'):
+ f = os.popen(command)
+ return f.read().strip()
+ else:
+ return commands.getoutput(command)
def get_excludes(root, patterns):
"""
@@ -100,7 +106,7 @@ def download_if_newer(url, destdir):
return None
-def update_wx_deps(wk_root, msvc_version='msvc2008'):
+def update_wx_deps(conf, wk_root, msvc_version='msvc2008'):
"""
Download and update tools needed to build the wx port.
"""
@@ -114,7 +120,10 @@ def update_wx_deps(wk_root, msvc_version='msvc2008'):
sys.exit(1)
# since this module is still experimental
- #swig_module = download_if_newer('http://wxwebkit.wxcommunity.com/downloads/deps/swig.py', os.path.join(wk_root, 'WebKit', 'wx', 'bindings', 'python'))
+ wxpy_dir = os.path.join(wk_root, 'WebKit', 'wx', 'bindings', 'python')
+ swig_module = download_if_newer('http://wxwebkit.wxcommunity.com/downloads/deps/swig.py.txt', wxpy_dir)
+ if swig_module:
+ shutil.copy(os.path.join(wxpy_dir, 'swig.py.txt'), os.path.join(wxpy_dir, 'swig.py'))
if sys.platform.startswith('win'):
Logs.info('downloading deps package')
@@ -123,6 +132,10 @@ def update_wx_deps(wk_root, msvc_version='msvc2008'):
os.system('unzip -o %s -d %s' % (archive, os.path.join(wklibs_dir, msvc_version)))
elif sys.platform.startswith('darwin'):
+ # export the right compiler for building the dependencies
+ if platform.release().startswith('10'): # Snow Leopard
+ os.environ['CC'] = conf.env['CC'][0]
+ os.environ['CXX'] = conf.env['CXX'][0]
os.system('%s/WebKitTools/wx/install-unix-extras' % wk_root)
def includeDirsForSources(sources):
diff --git a/WebKitTools/wx/build/settings.py b/WebKitTools/wx/build/settings.py
index b09f0bc..4019273 100644
--- a/WebKitTools/wx/build/settings.py
+++ b/WebKitTools/wx/build/settings.py
@@ -26,8 +26,11 @@
import commands
import os
import platform
+import re
import sys
+import Options
+
from build_utils import *
from waf_extensions import *
@@ -56,6 +59,24 @@ common_libs = []
common_libpaths = []
common_frameworks = []
+ports = [
+ 'CF',
+ 'Chromium',
+ 'Gtk',
+ 'Haiku',
+ 'Mac',
+ 'None',
+ 'Qt',
+ 'Safari',
+ 'Win',
+ 'Wince',
+ 'wx',
+]
+
+port_uses = {
+ 'wx': ['CURL','PTHREADS', 'WXGC'],
+}
+
jscore_dirs = [
'API',
'bytecode',
@@ -84,13 +105,15 @@ webcore_dirs = [
'dom/default',
'editing',
'history',
- 'html',
+ 'html',
+ 'html/canvas',
'inspector',
'loader',
'loader/appcache',
'loader/archive',
- 'loader/icon',
- 'page',
+ 'loader/icon',
+ 'notifications',
+ 'page',
'page/animation',
'platform',
'platform/animation',
@@ -103,7 +126,8 @@ webcore_dirs = [
'platform/image-decoders/jpeg',
'platform/image-decoders/png',
'platform/image-decoders/xbm',
- 'platform/image-decoders/zlib',
+ 'platform/image-decoders/zlib',
+ 'platform/mock',
'platform/network',
'platform/sql',
'platform/text',
@@ -111,6 +135,7 @@ webcore_dirs = [
'rendering',
'rendering/style',
'storage',
+ 'websockets',
'xml'
]
@@ -120,18 +145,35 @@ config = 'Debug'
if os.path.exists(config_file):
config = open(config_file).read()
-output_dir = os.path.join(wk_root, 'WebKitBuild', config)
+config_dir = config
-waf_configname = config.upper()
+try:
+ branches = commands.getoutput("git branch --no-color")
+ match = re.search('^\* (.*)', branches, re.MULTILINE)
+ if match:
+ config_dir += ".%s" % match.group(1)
+except:
+ pass
+
+output_dir = os.path.join(wk_root, 'WebKitBuild', config_dir)
build_port = "wx"
building_on_win32 = sys.platform.startswith('win')
-if building_on_win32:
- if config == 'Release':
- waf_configname = waf_configname + ' CRT_MULTITHREADED_DLL'
- else:
- waf_configname = waf_configname + ' CRT_MULTITHREADED_DLL_DBG'
+def get_config():
+ waf_configname = config.upper().strip()
+ if building_on_win32:
+ isReleaseCRT = (config == 'Release')
+ if build_port == 'wx':
+ if Options.options.wxpython:
+ isReleaseCRT = True
+
+ if isReleaseCRT:
+ waf_configname = waf_configname + ' CRT_MULTITHREADED_DLL'
+ else:
+ waf_configname = waf_configname + ' CRT_MULTITHREADED_DLL_DBG'
+
+ return waf_configname
create_hash_table = wk_root + "/JavaScriptCore/create_hash_table"
if building_on_win32:
@@ -140,6 +182,16 @@ os.environ['CREATE_HASH_TABLE'] = create_hash_table
feature_defines = ['ENABLE_DATABASE', 'ENABLE_XSLT', 'ENABLE_JAVASCRIPT_DEBUGGER']
+msvc_version = 'msvc2008'
+
+msvclibs_dir = os.path.join(wklibs_dir, msvc_version, 'win')
+
+def get_path_to_wxconfig():
+ if 'WX_CONFIG' in os.environ:
+ return os.environ['WX_CONFIG']
+ else:
+ return 'wx-config'
+
def common_set_options(opt):
"""
Initialize common options provided to the user.
@@ -149,38 +201,66 @@ def common_set_options(opt):
opt.tool_options('python')
opt.add_option('--wxpython', action='store_true', default=False, help='Create the wxPython bindings.')
+ opt.add_option('--wx-compiler-prefix', action='store', default='vc',
+ help='Specify a different compiler prefix (do this if you used COMPILER_PREFIX when building wx itself)')
def common_configure(conf):
"""
Configuration used by all targets, called from the target's configure() step.
"""
+
+ conf.env['MSVC_VERSIONS'] = ['msvc 9.0', 'msvc 8.0']
+ conf.env['MSVC_TARGETS'] = ['x86']
+
+ if sys.platform.startswith('cygwin'):
+ print "ERROR: You must use the Win32 Python from python.org, not Cygwin Python, when building on Windows."
+ sys.exit(1)
+
+ if sys.platform.startswith('darwin') and build_port == 'wx':
+ import platform
+ if platform.release().startswith('10'): # Snow Leopard
+ # wx currently only supports 32-bit compilation, so we want gcc-4.0 instead of 4.2 on Snow Leopard
+ # unless the user has explicitly set a different compiler.
+ if not "CC" in os.environ:
+ conf.env['CC'] = 'gcc-4.0'
+ if not "CXX" in os.environ:
+ conf.env['CXX'] = 'g++-4.0'
conf.check_tool('compiler_cxx')
conf.check_tool('compiler_cc')
- conf.check_tool('python')
- conf.check_python_headers()
+ if Options.options.wxpython:
+ conf.check_tool('python')
+ conf.check_python_headers()
if sys.platform.startswith('darwin'):
conf.check_tool('osx')
- msvc_version = 'msvc2008'
+ global msvc_version
+ global msvclibs_dir
+
if building_on_win32:
found_versions = conf.get_msvc_versions()
if found_versions[0][0] == 'msvc 9.0':
msvc_version = 'msvc2008'
elif found_versions[0][0] == 'msvc 8.0':
msvc_version = 'msvc2005'
-
- msvclibs_dir = ''
- if build_port == "wx":
- update_wx_deps(wk_root, msvc_version)
+
msvclibs_dir = os.path.join(wklibs_dir, msvc_version, 'win')
+ conf.env.append_value('CXXFLAGS', ['/wd4291','/wd4344','/wd4396','/wd4800'])
+
+ for use in port_uses[build_port]:
+ conf.env.append_value('CXXDEFINES', ['WTF_USE_%s' % use])
- conf.env.append_value('CXXDEFINES', ['BUILDING_WX__=1', 'WTF_USE_WXGC=1'])
+ if build_port == "wx":
+ update_wx_deps(conf, wk_root, msvc_version)
+
+ conf.env.append_value('CXXDEFINES', ['BUILDING_WX__=1'])
if building_on_win32:
conf.env.append_value('LIBPATH', os.path.join(msvclibs_dir, 'lib'))
# wx settings
- wxdefines, wxincludes, wxlibs, wxlibpaths = get_wxmsw_settings(wx_root, shared=True, unicode=True, wxPython=True)
+ global config
+ is_debug = (config == 'Debug')
+ wxdefines, wxincludes, wxlibs, wxlibpaths = get_wxmsw_settings(wx_root, shared=True, unicode=True, debug=is_debug, wxPython=Options.options.wxpython)
conf.env['CXXDEFINES_WX'] = wxdefines
conf.env['CPPPATH_WX'] = wxincludes
conf.env['LIB_WX'] = wxlibs
@@ -193,6 +273,14 @@ def common_configure(conf):
conf.env.append_value('CPPPATH', wklibs_dir)
conf.env.append_value('LIBPATH', wklibs_dir)
+
+ # WebKit only supports 10.4+
+ mac_target = 'MACOSX_DEPLOYMENT_TARGET'
+ if mac_target in os.environ and os.environ[mac_target] == '10.3':
+ os.environ[mac_target] = '10.4'
+
+ if mac_target in conf.env and conf.env[mac_target] == '10.3':
+ conf.env[mac_target] = '10.4'
#conf.env['PREFIX'] = output_dir
@@ -240,26 +328,22 @@ def common_configure(conf):
conf.env['LIB_XSLT'] = ['libxslt']
else:
if build_port == 'wx':
- conf.env.append_value('LIB', ['png', 'pthread'])
+ conf.env.append_value('LIB', ['jpeg', 'png', 'pthread'])
conf.env.append_value('LIBPATH', os.path.join(wklibs_dir, 'unix', 'lib'))
conf.env.append_value('CPPPATH', os.path.join(wklibs_dir, 'unix', 'include'))
conf.env.append_value('CXXFLAGS', ['-fPIC', '-DPIC'])
- conf.check_cfg(path='wx-config', args='--cxxflags --libs', package='', uselib_store='WX')
+ conf.check_cfg(path=get_path_to_wxconfig(), args='--cxxflags --libs', package='', uselib_store='WX', mandatory=True)
- conf.check_cfg(path='xslt-config', args='--cflags --libs', package='', uselib_store='XSLT')
- conf.check_cfg(path='xml2-config', args='--cflags --libs', package='', uselib_store='XML')
- conf.check_cfg(path='curl-config', args='--cflags --libs', package='', uselib_store='CURL')
+ conf.check_cfg(msg='Checking for libxslt', path='xslt-config', args='--cflags --libs', package='', uselib_store='XSLT', mandatory=True)
+ conf.check_cfg(path='xml2-config', args='--cflags --libs', package='', uselib_store='XML', mandatory=True)
+ conf.check_cfg(path='curl-config', args='--cflags --libs', package='', uselib_store='CURL', mandatory=True)
if sys.platform.startswith('darwin'):
conf.env.append_value('LIB', ['WebCoreSQLite3'])
if not sys.platform.startswith('darwin'):
- conf.check_cfg(package='cairo', args='--cflags --libs', uselib_store='WX')
- conf.check_cfg(package='pango', args='--cflags --libs', uselib_store='WX')
- conf.check_cfg(package='gtk+-2.0', args='--cflags --libs', uselib_store='WX')
- conf.check_cfg(package='sqlite3', args='--cflags --libs', uselib_store='SQLITE3')
- conf.check_cfg(path='icu-config', args='--cflags --ldflags', package='', uselib_store='ICU')
-
-
-
-
+ conf.check_cfg(package='cairo', args='--cflags --libs', uselib_store='WX', mandatory=True)
+ conf.check_cfg(package='pango', args='--cflags --libs', uselib_store='WX', mandatory=True)
+ conf.check_cfg(package='gtk+-2.0', args='--cflags --libs', uselib_store='WX', mandatory=True)
+ conf.check_cfg(package='sqlite3', args='--cflags --libs', uselib_store='SQLITE3', mandatory=True)
+ conf.check_cfg(path='icu-config', args='--cflags --ldflags', package='', uselib_store='ICU', mandatory=True)
diff --git a/WebKitTools/wx/build/waf_extensions.py b/WebKitTools/wx/build/waf_extensions.py
index fcf34df..6816441 100644
--- a/WebKitTools/wx/build/waf_extensions.py
+++ b/WebKitTools/wx/build/waf_extensions.py
@@ -34,10 +34,9 @@ def exec_command(s, **kw):
filename = ''
if sys.platform.startswith('win') and len(' '.join(s)) > 32000:
import tempfile
- file = tempfile.NamedTemporaryFile(delete=False)
- filename = file.name
- file.write(' '.join(s[1:]))
- file.close()
+ (fd, filename) = tempfile.mkstemp()
+ os.write(fd, ' '.join(s[1:]))
+ os.close(fd)
s = [s[0], '@' + filename]
diff --git a/WebKitTools/wx/build/wxpresets.py b/WebKitTools/wx/build/wxpresets.py
index 677720c..3d6b693 100644
--- a/WebKitTools/wx/build/wxpresets.py
+++ b/WebKitTools/wx/build/wxpresets.py
@@ -24,6 +24,37 @@
# Library for functions to determine wx settings based on configuration
import os
+import re
+
+import Options
+
+def parse_build_cfg(filename):
+ cfg_file = open(filename, 'r')
+ cfg = {}
+ for cfg_line in cfg_file.readlines():
+ key = None
+ value = None
+ parts = cfg_line.split('=')
+ if len(parts) >= 1:
+ key = parts[0].strip()
+
+ if len(parts) >= 2:
+ value = parts[1].strip()
+ if value.isdigit():
+ value = int(value)
+
+ if key:
+ cfg[key] = value
+
+ return cfg
+
+def get_wx_version(wx_root):
+ versionText = open(os.path.join(wx_root, "include", "wx", "version.h"), "r").read()
+
+ majorVersion = re.search("#define\swxMAJOR_VERSION\s+(\d+)", versionText).group(1)
+ minorVersion = re.search("#define\swxMINOR_VERSION\s+(\d+)", versionText).group(1)
+
+ return (majorVersion, minorVersion)
def get_wxmsw_settings(wx_root, shared = False, unicode = False, debug = False, wxPython=False):
if not os.path.exists(wx_root):
@@ -40,11 +71,13 @@ def get_wxmsw_settings(wx_root, shared = False, unicode = False, debug = False,
ext = ''
postfix = 'vc'
+ version_str_nodot = ''.join(get_wx_version(wx_root))
+
if shared:
defines.append('WXUSINGDLL')
- libdir = os.path.join(libdir, 'vc_dll')
+ libdir = os.path.join(libdir, Options.options.wx_compiler_prefix + '_dll')
else:
- libdir = os.path.join(libdir, 'vc_lib')
+ libdir = os.path.join(libdir, Options.options.wx_compiler_prefix + '_lib')
if unicode:
defines.append('_UNICODE')
@@ -59,18 +92,27 @@ def get_wxmsw_settings(wx_root, shared = False, unicode = False, debug = False,
depext += 'd'
configdir = os.path.join(libdir, 'msw' + ext)
+
+ monolithic = False
+ cfg_file = os.path.join(configdir, 'build.cfg')
+ if os.path.exists(cfg_file):
+ cfg = parse_build_cfg(cfg_file)
+ if "MONOLITHIC" in cfg:
+ monolithic = cfg["MONOLITHIC"]
libpaths.append(libdir)
includes.append(configdir)
def get_wxlib_name(name):
- prefix = 'wxmsw'
if name == 'base':
- return 'wxbase28%s' % (ext)
+ return 'wxbase%s%s' % (version_str_nodot, ext)
- return "wxmsw28%s_%s" % (ext, name)
+ return "wxmsw%s%s_%s" % (version_str_nodot, ext, name)
libs.extend(['wxzlib' + depext, 'wxjpeg' + depext, 'wxpng' + depext, 'wxexpat' + depext])
- libs.extend([get_wxlib_name('base'), get_wxlib_name('core')])
+ if monolithic:
+ libs.extend(["wxmsw%s%s" % (version_str_nodot, ext)])
+ else:
+ libs.extend([get_wxlib_name('base'), get_wxlib_name('core')])
if wxPython or debug:
defines.append('__WXDEBUG__')