]> git.saurik.com Git - wxWidgets.git/blob - wxPython/config.py
A way to make the DC classes in wxPython look like the ones in 2.5, so
[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 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, swig_deps=[]):
278 """Run SWIG the way I want it done"""
279
280 if USE_SWIG and not os.path.exists(os.path.join(dir, gendir)):
281 os.mkdir(os.path.join(dir, gendir))
282
283 if USE_SWIG and not os.path.exists(os.path.join("docs", "xml-raw")):
284 os.mkdir(os.path.join("docs", "xml-raw"))
285
286 sources = []
287
288 for file in files:
289 basefile = os.path.splitext(file)[0]
290 i_file = os.path.join(dir, file)
291 py_file = os.path.join(dir, gendir, basefile+'.py')
292 cpp_file = os.path.join(dir, gendir, basefile+'_wrap.cpp')
293 xml_file = os.path.join("docs", "xml-raw", basefile+'_swig.xml')
294
295 sources.append(cpp_file)
296
297 if not cleaning and USE_SWIG:
298 for dep in swig_deps:
299 if newer(dep, py_file) or newer(dep, cpp_file):
300 force = 1
301 break
302
303 if force or newer(i_file, py_file) or newer(i_file, cpp_file):
304 ## we need forward slashes here even on win32
305 #cpp_file = opj(cpp_file) #'/'.join(cpp_file.split('\\'))
306 #i_file = opj(i_file) #'/'.join(i_file.split('\\'))
307
308 if BUILD_RENAMERS:
309 #tempfile.tempdir = sourcePath
310 xmltemp = tempfile.mktemp('.xml')
311
312 # First run swig to produce the XML file, adding
313 # an extra -D that prevents the old rename
314 # directives from being used
315 cmd = [ swig_cmd ] + swig_args + \
316 [ '-DBUILDING_RENAMERS', '-xmlout', xmltemp ] + \
317 ['-I'+dir, '-o', cpp_file, i_file]
318 msg(' '.join(cmd))
319 spawn(cmd)
320
321 # Next run build_renamers to process the XML
322 cmd = [ sys.executable, '-u',
323 './distrib/build_renamers.py', dir, basefile, xmltemp]
324 msg(' '.join(cmd))
325 spawn(cmd)
326 os.remove(xmltemp)
327
328 # Then run swig for real
329 cmd = [ swig_cmd ] + swig_args + ['-I'+dir, '-o', cpp_file,
330 '-xmlout', xml_file, i_file]
331 msg(' '.join(cmd))
332 spawn(cmd)
333
334
335 # copy the generated python file to the package directory
336 copy_file(py_file, package, update=not force, verbose=0)
337 CLEANUP.append(opj(package, os.path.basename(py_file)))
338
339 return sources
340
341
342
343 # Specializations of some distutils command classes
344 class wx_smart_install_data(distutils.command.install_data.install_data):
345 """need to change self.install_dir to the actual library dir"""
346 def run(self):
347 install_cmd = self.get_finalized_command('install')
348 self.install_dir = getattr(install_cmd, 'install_lib')
349 return distutils.command.install_data.install_data.run(self)
350
351
352 class wx_extra_clean(distutils.command.clean.clean):
353 """
354 Also cleans stuff that this setup.py copies itself. If the
355 --all flag was used also searches for .pyc, .pyd, .so files
356 """
357 def run(self):
358 from distutils import log
359 from distutils.filelist import FileList
360 global CLEANUP
361
362 distutils.command.clean.clean.run(self)
363
364 if self.all:
365 fl = FileList()
366 fl.include_pattern("*.pyc", 0)
367 fl.include_pattern("*.pyd", 0)
368 fl.include_pattern("*.so", 0)
369 CLEANUP += fl.files
370
371 for f in CLEANUP:
372 if os.path.isdir(f):
373 try:
374 if not self.dry_run and os.path.exists(f):
375 os.rmdir(f)
376 log.info("removing '%s'", f)
377 except IOError:
378 log.warning("unable to remove '%s'", f)
379
380 else:
381 try:
382 if not self.dry_run and os.path.exists(f):
383 os.remove(f)
384 log.info("removing '%s'", f)
385 except IOError:
386 log.warning("unable to remove '%s'", f)
387
388
389
390 class wx_install_headers(distutils.command.install_headers.install_headers):
391 """
392 Install the header files to the WXPREFIX, with an extra dir per
393 filename too
394 """
395 def initialize_options (self):
396 self.root = None
397 distutils.command.install_headers.install_headers.initialize_options(self)
398
399 def finalize_options (self):
400 self.set_undefined_options('install', ('root', 'root'))
401 distutils.command.install_headers.install_headers.finalize_options(self)
402
403 def run(self):
404 if os.name == 'nt':
405 return
406 headers = self.distribution.headers
407 if not headers:
408 return
409
410 root = self.root
411 if root is None or WXPREFIX.startswith(root):
412 root = ''
413 for header, location in headers:
414 install_dir = os.path.normpath(root + WXPREFIX + location)
415 self.mkpath(install_dir)
416 (out, _) = self.copy_file(header, install_dir)
417 self.outfiles.append(out)
418
419
420
421
422 def build_locale_dir(destdir, verbose=1):
423 """Build a locale dir under the wxPython package for MSW"""
424 moFiles = glob.glob(opj(WXDIR, 'locale', '*.mo'))
425 for src in moFiles:
426 lang = os.path.splitext(os.path.basename(src))[0]
427 dest = opj(destdir, lang, 'LC_MESSAGES')
428 mkpath(dest, verbose=verbose)
429 copy_file(src, opj(dest, 'wxstd.mo'), update=1, verbose=verbose)
430 CLEANUP.append(opj(dest, 'wxstd.mo'))
431 CLEANUP.append(dest)
432
433
434 def build_locale_list(srcdir):
435 # get a list of all files under the srcdir, to be used for install_data
436 def walk_helper(lst, dirname, files):
437 for f in files:
438 filename = opj(dirname, f)
439 if not os.path.isdir(filename):
440 lst.append( (dirname, [filename]) )
441 file_list = []
442 os.path.walk(srcdir, walk_helper, file_list)
443 return file_list
444
445
446 def find_data_files(srcdir, *wildcards):
447 # get a list of all files under the srcdir matching wildcards,
448 # returned in a format to be used for install_data
449
450 def walk_helper(arg, dirname, files):
451 names = []
452 lst, wildcards = arg
453 for wc in wildcards:
454 for f in files:
455 filename = opj(dirname, f)
456 if fnmatch.fnmatch(filename, wc) and not os.path.isdir(filename):
457 names.append(filename)
458 if names:
459 lst.append( (dirname, names ) )
460
461 file_list = []
462 os.path.walk(srcdir, walk_helper, (file_list, wildcards))
463 return file_list
464
465
466 def makeLibName(name):
467 if os.name == 'posix':
468 libname = '%s_%s-%s' % (WXBASENAME, name, WXRELEASE)
469 else:
470 libname = 'wxmsw%s%s_%s' % (WXDLLVER, libFlag(), name)
471
472 return [libname]
473
474
475
476 def adjustCFLAGS(cflags, defines, includes):
477 '''Extrace the raw -I, -D, and -U flags and put them into
478 defines and includes as needed.'''
479 newCFLAGS = []
480 for flag in cflags:
481 if flag[:2] == '-I':
482 includes.append(flag[2:])
483 elif flag[:2] == '-D':
484 flag = flag[2:]
485 if flag.find('=') == -1:
486 defines.append( (flag, None) )
487 else:
488 defines.append( tuple(flag.split('=')) )
489 elif flag[:2] == '-U':
490 defines.append( (flag[2:], ) )
491 else:
492 newCFLAGS.append(flag)
493 return newCFLAGS
494
495
496
497 def adjustLFLAGS(lfags, libdirs, libs):
498 '''Extrace the -L and -l flags and put them in libdirs and libs as needed'''
499 newLFLAGS = []
500 for flag in lflags:
501 if flag[:2] == '-L':
502 libdirs.append(flag[2:])
503 elif flag[:2] == '-l':
504 libs.append(flag[2:])
505 else:
506 newLFLAGS.append(flag)
507
508 return newLFLAGS
509
510 #----------------------------------------------------------------------
511 # sanity checks
512
513 if CORE_ONLY:
514 BUILD_GLCANVAS = 0
515 BUILD_OGL = 0
516 BUILD_STC = 0
517 BUILD_XRC = 0
518 BUILD_GIZMOS = 0
519 BUILD_DLLWIDGET = 0
520 BUILD_IEWIN = 0
521 BUILD_ACTIVEX = 0
522
523 if debug:
524 FINAL = 0
525 HYBRID = 0
526
527 if FINAL:
528 HYBRID = 0
529
530 if UNICODE and WXPORT not in ['msw', 'gtk2']:
531 raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
532
533
534 if CONTRIBS_INC:
535 CONTRIBS_INC = [ CONTRIBS_INC ]
536 else:
537 CONTRIBS_INC = []
538
539
540 #----------------------------------------------------------------------
541 # Setup some platform specific stuff
542 #----------------------------------------------------------------------
543
544 if os.name == 'nt':
545 # Set compile flags and such for MSVC. These values are derived
546 # from the wxWidgets makefiles for MSVC, other compilers settings
547 # will probably vary...
548 if os.environ.has_key('WXWIN'):
549 WXDIR = os.environ['WXWIN']
550 else:
551 msg("WARNING: WXWIN not set in environment.")
552 WXDIR = '..' # assumes in CVS tree
553 WXPLAT = '__WXMSW__'
554 GENDIR = 'msw'
555
556 includes = ['include', 'src',
557 opj(WXDIR, 'lib', 'vc_dll', 'msw' + libFlag()),
558 opj(WXDIR, 'include'),
559 opj(WXDIR, 'contrib', 'include'),
560 ]
561
562 defines = [ ('WIN32', None),
563 ('_WINDOWS', None),
564
565 (WXPLAT, None),
566 ('WXUSINGDLL', '1'),
567
568 ('SWIG_GLOBAL', None),
569 ('WXP_USE_THREAD', '1'),
570 ]
571
572 if UNDEF_NDEBUG:
573 defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
574
575 if HYBRID:
576 defines.append( ('__NO_VC_CRTDBG__', None) )
577
578 if not FINAL or HYBRID:
579 defines.append( ('__WXDEBUG__', None) )
580
581 libdirs = [ opj(WXDIR, 'lib', 'vc_dll') ]
582 libs = [ 'wxbase' + WXDLLVER + libFlag(), # TODO: trim this down to what is really needed for the core
583 'wxbase' + WXDLLVER + libFlag() + '_net',
584 'wxbase' + WXDLLVER + libFlag() + '_xml',
585 makeLibName('core')[0],
586 makeLibName('adv')[0],
587 makeLibName('html')[0],
588 ]
589
590 libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32',
591 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
592 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
593 'advapi32', 'wsock32']
594
595
596 cflags = [ '/Gy',
597 # '/GX-' # workaround for internal compiler error in MSVC on some machines
598 ]
599 lflags = None
600
601 # Other MSVC flags...
602 # Too bad I don't remember why I was playing with these, can they be removed?
603 if FINAL:
604 pass #cflags = cflags + ['/O1']
605 elif HYBRID :
606 pass #cflags = cflags + ['/Ox']
607 else:
608 pass # cflags = cflags + ['/Od', '/Z7']
609 # lflags = ['/DEBUG', ]
610
611
612
613 #----------------------------------------------------------------------
614
615 elif os.name == 'posix':
616 WXDIR = '..'
617 includes = ['include', 'src']
618 defines = [('SWIG_GLOBAL', None),
619 ('HAVE_CONFIG_H', None),
620 ('WXP_USE_THREAD', '1'),
621 ]
622 if UNDEF_NDEBUG:
623 defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
624
625 Verify_WX_CONFIG()
626
627 libdirs = []
628 libs = []
629
630 # If you get unresolved symbol errors on Solaris and are using gcc, then
631 # uncomment this block to add the right flags to the link step and build
632 # again.
633 ## if os.uname()[0] == 'SunOS':
634 ## libs.append('gcc')
635 ## libdirs.append(commands.getoutput("gcc -print-search-dirs | grep '^install' | awk '{print $2}'")[:-1])
636
637 cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
638 cflags = cflags.split()
639 if debug:
640 cflags.append('-g')
641 cflags.append('-O0')
642 else:
643 cflags.append('-O3')
644
645 lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
646 lflags = lflags.split()
647
648 WXBASENAME = os.popen(WX_CONFIG + ' --basename').read()[:-1]
649 WXRELEASE = os.popen(WX_CONFIG + ' --release').read()[:-1]
650 WXPREFIX = os.popen(WX_CONFIG + ' --prefix').read()[:-1]
651
652
653 if sys.platform[:6] == "darwin":
654 # Flags and such for a Darwin (Max OS X) build of Python
655 WXPLAT = '__WXMAC__'
656 GENDIR = 'mac'
657 libs = ['stdc++']
658 NO_SCRIPTS = 1
659
660
661 else:
662 # Set flags for other Unix type platforms
663 GENDIR = WXPORT
664
665 if WXPORT == 'gtk':
666 WXPLAT = '__WXGTK__'
667 portcfg = os.popen('gtk-config --cflags', 'r').read()[:-1]
668 elif WXPORT == 'gtk2':
669 WXPLAT = '__WXGTK__'
670 GENDIR = 'gtk' # no code differences so use the same generated sources
671 portcfg = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
672 BUILD_BASE = BUILD_BASE + '-' + WXPORT
673 elif WXPORT == 'x11':
674 WXPLAT = '__WXX11__'
675 portcfg = ''
676 BUILD_BASE = BUILD_BASE + '-' + WXPORT
677 else:
678 raise SystemExit, "Unknown WXPORT value: " + WXPORT
679
680 cflags += portcfg.split()
681
682 # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
683 # wx-config doesn't output that for some reason. For now, just
684 # add it unconditionally but we should really check if the lib is
685 # really found there or wx-config should be fixed.
686 libdirs.append("/usr/X11R6/lib")
687
688
689 # Move the various -I, -D, etc. flags we got from the *config scripts
690 # into the distutils lists.
691 cflags = adjustCFLAGS(cflags, defines, includes)
692 lflags = adjustLFLAGS(lflags, libdirs, libs)
693
694
695 #----------------------------------------------------------------------
696 else:
697 raise 'Sorry, platform not supported...'
698
699
700 #----------------------------------------------------------------------
701 # post platform setup checks and tweaks, create the full version string
702 #----------------------------------------------------------------------
703
704 if UNICODE:
705 BUILD_BASE = BUILD_BASE + '.unicode'
706 VER_FLAGS += 'u'
707
708
709 VERSION = "%s.%s.%s.%s%s" % (VER_MAJOR, VER_MINOR, VER_RELEASE,
710 VER_SUBREL, VER_FLAGS)
711
712
713 #----------------------------------------------------------------------
714 # SWIG defaults
715 #----------------------------------------------------------------------
716
717 swig_cmd = SWIG
718 swig_force = force
719 swig_args = ['-c++',
720 '-Wall',
721 '-nodefault',
722
723 '-python',
724 '-keyword',
725 '-new_repr',
726 '-modern',
727
728 '-I./src',
729 '-D'+WXPLAT,
730 '-noruntime'
731 ]
732 if UNICODE:
733 swig_args.append('-DwxUSE_UNICODE')
734
735 swig_deps = [ 'src/my_typemaps.i',
736 'src/common.swg',
737 'src/pyrun.swg',
738 ]
739
740 depends = [ #'include/wx/wxPython/wxPython.h',
741 #'include/wx/wxPython/wxPython_int.h',
742 #'src/pyclasses.h',
743 ]
744
745 #----------------------------------------------------------------------