Changes to allow wxPython to be built on *nix with wxWindows ports
besides wxGTK. wxGTK2 (ANSI) currently works, others will be coming git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -444,6 +444,9 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
|
|||||||
from distutils.dep_util import newer
|
from distutils.dep_util import newer
|
||||||
from distutils.spawn import spawn
|
from distutils.spawn import spawn
|
||||||
|
|
||||||
|
if not os.path.exists(os.path.join(dir, gendir)):
|
||||||
|
os.mkdir(os.path.join(dir, gendir))
|
||||||
|
|
||||||
sources = []
|
sources = []
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
|
@@ -13,7 +13,7 @@ from my_distutils import run_swig, contrib_copy_tree
|
|||||||
# flags and values that affect this script
|
# flags and values that affect this script
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
VERSION = "2.4.0p1"
|
VERSION = "2.4.0"
|
||||||
DESCRIPTION = "Cross platform GUI toolkit for Python"
|
DESCRIPTION = "Cross platform GUI toolkit for Python"
|
||||||
AUTHOR = "Robin Dunn"
|
AUTHOR = "Robin Dunn"
|
||||||
AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
|
AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
|
||||||
@@ -71,13 +71,21 @@ UNDEF_NDEBUG = 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
|
|||||||
|
|
||||||
NO_SCRIPTS = 0 # Don't install the tool scripts
|
NO_SCRIPTS = 0 # Don't install the tool scripts
|
||||||
|
|
||||||
|
WX_CONFIG = None # Usually you shouldn't need to touch this, but you can set
|
||||||
|
# it to pass an alternate version of wx-config or alternate
|
||||||
|
# flags, eg. as required by the .deb in-tree build. By
|
||||||
|
# default a wx-config command will be assembled based on
|
||||||
|
# version, port, etc. and it will be looked for on the
|
||||||
|
# default $PATH.
|
||||||
|
|
||||||
|
WXPORT = 'gtk' # On Linux/Unix there are several ports of wxWindows available.
|
||||||
|
# Setting this value lets you select which will be used for
|
||||||
|
# the wxPython build. Possibilites are 'gtk', 'gtk2' and
|
||||||
|
# 'x11'. Curently only gtk and gtk2 works.
|
||||||
|
|
||||||
|
BUILD_BASE = "build" # Directory to use for temporary build files.
|
||||||
|
|
||||||
WX_CONFIG = "wx-config" # Usually you shouldn't need to touch this,
|
|
||||||
# but you can set it to pass an alternate
|
|
||||||
# version of wx-config or alternate flags,
|
|
||||||
# eg. as required by the .deb in-tree build.
|
|
||||||
|
|
||||||
BUILD_BASE = "build"
|
|
||||||
|
|
||||||
# Some MSW build settings
|
# Some MSW build settings
|
||||||
|
|
||||||
@@ -139,6 +147,15 @@ if bcpp_compiling:
|
|||||||
WXDLLVER="" # no dll ver path avaible
|
WXDLLVER="" # no dll ver path avaible
|
||||||
|
|
||||||
|
|
||||||
|
# change the PORT default for wxMac
|
||||||
|
if sys.platform[:6] == "darwin":
|
||||||
|
WXPORT = 'mac'
|
||||||
|
|
||||||
|
# and do the same for wxMSW, just for consistency
|
||||||
|
if os.name == 'nt':
|
||||||
|
WXPORT = 'msw'
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# Check for build flags on the command line
|
# Check for build flags on the command line
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@@ -157,7 +174,7 @@ for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
|
|||||||
sys.argv[x] = ''
|
sys.argv[x] = ''
|
||||||
|
|
||||||
# String options
|
# String options
|
||||||
for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE']:
|
for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']:
|
||||||
for x in range(len(sys.argv)):
|
for x in range(len(sys.argv)):
|
||||||
if string.find(sys.argv[x], option) == 0:
|
if string.find(sys.argv[x], option) == 0:
|
||||||
pos = string.find(sys.argv[x], '=') + 1
|
pos = string.find(sys.argv[x], '=') + 1
|
||||||
@@ -168,6 +185,34 @@ for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE']:
|
|||||||
sys.argv = filter(None, sys.argv)
|
sys.argv = filter(None, sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def Verify_WX_CONFIG():
|
||||||
|
""" Called below for the builds that need wx-config,
|
||||||
|
assumes POSIX $PATH in environment.
|
||||||
|
"""
|
||||||
|
# if WX_CONFIG hasn't been set to an explicit value then construct one.
|
||||||
|
global WX_CONFIG
|
||||||
|
if WX_CONFIG is None:
|
||||||
|
if debug: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows...
|
||||||
|
df = 'd'
|
||||||
|
else:
|
||||||
|
df = ''
|
||||||
|
if UNICODE:
|
||||||
|
uf = 'u'
|
||||||
|
else:
|
||||||
|
uf = ''
|
||||||
|
ver2 = VERSION[:3]
|
||||||
|
WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2)
|
||||||
|
|
||||||
|
searchpath = os.environ["PATH"]
|
||||||
|
for p in string.split(searchpath, ':'):
|
||||||
|
fp = os.path.join(p, WX_CONFIG)
|
||||||
|
if os.path.exists(fp) and os.access(fp, os.X_OK):
|
||||||
|
# success
|
||||||
|
print "Found wx-config: " + fp
|
||||||
|
return fp
|
||||||
|
raise SystemExit, "%s not found on $PATH" % WX_CONFIG
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# sanity checks
|
# sanity checks
|
||||||
@@ -188,11 +233,8 @@ if debug:
|
|||||||
if FINAL:
|
if FINAL:
|
||||||
HYBRID = 0
|
HYBRID = 0
|
||||||
|
|
||||||
|
if UNICODE and WXPORT not in ['msw', 'gtk2']:
|
||||||
if UNICODE and os.name != 'nt':
|
raise SystemExit, "UNICODE mode not surrently supported on this WXPORT."
|
||||||
print "UNICODE is currently only supported on Win32"
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
|
|
||||||
if UNICODE:
|
if UNICODE:
|
||||||
BUILD_BASE = BUILD_BASE + '.unicode'
|
BUILD_BASE = BUILD_BASE + '.unicode'
|
||||||
@@ -296,10 +338,9 @@ if os.name == 'nt':
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
elif os.name == 'posix' and sys.platform[:6] == "darwin":
|
elif os.name == 'posix' and sys.platform[:6] == "darwin":
|
||||||
# Flags and such for a Darwin (Max OS X) build of Python
|
# Flags and such for a Darwin (Max OS X) build of Python
|
||||||
|
|
||||||
WXDIR = '..' # assumes IN_CVS_TREE
|
WXDIR = '..' # assumes IN_CVS_TREE
|
||||||
WXPLAT = '__WXMAC__'
|
WXPLAT = '__WXMAC__'
|
||||||
GENDIR = 'mac'
|
GENDIR = 'mac'
|
||||||
@@ -312,6 +353,8 @@ elif os.name == 'posix' and sys.platform[:6] == "darwin":
|
|||||||
libdirs = []
|
libdirs = []
|
||||||
libs = ['stdc++']
|
libs = ['stdc++']
|
||||||
|
|
||||||
|
Verify_WX_CONFIG()
|
||||||
|
|
||||||
cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
|
cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
|
||||||
cflags = string.split(cflags)
|
cflags = string.split(cflags)
|
||||||
if UNDEF_NDEBUG:
|
if UNDEF_NDEBUG:
|
||||||
@@ -327,12 +370,24 @@ elif os.name == 'posix' and sys.platform[:6] == "darwin":
|
|||||||
BUILD_DLLWIDGET = 0
|
BUILD_DLLWIDGET = 0
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
elif os.name == 'posix':
|
elif os.name == 'posix':
|
||||||
# Set flags for other Unix type platforms
|
# Set flags for other Unix type platforms
|
||||||
|
|
||||||
WXDIR = '..' # assumes IN_CVS_TREE
|
WXDIR = '..' # assumes IN_CVS_TREE
|
||||||
WXPLAT = '__WXGTK__' # and assumes GTK...
|
GENDIR = WXPORT
|
||||||
GENDIR = 'gtk' # Need to allow for X11 and/or Motif eventually too
|
|
||||||
|
if WXPORT == 'gtk':
|
||||||
|
WXPLAT = '__WXGTK__'
|
||||||
|
portcfg = os.popen('gtk-config --cflags', 'r').read()[:-1]
|
||||||
|
elif WXPORT == 'gtk2':
|
||||||
|
WXPLAT = '__WXGTK__'
|
||||||
|
GENDIR = 'gtk' # no code differences so use the same generated sources
|
||||||
|
portcfg = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
|
||||||
|
elif WXPORT == 'x11':
|
||||||
|
WXPLAT = '__WXX11__'
|
||||||
|
portcfg = ''
|
||||||
|
else:
|
||||||
|
raise SystemExit, "Unknown WXPORT value: " + WXPORT
|
||||||
|
|
||||||
includes = ['src']
|
includes = ['src']
|
||||||
defines = [('SWIG_GLOBAL', None),
|
defines = [('SWIG_GLOBAL', None),
|
||||||
@@ -342,8 +397,10 @@ elif os.name == 'posix':
|
|||||||
libdirs = []
|
libdirs = []
|
||||||
libs = []
|
libs = []
|
||||||
|
|
||||||
cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + \
|
Verify_WX_CONFIG()
|
||||||
os.popen('gtk-config --cflags', 'r').read()[:-1]
|
|
||||||
|
cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + portcfg
|
||||||
|
|
||||||
cflags = string.split(cflags)
|
cflags = string.split(cflags)
|
||||||
if UNDEF_NDEBUG:
|
if UNDEF_NDEBUG:
|
||||||
cflags.append('-UNDEBUG')
|
cflags.append('-UNDEBUG')
|
||||||
@@ -361,6 +418,7 @@ elif os.name == 'posix':
|
|||||||
libdirs.append("/usr/X11R6/lib")
|
libdirs.append("/usr/X11R6/lib")
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------
|
||||||
else:
|
else:
|
||||||
raise 'Sorry Charlie...'
|
raise 'Sorry Charlie...'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user