Remove the old release making instructions and scripts.
Using git-based scripts seems to work well and the old scripts are not maintained any more and having several ways of making releases is just confusing, so leave only one set of scripts, the one actually used since 2.9. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76710 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,648 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
###################################
|
|
||||||
# Author: Kevin Ollivier
|
|
||||||
# Licence: wxWindows licence
|
|
||||||
###################################
|
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import builder
|
|
||||||
import glob
|
|
||||||
import optparse
|
|
||||||
import platform
|
|
||||||
import shutil
|
|
||||||
import types
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
# builder object
|
|
||||||
wxBuilder = None
|
|
||||||
|
|
||||||
# other globals
|
|
||||||
scriptDir = None
|
|
||||||
wxRootDir = None
|
|
||||||
contribDir = None
|
|
||||||
options = None
|
|
||||||
configure_opts = None
|
|
||||||
exitWithException = True
|
|
||||||
nmakeCommand = 'nmake.exe'
|
|
||||||
|
|
||||||
verbose = False
|
|
||||||
|
|
||||||
|
|
||||||
def numCPUs():
|
|
||||||
"""
|
|
||||||
Detects the number of CPUs on a system.
|
|
||||||
This approach is from detectCPUs here: http://www.artima.com/weblogs/viewpost.jsp?thread=230001
|
|
||||||
"""
|
|
||||||
# Linux, Unix and MacOS:
|
|
||||||
if hasattr(os, "sysconf"):
|
|
||||||
if "SC_NPROCESSORS_ONLN" in os.sysconf_names:
|
|
||||||
# Linux & Unix:
|
|
||||||
ncpus = os.sysconf("SC_NPROCESSORS_ONLN")
|
|
||||||
if isinstance(ncpus, int) and ncpus > 0:
|
|
||||||
return ncpus
|
|
||||||
else: # OSX:
|
|
||||||
p = subprocess.Popen("sysctl -n hw.ncpu", shell=True, stdout=subprocess.PIPE)
|
|
||||||
return p.stdout.read()
|
|
||||||
|
|
||||||
# Windows:
|
|
||||||
if "NUMBER_OF_PROCESSORS" in os.environ:
|
|
||||||
ncpus = int(os.environ["NUMBER_OF_PROCESSORS"]);
|
|
||||||
if ncpus > 0:
|
|
||||||
return ncpus
|
|
||||||
return 1 # Default
|
|
||||||
|
|
||||||
|
|
||||||
def getXcodePaths():
|
|
||||||
base = getoutput("xcode-select -print-path")
|
|
||||||
return [base, base+"/Platforms/MacOSX.platform/Developer"]
|
|
||||||
|
|
||||||
|
|
||||||
def getVisCVersion():
|
|
||||||
text = getoutput("cl.exe")
|
|
||||||
if 'Version 13' in text:
|
|
||||||
return '71'
|
|
||||||
if 'Version 15' in text:
|
|
||||||
return '90'
|
|
||||||
if 'Version 16' in text:
|
|
||||||
return '100'
|
|
||||||
# TODO: Add more tests to get the other versions...
|
|
||||||
else:
|
|
||||||
return 'FIXME'
|
|
||||||
|
|
||||||
|
|
||||||
def exitIfError(code, msg):
|
|
||||||
if code != 0:
|
|
||||||
print(msg)
|
|
||||||
if exitWithException:
|
|
||||||
raise builder.BuildError(msg)
|
|
||||||
else:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def getWxRelease(wxRoot=None):
|
|
||||||
if not wxRoot:
|
|
||||||
global wxRootDir
|
|
||||||
wxRoot = wxRootDir
|
|
||||||
|
|
||||||
configureText = open(os.path.join(wxRoot, "configure.in"), "r").read()
|
|
||||||
majorVersion = re.search("wx_major_version_number=(\d+)", configureText).group(1)
|
|
||||||
minorVersion = re.search("wx_minor_version_number=(\d+)", configureText).group(1)
|
|
||||||
|
|
||||||
versionText = "%s.%s" % (majorVersion, minorVersion)
|
|
||||||
|
|
||||||
if int(minorVersion) % 2:
|
|
||||||
releaseVersion = re.search("wx_release_number=(\d+)", configureText).group(1)
|
|
||||||
versionText += ".%s" % (releaseVersion)
|
|
||||||
|
|
||||||
return versionText
|
|
||||||
|
|
||||||
|
|
||||||
def getFrameworkName(options):
|
|
||||||
# the name of the framework is based on the wx port being built
|
|
||||||
name = "wxOSX"
|
|
||||||
if options.osx_cocoa:
|
|
||||||
name += "Cocoa"
|
|
||||||
else:
|
|
||||||
name += "Carbon"
|
|
||||||
return name
|
|
||||||
|
|
||||||
|
|
||||||
def getPrefixInFramework(options, wxRoot=None):
|
|
||||||
# the path inside the framework that is the wx --prefix
|
|
||||||
fwPrefix = os.path.join(
|
|
||||||
os.path.abspath(options.mac_framework_prefix),
|
|
||||||
"%s.framework/Versions/%s" % (getFrameworkName(options), getWxRelease(wxRoot)))
|
|
||||||
return fwPrefix
|
|
||||||
|
|
||||||
|
|
||||||
def macFixupInstallNames(destdir, prefix, buildDir=None):
|
|
||||||
# When an installdir is used then the install_names embedded in
|
|
||||||
# the dylibs are not correct. Reset the IDs and the dependencies
|
|
||||||
# to use just the prefix.
|
|
||||||
print("**** macFixupInstallNames(%s, %s, %s)" % (destdir, prefix, buildDir))
|
|
||||||
pwd = os.getcwd()
|
|
||||||
os.chdir(destdir+prefix+'/lib')
|
|
||||||
dylibs = glob.glob('*.dylib') # ('*[0-9].[0-9].[0-9].[0-9]*.dylib')
|
|
||||||
for lib in dylibs:
|
|
||||||
cmd = 'install_name_tool -id %s/lib/%s %s/lib/%s' % \
|
|
||||||
(prefix,lib, destdir+prefix,lib)
|
|
||||||
print(cmd)
|
|
||||||
run(cmd)
|
|
||||||
for dep in dylibs:
|
|
||||||
if buildDir is not None:
|
|
||||||
cmd = 'install_name_tool -change %s/lib/%s %s/lib/%s %s/lib/%s' % \
|
|
||||||
(buildDir,dep, prefix,dep, destdir+prefix,lib)
|
|
||||||
else:
|
|
||||||
cmd = 'install_name_tool -change %s/lib/%s %s/lib/%s %s/lib/%s' % \
|
|
||||||
(destdir+prefix,dep, prefix,dep, destdir+prefix,lib)
|
|
||||||
print(cmd)
|
|
||||||
run(cmd)
|
|
||||||
os.chdir(pwd)
|
|
||||||
|
|
||||||
|
|
||||||
def run(cmd):
|
|
||||||
global verbose
|
|
||||||
if verbose:
|
|
||||||
print("Running %s" % cmd)
|
|
||||||
return exitIfError(os.system(cmd), "Error running %s" % cmd)
|
|
||||||
|
|
||||||
|
|
||||||
def getoutput(cmd):
|
|
||||||
sp = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
||||||
output = None
|
|
||||||
output = sp.stdout.read()
|
|
||||||
if sys.version_info > (3,):
|
|
||||||
output = output.decode('utf-8') # TODO: is utf-8 okay here?
|
|
||||||
output = output.rstrip()
|
|
||||||
rval = sp.wait()
|
|
||||||
if rval:
|
|
||||||
# Failed!
|
|
||||||
print("Command '%s' failed with exit code %d." % (cmd, rval))
|
|
||||||
sys.exit(rval)
|
|
||||||
return output
|
|
||||||
|
|
||||||
|
|
||||||
def main(scriptName, args):
|
|
||||||
global scriptDir
|
|
||||||
global wxRootDir
|
|
||||||
global contribDir
|
|
||||||
global options
|
|
||||||
global configure_opts
|
|
||||||
global wxBuilder
|
|
||||||
global nmakeCommand
|
|
||||||
|
|
||||||
scriptDir = os.path.dirname(os.path.abspath(scriptName))
|
|
||||||
wxRootDir = os.path.abspath(os.path.join(scriptDir, "..", ".."))
|
|
||||||
|
|
||||||
contribDir = os.path.join("contrib", "src")
|
|
||||||
installDir = None
|
|
||||||
|
|
||||||
VERSION = tuple([int(i) for i in getWxRelease().split('.')[:2]])
|
|
||||||
|
|
||||||
if sys.platform.startswith("win"):
|
|
||||||
contribDir = os.path.join(wxRootDir, "contrib", "build")
|
|
||||||
|
|
||||||
if sys.platform.startswith("win"):
|
|
||||||
toolkit = "msvc"
|
|
||||||
else:
|
|
||||||
toolkit = "autoconf"
|
|
||||||
|
|
||||||
defJobs = str(numCPUs())
|
|
||||||
defFwPrefix = '/Library/Frameworks'
|
|
||||||
|
|
||||||
option_dict = {
|
|
||||||
"clean" : (False, "Clean all files from the build directory"),
|
|
||||||
"debug" : (False, "Build the library in debug symbols"),
|
|
||||||
"builddir" : ("", "Directory where the build will be performed for autoconf builds."),
|
|
||||||
"prefix" : ("", "Configured prefix to use for autoconf builds. Defaults to installdir if set. Ignored for framework builds."),
|
|
||||||
"jobs" : (defJobs, "Number of jobs to run at one time in make. Default: %s" % defJobs),
|
|
||||||
"install" : (False, "Install the toolkit to the installdir directory, or the default dir."),
|
|
||||||
"installdir" : ("", "Directory where built wxWidgets will be installed"),
|
|
||||||
"mac_distdir" : (None, "If set on Mac, will create an installer package in the specified dir."),
|
|
||||||
"mac_universal_binary"
|
|
||||||
: ("", "Comma separated list of architectures to include in the Mac universal binary"),
|
|
||||||
"mac_framework" : (False, "Install the Mac build as a framework"),
|
|
||||||
"mac_framework_prefix"
|
|
||||||
: (defFwPrefix, "Prefix where the framework should be installed. Default: %s" % defFwPrefix),
|
|
||||||
"cairo" : (False, "Enable dynamically loading the Cairo lib for wxGraphicsContext on MSW"),
|
|
||||||
"no_config" : (False, "Turn off configure step on autoconf builds"),
|
|
||||||
"config_only" : (False, "Only run the configure step and then exit"),
|
|
||||||
"rebake" : (False, "Regenerate Bakefile and autoconf files"),
|
|
||||||
"unicode" : (False, "Build the library with unicode support"),
|
|
||||||
"wxpython" : (False, "Build the wxWidgets library with all options needed by wxPython"),
|
|
||||||
"cocoa" : (False, "Build the old Mac Cocoa port."),
|
|
||||||
"osx_cocoa" : (False, "Build the new Cocoa port"),
|
|
||||||
"shared" : (False, "Build wx as a dynamic library"),
|
|
||||||
"extra_make" : ("", "Extra args to pass on [n]make's command line."),
|
|
||||||
"features" : ("", "A comma-separated list of wxUSE_XYZ defines on Win, or a list of configure flags on unix."),
|
|
||||||
"verbose" : (False, "Print commands as they are run, (to aid with debugging this script)"),
|
|
||||||
"jom" : (False, "Use jom.exe instead of nmake for MSW builds."),
|
|
||||||
}
|
|
||||||
|
|
||||||
parser = optparse.OptionParser(usage="usage: %prog [options]", version="%prog 1.0")
|
|
||||||
|
|
||||||
keys = option_dict.keys()
|
|
||||||
for opt in sorted(keys):
|
|
||||||
default = option_dict[opt][0]
|
|
||||||
action = "store"
|
|
||||||
if type(default) == bool:
|
|
||||||
action = "store_true"
|
|
||||||
parser.add_option("--" + opt, default=default, action=action, dest=opt,
|
|
||||||
help=option_dict[opt][1])
|
|
||||||
|
|
||||||
options, arguments = parser.parse_args(args=args)
|
|
||||||
|
|
||||||
global verbose
|
|
||||||
if options.verbose:
|
|
||||||
verbose = True
|
|
||||||
|
|
||||||
# compiler / build system specific args
|
|
||||||
buildDir = options.builddir
|
|
||||||
args = []
|
|
||||||
installDir = options.installdir
|
|
||||||
prefixDir = options.prefix
|
|
||||||
|
|
||||||
if toolkit == "autoconf":
|
|
||||||
if not buildDir:
|
|
||||||
buildDir = os.getcwd()
|
|
||||||
configure_opts = []
|
|
||||||
if options.features != "":
|
|
||||||
configure_opts.extend(options.features.split(" "))
|
|
||||||
|
|
||||||
if options.unicode:
|
|
||||||
configure_opts.append("--enable-unicode")
|
|
||||||
|
|
||||||
if options.debug:
|
|
||||||
configure_opts.append("--enable-debug")
|
|
||||||
|
|
||||||
if options.cocoa:
|
|
||||||
configure_opts.append("--with-old_cocoa")
|
|
||||||
|
|
||||||
if options.osx_cocoa:
|
|
||||||
configure_opts.append("--with-osx_cocoa")
|
|
||||||
|
|
||||||
wxpy_configure_opts = [
|
|
||||||
"--with-opengl",
|
|
||||||
"--enable-sound",
|
|
||||||
"--enable-graphics_ctx",
|
|
||||||
"--enable-mediactrl",
|
|
||||||
"--enable-display",
|
|
||||||
"--enable-geometry",
|
|
||||||
"--enable-debug_flag",
|
|
||||||
"--enable-optimise",
|
|
||||||
"--disable-debugreport",
|
|
||||||
"--enable-uiactionsim",
|
|
||||||
]
|
|
||||||
|
|
||||||
if sys.platform.startswith("darwin"):
|
|
||||||
wxpy_configure_opts.append("--enable-monolithic")
|
|
||||||
else:
|
|
||||||
wxpy_configure_opts.append("--with-sdl")
|
|
||||||
|
|
||||||
# Try to use use lowest available SDK back to 10.5. Both Carbon and
|
|
||||||
# Cocoa builds require at least the 10.5 SDK now. We only add it to
|
|
||||||
# the wxpy options because this is a hard-requirement for wxPython,
|
|
||||||
# but other cases it is optional and is left up to the developer.
|
|
||||||
# TODO: there should be a command line option to set the SDK...
|
|
||||||
if sys.platform.startswith("darwin"):
|
|
||||||
for xcodePath in getXcodePaths():
|
|
||||||
sdks = [
|
|
||||||
xcodePath+"/SDKs/MacOSX10.5.sdk",
|
|
||||||
xcodePath+"/SDKs/MacOSX10.6.sdk",
|
|
||||||
xcodePath+"/SDKs/MacOSX10.7.sdk",
|
|
||||||
xcodePath+"/SDKs/MacOSX10.8.sdk",
|
|
||||||
]
|
|
||||||
|
|
||||||
# use the lowest available sdk
|
|
||||||
for sdk in sdks:
|
|
||||||
if os.path.exists(sdk):
|
|
||||||
wxpy_configure_opts.append(
|
|
||||||
"--with-macosx-sdk=%s" % sdk)
|
|
||||||
break
|
|
||||||
|
|
||||||
if not options.mac_framework:
|
|
||||||
if installDir and not prefixDir:
|
|
||||||
prefixDir = installDir
|
|
||||||
if prefixDir:
|
|
||||||
prefixDir = os.path.abspath(prefixDir)
|
|
||||||
configure_opts.append("--prefix=" + prefixDir)
|
|
||||||
|
|
||||||
|
|
||||||
if options.wxpython:
|
|
||||||
configure_opts.extend(wxpy_configure_opts)
|
|
||||||
if options.debug:
|
|
||||||
# wxPython likes adding these debug options too
|
|
||||||
configure_opts.append("--enable-debug_gdb")
|
|
||||||
configure_opts.append("--disable-optimise")
|
|
||||||
configure_opts.remove("--enable-optimise")
|
|
||||||
|
|
||||||
|
|
||||||
if options.rebake:
|
|
||||||
retval = run("make -f autogen.mk")
|
|
||||||
exitIfError(retval, "Error running autogen.mk")
|
|
||||||
|
|
||||||
if options.mac_framework:
|
|
||||||
# TODO: Should options.install be automatically turned on if the
|
|
||||||
# mac_framework flag is given?
|
|
||||||
|
|
||||||
# framework builds always need to be monolithic
|
|
||||||
if not "--enable-monolithic" in configure_opts:
|
|
||||||
configure_opts.append("--enable-monolithic")
|
|
||||||
|
|
||||||
# The --prefix given to configure will be the framework prefix
|
|
||||||
# plus the framework specific dir structure.
|
|
||||||
prefixDir = getPrefixInFramework(options)
|
|
||||||
configure_opts.append("--prefix=" + prefixDir)
|
|
||||||
|
|
||||||
# the framework build adds symlinks above the installDir + prefixDir folder
|
|
||||||
# so we need to wipe from the framework root instead of inside the prefixDir.
|
|
||||||
frameworkRootDir = os.path.abspath(os.path.join(installDir + prefixDir, "..", ".."))
|
|
||||||
if os.path.exists(frameworkRootDir):
|
|
||||||
if os.path.exists(frameworkRootDir):
|
|
||||||
shutil.rmtree(frameworkRootDir)
|
|
||||||
|
|
||||||
if options.mac_universal_binary:
|
|
||||||
if options.mac_universal_binary == 'default':
|
|
||||||
if options.osx_cocoa:
|
|
||||||
configure_opts.append("--enable-universal_binary=i386,x86_64")
|
|
||||||
else:
|
|
||||||
configure_opts.append("--enable-universal_binary")
|
|
||||||
else:
|
|
||||||
configure_opts.append("--enable-universal_binary=%s" % options.mac_universal_binary)
|
|
||||||
|
|
||||||
|
|
||||||
print("Configure options: " + repr(configure_opts))
|
|
||||||
wxBuilder = builder.AutoconfBuilder()
|
|
||||||
if not options.no_config and not options.clean:
|
|
||||||
olddir = os.getcwd()
|
|
||||||
if buildDir:
|
|
||||||
os.chdir(buildDir)
|
|
||||||
exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts),
|
|
||||||
"Error running configure")
|
|
||||||
os.chdir(olddir)
|
|
||||||
|
|
||||||
if options.config_only:
|
|
||||||
print("Exiting after configure")
|
|
||||||
return
|
|
||||||
|
|
||||||
elif toolkit in ["msvc", "msvcProject"]:
|
|
||||||
flags = {}
|
|
||||||
buildDir = os.path.abspath(os.path.join(scriptDir, "..", "msw"))
|
|
||||||
|
|
||||||
print("creating wx/msw/setup.h from setup0.h")
|
|
||||||
if options.unicode:
|
|
||||||
flags["wxUSE_UNICODE"] = "1"
|
|
||||||
|
|
||||||
if options.cairo:
|
|
||||||
if not os.environ.get("CAIRO_ROOT"):
|
|
||||||
print("WARNING: Expected CAIRO_ROOT set in the environment!")
|
|
||||||
flags["wxUSE_CAIRO"] = "1"
|
|
||||||
|
|
||||||
if options.wxpython:
|
|
||||||
flags["wxDIALOG_UNIT_COMPATIBILITY "] = "0"
|
|
||||||
flags["wxUSE_DEBUGREPORT"] = "0"
|
|
||||||
flags["wxUSE_DIALUP_MANAGER"] = "0"
|
|
||||||
flags["wxUSE_GRAPHICS_CONTEXT"] = "1"
|
|
||||||
flags["wxUSE_DISPLAY"] = "1"
|
|
||||||
flags["wxUSE_GLCANVAS"] = "1"
|
|
||||||
flags["wxUSE_POSTSCRIPT"] = "1"
|
|
||||||
flags["wxUSE_AFM_FOR_POSTSCRIPT"] = "0"
|
|
||||||
flags["wxUSE_DATEPICKCTRL_GENERIC"] = "1"
|
|
||||||
|
|
||||||
# Remove this when Windows XP finally dies, or when there is a
|
|
||||||
# solution for ticket #13116...
|
|
||||||
flags["wxUSE_COMPILER_TLS"] = "0"
|
|
||||||
|
|
||||||
if VERSION < (2,9):
|
|
||||||
flags["wxUSE_DIB_FOR_BITMAP"] = "1"
|
|
||||||
|
|
||||||
if VERSION >= (2,9):
|
|
||||||
flags["wxUSE_UIACTIONSIMULATOR"] = "1"
|
|
||||||
|
|
||||||
|
|
||||||
mswIncludeDir = os.path.join(wxRootDir, "include", "wx", "msw")
|
|
||||||
setup0File = os.path.join(mswIncludeDir, "setup0.h")
|
|
||||||
setupText = open(setup0File, "rb").read()
|
|
||||||
|
|
||||||
for flag in flags:
|
|
||||||
setupText, subsMade = re.subn(flag + "\s+?\d", "%s %s" % (flag, flags[flag]), setupText)
|
|
||||||
if subsMade == 0:
|
|
||||||
print("Flag %s wasn't found in setup0.h!" % flag)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
setupFile = open(os.path.join(mswIncludeDir, "setup.h"), "wb")
|
|
||||||
setupFile.write(setupText)
|
|
||||||
setupFile.close()
|
|
||||||
args = []
|
|
||||||
if toolkit == "msvc":
|
|
||||||
print("setting build options...")
|
|
||||||
args.append("-f makefile.vc")
|
|
||||||
if options.unicode:
|
|
||||||
args.append("UNICODE=1")
|
|
||||||
|
|
||||||
if options.wxpython:
|
|
||||||
args.append("OFFICIAL_BUILD=1")
|
|
||||||
args.append("COMPILER_VERSION=%s" % getVisCVersion())
|
|
||||||
args.append("SHARED=1")
|
|
||||||
args.append("MONOLITHIC=0")
|
|
||||||
args.append("USE_OPENGL=1")
|
|
||||||
args.append("USE_GDIPLUS=1")
|
|
||||||
|
|
||||||
if not options.debug:
|
|
||||||
args.append("BUILD=release")
|
|
||||||
else:
|
|
||||||
args.append("BUILD=debug")
|
|
||||||
|
|
||||||
if options.shared:
|
|
||||||
args.append("SHARED=1")
|
|
||||||
|
|
||||||
if options.cairo:
|
|
||||||
args.append(
|
|
||||||
"CPPFLAGS=/I%s" %
|
|
||||||
os.path.join(os.environ.get("CAIRO_ROOT", ""), 'include\\cairo'))
|
|
||||||
|
|
||||||
if options.jom:
|
|
||||||
nmakeCommand = 'jom.exe'
|
|
||||||
|
|
||||||
wxBuilder = builder.MSVCBuilder(commandName=nmakeCommand)
|
|
||||||
|
|
||||||
if toolkit == "msvcProject":
|
|
||||||
args = []
|
|
||||||
if options.shared or options.wxpython:
|
|
||||||
args.append("wx_dll.dsw")
|
|
||||||
else:
|
|
||||||
args.append("wx.dsw")
|
|
||||||
|
|
||||||
# TODO:
|
|
||||||
wxBuilder = builder.MSVCProjectBuilder()
|
|
||||||
|
|
||||||
|
|
||||||
if not wxBuilder:
|
|
||||||
print("Builder not available for your specified platform/compiler.")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if options.clean:
|
|
||||||
print("Performing cleanup.")
|
|
||||||
wxBuilder.clean(dir=buildDir, options=args)
|
|
||||||
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
if options.extra_make:
|
|
||||||
args.append(options.extra_make)
|
|
||||||
|
|
||||||
if not sys.platform.startswith("win"):
|
|
||||||
args.append("--jobs=" + options.jobs)
|
|
||||||
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
|
|
||||||
|
|
||||||
if options.install:
|
|
||||||
extra=None
|
|
||||||
if installDir:
|
|
||||||
extra = ['DESTDIR='+installDir]
|
|
||||||
wxBuilder.install(dir=buildDir, options=extra)
|
|
||||||
|
|
||||||
if options.install and options.mac_framework:
|
|
||||||
|
|
||||||
def renameLibrary(libname, frameworkname):
|
|
||||||
reallib = libname
|
|
||||||
links = []
|
|
||||||
while os.path.islink(reallib):
|
|
||||||
links.append(reallib)
|
|
||||||
reallib = "lib/" + os.readlink(reallib)
|
|
||||||
|
|
||||||
#print("reallib is %s" % reallib)
|
|
||||||
run("mv -f %s lib/%s.dylib" % (reallib, frameworkname))
|
|
||||||
|
|
||||||
for link in links:
|
|
||||||
run("ln -s -f %s.dylib %s" % (frameworkname, link))
|
|
||||||
|
|
||||||
frameworkRootDir = prefixDir
|
|
||||||
if installDir:
|
|
||||||
print("installDir = %s" % installDir)
|
|
||||||
frameworkRootDir = installDir + prefixDir
|
|
||||||
os.chdir(frameworkRootDir)
|
|
||||||
build_string = ""
|
|
||||||
if options.debug:
|
|
||||||
build_string = "d"
|
|
||||||
|
|
||||||
fwname = getFrameworkName(options)
|
|
||||||
version = getoutput("bin/wx-config --release")
|
|
||||||
version_full = getoutput("bin/wx-config --version")
|
|
||||||
basename = getoutput("bin/wx-config --basename")
|
|
||||||
configname = getoutput("bin/wx-config --selected-config")
|
|
||||||
|
|
||||||
os.makedirs("Resources")
|
|
||||||
wxplist = dict(
|
|
||||||
CFBundleDevelopmentRegion="English",
|
|
||||||
CFBundleIdentifier='org.wxwidgets.wxosxcocoa',
|
|
||||||
CFBundleName=fwname,
|
|
||||||
CFBundleVersion=version_full,
|
|
||||||
CFBundleExecutable=fwname,
|
|
||||||
CFBundleGetInfoString="%s %s" % (fwname, version_full),
|
|
||||||
CFBundlePackageType="FMWK",
|
|
||||||
CFBundleSignature="WXCO",
|
|
||||||
CFBundleShortVersionString=version_full,
|
|
||||||
CFBundleInfoDictionaryVersion="6.0",
|
|
||||||
)
|
|
||||||
|
|
||||||
import plistlib
|
|
||||||
plistlib.writePlist(wxplist, os.path.join(frameworkRootDir, "Resources", "Info.plist"))
|
|
||||||
|
|
||||||
# we make wx the "actual" library file and link to it from libwhatever.dylib
|
|
||||||
# so that things can link to wx and survive minor version changes
|
|
||||||
renameLibrary("lib/lib%s-%s.dylib" % (basename, version), fwname)
|
|
||||||
run("ln -s -f lib/%s.dylib %s" % (fwname, fwname))
|
|
||||||
|
|
||||||
run("ln -s -f include Headers")
|
|
||||||
|
|
||||||
for lib in ["GL", "STC", "Gizmos", "Gizmos_xrc"]:
|
|
||||||
libfile = "lib/lib%s_%s-%s.dylib" % (basename, lib.lower(), version)
|
|
||||||
if os.path.exists(libfile):
|
|
||||||
frameworkDir = "framework/wx%s/%s" % (lib, version)
|
|
||||||
if not os.path.exists(frameworkDir):
|
|
||||||
os.makedirs(frameworkDir)
|
|
||||||
renameLibrary(libfile, "wx" + lib)
|
|
||||||
run("ln -s -f ../../../%s %s/wx%s" % (libfile, frameworkDir, lib))
|
|
||||||
|
|
||||||
for lib in glob.glob("lib/*.dylib"):
|
|
||||||
if not os.path.islink(lib):
|
|
||||||
corelibname = "lib/lib%s-%s.0.dylib" % (basename, version)
|
|
||||||
run("install_name_tool -id %s %s" % (os.path.join(prefixDir, lib), lib))
|
|
||||||
run("install_name_tool -change %s %s %s" % (os.path.join(frameworkRootDir, corelibname), os.path.join(prefixDir, corelibname), lib))
|
|
||||||
|
|
||||||
os.chdir("include")
|
|
||||||
|
|
||||||
header_template = """
|
|
||||||
#ifndef __WX_FRAMEWORK_HEADER__
|
|
||||||
#define __WX_FRAMEWORK_HEADER__
|
|
||||||
|
|
||||||
%s
|
|
||||||
|
|
||||||
#endif // __WX_FRAMEWORK_HEADER__
|
|
||||||
"""
|
|
||||||
headers = ""
|
|
||||||
header_dir = "wx-%s/wx" % version
|
|
||||||
for include in glob.glob(header_dir + "/*.h"):
|
|
||||||
headers += "#include <wx/" + os.path.basename(include) + ">\n"
|
|
||||||
|
|
||||||
framework_header = open("%s.h" % fwname, "w")
|
|
||||||
framework_header.write(header_template % headers)
|
|
||||||
framework_header.close()
|
|
||||||
|
|
||||||
run("ln -s -f %s wx" % header_dir)
|
|
||||||
os.chdir("wx-%s/wx" % version)
|
|
||||||
run("ln -s -f ../../../lib/wx/include/%s/wx/setup.h setup.h" % configname)
|
|
||||||
|
|
||||||
os.chdir(os.path.join(frameworkRootDir, ".."))
|
|
||||||
run("ln -s -f %s Current" % getWxRelease())
|
|
||||||
os.chdir("..")
|
|
||||||
run("ln -s -f Versions/Current/Headers Headers")
|
|
||||||
run("ln -s -f Versions/Current/Resources Resources")
|
|
||||||
run("ln -s -f Versions/Current/%s %s" % (fwname, fwname))
|
|
||||||
|
|
||||||
# sanity check to ensure the symlink works
|
|
||||||
os.chdir("Versions/Current")
|
|
||||||
|
|
||||||
# put info about the framework into wx-config
|
|
||||||
os.chdir(frameworkRootDir)
|
|
||||||
text = file('lib/wx/config/%s' % configname).read()
|
|
||||||
text = text.replace("MAC_FRAMEWORK=", "MAC_FRAMEWORK=%s" % getFrameworkName(options))
|
|
||||||
if options.mac_framework_prefix not in ['/Library/Frameworks',
|
|
||||||
'/System/Library/Frameworks']:
|
|
||||||
text = text.replace("MAC_FRAMEWORK_PREFIX=",
|
|
||||||
"MAC_FRAMEWORK_PREFIX=%s" % options.mac_framework_prefix)
|
|
||||||
file('lib/wx/config/%s' % configname, 'w').write(text)
|
|
||||||
|
|
||||||
# The framework is finished!
|
|
||||||
print("wxWidgets framework created at: " +
|
|
||||||
os.path.join( installDir,
|
|
||||||
options.mac_framework_prefix,
|
|
||||||
'%s.framework' % fwname))
|
|
||||||
|
|
||||||
|
|
||||||
# adjust the install_name if needed
|
|
||||||
if sys.platform.startswith("darwin") and \
|
|
||||||
options.install and \
|
|
||||||
options.installdir and \
|
|
||||||
not options.mac_framework and \
|
|
||||||
not options.wxpython: # wxPython's build will do this later if needed
|
|
||||||
if not prefixDir:
|
|
||||||
prefixDir = '/usr/local'
|
|
||||||
macFixupInstallNames(options.installdir, prefixDir)#, buildDir)
|
|
||||||
|
|
||||||
# make a package if a destdir was set.
|
|
||||||
if options.mac_framework and \
|
|
||||||
options.install and \
|
|
||||||
options.installdir and \
|
|
||||||
options.mac_distdir:
|
|
||||||
|
|
||||||
if os.path.exists(options.mac_distdir):
|
|
||||||
shutil.rmtree(options.mac_distdir)
|
|
||||||
|
|
||||||
packagedir = os.path.join(options.mac_distdir, "packages")
|
|
||||||
os.makedirs(packagedir)
|
|
||||||
basename = os.path.basename(prefixDir.split(".")[0])
|
|
||||||
packageName = basename + "-" + getWxRelease()
|
|
||||||
packageMakerPath = getXcodePaths()[0]+"/usr/bin/packagemaker "
|
|
||||||
args = []
|
|
||||||
args.append("--root %s" % options.installdir)
|
|
||||||
args.append("--id org.wxwidgets.%s" % basename.lower())
|
|
||||||
args.append("--title %s" % packageName)
|
|
||||||
args.append("--version %s" % getWxRelease())
|
|
||||||
args.append("--out %s" % os.path.join(packagedir, packageName + ".pkg"))
|
|
||||||
cmd = packageMakerPath + ' '.join(args)
|
|
||||||
print("cmd = %s" % cmd)
|
|
||||||
run(cmd)
|
|
||||||
|
|
||||||
os.chdir(options.mac_distdir)
|
|
||||||
|
|
||||||
run('hdiutil create -srcfolder %s -volname "%s" -imagekey zlib-level=9 %s.dmg' % (packagedir, packageName, packageName))
|
|
||||||
|
|
||||||
shutil.rmtree(packagedir)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
exitWithException = False # use sys.exit instead
|
|
||||||
main(sys.argv[0], sys.argv[1:])
|
|
||||||
|
|
@@ -1,255 +0,0 @@
|
|||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
class BuildError(Exception):
|
|
||||||
def __init__(self, value):
|
|
||||||
self.value = value
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return repr(self.value)
|
|
||||||
|
|
||||||
def runInDir(command, dir=None, verbose=True):
|
|
||||||
if dir:
|
|
||||||
olddir = os.getcwd()
|
|
||||||
os.chdir(dir)
|
|
||||||
|
|
||||||
commandStr = " ".join(command)
|
|
||||||
if verbose:
|
|
||||||
print(commandStr)
|
|
||||||
result = os.system(commandStr)
|
|
||||||
|
|
||||||
if dir:
|
|
||||||
os.chdir(olddir)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
class Builder:
|
|
||||||
"""
|
|
||||||
Base class exposing the Builder interface.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, formatName="", commandName="", programDir=None):
|
|
||||||
"""
|
|
||||||
formatName = human readable name for project format (should correspond with Bakefile names)
|
|
||||||
commandName = name of command line program used to invoke builder
|
|
||||||
programDir = directory program is located in, if not on the path
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.dir = dir
|
|
||||||
self.name = commandName
|
|
||||||
self.formatName = formatName
|
|
||||||
self.programDir = programDir
|
|
||||||
self.doSetup()
|
|
||||||
|
|
||||||
def doSetup(self):
|
|
||||||
"""
|
|
||||||
Do anything special needed to configure the environment to build with this builder.
|
|
||||||
"""
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
def isAvailable(self):
|
|
||||||
"""
|
|
||||||
Run sanity checks before attempting to build with this format
|
|
||||||
"""
|
|
||||||
# Make sure the builder program exists
|
|
||||||
programPath = self.getProgramPath()
|
|
||||||
if os.path.exists(programPath):
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
# check the PATH for the program
|
|
||||||
# TODO: How do we check if we're in Cygwin?
|
|
||||||
if sys.platform.startswith("win"):
|
|
||||||
result = os.system(self.name)
|
|
||||||
if result == 0:
|
|
||||||
return True
|
|
||||||
dirs = os.environ["PATH"].split(":")
|
|
||||||
|
|
||||||
for dir in dirs:
|
|
||||||
if os.path.isfile(os.path.join(dir, self.name)):
|
|
||||||
return True
|
|
||||||
|
|
||||||
else:
|
|
||||||
result = os.system("which %s" % self.name)
|
|
||||||
|
|
||||||
if result == 0:
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def getProgramPath(self):
|
|
||||||
if self.programDir:
|
|
||||||
path = os.path.join(self.programDir, self.name)
|
|
||||||
if sys.platform.startswith("win"):
|
|
||||||
path = '"%s"' % path
|
|
||||||
return path
|
|
||||||
|
|
||||||
return self.name
|
|
||||||
|
|
||||||
def getProjectFileArg(self, projectFile = None):
|
|
||||||
result = []
|
|
||||||
if projectFile:
|
|
||||||
result.append(projectFile)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def clean(self, dir=None, projectFile=None, options=[]):
|
|
||||||
"""
|
|
||||||
dir = the directory containing the project file
|
|
||||||
projectFile = Some formats need to explicitly specify the project file's name
|
|
||||||
"""
|
|
||||||
if self.isAvailable():
|
|
||||||
args = [self.getProgramPath()]
|
|
||||||
pfArg = self.getProjectFileArg(projectFile)
|
|
||||||
if pfArg:
|
|
||||||
args.extend(pfArg)
|
|
||||||
args.append("clean")
|
|
||||||
if options:
|
|
||||||
args.extend(options)
|
|
||||||
result = runInDir(args, dir)
|
|
||||||
return result
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def configure(self, dir=None, options=[]):
|
|
||||||
# if we don't have configure, just report success
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def build(self, dir=None, projectFile=None, targets=None, options=[]):
|
|
||||||
if self.isAvailable():
|
|
||||||
args = [self.getProgramPath()]
|
|
||||||
pfArg = self.getProjectFileArg(projectFile)
|
|
||||||
if pfArg:
|
|
||||||
args.extend(pfArg)
|
|
||||||
# Important Note: if extending args, check it first!
|
|
||||||
# NoneTypes are not iterable and will crash the clean, build, or install!
|
|
||||||
# Very very irritating when this happens right at the end.
|
|
||||||
if options:
|
|
||||||
args.extend(options)
|
|
||||||
result = runInDir(args, dir)
|
|
||||||
return result
|
|
||||||
|
|
||||||
return 1
|
|
||||||
|
|
||||||
def install(self, dir=None, projectFile=None, options=[]):
|
|
||||||
if self.isAvailable():
|
|
||||||
args = [self.getProgramPath()]
|
|
||||||
pfArg = self.getProjectFileArg(projectFile)
|
|
||||||
if pfArg:
|
|
||||||
args.extend(pfArg)
|
|
||||||
args.append("install")
|
|
||||||
if options:
|
|
||||||
args.extend(options)
|
|
||||||
result = runInDir(args, dir)
|
|
||||||
return result
|
|
||||||
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
# Concrete subclasses of abstract Builder interface
|
|
||||||
|
|
||||||
class GNUMakeBuilder(Builder):
|
|
||||||
def __init__(self, commandName="make", formatName="GNUMake"):
|
|
||||||
Builder.__init__(self, commandName=commandName, formatName=formatName)
|
|
||||||
|
|
||||||
|
|
||||||
class XcodeBuilder(Builder):
|
|
||||||
def __init__(self, commandName="xcodebuild", formatName="Xcode"):
|
|
||||||
Builder.__init__(self, commandName=commandName, formatName=formatName)
|
|
||||||
|
|
||||||
|
|
||||||
class AutoconfBuilder(GNUMakeBuilder):
|
|
||||||
def __init__(self, formatName="autoconf"):
|
|
||||||
GNUMakeBuilder.__init__(self, formatName=formatName)
|
|
||||||
|
|
||||||
def configure(self, dir=None, options=None):
|
|
||||||
#olddir = os.getcwd()
|
|
||||||
#os.chdir(dir)
|
|
||||||
|
|
||||||
configdir = dir
|
|
||||||
if not dir:
|
|
||||||
configdir = os.getcwd()
|
|
||||||
|
|
||||||
configure_cmd = ""
|
|
||||||
while os.path.exists(configdir):
|
|
||||||
config_cmd = os.path.join(configdir, "configure")
|
|
||||||
if not os.path.exists(config_cmd):
|
|
||||||
parentdir = os.path.abspath(os.path.join(configdir, ".."))
|
|
||||||
if configdir == parentdir:
|
|
||||||
break
|
|
||||||
|
|
||||||
configdir = parentdir
|
|
||||||
else:
|
|
||||||
configure_cmd = config_cmd
|
|
||||||
break
|
|
||||||
|
|
||||||
if not configure_cmd:
|
|
||||||
sys.stderr.write("Could not find configure script at %r. Have you run autoconf?\n" % dir)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
optionsStr = " ".join(options) if options else ""
|
|
||||||
command = "%s %s" % (configure_cmd, optionsStr)
|
|
||||||
print(command)
|
|
||||||
result = os.system(command)
|
|
||||||
#os.chdir(olddir)
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
class MSVCBuilder(Builder):
|
|
||||||
def __init__(self, commandName="nmake.exe"):
|
|
||||||
Builder.__init__(self, commandName=commandName, formatName="msvc")
|
|
||||||
|
|
||||||
def isAvailable(self):
|
|
||||||
PATH = os.environ['PATH'].split(os.path.pathsep)
|
|
||||||
for p in PATH:
|
|
||||||
if os.path.exists(os.path.join(p, self.name)):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def getProjectFileArg(self, projectFile = None):
|
|
||||||
result = []
|
|
||||||
if projectFile:
|
|
||||||
result.extend(['-f', projectFile])
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
class MSVCProjectBuilder(Builder):
|
|
||||||
def __init__(self):
|
|
||||||
Builder.__init__(self, commandName="VCExpress.exe", formatName="msvcProject")
|
|
||||||
for key in ["VS90COMNTOOLS", "VC80COMNTOOLS", "VC71COMNTOOLS"]:
|
|
||||||
if os.environ.has_key(key):
|
|
||||||
self.programDir = os.path.join(os.environ[key], "..", "IDE")
|
|
||||||
|
|
||||||
if self.programDir == None:
|
|
||||||
for version in ["9.0", "8", ".NET 2003"]:
|
|
||||||
msvcDir = "C:\\Program Files\\Microsoft Visual Studio %s\\Common7\\IDE" % version
|
|
||||||
if os.path.exists(msvcDir):
|
|
||||||
self.programDir = msvcDir
|
|
||||||
|
|
||||||
def isAvailable(self):
|
|
||||||
if self.programDir:
|
|
||||||
path = os.path.join(self.programDir, self.name)
|
|
||||||
if os.path.exists(path):
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
# I don't have commercial versions of MSVC so I can't test this
|
|
||||||
name = "devenv.com"
|
|
||||||
path = os.path.join(self.programDir, name)
|
|
||||||
if os.path.exists(path):
|
|
||||||
self.name = "devenv.com"
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
builders = [GNUMakeBuilder, XcodeBuilder, AutoconfBuilder, MSVCBuilder, MSVCProjectBuilder]
|
|
||||||
|
|
||||||
def getAvailableBuilders():
|
|
||||||
availableBuilders = {}
|
|
||||||
for symbol in builders:
|
|
||||||
thisBuilder = symbol()
|
|
||||||
if thisBuilder.isAvailable():
|
|
||||||
availableBuilders[thisBuilder.formatName] = symbol
|
|
||||||
|
|
||||||
return availableBuilders
|
|
@@ -1,243 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import glob
|
|
||||||
import optparse
|
|
||||||
import os
|
|
||||||
import platform
|
|
||||||
import re
|
|
||||||
import shutil
|
|
||||||
import string
|
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
import types
|
|
||||||
import pdb
|
|
||||||
|
|
||||||
## CONSTANTS
|
|
||||||
|
|
||||||
scriptDir = os.path.join(sys.path[0])
|
|
||||||
rootDir = os.path.abspath(os.path.join(scriptDir, "..", ".."))
|
|
||||||
contribDir = os.path.join("contrib", "src")
|
|
||||||
|
|
||||||
dirsToCopy = ["art", "build", "demos", "distrib/mac", "docs", "include", "interface", "lib",
|
|
||||||
"locale", "samples", "src", "tests", "utils"]
|
|
||||||
|
|
||||||
dirsToIgnore = [".svn", "CVS"]
|
|
||||||
excludeExtensions = [".rej", ".orig", ".mine", ".tmp"]
|
|
||||||
|
|
||||||
option_dict = {
|
|
||||||
"compression" : ("gzip", "Compression to use. Values are: gzip, bzip, zip, all (default: gzip)"),
|
|
||||||
"docs" : ("html", "Doc formats to build. Comma separated. Values are: none, html (default: html)"),
|
|
||||||
"name" : ("wxWidgets", "Name given to the tarball created (default: wxWidgets)"),
|
|
||||||
"postfix" : ("", "String appended to the version to indicate a special release (default: none)"),
|
|
||||||
"wxpython" : (False, "Produce wxPython source tarball (name defaults to wxPython-src)")
|
|
||||||
}
|
|
||||||
|
|
||||||
mswProjectFiles = [ ".vcproj", ".sln", ".dsp", ".dsw", ".vc", ".bat"]
|
|
||||||
nativeLineEndingFiles = [".cpp", ".h", ".c", ".txt"]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## PARSE OPTIONS
|
|
||||||
|
|
||||||
usage="""usage: %prog [options] <output directory>\n
|
|
||||||
Create a wxWidgets archive and store it in <output directory>.
|
|
||||||
The output directory must be an absolute, existing path.
|
|
||||||
Type %prog --help for options.
|
|
||||||
"""
|
|
||||||
|
|
||||||
parser = optparse.OptionParser(usage, version="%prog 1.0")
|
|
||||||
|
|
||||||
for opt in option_dict:
|
|
||||||
default = option_dict[opt][0]
|
|
||||||
|
|
||||||
action = "store"
|
|
||||||
if type(default) == types.BooleanType:
|
|
||||||
action = "store_true"
|
|
||||||
parser.add_option("--" + opt, default=default, action=action, dest=opt, help=option_dict[opt][1])
|
|
||||||
|
|
||||||
options, arguments = parser.parse_args()
|
|
||||||
|
|
||||||
if len(arguments) < 1 or not os.path.exists(arguments[0]) or not os.path.isabs(arguments[0]):
|
|
||||||
parser.print_usage()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
destDir = arguments[0]
|
|
||||||
if not os.path.exists(destDir):
|
|
||||||
os.makedirs(destDir)
|
|
||||||
|
|
||||||
wxVersion = None
|
|
||||||
VERSION_FILE = os.path.join(rootDir, 'include/wx/version.h')
|
|
||||||
|
|
||||||
|
|
||||||
## HELPER FUNCTIONS
|
|
||||||
|
|
||||||
def makeDOSLineEndings(dir, extensions):
|
|
||||||
fileList = []
|
|
||||||
for root, subFolders, files in os.walk(dir):
|
|
||||||
for file in files:
|
|
||||||
if os.path.splitext(file)[1] in extensions:
|
|
||||||
os.system("unix2dos %s" % os.path.join(root, file))
|
|
||||||
|
|
||||||
def getVersion(includeSubrelease=False):
|
|
||||||
"""Returns wxWidgets version as a tuple: (major,minor,release)."""
|
|
||||||
|
|
||||||
wxVersion = None
|
|
||||||
major = None
|
|
||||||
minor = None
|
|
||||||
release = None
|
|
||||||
subrelease = None
|
|
||||||
if wxVersion == None:
|
|
||||||
f = open(VERSION_FILE, 'rt')
|
|
||||||
lines = f.readlines()
|
|
||||||
f.close()
|
|
||||||
major = minor = release = None
|
|
||||||
for l in lines:
|
|
||||||
if not l.startswith('#define'): continue
|
|
||||||
splitline = l.strip().split()
|
|
||||||
if splitline[0] != '#define': continue
|
|
||||||
if len(splitline) < 3: continue
|
|
||||||
name = splitline[1]
|
|
||||||
value = splitline[2]
|
|
||||||
if value == None: continue
|
|
||||||
if name == 'wxMAJOR_VERSION': major = int(value)
|
|
||||||
if name == 'wxMINOR_VERSION': minor = int(value)
|
|
||||||
if name == 'wxRELEASE_NUMBER': release = int(value)
|
|
||||||
if name == 'wxSUBRELEASE_NUMBER': subrelease = int(value)
|
|
||||||
if major != None and minor != None and release != None:
|
|
||||||
if not includeSubrelease or subrelease != None:
|
|
||||||
break
|
|
||||||
|
|
||||||
if includeSubrelease:
|
|
||||||
wxVersion = (major, minor, release, subrelease)
|
|
||||||
else:
|
|
||||||
wxVersion = (major, minor, release)
|
|
||||||
return wxVersion
|
|
||||||
|
|
||||||
def allFilesRecursive(dir):
|
|
||||||
fileList = []
|
|
||||||
for root, subFolders, files in os.walk(dir):
|
|
||||||
shouldCopy = True
|
|
||||||
for ignoreDir in dirsToIgnore:
|
|
||||||
if ignoreDir in root:
|
|
||||||
shouldCopy = False
|
|
||||||
|
|
||||||
if shouldCopy:
|
|
||||||
for file in files:
|
|
||||||
path = os.path.join(root,file)
|
|
||||||
for exclude in excludeExtensions:
|
|
||||||
if not os.path.splitext(file)[1] in excludeExtensions:
|
|
||||||
fileList.append(os.path.join(root,file))
|
|
||||||
return fileList
|
|
||||||
|
|
||||||
|
|
||||||
## MAKE THE RELEASE!
|
|
||||||
|
|
||||||
str_version = "" ##"%d.%d.%d" % getVersion()
|
|
||||||
archive_name = options.name
|
|
||||||
|
|
||||||
if options.wxpython:
|
|
||||||
dirsToCopy.append("wxPython")
|
|
||||||
archive_name = "wxPython-src"
|
|
||||||
## str_version = "%d.%d.%d.%d" % getVersion(includeSubrelease=True)
|
|
||||||
options.docs = "none"
|
|
||||||
|
|
||||||
if options.postfix != "":
|
|
||||||
str_version += "-" + options.postfix
|
|
||||||
|
|
||||||
full_name = archive_name ## + "-" + str_version
|
|
||||||
|
|
||||||
copyDir = tempfile.mkdtemp()
|
|
||||||
wxCopyDir = os.path.join(copyDir, full_name)
|
|
||||||
|
|
||||||
os.makedirs(wxCopyDir)
|
|
||||||
|
|
||||||
os.chdir(rootDir)
|
|
||||||
fileList = []
|
|
||||||
rootFiles = glob.glob("*")
|
|
||||||
for afile in rootFiles:
|
|
||||||
if os.path.isfile(os.path.abspath(afile)):
|
|
||||||
fileList.append(afile)
|
|
||||||
|
|
||||||
for dir in dirsToCopy:
|
|
||||||
print "Determining files to copy from %s..." % dir
|
|
||||||
fileList.extend(allFilesRecursive(dir))
|
|
||||||
|
|
||||||
print "Copying files to the temporary folder %s..." % copyDir
|
|
||||||
for afile in fileList:
|
|
||||||
destFile = os.path.join(wxCopyDir, afile)
|
|
||||||
dirName = os.path.dirname(destFile)
|
|
||||||
if not os.path.exists(dirName):
|
|
||||||
os.makedirs(dirName)
|
|
||||||
shutil.copy(os.path.join(rootDir, afile), destFile)
|
|
||||||
|
|
||||||
# copy include/wx/msw/setup0.h -> include/wx/msw/setup.h
|
|
||||||
mswSetup0 = os.path.join(wxCopyDir, "include","wx","msw","setup0.h")
|
|
||||||
shutil.copy(mswSetup0, mswSetup0.replace("setup0.h", "setup.h")),
|
|
||||||
|
|
||||||
# compile gettext catalogs
|
|
||||||
print "Compiling gettext catalogs..."
|
|
||||||
os.system("make -C %s/locale allmo" % wxCopyDir)
|
|
||||||
|
|
||||||
all = options.compression == "all"
|
|
||||||
|
|
||||||
# make sure they have the DOS line endings everywhere
|
|
||||||
##print "Setting MSW Project files to use DOS line endings..."
|
|
||||||
##makeDOSLineEndings(wxCopyDir, mswProjectFiles)
|
|
||||||
|
|
||||||
if all or options.compression == "gzip":
|
|
||||||
print "Creating gzip archive..."
|
|
||||||
os.chdir(copyDir)
|
|
||||||
os.system("tar -czvf %s/%s.tar.gz %s" % (destDir, full_name, "*"))
|
|
||||||
os.chdir(rootDir)
|
|
||||||
|
|
||||||
if all or options.compression == "bzip":
|
|
||||||
print "Creating bzip archive..."
|
|
||||||
os.chdir(copyDir)
|
|
||||||
os.system("tar -cjvf %s/%s.tar.bz2 %s" % (destDir, full_name, "*"))
|
|
||||||
os.chdir(rootDir)
|
|
||||||
|
|
||||||
if all or options.compression == "zip":
|
|
||||||
os.chdir(copyDir)
|
|
||||||
print "Setting DOS line endings on source and text files..."
|
|
||||||
## makeDOSLineEndings(copyDir, nativeLineEndingFiles)
|
|
||||||
print "Creating zip archive..."
|
|
||||||
os.system("zip -9 -r %s/%s.zip %s" % (destDir, full_name, "*"))
|
|
||||||
os.chdir(rootDir)
|
|
||||||
|
|
||||||
shutil.rmtree(copyDir)
|
|
||||||
|
|
||||||
|
|
||||||
# build any docs packages:
|
|
||||||
doc_formats = string.split(options.docs, ",")
|
|
||||||
doxy_dir = "docs/doxygen"
|
|
||||||
output_dir = os.path.join(rootDir,"docs/doxygen/out")
|
|
||||||
if not os.path.exists(output_dir):
|
|
||||||
os.makedirs(output_dir)
|
|
||||||
|
|
||||||
for format in doc_formats:
|
|
||||||
if not format == "none":
|
|
||||||
os.chdir(doxy_dir)
|
|
||||||
if platform.system() == "Windows":
|
|
||||||
print "Windows platform"
|
|
||||||
os.system("regen.bat %s" % format)
|
|
||||||
else:
|
|
||||||
os.system("regen.sh %s" % format)
|
|
||||||
|
|
||||||
os.chdir(output_dir)
|
|
||||||
|
|
||||||
if format == "html":
|
|
||||||
src = format
|
|
||||||
docs_full_name = "%s-%s" % (full_name, format.upper())
|
|
||||||
files_to_zip = "*"
|
|
||||||
else:
|
|
||||||
src = "wx.%s" % format
|
|
||||||
docs_full_name = "%s.%s" % (full_name, format.upper())
|
|
||||||
files_to_zip = docs_full_name
|
|
||||||
|
|
||||||
os.rename(src, docs_full_name)
|
|
||||||
os.system("zip -9 -r %s/%s.zip %s" % (destDir, docs_full_name, files_to_zip))
|
|
||||||
os.chdir(rootDir)
|
|
||||||
|
|
||||||
os.chdir(rootDir)
|
|
||||||
if os.path.exists(output_dir):
|
|
||||||
shutil.rmtree(output_dir)
|
|
@@ -40,14 +40,17 @@ working copy and you want to prepare distribution for the version x.y.z:
|
|||||||
4. This step must be done under Windows as it relies on having hhc.exe, the
|
4. This step must be done under Windows as it relies on having hhc.exe, the
|
||||||
Html Help compiler, in PATH: run the following commands
|
Html Help compiler, in PATH: run the following commands
|
||||||
|
|
||||||
|
```
|
||||||
cd docs\doxygen
|
cd docs\doxygen
|
||||||
regen.bat chm
|
regen.bat chm
|
||||||
cd out
|
cd out
|
||||||
zip ..\..\..\wxWidgets-x.y.z-docs-chm.zip wx.chm
|
zip ..\..\..\wxWidgets-x.y.z-docs-chm.zip wx.chm
|
||||||
|
```
|
||||||
|
|
||||||
5. This step also must be done under Windows as it uses Inno Setup to produce
|
5. This step also must be done under Windows as it uses Inno Setup to produce
|
||||||
the .exe file and it also requires the CHM file built above:
|
the .exe file and it also requires the CHM file built above:
|
||||||
|
|
||||||
|
```
|
||||||
md x.y.z-sources
|
md x.y.z-sources
|
||||||
cd x.y.z-sources
|
cd x.y.z-sources
|
||||||
7z x ..\wxWidgets-x.y.z.7z
|
7z x ..\wxWidgets-x.y.z.7z
|
||||||
@@ -55,46 +58,7 @@ working copy and you want to prepare distribution for the version x.y.z:
|
|||||||
cp ..\docs\doxygen\out\wx.chm docs\htmlhelp
|
cp ..\docs\doxygen\out\wx.chm docs\htmlhelp
|
||||||
set WXW_VER=x.y.z
|
set WXW_VER=x.y.z
|
||||||
iscc build\tools\wxwidgets.iss
|
iscc build\tools\wxwidgets.iss
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Instructions for the previous version of release scripts
|
|
||||||
--------------------------------------------------------
|
|
||||||
|
|
||||||
NB: These scripts haven't been used since 2.8 series and may not work any longer!
|
|
||||||
|
|
||||||
Currently our release system uses a Python 2.x script to generate releases.
|
|
||||||
The script requires Unix utilities such as tar, zip and unix2dos and thus must
|
|
||||||
be run either on Unix or using Cygwin on Windows. To generate a release, simply
|
|
||||||
run the following command:
|
|
||||||
|
|
||||||
build/tools/create-archive.py --compression=all /path/to/output/dir
|
|
||||||
|
|
||||||
This will produce zip, gzip and bzip archives of the tree (without
|
|
||||||
"compression" argument only .gz is made). Note that this commands produces huge
|
|
||||||
amounts of output so redirecting it to a file is recommended.
|
|
||||||
|
|
||||||
To add a prefix to the release, such as RC1, the SVN revision, or a date, just
|
|
||||||
pass --postfix="postfix" to the script. More info on the options and their
|
|
||||||
possible values can be found by calling `create-archive.py --help`.
|
|
||||||
|
|
||||||
IMPORTANT NOTE: You *must* run this script from a clean source tree, that is,
|
|
||||||
with no junk files in it or modifications. This is because the
|
|
||||||
release should be a pristine copy of the tree as of the time of
|
|
||||||
release. If you have legitimate modifications in the tree that need
|
|
||||||
to be in the release, commit them first.
|
|
||||||
|
|
||||||
To generate the windows installer (.exe) and the documentation files (chm and htb formats)
|
|
||||||
run:
|
|
||||||
|
|
||||||
build\tools\bld_chm_exe.bat
|
|
||||||
|
|
||||||
which depends on the wxwidgets.iss file, and generates output in the %DAILY% directory. It
|
|
||||||
assumes a clean copy of the wxWidgets source tree in %INNO%. Temporary files will be generated
|
|
||||||
in the tree from which the batch file is run. It depends on doxygen, a number of gnu
|
|
||||||
win32 tools and Microsofts htmlhelp compiler. The wxwidgets.iss file should not need
|
|
||||||
editing, but you will want to check that the bld_chm_exe.bat has the correct version number.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Uploading
|
Uploading
|
||||||
|
Reference in New Issue
Block a user