diff options
Diffstat (limited to 'Tools/wx')
-rw-r--r-- | Tools/wx/browser/browser.cpp | 70 | ||||
-rw-r--r-- | Tools/wx/browser/wscript | 55 | ||||
-rw-r--r-- | Tools/wx/build/build_utils.py | 188 | ||||
-rw-r--r-- | Tools/wx/build/settings.py | 407 | ||||
-rw-r--r-- | Tools/wx/build/waf_extensions.py | 83 | ||||
-rw-r--r-- | Tools/wx/build/wxpresets.py | 120 | ||||
-rwxr-xr-x | Tools/wx/install-unix-extras | 200 | ||||
-rw-r--r-- | Tools/wx/packaging/build-debian-installer.py | 36 | ||||
-rw-r--r-- | Tools/wx/packaging/build-mac-installer.py | 158 | ||||
-rw-r--r-- | Tools/wx/packaging/build-win-installer.py | 98 | ||||
-rw-r--r-- | Tools/wx/packaging/debian/changelog | 1 | ||||
-rw-r--r-- | Tools/wx/packaging/debian/compat | 1 | ||||
-rw-r--r-- | Tools/wx/packaging/debian/control | 29 | ||||
-rw-r--r-- | Tools/wx/packaging/debian/copyright | 18 | ||||
-rw-r--r-- | Tools/wx/packaging/debian/python-webkitwx.install | 1 | ||||
-rw-r--r-- | Tools/wx/packaging/debian/rules | 75 | ||||
-rw-r--r-- | Tools/wx/packaging/wxWebKitInstaller.iss.in | 79 |
17 files changed, 1619 insertions, 0 deletions
diff --git a/Tools/wx/browser/browser.cpp b/Tools/wx/browser/browser.cpp new file mode 100644 index 0000000..95c39d4 --- /dev/null +++ b/Tools/wx/browser/browser.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> + * + * 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. + */ + +// webkit includes +#include "WebBrowserShell.h" +#include "WebSettings.h" +#include "WebView.h" + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +class MyApp : public wxApp +{ +public: + + virtual bool OnInit(); +}; + + +IMPLEMENT_APP(MyApp) + +bool MyApp::OnInit() +{ + wxInitAllImageHandlers(); + + // create the main application window + // see WebKit/wx/WebFrame.cpp for how to write a shell around wxWebView. + wxWebBrowserShell *frame = new wxWebBrowserShell(_T("wxWebKit Test App")); + +#ifndef NDEBUG + frame->ShowDebugMenu(true); +#endif + + wxWebSettings settings = frame->webview->GetWebSettings(); +#if __WXMSW__ || __WXMAC__ + settings.SetPluginsEnabled(true); +#endif + frame->webview->SetDatabasesEnabled(true); + settings.SetEditableLinkBehavior(wxEditableLinkOnlyLiveWithShiftKey); + frame->CentreOnScreen(); + frame->Show(true); + + return true; +} diff --git a/Tools/wx/browser/wscript b/Tools/wx/browser/wscript new file mode 100644 index 0000000..8c22cf6 --- /dev/null +++ b/Tools/wx/browser/wscript @@ -0,0 +1,55 @@ +#! /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. +# +# wxBrowser sample app build script for the waf build system + +import sys + +from settings import * + +include_paths = [os.path.join(wk_root, 'WebCore', 'bindings', 'wx'), + os.path.join(wk_root, 'WebKit', 'wx')] + +def set_options(opt): + common_set_options(opt) + +def configure(conf): + common_configure(conf) + +def build(bld): + import Options + + obj = bld.new_task_gen( + features = 'cxx cprogram', + includes = ' '.join(include_paths), + source = 'browser.cpp', + target = 'wxBrowser', + uselib = 'WX CURL ICU XSLT XML ' + get_config(), + libpath = [output_dir], + uselib_local = 'wxwebkit', + install_path = output_dir) + + if sys.platform.startswith('darwin'): + obj.mac_app = True diff --git a/Tools/wx/build/build_utils.py b/Tools/wx/build/build_utils.py new file mode 100644 index 0000000..bf440a6 --- /dev/null +++ b/Tools/wx/build/build_utils.py @@ -0,0 +1,188 @@ +# 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. +# +# Helper functions for the WebKit build. + +import commands +import glob +import os +import platform +import re +import shutil +import sys +import urllib +import urlparse + +def get_output(command): + """ + Windows-compatible function for getting output from a command. + """ + if sys.platform.startswith('win'): + f = os.popen(command) + return f.read().strip() + else: + return commands.getoutput(command) + +def get_excludes(root, patterns): + """ + Get a list of exclude patterns going down several dirs. + TODO: Make this fully recursive. + """ + excludes = [] + + for pattern in patterns: + subdir_pattern = os.sep + '*' + for subdir in [subdir_pattern, subdir_pattern*2, subdir_pattern*3]: + adir = root + subdir + os.sep + pattern + files = glob.glob(adir) + for afile in files: + excludes.append(os.path.basename(afile)) + + return excludes + +def get_dirs_for_features(root, features, dirs): + """ + Find which directories to include in the list of build dirs based upon the + enabled port(s) and features. + """ + outdirs = dirs + for adir in dirs: + for feature in features: + relpath = os.path.join(adir, feature) + featuredir = os.path.join(root, relpath) + if os.path.exists(featuredir) and not relpath in outdirs: + outdirs.append(relpath) + + return outdirs + +def download_if_newer(url, destdir): + """ + Checks if the file on the server is newer than the one in the user's tree, + and if so, downloads it. + + Returns the filename of the downloaded file if downloaded, or None if + the existing file matches the one on the server. + """ + obj = urlparse.urlparse(url) + filename = os.path.basename(obj.path) + destfile = os.path.join(destdir, filename) + + urlobj = urllib.urlopen(url) + size = long(urlobj.info().getheader('Content-Length')) + + def download_callback(downloaded, block_size, total_size): + downloaded = block_size * downloaded + if downloaded > total_size: + downloaded = total_size + sys.stdout.write('%s %d of %d bytes downloaded\r' % (filename, downloaded, total_size)) + + # NB: We don't check modified time as Python doesn't yet handle timezone conversion + # properly when converting strings to time objects. + if not os.path.exists(destfile) or os.path.getsize(destfile) != size: + urllib.urlretrieve(url, destfile, download_callback) + print '' + return destfile + + return None + +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') + waf = download_if_newer('http://wxwebkit.wxcommunity.com/downloads/deps/waf', os.path.join(wk_root, 'Tools', 'wx')) + if waf: + # TODO: Make the build restart itself after an update. + Logs.warn('Build system updated, please restart build.') + sys.exit(1) + + # since this module is still experimental + 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') + archive = download_if_newer('http://wxwebkit.wxcommunity.com/downloads/deps/wxWebKitDeps-%s.zip' % msvc_version, wklibs_dir) + if archive and os.path.exists(archive): + 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/Tools/wx/install-unix-extras' % wk_root) + +def includeDirsForSources(sources): + include_dirs = [] + for group in sources: + for source in group: + dirname = os.path.dirname(source) + if not dirname in include_dirs: + include_dirs.append(dirname) + + return include_dirs + +def flattenSources(sources): + flat_sources = [] + for group in 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-svn 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/Tools/wx/build/settings.py b/Tools/wx/build/settings.py new file mode 100644 index 0000000..03c0880 --- /dev/null +++ b/Tools/wx/build/settings.py @@ -0,0 +1,407 @@ +# 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. +# +# Common elements of the waf build system shared by all projects. + +import commands +import os +import platform +import re +import sys + +import Options + +from build_utils import * +from waf_extensions import * + +# to be moved to wx when it supports more configs +from wxpresets import * + +wk_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')) + +if sys.platform.startswith('win'): + if not 'WXWIN' in os.environ: + print "Please set WXWIN to the directory containing wxWidgets." + sys.exit(1) + + wx_root = os.environ['WXWIN'] +else: + wx_root = commands.getoutput('wx-config --prefix') + +jscore_dir = os.path.join(wk_root, 'JavaScriptCore') +webcore_dir = os.path.join(wk_root, 'WebCore') +wklibs_dir = os.path.join(wk_root, 'WebKitLibraries') + +common_defines = [] +common_cxxflags = [] +common_includes = [] +common_libs = [] +common_libpaths = [] +common_frameworks = [] + +ports = [ + 'Brew', + 'Chromium', + 'Gtk', + 'Haiku', + 'Mac', + 'None', + 'Qt', + 'Safari', + 'Win', + 'Wince', + 'wx', +] + +port_uses = { + 'wx': ['CURL', 'WXGC'], +} + +jscore_dirs = [ + 'API', + 'bytecode', + 'bytecompiler', + 'debugger', + 'DerivedSources', + 'interpreter', + 'jit', + 'parser', + 'pcre', + 'profiler', + 'runtime', + 'wtf', + 'wtf/text', + 'wtf/unicode', + 'wtf/unicode/icu', + 'yarr', +] + +webcore_dirs = [ + 'WebCore/accessibility', + 'WebCore/bindings', + 'WebCore/bindings/cpp', + 'WebCore/bindings/generic', + 'WebCore/bindings/js', + 'WebCore/bindings/js/specialization', + 'WebCore/bridge', + 'WebCore/bridge/c', + 'WebCore/bridge/jsc', + 'WebCore/css', + 'WebCore/DerivedSources', + 'WebCore/dom', + 'WebCore/dom/default', + 'WebCore/editing', + 'WebCore/fileapi', + 'WebCore/history', + 'WebCore/html', + 'WebCore/html/canvas', + 'WebCore/html/parser', + 'WebCore/inspector', + 'WebCore/loader', + 'WebCore/loader/appcache', + 'WebCore/loader/archive', + 'WebCore/loader/cache', + 'WebCore/loader/icon', + 'WebCore/notifications', + 'WebCore/page', + 'WebCore/page/animation', + 'WebCore/platform', + 'WebCore/platform/animation', + 'WebCore/platform/graphics', + 'WebCore/platform/graphics/filters', + 'WebCore/platform/graphics/transforms', + 'WebCore/platform/image-decoders', + 'WebCore/platform/image-decoders/bmp', + 'WebCore/platform/image-decoders/gif', + 'WebCore/platform/image-decoders/ico', + 'WebCore/platform/image-decoders/jpeg', + 'WebCore/platform/image-decoders/png', + 'WebCore/platform/image-decoders/webp', + 'WebCore/platform/mock', + 'WebCore/platform/network', + 'WebCore/platform/sql', + 'WebCore/platform/text', + 'WebCore/platform/text/transcoder', + 'WebCore/plugins', + 'WebCore/rendering', + 'WebCore/rendering/style', + 'WebCore/rendering/svg', + 'WebCore/storage', + 'WebCore/svg', + 'WebCore/svg/animation', + 'WebCore/svg/graphics', + 'WebCore/svg/graphics/filters', + 'WebCore/svg/properties', + 'WebCore/websockets', + 'WebCore/xml' +] + +config = get_config(wk_root) +config_dir = config + git_branch_name() + +output_dir = os.path.join(wk_root, 'WebKitBuild', config_dir) + +build_port = "wx" +building_on_win32 = sys.platform.startswith('win') + +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: + create_hash_table = get_output('cygpath --unix "%s"' % create_hash_table) +os.environ['CREATE_HASH_TABLE'] = create_hash_table + +feature_defines = ['ENABLE_DATABASE', 'ENABLE_XSLT', 'ENABLE_JAVASCRIPT_DEBUGGER', + 'ENABLE_SVG', 'ENABLE_SVG_USE', 'ENABLE_FILTERS', 'ENABLE_SVG_FONTS', + 'ENABLE_SVG_ANIMATION', 'ENABLE_SVG_AS_IMAGE', 'ENABLE_SVG_FOREIGN_OBJECT', + 'ENABLE_JIT', 'BUILDING_%s' % build_port.upper()] + +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. + """ + opt.tool_options('compiler_cxx') + opt.tool_options('compiler_cc') + 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)') + opt.add_option('--macosx-version', action='store', default='', help="Version of OS X to build for.") + opt.add_option('--msvc-version', action='store', default='', help="MSVC version to use to build. Use 8 for 2005, 9 for 2008") + +def common_configure(conf): + """ + Configuration used by all targets, called from the target's configure() step. + """ + + conf.env['MSVC_TARGETS'] = ['x86'] + + if Options.options.msvc_version and Options.options.msvc_version != '': + print "msvc version = %s" % Options.options.msvc_version + conf.env['MSVC_VERSIONS'] = ['msvc %s.0' % Options.options.msvc_version] + else: + print "msvc not set!" + conf.env['MSVC_VERSIONS'] = ['msvc 9.0', 'msvc 8.0'] + + 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') + if Options.options.wxpython: + conf.check_tool('python') + conf.check_python_headers() + + if sys.platform.startswith('darwin'): + conf.check_tool('osx') + + global msvc_version + global msvclibs_dir + + libprefix = '' + + if building_on_win32: + libprefix = 'lib' + + found = conf.get_msvc_versions() + found_versions = [] + for version in found: + found_versions.append(version[0]) + + if 'msvc 9.0' in conf.env['MSVC_VERSIONS'] and 'msvc 9.0' in found_versions: + msvc_version = 'msvc2008' + elif 'msvc 8.0' in conf.env['MSVC_VERSIONS'] and 'msvc 8.0' in found_versions: + msvc_version = 'msvc2005' + + msvclibs_dir = os.path.join(wklibs_dir, msvc_version, 'win') + + # 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']) + + if build_port == "wx": + update_wx_deps(conf, wk_root, msvc_version) + + conf.env.append_value('CXXDEFINES', ['BUILDING_WX__=1', 'JS_NO_EXPORT']) + + if building_on_win32: + conf.env.append_value('LIBPATH', os.path.join(msvclibs_dir, 'lib')) + # wx settings + 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 + conf.env['LIBPATH_WX'] = wxlibpaths + + if sys.platform.startswith('darwin'): + conf.env['LIB_ICU'] = ['icucore'] + + conf.env.append_value('CPPPATH', wklibs_dir) + conf.env.append_value('LIBPATH', wklibs_dir) + + min_version = None + + mac_target = 'MACOSX_DEPLOYMENT_TARGET' + if Options.options.macosx_version != '': + min_version = Options.options.macosx_version + + # 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_WKINTERFACE', ['WebKitSystemInterfaceTiger']) + else: + # NOTE: There is a WebKitSystemInterfaceSnowLeopard, but when we use that + # on 10.6, we get a strange missing symbol error, and this library seems to + # work fine for wx's purposes. + conf.env.append_value('LIB_WKINTERFACE', ['WebKitSystemInterfaceLeopard']) + + 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']) + + conf.env.append_value('CXXDEFINES', feature_defines) + if config == 'Release': + conf.env.append_value('CPPDEFINES', 'NDEBUG') + + if building_on_win32: + conf.env.append_value('CPPPATH', [ + os.path.join(jscore_dir, 'os-win32'), + os.path.join(msvclibs_dir, 'include'), + os.path.join(msvclibs_dir, 'include', 'pthreads'), + os.path.join(msvclibs_dir, 'lib'), + ]) + + conf.env.append_value('LIB', ['libpng', 'libjpeg', 'pthreadVC2']) + # common win libs + conf.env.append_value('LIB', [ + 'kernel32', 'user32','gdi32','comdlg32','winspool','winmm', + 'shell32', 'shlwapi', 'comctl32', 'ole32', 'oleaut32', 'uuid', 'advapi32', + 'wsock32', 'gdiplus', 'usp10','version']) + + conf.env['LIB_ICU'] = ['icudt', 'icule', 'iculx', 'icuuc', 'icuin', 'icuio', 'icutu'] + + #curl + conf.env['LIB_CURL'] = ['libcurl'] + + #sqlite3 + conf.env['CPPPATH_SQLITE3'] = [os.path.join(msvclibs_dir, 'include', 'SQLite')] + conf.env['LIB_SQLITE3'] = ['sqlite3'] + + #libxml2 + conf.env['LIB_XML'] = ['libxml2'] + + #libxslt + conf.env['LIB_XSLT'] = ['libxslt'] + else: + if build_port == 'wx': + port_uses['wx'].append('PTHREADS') + 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=get_path_to_wxconfig(), args='--cxxflags --libs', package='', uselib_store='WX', mandatory=True) + + 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) + 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) + 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) + + for use in port_uses[build_port]: + conf.env.append_value('CXXDEFINES', ['WTF_USE_%s' % use]) diff --git a/Tools/wx/build/waf_extensions.py b/Tools/wx/build/waf_extensions.py new file mode 100644 index 0000000..f50f264 --- /dev/null +++ b/Tools/wx/build/waf_extensions.py @@ -0,0 +1,83 @@ +# 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. +# +# This module is for code where we override waf's default behavior or extend waf + +import os +import subprocess +import sys + +import Utils + +# version of exec_command that handles Windows command lines longer than 32000 chars +def exec_command(s, **kw): + filename = '' + if sys.platform.startswith('win') and len(' '.join(s)) > 32000: + import tempfile + (fd, filename) = tempfile.mkstemp() + t = [] + for i in s: + if i.find(" ") != -1: + i = '"%s"' % i + t.append(i) + os.write(fd, ' '.join(t[1:])) + os.close(fd) + + s = [s[0], '@' + filename] + + if 'log' in kw: + kw['stdout'] = kw['stderr'] = kw['log'] + del(kw['log']) + kw['shell'] = isinstance(s, str) + + def cleanup(): + try: + if os.path.exists(filename): + os.remove(filename) + except: + pass + + try: + proc = subprocess.Popen(s, **kw) + result = proc.wait() + cleanup() + return result + + except OSError: + cleanup() + raise + +Utils.exec_command = exec_command + +# Better performing h_file to keep hashing from consuming lots of time +import stat +def h_file(filename): + st = os.stat(filename) + if stat.S_ISDIR(st[stat.ST_MODE]): raise IOError('not a file') + m = Utils.md5() + m.update(str(st.st_mtime)) + m.update(str(st.st_size)) + m.update(filename) + return m.digest() + +Utils.h_file = h_file diff --git a/Tools/wx/build/wxpresets.py b/Tools/wx/build/wxpresets.py new file mode 100644 index 0000000..3d6b693 --- /dev/null +++ b/Tools/wx/build/wxpresets.py @@ -0,0 +1,120 @@ +# 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. +# +# 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): + print "Directory %s does not exist." % wx_root + sys.exit(1) + + defines = ['__WXMSW__'] + includes = [os.path.join(wx_root, 'include')] + cxxflags = [] + libs = [] + libpaths = [] + + libdir = os.path.join(wx_root, 'lib') + ext = '' + postfix = 'vc' + + version_str_nodot = ''.join(get_wx_version(wx_root)) + + if shared: + defines.append('WXUSINGDLL') + libdir = os.path.join(libdir, Options.options.wx_compiler_prefix + '_dll') + else: + libdir = os.path.join(libdir, Options.options.wx_compiler_prefix + '_lib') + + if unicode: + defines.append('_UNICODE') + ext += 'u' + + depext = '' + if wxPython: + ext += 'h' + depext += 'h' + elif debug: + ext += 'd' + 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): + if name == 'base': + return 'wxbase%s%s' % (version_str_nodot, ext) + + return "wxmsw%s%s_%s" % (version_str_nodot, ext, name) + + libs.extend(['wxzlib' + depext, 'wxjpeg' + depext, 'wxpng' + depext, 'wxexpat' + depext]) + 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__') + + return (defines, includes, libs, libpaths) diff --git a/Tools/wx/install-unix-extras b/Tools/wx/install-unix-extras new file mode 100755 index 0000000..00c936c --- /dev/null +++ b/Tools/wx/install-unix-extras @@ -0,0 +1,200 @@ +#!/bin/sh + +# Copyright (C) 2005, 2006 Apple Computer, Inc. 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. +# 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of +# its contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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. + +# A script to download the extra libraries needed to build WebKit on UNIX-based OSes. +# libxml/libxslt need to be added, but so far I've had them on all the (UNIX) machines +# I've tested on, so I don't have a machine to test the code on. + +DL_CMD="curl -L" + +scriptDir="$(cd $(dirname $0);pwd)" +WK_ROOT=$scriptDir/../.. +WK_ROOTDIR=$WK_ROOT + +DL_DIR=/tmp/webkit-deps +# NOTE: If you change this, make sure the dir is on the path. +DEPS_PREFIX=$WK_ROOT/WebKitLibraries/unix +DLLEXT=so + +if [ "${OSTYPE:0:6}" == "darwin" ]; then + DLLEXT=dylib +fi + +mkdir -p $DL_DIR +mkdir -p $DEPS_PREFIX + +ICU_VERSION="3.4.1" +ICU_TARBALL="icu-$ICU_VERSION.tgz" +ICU_URL="ftp://ftp.software.ibm.com/software/globalization/icu/$ICU_VERSION/$ICU_TARBALL" + +# dependent app, not lib, what should we do for these? + +GPERF_VERSION="3.0.1" +GPERF_TARBALL="gperf-$GPERF_VERSION.tar.gz" +GPERF_URL="ftp://mirrors.kernel.org/gnu/gperf/$GPERF_TARBALL" + +PKG_CONFIG_VERSION="0.20" +PKG_CONFIG_TARBALL="pkg-config-$PKG_CONFIG_VERSION.tar.gz" +PKG_CONFIG_URL="http://pkgconfig.freedesktop.org/releases/$PKG_CONFIG_TARBALL" + +ICONV_VERSION="1.9.2" +ICONV_TARBALL="libiconv-$ICONV_VERSION.tar.gz" +ICONV_URL="http://ftp.gnu.org/pub/gnu/libiconv/$ICONV_TARBALL" + +LIBJPEG_VERSION="6b" +LIBJPEG_TARBALL="jpegsrc.v$LIBJPEG_VERSION.tar.gz" +LIBJPEG_URL="http://wxwebkit.wxcommunity.com/downloads/deps/$LIBJPEG_TARBALL" + +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 + $DL_CMD -o $DL_DIR/$ICU_TARBALL $ICU_URL + + tar xzvf $DL_DIR/$ICU_TARBALL + cd $DL_DIR/icu/source + + chmod +x configure install-sh + + 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 check + make install + fi + cd $DL_DIR + rm -rf icu +fi + +# TODO: What would be a good way to test for this? +if [ ! -f $DEPS_PREFIX/lib/libiconv.$DLLEXT ]; then + $DL_CMD -o $DL_DIR/$ICONV_TARBALL $ICONV_URL + + tar xzvf $DL_DIR/$ICONV_TARBALL + cd $DL_DIR/libiconv-$ICONV_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/libiconv-$ICONV_VERSION +fi + +if [ ! -f $DEPS_PREFIX/lib/libjpeg.a ]; then + $DL_CMD -o $DL_DIR/$LIBJPEG_TARBALL $LIBJPEG_URL + + tar xzvf $DL_DIR/$LIBJPEG_TARBALL + cd $DL_DIR/jpeg-$LIBJPEG_VERSION + + # jpeg install command expects this to exist. + mkdir -p $DEPS_PREFIX/man/man1 + + 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 + fi + + cp libjpeg.a $DEPS_PREFIX/lib + cp *.h $DEPS_PREFIX/include + + cd $DL_DIR + rm -rf $DL_DIR/jpeg-$LIBJPEG_VERSION +fi + +if [ ! -f $DEPS_PREFIX/lib/libpng.a ]; then + $DL_CMD -o $DL_DIR/$LIBPNG_TARBALL $LIBPNG_URL + + tar xzvf $DL_DIR/$LIBPNG_TARBALL + cd $DL_DIR/libpng-$LIBPNG_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/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/Tools/wx/packaging/build-debian-installer.py b/Tools/wx/packaging/build-debian-installer.py new file mode 100644 index 0000000..5c6795d --- /dev/null +++ b/Tools/wx/packaging/build-debian-installer.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +import os +import shutil +import sys + +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "build"))) + +import build_utils + +script_dir = os.path.abspath(os.path.dirname(__file__)) +wxwebkit_dir = os.path.abspath(os.path.join(script_dir, "..", "..", "..", "WebKitBuild", "Debug" + build_utils.git_branch_name())) +wxwk_root = os.path.abspath(os.path.join(script_dir, "..", "..", "..")) + +try: + os.chdir(wxwk_root) + deb_dir = os.path.join(wxwk_root, 'wxwebkit') + if os.path.exists(deb_dir): + shutil.rmtree(deb_dir) + os.makedirs(deb_dir) + print "Archiving git tree..." + os.system('git archive --format=tar HEAD | gzip > %s/webkitwx_0.1.orig.tar.gz' % deb_dir) + src_root = os.path.join(deb_dir, 'webkitwx-0.1') + print "Extracting tree..." + os.makedirs(src_root) + os.chdir(src_root) + os.system('tar xzvf ../webkitwx_0.1.orig.tar.gz') + + shutil.copytree(os.path.join(script_dir, 'debian'), os.path.join(src_root, 'debian')) + + print "Building package..." + os.system('fakeroot debian/rules clean') + os.system('fakeroot debian/rules build') + os.system('debuild -i -rfakeroot -us -uc') +finally: + shutil.rmtree(os.path.join(src_root, 'debian')) diff --git a/Tools/wx/packaging/build-mac-installer.py b/Tools/wx/packaging/build-mac-installer.py new file mode 100644 index 0000000..5b76b0b --- /dev/null +++ b/Tools/wx/packaging/build-mac-installer.py @@ -0,0 +1,158 @@ +#!/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 datetime +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] + +date = str(datetime.date.today()) + +platform = "osx" + +pkgname = "wxWebKit-%s-wx%s-py%s-%s" % (platform, wx_version[:3], py_version, date) + +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 ' + date.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/Tools/wx/packaging/build-win-installer.py b/Tools/wx/packaging/build-win-installer.py new file mode 100644 index 0000000..ffbdd19 --- /dev/null +++ b/Tools/wx/packaging/build-win-installer.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python + +# Copyright (C) 2008 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. +# +# Create a Windows installer package for wxPython wxWebKit binaries + +import sys, os, string +import commands +import datetime +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" + retval = "" + 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"] + + if retval == "": + for dir in dirs: + filepath = os.path.join(dir, name) + if os.path.isfile(filepath): + retval = filepath + + return retval + +if __name__ == "__main__": + innoSetup = getInnoSetupPath() + os.chdir(sys.path[0]) + + date = str(datetime.date.today()) + + if not os.path.exists(innoSetup): + print "ERROR: Cannot find InnoSetup." + #sys.exit(1) + + if not os.path.exists(wxwebkit_dir): + print "ERROR: Build dir %s doesn't exist." % wxwebkit_dir + sys.exit(1) + + fileList = """ +CopyMode: alwaysoverwrite; Source: *.pyd; DestDir: "{app}" +CopyMode: alwaysoverwrite; Source: *.py; DestDir: "{app}" +""" + + 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 + + installerTemplate = open("wxWebKitInstaller.iss.in", "r").read() + + installerTemplate = installerTemplate.replace("<<VERSION>>", date) + installerTemplate = installerTemplate.replace("<<ROOTDIR>>", wxwebkit_dir ) + installerTemplate = installerTemplate.replace("<<PYTHONVER>>", sys.version[0:3] ) + installerTemplate = installerTemplate.replace("<<FILES>>", fileList ) + + outputFile = open("wxWebKitInstaller.iss", "w") + outputFile.write(installerTemplate) + outputFile.close() + + success = os.system('"%s" wxWebKitInstaller.iss' % innoSetup) + sys.exit(success) diff --git a/Tools/wx/packaging/debian/changelog b/Tools/wx/packaging/debian/changelog new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Tools/wx/packaging/debian/changelog @@ -0,0 +1 @@ + diff --git a/Tools/wx/packaging/debian/compat b/Tools/wx/packaging/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/Tools/wx/packaging/debian/compat @@ -0,0 +1 @@ +5 diff --git a/Tools/wx/packaging/debian/control b/Tools/wx/packaging/debian/control new file mode 100644 index 0000000..57d8407 --- /dev/null +++ b/Tools/wx/packaging/debian/control @@ -0,0 +1,29 @@ +Source: webkitwx +Section: Python +Priority: extra +Maintainer: Kevin Ollivier <kevino@theolliviers.com> +Build-Depends: debhelper (>= 5.0.38), python-central (>= 0.6), python-all-dev, + libwxgtk2.8-dev (>= 2.8.9.2-1), python-wxgtk2.8, python-wxtools (>= 2.8.9.2-1), + wx2.8-headers (>= 2.8.9.2-1), wx2.8-i18n (>= 2.8.9.2-1), + flex, bison, gperf, automake, autoconf, libtool, dpatch, + libxslt1-dev, libcurl4-openssl-dev, + libicu-dev, libjpeg62-dev, libpng12-dev, libsqlite3-dev, libgtk2.0-dev +Build-Conflicts: python-setuptools +XS-Python-Version: all +Standards-Version: 3.7.3 + +Package: python-webkitwx +Section: python +Architecture: any +Depends: ${python:Depends}, ${shlibs:Depends} +Provides: ${python:Provides}, webkitwx +XB-Python-Version: ${python:Versions} +Description: Python binding of wxwebkit + This is an experimental packaged release of webkit for wxpython + +Package: webkitwx-headers +Architecture: all +Description: Python binding of wxwebkit + This is an experimental packaged release of webkit for wxpython + These are the header files + diff --git a/Tools/wx/packaging/debian/copyright b/Tools/wx/packaging/debian/copyright new file mode 100644 index 0000000..c2244ec --- /dev/null +++ b/Tools/wx/packaging/debian/copyright @@ -0,0 +1,18 @@ +This package was debianized by Chris Willing c.willing@uq.edu.au on +Thu, Sat, 11 Apr 2009 12:54:52 +1000 + +Upstream Author: Kevin Ollivier kevino@theolliviers.com and others + +Copyright: 2009 Kevin Ollivier, Apple Inc., and others + +License: + LGPL + + +The Debian packaging is (C) 2009, Chris Willing <c.willing@uq.edu.au> and +is licensed under the GPL, see `/usr/share/common-licenses/GPL'. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. + diff --git a/Tools/wx/packaging/debian/python-webkitwx.install b/Tools/wx/packaging/debian/python-webkitwx.install new file mode 100644 index 0000000..dff51ce --- /dev/null +++ b/Tools/wx/packaging/debian/python-webkitwx.install @@ -0,0 +1 @@ +WebKitBuild/Debug.master/libwxwebkit.so usr/lib/ diff --git a/Tools/wx/packaging/debian/rules b/Tools/wx/packaging/debian/rules new file mode 100644 index 0000000..aea6def --- /dev/null +++ b/Tools/wx/packaging/debian/rules @@ -0,0 +1,75 @@ +#! /usr/bin/make -f + +SHELL = /bin/bash + +PYVERS := $(shell /usr/bin/python -c 'import sys; print sys.version[:3]') +VER := $(shell /usr/bin/python -c 'import sys; print sys.version[:3]') +BIULD_DIR := WebKitBuild/Debug.master +build: build-stamp +build-stamp: $(PYVERS:%=build-python%) + touch $@ +build-python%: + touch $@ + +clean: + rm -rf *-stamp build-python* build + rm -rf $(addprefix debian/,$(packages)) debian/files debian/substvars + rm -rf _trial_temp test.log + find . -name "*.pyc" |xargs -r rm + dh_clean + +install: build-stamp install-prereq $(PYVERS:%=install-python%) install-libs install-nover + +install-prereq: build-stamp + dh_testdir + dh_testroot + dh_clean -k + +install-python%: install-prereq + dh_install -ppython-webkitwx \ + $(BUILD_DIR)/webview.py \ + $(BUILD_DIR)/Debug.master/_webview.so \ + usr/lib/python$*/site-packages/wx-2.8-gtk2-unicode/wx/ + +install-nover: install-prereq + dh_install -pwebkitwx-headers \ + $(BUILD_DIR)/JavaScriptCore \ + usr/include/wxwebkit-1.0/ + +install-libs: install-prereq + dh_install + + +binary-indep: + (cd Tools/Scripts && ./build-webkit --wx --makeargs="--wxpython") + dh_testdir + dh_testroot + dh_installchangelogs -i + dh_installdocs -i + dh_strip -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +binary-arch: + dh_testdir + dh_testroot + echo $(shell pwd) + echo $(shell ls -l) + dh_installchangelogs -a + dh_installdocs -a WebKit/wx/bindings/python/samples/simple.py + dh_strip -a + dh_compress -a -Xsimple.py + dh_fixperms -a + dh_pycentral -a + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install install-nover install-prereq install-libs diff --git a/Tools/wx/packaging/wxWebKitInstaller.iss.in b/Tools/wx/packaging/wxWebKitInstaller.iss.in new file mode 100644 index 0000000..ebc89d4 --- /dev/null +++ b/Tools/wx/packaging/wxWebKitInstaller.iss.in @@ -0,0 +1,79 @@ +; Installer script for wxWebKit for wxPython + +[Setup] +AppName=wxWebKit +AppId=wxWebKit +AppVersion=<<VERSION>> +AppVerName=wxWebKit <<VERSION>> +AppCopyright=LGPL +DefaultDirName={code:GetInstallDir|c:\DoNotInstallHere} +AppPublisher=wxWebKit Project +AppPublisherURL=http://wxwebkit.wxcommunity.com/pmwiki/ +AppSupportURL=http://wxwebkit.wxcommunity.com/pmwiki/ +AppUpdatesURL=http://wxwebkit.wxcommunity.com/pmwiki/ +UninstallDisplayName=wxWebKit <<VERSION>> +UninstallFilesDir={app}\Uninstall + +Compression=bzip/9 +SourceDir=<<ROOTDIR>> +OutputDir=win-installer +OutputBaseFilename=wxWebKit-wx2.8-Py<<PYTHONVER>>-<<VERSION>> +DisableStartupPrompt=yes +AllowNoIcons=yes +DisableProgramGroupPage=yes +DisableReadyPage=yes + +[Files] +<<FILES>> + +[Messages] +WelcomeLabel1=Welcome to the wxWebKit for wxPython Setup Wizard + +[Code] + +program Setup; +var + PythonDir : String; + InstallDir : String; + + +function InitializeSetup(): Boolean; +begin + + (* -------------------------------------------------------------- *) + (* Figure out what to use as a default installation dir *) + + if not RegQueryStringValue(HKEY_LOCAL_MACHINE, + 'Software\Python\PythonCore\<<PYTHONVER>>\InstallPath', + '', PythonDir) then begin + + if not RegQueryStringValue(HKEY_CURRENT_USER, + 'Software\Python\PythonCore\<<PYTHONVER>>\InstallPath', + '', PythonDir) then begin + + MsgBox('No installation of Python <<PYTHONVER>> found in registry.' + #13 + + 'Be sure to enter a pathname that places wxPython on the PYTHONPATH', + mbConfirmation, MB_OK); + PythonDir := 'C:\Put a directory on PYTHONPATH here\'; + end; + end; + InstallDir := PythonDir + '\Lib\site-packages\wx-2.8-msw-unicode\wx\'; + Result := True; +end; + + + +function GetPythonDir(Default: String): String; +begin + Result := PythonDir; +end; + + + +function GetInstallDir(Default: String): String; +begin + Result := InstallDir; +end; + +begin +end. |