diff options
Diffstat (limited to 'WebKitTools/wx')
-rw-r--r-- | WebKitTools/wx/browser/wscript | 2 | ||||
-rw-r--r-- | WebKitTools/wx/build/build_utils.py | 36 | ||||
-rw-r--r-- | WebKitTools/wx/build/settings.py | 91 | ||||
-rwxr-xr-x | WebKitTools/wx/install-unix-extras | 28 | ||||
-rw-r--r-- | WebKitTools/wx/packaging/build-mac-installer.py | 157 | ||||
-rw-r--r-- | WebKitTools/wx/packaging/build-win-installer.py | 44 | ||||
-rw-r--r-- | WebKitTools/wx/packaging/wxWebKitInstaller.iss.in | 2 |
7 files changed, 297 insertions, 63 deletions
diff --git a/WebKitTools/wx/browser/wscript b/WebKitTools/wx/browser/wscript index 530cd75..d5246c1 100644 --- a/WebKitTools/wx/browser/wscript +++ b/WebKitTools/wx/browser/wscript @@ -45,7 +45,7 @@ def build(bld): includes = ' '.join(include_paths), source = 'browser.cpp', target = 'wxBrowser', - uselib = 'WX CURL ICU SQLITE3 XSLT XML WXWEBKIT ' + get_config(), + uselib = 'WXWEBKIT WX ' + get_config(), libpath = [output_dir], uselib_local = '', install_path = output_dir) diff --git a/WebKitTools/wx/build/build_utils.py b/WebKitTools/wx/build/build_utils.py index 0a795a8..b767d9f 100644 --- a/WebKitTools/wx/build/build_utils.py +++ b/WebKitTools/wx/build/build_utils.py @@ -27,13 +27,12 @@ import commands import glob import os import platform +import re import shutil import sys import urllib import urlparse -import Logs - def get_output(command): """ Windows-compatible function for getting output from a command. @@ -110,6 +109,7 @@ def update_wx_deps(conf, wk_root, msvc_version='msvc2008'): """ Download and update tools needed to build the wx port. """ + import Logs Logs.info('Ensuring wxWebKit dependencies are up-to-date.') wklibs_dir = os.path.join(wk_root, 'WebKitLibraries') @@ -154,3 +154,35 @@ def flattenSources(sources): flat_sources.extend(group) return flat_sources + +def git_branch_name(): + try: + branches = commands.getoutput("git branch --no-color") + match = re.search('^\* (.*)', branches, re.MULTILINE) + if match: + return ".%s" % match.group(1) + except: + pass + + return "" + +def get_config(wk_root): + config_file = os.path.join(wk_root, 'WebKitBuild', 'Configuration') + config = 'Debug' + + if os.path.exists(config_file): + config = open(config_file).read() + + return config + +def svn_revision(): + if os.system("git info") == 0: + info = commands.getoutput("git-svn info ../..") + else: + info = commands.getoutput("svn info") + + for line in info.split("\n"): + if line.startswith("Revision: "): + return line.replace("Revision: ", "").strip() + + return "" diff --git a/WebKitTools/wx/build/settings.py b/WebKitTools/wx/build/settings.py index 4019273..652a880 100644 --- a/WebKitTools/wx/build/settings.py +++ b/WebKitTools/wx/build/settings.py @@ -95,8 +95,9 @@ jscore_dirs = [ ] webcore_dirs = [ - 'accessibility', - 'bindings/js', + 'accessibility', + 'bindings', + 'bindings/js', 'bridge', 'bridge/c', 'css', @@ -139,21 +140,8 @@ webcore_dirs = [ 'xml' ] -config_file = os.path.join(wk_root, 'WebKitBuild', 'Configuration') -config = 'Debug' - -if os.path.exists(config_file): - config = open(config_file).read() - -config_dir = config - -try: - branches = commands.getoutput("git branch --no-color") - match = re.search('^\* (.*)', branches, re.MULTILINE) - if match: - config_dir += ".%s" % match.group(1) -except: - pass +config = get_config(wk_root) +config_dir = config + git_branch_name() output_dir = os.path.join(wk_root, 'WebKitBuild', config_dir) @@ -203,6 +191,7 @@ def common_set_options(opt): 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)') + opt.add_option('--macosx-version', action='store', default='', help="Version of OS X to build for.") def common_configure(conf): """ @@ -245,11 +234,32 @@ def common_configure(conf): msvc_version = 'msvc2005' msvclibs_dir = os.path.join(wklibs_dir, msvc_version, 'win') - conf.env.append_value('CXXFLAGS', ['/wd4291','/wd4344','/wd4396','/wd4800']) + + # Disable several warnings which occur many times during the build. + # Some of them are harmless (4099, 4344, 4396, 4800) and working around + # them in WebKit code is probably just not worth it. We can simply do + # nothing about the others (4503). A couple are possibly valid but + # there are just too many of them in the code so fixing them is + # impossible in practice and just results in tons of distracting output + # (4244, 4291). Finally 4996 is actively harmful as it is given for + # just about any use of standard C/C++ library facilities. + conf.env.append_value('CXXFLAGS', [ + '/wd4099', # type name first seen using 'struct' now seen using 'class' + '/wd4244', # conversion from 'xxx' to 'yyy', possible loss of data: + '/wd4291', # no matching operator delete found (for placement new) + '/wd4344', # behaviour change in template deduction + '/wd4396', # inline can't be used in friend declaration + '/wd4503', # decorated name length exceeded, name was truncated + '/wd4800', # forcing value to bool 'true' or 'false' + '/wd4996', # deprecated function + ]) + + # This one also occurs in C code, so disable it there as well. + conf.env.append_value('CCFLAGS', ['/wd4996']) for use in port_uses[build_port]: conf.env.append_value('CXXDEFINES', ['WTF_USE_%s' % use]) - + if build_port == "wx": update_wx_deps(conf, wk_root, msvc_version) @@ -265,7 +275,7 @@ def common_configure(conf): conf.env['CPPPATH_WX'] = wxincludes conf.env['LIB_WX'] = wxlibs conf.env['LIBPATH_WX'] = wxlibpaths - + if sys.platform.startswith('darwin'): conf.env['LIB_ICU'] = ['icucore'] # Apple does not ship the ICU headers with Mac OS X, so WebKit includes a copy of 3.2 headers @@ -274,15 +284,33 @@ def common_configure(conf): conf.env.append_value('CPPPATH', wklibs_dir) conf.env.append_value('LIBPATH', wklibs_dir) - # WebKit only supports 10.4+ + min_version = None + 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 Options.options.macosx_version != '': + min_version = Options.options.macosx_version - if mac_target in conf.env and conf.env[mac_target] == '10.3': - conf.env[mac_target] = '10.4' - - #conf.env['PREFIX'] = output_dir + # WebKit only supports 10.4+, but ppc systems often set this to earlier systems + if not min_version: + min_version = commands.getoutput('sw_vers -productVersion')[:4] + if min_version in ['10.1','10.2','10.3']: + min_version = '10.4' + + os.environ[mac_target] = conf.env[mac_target] = min_version + + sdk_version = min_version + if min_version == "10.4": + sdk_version += "u" + conf.env.append_value('LIB', ['WebKitSystemInterfaceTiger']) + + sdkroot = '/Developer/SDKs/MacOSX%s.sdk' % sdk_version + sdkflags = ['-arch', 'i386', '-isysroot', sdkroot] + + conf.env.append_value('CPPFLAGS', sdkflags) + conf.env.append_value('LINKFLAGS', sdkflags) + + conf.env.append_value('CPPPATH_SQLITE3', [os.path.join(wklibs_dir, 'WebCoreSQLite3')]) + conf.env.append_value('LIB_SQLITE3', ['WebCoreSQLite3']) libprefix = '' if building_on_win32: @@ -310,7 +338,7 @@ def common_configure(conf): conf.env.append_value('LIB', [ 'kernel32', 'user32','gdi32','comdlg32','winspool','winmm', 'shell32', 'comctl32', 'ole32', 'oleaut32', 'uuid', 'advapi32', - 'wsock32', 'gdiplus']) + 'wsock32', 'gdiplus', 'version']) conf.env['LIB_ICU'] = ['icudt', 'icule', 'iculx', 'icuuc', 'icuin', 'icuio', 'icutu'] @@ -337,9 +365,10 @@ def common_configure(conf): 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 sys.platform.startswith('darwin') and min_version and min_version == '10.4': + conf.check_cfg(path=os.path.join(wklibs_dir, 'unix', 'bin', 'curl-config'), args='--cflags --libs', package='', uselib_store='CURL', mandatory=True) + else: + conf.check_cfg(path='curl-config', args='--cflags --libs', package='', uselib_store='CURL', mandatory=True) if not sys.platform.startswith('darwin'): conf.check_cfg(package='cairo', args='--cflags --libs', uselib_store='WX', mandatory=True) diff --git a/WebKitTools/wx/install-unix-extras b/WebKitTools/wx/install-unix-extras index 68d81e4..00c936c 100755 --- a/WebKitTools/wx/install-unix-extras +++ b/WebKitTools/wx/install-unix-extras @@ -74,6 +74,12 @@ LIBPNG_VERSION="1.2.33" LIBPNG_TARBALL="libpng-$LIBPNG_VERSION.tar.gz" LIBPNG_URL="http://wxwebkit.wxcommunity.com/downloads/deps/$LIBPNG_TARBALL" +LIBCURL_VERSION="7.19.6" +LIBCURL_TARBALL="curl-$LIBCURL_VERSION.tar.gz" +LIBCURL_URL="http://curl.haxx.se/download/$LIBCURL_TARBALL" + +export MAC_OS_X_DEPLOYMENT_TARGET=10.4 + cd $DL_DIR # build ICU if [ `which icu-config >/dev/null 2>&1` ]; then @@ -170,3 +176,25 @@ if [ ! -f $DEPS_PREFIX/lib/libpng.a ]; then cd $DL_DIR rm -rf $DL_DIR/libpng-$LIBPNG_VERSION fi + +if [ ! -f $DEPS_PREFIX/lib/libcurl.$DLLEXT ]; then + $DL_CMD -o $DL_DIR/$LIBCURL_TARBALL $LIBCURL_URL + + tar xzvf $DL_DIR/$LIBCURL_TARBALL + cd $DL_DIR/curl-$LIBCURL_VERSION + + if [ "${OSTYPE:0:6}" == "darwin" ]; then + ./configure --prefix=$DEPS_PREFIX --disable-dependency-tracking + make CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" \ + LDFLAGS="-arch i386 -arch ppc" + make install + else + ./configure --prefix=$DEPS_PREFIX + + make + make install + fi + + cd $DL_DIR + rm -rf $DL_DIR/curl-$LIBCURL_VERSION +fi diff --git a/WebKitTools/wx/packaging/build-mac-installer.py b/WebKitTools/wx/packaging/build-mac-installer.py new file mode 100644 index 0000000..a0c1b22 --- /dev/null +++ b/WebKitTools/wx/packaging/build-mac-installer.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python + +# Copyright (C) 2009 Kevin Ollivier All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Script for building Mac .pkg installer + +import commands +import distutils.sysconfig +import glob +import optparse +import os +import shutil +import string +import sys +import tempfile + +script_dir = os.path.abspath(os.path.dirname(__file__)) +sys.path.append(os.path.abspath(os.path.join(script_dir, "..", "build"))) + +from build_utils import * + +import wx + +wxwk_root = os.path.abspath(os.path.join(script_dir, "..", "..", "..")) +wxwebkit_dir = os.path.abspath(os.path.join(wxwk_root, "WebKitBuild", get_config(wxwk_root) + git_branch_name())) + +wx_version = wx.__version__[:5] +py_version = sys.version[:3] + +wxwk_version = svn_revision() + +platform = "osx" + +pkgname = "wxWebKit-%s-wx%s-py%s" % (platform, wx_version[:3], py_version) + +tempdir = "/tmp/%s" % (pkgname) + +if os.path.exists(tempdir): + shutil.rmtree(tempdir) + os.makedirs(tempdir) + +installroot = os.path.join(tempdir, "install-root") +installapps = os.path.join(tempdir, "install-apps") + +sp_root = distutils.sysconfig.get_python_lib() +wx_root = sp_root +if sys.platform.startswith("darwin"): + wx_root = "/usr/local/lib/wxPython-unicode-%s" % wx.__version__ + sp_root = "%s/lib/python%s/site-packages" % (wx_root, py_version) +sitepackages = "%s/wx-%s-mac-unicode/wx" % (sp_root, wx_version[:3]) +prefix = sitepackages + +def mac_update_dependencies(dylib, prefix): + """ + Copies any non-system dependencies into the bundle, and + updates the install name path to the new path in the bundle. + """ + global wx_root + system_prefixes = ["/usr/lib", "/System/Library", wx_root] + + output = commands.getoutput("otool -L %s" % dylib).strip() + for line in output.split("\n"): + filename = line.split("(")[0].strip() + if os.path.exists(filename): + print "checking dll %s" % filename + copy = True + for sys_prefix in system_prefixes: + if filename.startswith(sys_prefix): + copy = False + + if copy: + copydir = os.path.dirname(dylib) + + filedir, basename = os.path.split(filename) + dest_filename = os.path.join(prefix, basename) + copyname = os.path.join(copydir, basename) + if not os.path.exists(copyname): + shutil.copy(filename, copydir) + os.system("install_name_tool -id %s %s" % (dest_filename, copyname)) + + os.system("install_name_tool -change %s %s %s" % (filename, dest_filename, dylib)) + +def exitIfError(cmd): + print cmd + retval = os.system(cmd) + if retval != 0: + if os.path.exists(tempdir): + shutil.rmtree(tempdir) + sys.exit(1) + +wxroot = installroot + prefix +wxpythonroot = installroot + sitepackages + +try: + if not os.path.exists(wxroot): + os.makedirs(wxroot) + + if not os.path.exists(wxpythonroot): + os.makedirs(wxpythonroot) + + for wildcard in ["*.py", "*.so", "*.dylib"]: + files = glob.glob(os.path.join(wxwebkit_dir, wildcard)) + for afile in files: + shutil.copy(afile, wxpythonroot) + + if sys.platform.startswith("darwin"): + dylib_path = os.path.join(wxpythonroot, "libwxwebkit.dylib") + os.system("install_name_tool -id %s %s" % (os.path.join(prefix, "libwxwebkit.dylib"), dylib_path)) + mac_update_dependencies(dylib_path, prefix) + mac_update_dependencies(os.path.join(wxpythonroot, "_webview.so"), prefix) + + demodir = installroot + "/Applications/wxWebKit/Demos" + if not os.path.exists(demodir): + os.makedirs(demodir) + + shutil.copy(os.path.join(wxwk_root, "WebKit", "wx", "bindings", "python", "samples", "simple.py"), demodir) + + if os.path.exists(pkgname + ".pkg"): + shutil.rmtree(pkgname + ".pkg") + + pkg_args = ['--title ' + pkgname, + '--out %s.pkg' % pkgname, + '--version ' + wxwk_version.strip(), + '--id org.wxwebkit.wxwebkit', + '--domain system', + '--root-volume-only', + '--root ' + installroot, + '--resources %s/mac/resources' % script_dir, + '--verbose' + ] + + packagemaker = "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker" + exitIfError(packagemaker + " %s" % (string.join(pkg_args, " "))) +finally: + if os.path.exists(tempdir): + shutil.rmtree(tempdir) diff --git a/WebKitTools/wx/packaging/build-win-installer.py b/WebKitTools/wx/packaging/build-win-installer.py index beed705..2bb8034 100644 --- a/WebKitTools/wx/packaging/build-win-installer.py +++ b/WebKitTools/wx/packaging/build-win-installer.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Copyright (C) 2008 Kevin Ollivier All rights reserved. # @@ -30,6 +30,14 @@ import commands import glob from subprocess import * +script_dir = os.path.abspath(os.path.dirname(__file__)) +sys.path.append(os.path.abspath(os.path.join(script_dir, "..", "build"))) + +from build_utils import * + +wxwk_root = os.path.abspath(os.path.join(script_dir, "..", "..", "..")) +wxwebkit_dir = os.path.abspath(os.path.join(wxwk_root, "WebKitBuild", get_config(wxwk_root) + git_branch_name())) + # Find InnoSetup executable def getInnoSetupPath(): name = "ISCC.exe" @@ -37,6 +45,7 @@ def getInnoSetupPath(): dirs = os.environ["PATH"].split(":") # Add the default file path dirs.append("C:\\Program Files\\Inno Setup 5") + dirs.append("C:\\Program Files (x86)\\Inno Setup 5") if os.environ.has_key("INNO5"): retval = os.environ["INNO5"] @@ -48,40 +57,19 @@ def getInnoSetupPath(): retval = filepath return retval - -def getWebKitOutputDir(): - retval = "" - if os.environ.has_key("WEBKITOUTPUTDIR"): - retval = os.environ["WEBKITOUTPUTDIR"] - - if retval == "": - retval = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..", "WebKitBuild")) - - return os.path.join(retval, "Release") - -def getRevisionString(): - pipe = Popen("svnversion", shell=True, stdout=PIPE).stdout - svnrevision = pipe.read().strip() - print "r" + svnrevision - svnrevision = string.split(svnrevision, ":")[0] - svnrevision = svnrevision.replace("M", "") - svnrevision = "r" + svnrevision - - return svnrevision if __name__ == "__main__": innoSetup = getInnoSetupPath() - buildDir = getWebKitOutputDir() os.chdir(sys.path[0]) - svnrevision = getRevisionString() + svnrevision = svn_revision() if not os.path.exists(innoSetup): print "ERROR: Cannot find InnoSetup." #sys.exit(1) - if not os.path.exists(buildDir): - print "ERROR: Build dir %s doesn't exist." % buildDir + if not os.path.exists(wxwebkit_dir): + print "ERROR: Build dir %s doesn't exist." % wxwebkit_dir sys.exit(1) fileList = """ @@ -89,7 +77,7 @@ CopyMode: alwaysoverwrite; Source: *.pyd; DestDir: "{app}" CopyMode: alwaysoverwrite; Source: *.py; DestDir: "{app}" """ - dlls = glob.glob(os.path.join(buildDir, "*.dll")) + dlls = glob.glob(os.path.join(wxwebkit_dir, "*.dll")) for dll in dlls: if dll.find("wxbase") == -1 and dll.find("wxmsw") == -1: fileList += """CopyMode: alwaysoverwrite; Source: %s; DestDir: "{app}" \n""" % dll @@ -97,8 +85,8 @@ CopyMode: alwaysoverwrite; Source: *.py; DestDir: "{app}" installerTemplate = open("wxWebKitInstaller.iss.in", "r").read() installerTemplate = installerTemplate.replace("<<VERSION>>", svnrevision) - installerTemplate = installerTemplate.replace("<<ROOTDIR>>", buildDir ) - installerTemplate = installerTemplate.replace("<<PYTHONVER>>", "2.5" ) + installerTemplate = installerTemplate.replace("<<ROOTDIR>>", wxwebkit_dir ) + installerTemplate = installerTemplate.replace("<<PYTHONVER>>", sys.version[0:3] ) installerTemplate = installerTemplate.replace("<<FILES>>", fileList ) outputFile = open("wxWebKitInstaller.iss", "w") diff --git a/WebKitTools/wx/packaging/wxWebKitInstaller.iss.in b/WebKitTools/wx/packaging/wxWebKitInstaller.iss.in index a2c808c..ebc89d4 100644 --- a/WebKitTools/wx/packaging/wxWebKitInstaller.iss.in +++ b/WebKitTools/wx/packaging/wxWebKitInstaller.iss.in @@ -17,7 +17,7 @@ UninstallFilesDir={app}\Uninstall Compression=bzip/9 SourceDir=<<ROOTDIR>> OutputDir=win-installer -OutputBaseFilename=wxWebKit-Py<<PYTHONVER>>-<<VERSION>> +OutputBaseFilename=wxWebKit-wx2.8-Py<<PYTHONVER>>-<<VERSION>> DisableStartupPrompt=yes AllowNoIcons=yes DisableProgramGroupPage=yes |