]> git.saurik.com Git - wxWidgets.git/blob - wxPython/config.py
OSX Info.plist
[wxWidgets.git] / wxPython / config.py
1 #----------------------------------------------------------------------
2 # Name: wx.build.config
3 # Purpose: Most of the contents of this module used to be located
4 # in wxPython's setup.py script. It was moved here so
5 # it would be installed with the rest of wxPython and
6 # could therefore be used by the setup.py for other
7 # projects that needed this same info and functionality
8 # (most likely in order to be compatible with wxPython.)
9 #
10 # This split from setup.py is still fairly rough, and
11 # some things may still get shuffled back and forth,
12 # refactored, etc. Please send me any comments and
13 # suggestions about this.
14 #
15 # Author: Robin Dunn
16 #
17 # Created: 23-March-2004
18 # RCS-ID: $Id$
19 # Copyright: (c) 2004 by Total Control Software
20 # Licence: wxWindows license
21 #----------------------------------------------------------------------
22
23 import sys, os, glob, fnmatch, tempfile
24 from distutils.core import setup, Extension
25 from distutils.file_util import copy_file
26 from distutils.dir_util import mkpath
27 from distutils.dep_util import newer
28 from distutils.spawn import spawn
29
30 import distutils.command.install_data
31 import distutils.command.install_headers
32 import distutils.command.clean
33
34 #----------------------------------------------------------------------
35 # flags and values that affect this script
36 #----------------------------------------------------------------------
37
38 VER_MAJOR = 2 # The first three must match wxWidgets
39 VER_MINOR = 5
40 VER_RELEASE = 1
41 VER_SUBREL = 6 # wxPython release num for x.y.z release of wxWidgets
42 VER_FLAGS = "p" # release flags, such as prerelease num, unicode, etc.
43
44 DESCRIPTION = "Cross platform GUI toolkit for Python"
45 AUTHOR = "Robin Dunn"
46 AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
47 URL = "http://wxPython.org/"
48 DOWNLOAD_URL = "http://wxPython.org/download.php"
49 LICENSE = "wxWidgets Library License (LGPL derivative)"
50 PLATFORMS = "WIN32,OSX,POSIX"
51 KEYWORDS = "GUI,wx,wxWindows,wxWidgets,cross-platform"
52
53 LONG_DESCRIPTION = """\
54 wxPython is a GUI toolkit for Python that is a wrapper around the
55 wxWidgets C++ GUI library. wxPython provides a large variety of
56 window types and controls, all implemented with a native look and
57 feel (by using the native widgets) on the platforms it is supported
58 on.
59 """
60
61 CLASSIFIERS = """\
62 Development Status :: 6 - Mature
63 Environment :: MacOS X :: Carbon
64 Environment :: Win32 (MS Windows)
65 Environment :: X11 Applications :: GTK
66 Intended Audience :: Developers
67 License :: OSI Approved
68 Operating System :: MacOS :: MacOS X
69 Operating System :: Microsoft :: Windows :: Windows 95/98/2000
70 Operating System :: POSIX
71 Programming Language :: Python
72 Topic :: Software Development :: User Interfaces
73 """
74
75 ## License :: OSI Approved :: wxWidgets Library Licence
76
77
78 # Config values below this point can be reset on the setup.py command line.
79
80 BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module
81 BUILD_OGL = 1 # If true, build the contrib/ogl extension module
82 BUILD_STC = 1 # If true, build the contrib/stc extension module
83 BUILD_XRC = 1 # XML based resource system
84 BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library
85 BUILD_DLLWIDGET = 0# Build a module that enables unknown wx widgets
86 # to be loaded from a DLL and to be used from Python.
87
88 # Internet Explorer wrapper (experimental)
89 BUILD_IEWIN = (os.name == 'nt')
90 BUILD_ACTIVEX = (os.name == 'nt') # new version of IEWIN and more
91
92
93 CORE_ONLY = 0 # if true, don't build any of the above
94
95 PREP_ONLY = 0 # Only run the prepatory steps, not the actual build.
96
97 USE_SWIG = 0 # Should we actually execute SWIG, or just use the
98 # files already in the distribution?
99
100 SWIG = "swig" # The swig executable to use.
101
102 BUILD_RENAMERS = 1 # Should we build the renamer modules too?
103
104 UNICODE = 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and
105 # will ensure that the right headers are found and the
106 # right libs are linked.
107
108 UNDEF_NDEBUG = 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
109 # and distutils will pick this up and use it on the
110 # compile command-line for the extensions. This could
111 # conflict with how wxWidgets was built. If NDEBUG is
112 # set then wxWidgets' __WXDEBUG__ setting will be turned
113 # off. If wxWidgets was actually built with it turned
114 # on then you end up with mismatched class structures,
115 # and wxPython will crash.
116
117 NO_SCRIPTS = 0 # Don't install the tool scripts
118 NO_HEADERS = 0 # Don't install the wxPython *.h and *.i files
119
120 WX_CONFIG = None # Usually you shouldn't need to touch this, but you can set
121 # it to pass an alternate version of wx-config or alternate
122 # flags, eg. as required by the .deb in-tree build. By
123 # default a wx-config command will be assembled based on
124 # version, port, etc. and it will be looked for on the
125 # default $PATH.
126
127 WXPORT = 'gtk' # On Linux/Unix there are several ports of wxWidgets available.
128 # Setting this value lets you select which will be used for
129 # the wxPython build. Possibilites are 'gtk', 'gtk2' and
130 # 'x11'. Curently only gtk and gtk2 works.
131
132 BUILD_BASE = "build" # Directory to use for temporary build files.
133 # This name will be appended to if the WXPORT or
134 # the UNICODE flags are set to non-standard
135 # values. See below.
136
137
138 CONTRIBS_INC = "" # A dir to add as an -I flag when compiling the contribs
139
140
141 # Some MSW build settings
142
143 FINAL = 0 # Mirrors use of same flag in wx makefiles,
144 # (0 or 1 only) should probably find a way to
145 # autodetect this...
146
147 HYBRID = 1 # If set and not debug or FINAL, then build a
148 # hybrid extension that can be used by the
149 # non-debug version of python, but contains
150 # debugging symbols for wxWidgets and wxPython.
151 # wxWidgets must have been built with /MD, not /MDd
152 # (using FINAL=hybrid will do it.)
153
154 # Version part of wxWidgets LIB/DLL names
155 WXDLLVER = '%d%d' % (VER_MAJOR, VER_MINOR)
156
157
158 #----------------------------------------------------------------------
159
160 def msg(text):
161 if hasattr(sys, 'setup_is_main') and sys.setup_is_main:
162 print text
163
164
165 def opj(*args):
166 path = apply(os.path.join, args)
167 return os.path.normpath(path)
168
169
170 def libFlag():
171 if FINAL:
172 rv = ''
173 elif HYBRID:
174 rv = 'h'
175 else:
176 rv = 'd'
177 if UNICODE:
178 rv = 'u' + rv
179 return rv
180
181
182 #----------------------------------------------------------------------
183 # Some other globals
184 #----------------------------------------------------------------------
185
186 PKGDIR = 'wx'
187 wxpExtensions = []
188 DATA_FILES = []
189 CLEANUP = []
190
191 force = '--force' in sys.argv or '-f' in sys.argv
192 debug = '--debug' in sys.argv or '-g' in sys.argv
193 cleaning = 'clean' in sys.argv
194
195
196 # change the PORT default for wxMac
197 if sys.platform[:6] == "darwin":
198 WXPORT = 'mac'
199
200 # and do the same for wxMSW, just for consistency
201 if os.name == 'nt':
202 WXPORT = 'msw'
203
204
205 #----------------------------------------------------------------------
206 # Check for build flags on the command line
207 #----------------------------------------------------------------------
208
209 # Boolean (int) flags
210 for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
211 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN', 'BUILD_ACTIVEX',
212 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'UNICODE',
213 'UNDEF_NDEBUG', 'NO_SCRIPTS', 'NO_HEADERS', 'BUILD_RENAMERS',
214 'FINAL', 'HYBRID', ]:
215 for x in range(len(sys.argv)):
216 if sys.argv[x].find(flag) == 0:
217 pos = sys.argv[x].find('=') + 1
218 if pos > 0:
219 vars()[flag] = eval(sys.argv[x][pos:])
220 sys.argv[x] = ''
221
222 # String options
223 for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG',
224 'CONTRIBS_INC']:
225 for x in range(len(sys.argv)):
226 if sys.argv[x].find(option) == 0:
227 pos = sys.argv[x].find('=') + 1
228 if pos > 0:
229 vars()[option] = sys.argv[x][pos:]
230 sys.argv[x] = ''
231
232 sys.argv = filter(None, sys.argv)
233
234
235 #----------------------------------------------------------------------
236 # some helper functions
237 #----------------------------------------------------------------------
238
239 def Verify_WX_CONFIG():
240 """ Called below for the builds that need wx-config,
241 if WX_CONFIG is not set then tries to select the specific
242 wx*-config script based on build options. If not found
243 then it defaults to 'wx-config'.
244 """
245 # if WX_CONFIG hasn't been set to an explicit value then construct one.
246 global WX_CONFIG
247 if WX_CONFIG is None:
248 if debug: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWidgets...
249 df = 'd'
250 else:
251 df = ''
252 if UNICODE:
253 uf = 'u'
254 else:
255 uf = ''
256 ver2 = "%s.%s" % (VER_MAJOR, VER_MINOR)
257 port = WXPORT
258 if port == "x11":
259 port = "x11univ"
260 WX_CONFIG = 'wx%s%s%s-%s-config' % (port, uf, df, ver2)
261
262 searchpath = os.environ["PATH"]
263 for p in searchpath.split(':'):
264 fp = os.path.join(p, WX_CONFIG)
265 if os.path.exists(fp) and os.access(fp, os.X_OK):
266 # success
267 msg("Found wx-config: " + fp)
268 WX_CONFIG = fp
269 break
270 else:
271 msg("WX_CONFIG not specified and %s not found on $PATH "
272 "defaulting to \"wx-config\"" % WX_CONFIG)
273 WX_CONFIG = 'wx-config'
274
275
276
277 def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args,
278 swig_deps=[], add_under=False):
279 """Run SWIG the way I want it done"""
280
281 if USE_SWIG and not os.path.exists(os.path.join(dir, gendir)):
282 os.mkdir(os.path.join(dir, gendir))
283
284 if USE_SWIG and not os.path.exists(os.path.join("docs", "xml-raw")):
285 os.mkdir(os.path.join("docs", "xml-raw"))
286
287 sources = []
288
289 if add_under: pre = '_'
290 else: pre = ''
291
292 for file in files:
293 basefile = os.path.splitext(file)[0]
294 i_file = os.path.join(dir, file)
295 py_file = os.path.join(dir, gendir, pre+basefile+'.py')
296 cpp_file = os.path.join(dir, gendir, pre+basefile+'_wrap.cpp')
297 xml_file = os.path.join("docs", "xml-raw", basefile+'_swig.xml')
298
299 if add_under:
300 interface = ['-interface', '_'+basefile+'_']
301 else:
302 interface = []
303
304 sources.append(cpp_file)
305
306 if not cleaning and USE_SWIG:
307 for dep in swig_deps:
308 if newer(dep, py_file) or newer(dep, cpp_file):
309 force = 1
310 break
311
312 if force or newer(i_file, py_file) or newer(i_file, cpp_file):
313 ## we need forward slashes here even on win32
314 #cpp_file = opj(cpp_file) #'/'.join(cpp_file.split('\\'))
315 #i_file = opj(i_file) #'/'.join(i_file.split('\\'))
316
317 if BUILD_RENAMERS:
318 #tempfile.tempdir = sourcePath
319 xmltemp = tempfile.mktemp('.xml')
320
321 # First run swig to produce the XML file, adding
322 # an extra -D that prevents the old rename
323 # directives from being used
324 cmd = [ swig_cmd ] + swig_args + \
325 [ '-DBUILDING_RENAMERS', '-xmlout', xmltemp ] + \
326 ['-I'+dir, '-o', cpp_file, i_file]
327 msg(' '.join(cmd))
328 spawn(cmd)
329
330 # Next run build_renamers to process the XML
331 cmd = [ sys.executable, '-u',
332 './distrib/build_renamers.py', dir, pre+basefile, xmltemp]
333 msg(' '.join(cmd))
334 spawn(cmd)
335 os.remove(xmltemp)
336
337 # Then run swig for real
338 cmd = [ swig_cmd ] + swig_args + interface + \
339 ['-I'+dir, '-o', cpp_file, '-xmlout', xml_file, i_file]
340 msg(' '.join(cmd))
341 spawn(cmd)
342
343
344 # copy the generated python file to the package directory
345 copy_file(py_file, package, update=not force, verbose=0)
346 CLEANUP.append(opj(package, os.path.basename(py_file)))
347
348 return sources
349
350
351
352 # Specializations of some distutils command classes
353 class wx_smart_install_data(distutils.command.install_data.install_data):
354 """need to change self.install_dir to the actual library dir"""
355 def run(self):
356 install_cmd = self.get_finalized_command('install')
357 self.install_dir = getattr(install_cmd, 'install_lib')
358 return distutils.command.install_data.install_data.run(self)
359
360
361 class wx_extra_clean(distutils.command.clean.clean):
362 """
363 Also cleans stuff that this setup.py copies itself. If the
364 --all flag was used also searches for .pyc, .pyd, .so files
365 """
366 def run(self):
367 from distutils import log
368 from distutils.filelist import FileList
369 global CLEANUP
370
371 distutils.command.clean.clean.run(self)
372
373 if self.all:
374 fl = FileList()
375 fl.include_pattern("*.pyc", 0)
376 fl.include_pattern("*.pyd", 0)
377 fl.include_pattern("*.so", 0)
378 CLEANUP += fl.files
379
380 for f in CLEANUP:
381 if os.path.isdir(f):
382 try:
383 if not self.dry_run and os.path.exists(f):
384 os.rmdir(f)
385 log.info("removing '%s'", f)
386 except IOError:
387 log.warning("unable to remove '%s'", f)
388
389 else:
390 try:
391 if not self.dry_run and os.path.exists(f):
392 os.remove(f)
393 log.info("removing '%s'", f)
394 except IOError:
395 log.warning("unable to remove '%s'", f)
396
397
398
399 class wx_install_headers(distutils.command.install_headers.install_headers):
400 """
401 Install the header files to the WXPREFIX, with an extra dir per
402 filename too
403 """
404 def initialize_options (self):
405 self.root = None
406 distutils.command.install_headers.install_headers.initialize_options(self)
407
408 def finalize_options (self):
409 self.set_undefined_options('install', ('root', 'root'))
410 distutils.command.install_headers.install_headers.finalize_options(self)
411
412 def run(self):
413 if os.name == 'nt':
414 return
415 headers = self.distribution.headers
416 if not headers:
417 return
418
419 root = self.root
420 if root is None or WXPREFIX.startswith(root):
421 root = ''
422 for header, location in headers:
423 install_dir = os.path.normpath(root + WXPREFIX + location)
424 self.mkpath(install_dir)
425 (out, _) = self.copy_file(header, install_dir)
426 self.outfiles.append(out)
427
428
429
430
431 def build_locale_dir(destdir, verbose=1):
432 """Build a locale dir under the wxPython package for MSW"""
433 moFiles = glob.glob(opj(WXDIR, 'locale', '*.mo'))
434 for src in moFiles:
435 lang = os.path.splitext(os.path.basename(src))[0]
436 dest = opj(destdir, lang, 'LC_MESSAGES')
437 mkpath(dest, verbose=verbose)
438 copy_file(src, opj(dest, 'wxstd.mo'), update=1, verbose=verbose)
439 CLEANUP.append(opj(dest, 'wxstd.mo'))
440 CLEANUP.append(dest)
441
442
443 def build_locale_list(srcdir):
444 # get a list of all files under the srcdir, to be used for install_data
445 def walk_helper(lst, dirname, files):
446 for f in files:
447 filename = opj(dirname, f)
448 if not os.path.isdir(filename):
449 lst.append( (dirname, [filename]) )
450 file_list = []
451 os.path.walk(srcdir, walk_helper, file_list)
452 return file_list
453
454
455 def find_data_files(srcdir, *wildcards):
456 # get a list of all files under the srcdir matching wildcards,
457 # returned in a format to be used for install_data
458
459 def walk_helper(arg, dirname, files):
460 names = []
461 lst, wildcards = arg
462 for wc in wildcards:
463 for f in files:
464 filename = opj(dirname, f)
465 if fnmatch.fnmatch(filename, wc) and not os.path.isdir(filename):
466 names.append(filename)
467 if names:
468 lst.append( (dirname, names ) )
469
470 file_list = []
471 os.path.walk(srcdir, walk_helper, (file_list, wildcards))
472 return file_list
473
474
475 def makeLibName(name):
476 if os.name == 'posix':
477 libname = '%s_%s-%s' % (WXBASENAME, name, WXRELEASE)
478 else:
479 libname = 'wxmsw%s%s_%s' % (WXDLLVER, libFlag(), name)
480
481 return [libname]
482
483
484
485 def adjustCFLAGS(cflags, defines, includes):
486 '''Extrace the raw -I, -D, and -U flags and put them into
487 defines and includes as needed.'''
488 newCFLAGS = []
489 for flag in cflags:
490 if flag[:2] == '-I':
491 includes.append(flag[2:])
492 elif flag[:2] == '-D':
493 flag = flag[2:]
494 if flag.find('=') == -1:
495 defines.append( (flag, None) )
496 else:
497 defines.append( tuple(flag.split('=')) )
498 elif flag[:2] == '-U':
499 defines.append( (flag[2:], ) )
500 else:
501 newCFLAGS.append(flag)
502 return newCFLAGS
503
504
505
506 def adjustLFLAGS(lfags, libdirs, libs):
507 '''Extrace the -L and -l flags and put them in libdirs and libs as needed'''
508 newLFLAGS = []
509 for flag in lflags:
510 if flag[:2] == '-L':
511 libdirs.append(flag[2:])
512 elif flag[:2] == '-l':
513 libs.append(flag[2:])
514 else:
515 newLFLAGS.append(flag)
516
517 return newLFLAGS
518
519 #----------------------------------------------------------------------
520 # sanity checks
521
522 if CORE_ONLY:
523 BUILD_GLCANVAS = 0
524 BUILD_OGL = 0
525 BUILD_STC = 0
526 BUILD_XRC = 0
527 BUILD_GIZMOS = 0
528 BUILD_DLLWIDGET = 0
529 BUILD_IEWIN = 0
530 BUILD_ACTIVEX = 0
531
532 if debug:
533 FINAL = 0
534 HYBRID = 0
535
536 if FINAL:
537 HYBRID = 0
538
539 if UNICODE and WXPORT not in ['msw', 'gtk2']:
540 raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
541
542
543 if CONTRIBS_INC:
544 CONTRIBS_INC = [ CONTRIBS_INC ]
545 else:
546 CONTRIBS_INC = []
547
548
549 #----------------------------------------------------------------------
550 # Setup some platform specific stuff
551 #----------------------------------------------------------------------
552
553 if os.name == 'nt':
554 # Set compile flags and such for MSVC. These values are derived
555 # from the wxWidgets makefiles for MSVC, other compilers settings
556 # will probably vary...
557 if os.environ.has_key('WXWIN'):
558 WXDIR = os.environ['WXWIN']
559 else:
560 msg("WARNING: WXWIN not set in environment.")
561 WXDIR = '..' # assumes in CVS tree
562 WXPLAT = '__WXMSW__'
563 GENDIR = 'msw'
564
565 includes = ['include', 'src',
566 opj(WXDIR, 'lib', 'vc_dll', 'msw' + libFlag()),
567 opj(WXDIR, 'include'),
568 opj(WXDIR, 'contrib', 'include'),
569 ]
570
571 defines = [ ('WIN32', None),
572 ('_WINDOWS', None),
573
574 (WXPLAT, None),
575 ('WXUSINGDLL', '1'),
576
577 ('SWIG_GLOBAL', None),
578 ('WXP_USE_THREAD', '1'),
579 ]
580
581 if UNDEF_NDEBUG:
582 defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
583
584 if HYBRID:
585 defines.append( ('__NO_VC_CRTDBG__', None) )
586
587 if not FINAL or HYBRID:
588 defines.append( ('__WXDEBUG__', None) )
589
590 libdirs = [ opj(WXDIR, 'lib', 'vc_dll') ]
591 libs = [ 'wxbase' + WXDLLVER + libFlag(), # TODO: trim this down to what is really needed for the core
592 'wxbase' + WXDLLVER + libFlag() + '_net',
593 'wxbase' + WXDLLVER + libFlag() + '_xml',
594 makeLibName('core')[0],
595 makeLibName('adv')[0],
596 makeLibName('html')[0],
597 ]
598
599 libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32',
600 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
601 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
602 'advapi32', 'wsock32']
603
604
605 cflags = [ '/Gy',
606 # '/GX-' # workaround for internal compiler error in MSVC on some machines
607 ]
608 lflags = None
609
610 # Other MSVC flags...
611 # Too bad I don't remember why I was playing with these, can they be removed?
612 if FINAL:
613 pass #cflags = cflags + ['/O1']
614 elif HYBRID :
615 pass #cflags = cflags + ['/Ox']
616 else:
617 pass # cflags = cflags + ['/Od', '/Z7']
618 # lflags = ['/DEBUG', ]
619
620
621
622 #----------------------------------------------------------------------
623
624 elif os.name == 'posix':
625 WXDIR = '..'
626 includes = ['include', 'src']
627 defines = [('SWIG_GLOBAL', None),
628 ('HAVE_CONFIG_H', None),
629 ('WXP_USE_THREAD', '1'),
630 ]
631 if UNDEF_NDEBUG:
632 defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
633
634 Verify_WX_CONFIG()
635
636 libdirs = []
637 libs = []
638
639 # If you get unresolved symbol errors on Solaris and are using gcc, then
640 # uncomment this block to add the right flags to the link step and build
641 # again.
642 ## if os.uname()[0] == 'SunOS':
643 ## libs.append('gcc')
644 ## libdirs.append(commands.getoutput("gcc -print-search-dirs | grep '^install' | awk '{print $2}'")[:-1])
645
646 cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
647 cflags = cflags.split()
648 if debug:
649 cflags.append('-g')
650 cflags.append('-O0')
651 else:
652 cflags.append('-O3')
653
654 lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
655 lflags = lflags.split()
656
657 WXBASENAME = os.popen(WX_CONFIG + ' --basename').read()[:-1]
658 WXRELEASE = os.popen(WX_CONFIG + ' --release').read()[:-1]
659 WXPREFIX = os.popen(WX_CONFIG + ' --prefix').read()[:-1]
660
661
662 if sys.platform[:6] == "darwin":
663 # Flags and such for a Darwin (Max OS X) build of Python
664 WXPLAT = '__WXMAC__'
665 GENDIR = 'mac'
666 libs = ['stdc++']
667 NO_SCRIPTS = 1
668
669
670 else:
671 # Set flags for other Unix type platforms
672 GENDIR = WXPORT
673
674 if WXPORT == 'gtk':
675 WXPLAT = '__WXGTK__'
676 portcfg = os.popen('gtk-config --cflags', 'r').read()[:-1]
677 elif WXPORT == 'gtk2':
678 WXPLAT = '__WXGTK__'
679 GENDIR = 'gtk' # no code differences so use the same generated sources
680 portcfg = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
681 BUILD_BASE = BUILD_BASE + '-' + WXPORT
682 elif WXPORT == 'x11':
683 WXPLAT = '__WXX11__'
684 portcfg = ''
685 BUILD_BASE = BUILD_BASE + '-' + WXPORT
686 else:
687 raise SystemExit, "Unknown WXPORT value: " + WXPORT
688
689 cflags += portcfg.split()
690
691 # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
692 # wx-config doesn't output that for some reason. For now, just
693 # add it unconditionally but we should really check if the lib is
694 # really found there or wx-config should be fixed.
695 libdirs.append("/usr/X11R6/lib")
696
697
698 # Move the various -I, -D, etc. flags we got from the *config scripts
699 # into the distutils lists.
700 cflags = adjustCFLAGS(cflags, defines, includes)
701 lflags = adjustLFLAGS(lflags, libdirs, libs)
702
703
704 #----------------------------------------------------------------------
705 else:
706 raise 'Sorry, platform not supported...'
707
708
709 #----------------------------------------------------------------------
710 # post platform setup checks and tweaks, create the full version string
711 #----------------------------------------------------------------------
712
713 if UNICODE:
714 BUILD_BASE = BUILD_BASE + '.unicode'
715 VER_FLAGS += 'u'
716
717
718 VERSION = "%s.%s.%s.%s%s" % (VER_MAJOR, VER_MINOR, VER_RELEASE,
719 VER_SUBREL, VER_FLAGS)
720
721
722 #----------------------------------------------------------------------
723 # SWIG defaults
724 #----------------------------------------------------------------------
725
726 swig_cmd = SWIG
727 swig_force = force
728 swig_args = ['-c++',
729 '-Wall',
730 '-nodefault',
731
732 '-python',
733 '-keyword',
734 '-new_repr',
735 '-modern',
736
737 '-I./src',
738 '-D'+WXPLAT,
739 '-noruntime'
740 ]
741 if UNICODE:
742 swig_args.append('-DwxUSE_UNICODE')
743
744 swig_deps = [ 'src/my_typemaps.i',
745 'src/common.swg',
746 'src/pyrun.swg',
747 ]
748
749 depends = [ #'include/wx/wxPython/wxPython.h',
750 #'include/wx/wxPython/wxPython_int.h',
751 #'src/pyclasses.h',
752 ]
753
754 #----------------------------------------------------------------------