From: Robin Dunn Date: Tue, 24 Aug 1999 07:46:54 +0000 (+0000) Subject: New build system for wxPython. (Still needs some polish but is stable X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5148fc8e358a2e0ae5c655b32d5d64c2cfad525e?hp=a8e3377c030428628a503807026d0b7bcf46585b New build system for wxPython. (Still needs some polish but is stable for me. Will be doing more testing tomorrow on other platforms and then will remove the old wxPython build stuff...) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3456 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/wxPython/README.txt b/utils/wxPython/README.txt index 8c6c4919f8..ee7ec93126 100644 --- a/utils/wxPython/README.txt +++ b/utils/wxPython/README.txt @@ -53,6 +53,10 @@ for some of the new features and such. Also they have encorporated my patches so there is really no reason to stick with the current (very old) release... +New build system based on a Python program. Now wxPython builds are +the same on MSW or Unix systems. See distrib/build.py for details. + + What's new in 2.1b2 @@ -306,86 +310,76 @@ me. You don't need SWIG to build the extension module as all the generated C++ code is included under the src directory. I added a few minor features to SWIG to control some of the code -generation. If you want to playaround with this the patches are in -wxPython/SWIG.patches and they should be applied to the 1.1p5 version -of SWIG. These new patches are documented at -http://starship.skyport.net/crew/robind/#swig, and they should also -end up in the 1.2 version of SWIG. +generation. If you want to play around with this you will need to get +a recent version of SWIG from their CVS or from a daily build. See +http://www.swig.org/ for details. wxPython is organized as a Python package. This means that the directory containing the results of the build process should be a subdirectory of a directory on the PYTHONPATH. (And preferably should be named wxPython.) You can control where the build process will dump -wxPython by setting the TARGETDIR makefile variable. The default is -$(WXWIN)/utils/wxPython, where this README.txt is located. If you -leave it here then you should add $(WXWIN)/utils to your PYTHONPATH. -However, you may prefer to use something that is already on your -PYTHONPATH, such as the site-packages directory on Unix systems. - - -Win32 ------ - -1. Build wxWindows with wxUSE_RESOURCE_LOADING_IN_MSW set to 1 in -include/wx/msw/setup.h so icons can be loaded dynamically. While -there, make sure wxUSE_OWNER_DRAWN is also set to 1. +wxPython by setting the TARGETDIR variable for the build utility, (see +below.) -2. Change into the $(WXWIN)/utils/wxPython/src directory. -3. Edit makefile.vc and specify where your python installation is at. -You may also want to fiddle with the TARGETDIR variable as described -above. +1. Build wxWindows as described in its BuildCVS.txt file. For *nix + systems I run configure with these flags: -4. Run nmake -f makefile.vc + --with-gtk + --with-libjpeg + --without-odbc + --enable-unicode=no + --enable-threads=yes + --enable-socket=yes + --enable-static=no + --enable-shared=yes + --disable-std_iostreams -5. If it builds successfully, congratulations! Move on to the next -step. If not then you can try mailing me for help. Also, I will -always have a pre-built win32 version of this extension module at -http://alldunn.com/wxPython/. + You can use whatever flags you want, but I know these work. -6. Change to the $(WXWIN)/utils/wxPython/demo directory. +2. At this point you may want to make an alias or symlink, script, + batch file, whatever on the PATH that invokes + $(WXWIN)/utils/wxPython/distrib/build.py to help simplify matters + somewhat. For example, on my win32 system I have a file named + build.bat in a directory on the PATH that contains: -7. Try executing the demo program. For example: + python $(WXWIN)/utils/wxPython/distrib/build.py %1 %2 %3 %4 %5 %6 - python demo.py -To run it without requiring a console, you can use the pythonw.exe -version of Python either from the command line or from a shortcut. +3. Change into the $(WXWIN)/utils/wxPython/src directory. +4. Type "build -b" to build wxPython and "build -i" to install it. + The build.py script actually generates a Makefile based on what it + finds on your system and information found in the build.cfg file. + If you have troubles building or you want it built or installed in + a different way, take a look at the docstring in build.py, you may + be able to override configuration options in a file named + build.local. -Unix ----- -0. I configure wxWindows like this, YMMV: +5. To build and install the add-on modules, change to the appropriate + directory under $(WXWIN)/utils/wxPython/modules and run the build + utility again. -./configure --with-gtk --disable-shared --enable-threads --disable-unicode - -1. Change into the $(WXWIN)/utils/wxPython/src directory. +6. Change to the $(WXWIN)/utils/wxPython/demo directory. -2. Edit Setup.in and ensure that the flags, directories, and toolkit -options are correct. See the above commentary about TARGETDIR. There -are a few sample Setup.in.[platform] files provided. +7. Try executing the demo program. For example: -3. Run this command to generate a makefile: + python demo.py - make -f Makefile.pre.in boot +To run it without requiring a console on win32, you can use the +pythonw.exe version of Python either from the command line or from a +shortcut. -4. Run these commands to build and then install the wxPython extension -module: - make - make install +---------------- +Robin Dunn +robin@alldunn.com -5. Change to the $(WXWIN)/utils/wxPython/demo directory. -6. Try executing the demo program. For example: - python demo.py ----------------- -Robin Dunn -robin@alldunn.com diff --git a/utils/wxPython/distrib/.cvsignore b/utils/wxPython/distrib/.cvsignore index 21d5fb12cc..ac95d78017 100644 --- a/utils/wxPython/distrib/.cvsignore +++ b/utils/wxPython/distrib/.cvsignore @@ -1,6 +1,7 @@ *.gz *.rpm *.zip +build.pyc filelist wxPython.spec wxp2.wse diff --git a/utils/wxPython/distrib/build.py b/utils/wxPython/distrib/build.py new file mode 100755 index 0000000000..1f2fd6b8e7 --- /dev/null +++ b/utils/wxPython/distrib/build.py @@ -0,0 +1,721 @@ +#!/usr/bin/env python +#---------------------------------------------------------------------------- +# Name: build.py +# Purpose: This script is used to build wxPython. It reads a build +# configuration file in the requested project directory and +# based on the contents of the file can build Makefiles for +# unix or win32, and can execute make with various options +# potentially automating the entire build/install/clean process +# from a single command. +# +# Author: Robin Dunn +# +# Created: 18-Aug-1999 +# RCS-ID: $Id$ +# Copyright: (c) 1999 by Total Control Software +# Licence: wxWindows license +#---------------------------------------------------------------------------- +""" +build.py + + This script is used to build wxPython. It reads a build configuration + file in the requested project directory and based on the contents of + the file can build Makefiles for unix or win32, and can execute make + with various options potentially automating the entire + build/install/clean process from a single command. + + The default action is to build the Makefile and exit. + +Options + -C dir CD to dir before doing anything + -B file Use file as the build configuration (default ./build.cfg) + -M file Use file as the name of the makefile to create + (default Makefile) + + -b Build the module (runs make) + -i Install the module (runs make install) + -c Cleanup (runs make clean) + -u Uninstall (runs make uninstall) + + -h Show help and exit + + +Configuration Files + + The build configuration file lists targets, source files and options + for the the build process. The contents of the build.cfg are used to + dynamically generate the Makefile. + + To prevent you from getting screwed when the default build.cfg is + updated, you can override the values in build.cfg by putting your + custom definitions in a file named build.local. You can also place a + build.local file in the parent directory, or even in the grandparent + directory for project-wide overrides. Finally, command-line arguments + of the form NAME=VALUE can also be used to override simple configuration + values. The order of evaluation is: + + 0. comman-line flags (-M, -b, etc.) + 1. ./build.cfg + 2. ../../build.local (if present) + 3. ../build.local (if present) + 4. ./build.local (if present) + 5. command-line NAME=VALUEs + + The config files are actually just Python files that get exec'ed in a + separate namespace which is then used later as a configuration object. + This keeps the build script simple in that it doesn't have to parse + anything, and the config files can be much more than just names and + values as any pretty much any python code can be executed. The global + variables set in the config namespace are what are used later as + configuation values. + + +Configuration Options + + The following variables can be set in the config files. Only a few are + required, the rest will either have suitable defaults or will be + calculated from your current Python runtime environment. + + MODULE The name of the extension module to produce + SWIGFILES A list of files that should be run through SWIG + SWIGFLAGS Flags for SWIG + SOURCES Other C/C++ sources that should be part of the module + PYFILES Other Python files that should be installed with the module + CFLAGS Flags to be used by the compiler + LFLAGS Flags to be used at the link step + LIBS Libraries to be linked with + + OTHERCFLAGS Extra flags to append to CFLAGS + OTHERLFLAGS Extra flags to append to LFLAGS + OTHERSWIGFLAGS Extra flags to append to SWIGFLAGS + OTHERLIBS Other libraries to be linked with, in addition to LIBS + OTHERTARGETS Other targets to be placed on the default rule line + OTHERINSTALLTARGETS + Other targets to be placed on the install rule line + OTHERRULES This text is placed at the end of the makefile and + will typically be used for adding rules and such + DEFAULTRULE Text to be used for the default rule in the makefile + + TARGETDIR Destination for the install step + + MAKE The make program to use + MAKEFILE The name of the makefile + + runBuild Setting this to 1 is eqivalent to the -b flag + runInstall Setting this to 1 is eqivalent to the -i flag + runClean Setting this to 1 is eqivalent to the -c flag + runUninstall Setting this to 1 is eqivalent to the -u flag + + PYVERSION Version number of Python used in pathnames + PYPREFIX The root of the Python install + EXECPREFIX The root of the Python install for binary files + PYTHONLIB The Python link library + +""" + +import sys, os, string, getopt + +#---------------------------------------------------------------------------- +# This is really the wxPython version number, and will be placed in the +# Makefiles for use with the distribution related targets. + +__version__ = '2.1b3' + +#---------------------------------------------------------------------------- + +def main(args): + try: + opts, args = getopt.getopt(args[1:], 'C:B:M:bicu') + except getopt.error: + usage() + sys.exit(1) + + if not os.environ.has_key('WXWIN'): + print "WARNING: WXWIN is not set in the environment. WXDIR may not\n"\ + " be set properly in the makefile, you will have to \n"\ + " set the environment variable or override in build.local." + + bldCfg = 'build.cfg' + bldCfgLocal = 'build.local' + MAKEFILE = 'Makefile' + runBuild = 0 + runInstall = 0 + runClean = 0 + runUninstall = 0 + + for flag, value in opts: + if flag == '-C': os.chdir(value) + elif flag == '-B': bldCfgFile = value + elif flag == '-M': makefile = value + elif flag == '-b': runBuild = 1 + elif flag == '-c': runClean = 1 + elif flag == '-i': runInstall = 1 + elif flag == '-u': runUninstall = 1 + + elif flag == '-h': usage(); sys.exit(1) + else: usage(); sys.exit(1) + + config = BuildConfig(bldCfg = bldCfg, + bldCfgLocal = bldCfgLocal, + MAKEFILE = MAKEFILE, + runBuild = runBuild, + runInstall = runInstall, + runClean = runClean, + runUninstall = runUninstall) + + if config.readConfigFiles(args): + config.makeMakefile() + err = 0 + + if config.runBuild: + cmd = "%s -f %s" % (config.MAKE, config.MAKEFILE) + print "Running:", cmd + err = os.system(cmd) + + if not err and config.runInstall: + cmd = "%s -f %s install" % (config.MAKE, config.MAKEFILE) + print "Running:", cmd + err = os.system(cmd) + + + if not err and config.runClean: + cmd = "%s -f %s clean" % (config.MAKE, config.MAKEFILE) + print "Running:", cmd + err = os.system(cmd) + + if not err and config.runUninstall: + cmd = "%s -f %s uninstall" % (config.MAKE, config.MAKEFILE) + print "Running:", cmd + err = os.system(cmd) + + + +#---------------------------------------------------------------------------- + +def usage(): + print __doc__ + +#---------------------------------------------------------------------------- + +def swapslash(st): + if sys.platform != 'win32': + st = string.join(string.split(st, '\\'), '/') + return st + +#---------------------------------------------------------------------------- + +def splitlines(st): + return string.join(string.split(string.strip(st), ' '), ' \\\n\t') + +#---------------------------------------------------------------------------- + +class BuildConfig: + def __init__(self, **kw): + self.__dict__.update(kw) + self.setDefaults() + + #------------------------------------------------------------ + def setDefaults(self): + self.VERSION = __version__ + self.MODULE = '' + self.SWIGFILES = [] + self.SWIGFLAGS = '-c++ -shadow -python -dnone -I$(WXPSRCDIR)' + self.SOURCES = [] + self.PYFILES = [] + self.LFLAGS = '' + self.OTHERCFLAGS = '' + self.OTHERLFLAGS = '' + self.OTHERSWIGFLAGS = '' + self.OTHERLIBS = '' + self.OTHERTARGETS = '' + self.OTHERINSTALLTARGETS = '' + self.OTHERRULES = '' + self.DEFAULTRULE = 'default: $(GENCODEDIR) $(TARGET)' + self.PYVERSION = sys.version[:3] + self.PYPREFIX = sys.prefix + self.EXECPREFIX = sys.exec_prefix + self.WXDIR = '$(WXWIN)' + self.FINAL = '0' + self.WXP_USE_THREAD = '1' + self.WXUSINGDLL = '1' + self.OTHERDEP = '' + self.WXPSRCDIR = '$(WXDIR)/utils/wxPython/src' + + + if sys.platform == 'win32': + self.MAKE = 'nmake' + self.PYTHONLIB = '$(PYPREFIX)\\libs\\python15.lib' + self.TARGETDIR = '$(PYPREFIX)\\wxPython' + self.LIBS = '$(PYTHONLIB) $(WXPSRCDIR)\wxc.lib' + self.GENCODEDIR = 'msw' + self.SWIGTOOLKITFLAG = '-D__WXMSW__' + self.OBJEXT = '.obj' + self.TARGET = '$(MODULE).pyd' + self.CFLAGS = '-I$(PYPREFIX)\include -I$(WXPSRCDIR) -I. /Fp$(MODULE).pch /YXhelpers.h -DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) ' + self.LFLAGS = '$(DEBUGLFLAGS) /DLL /subsystem:windows,3.50 /machine:I386 /nologo' + self.RESFILE = '' + self.RESRULE = '' + self.OVERRIDEFLAGS = '/GX-' + + else: + self.MAKE = 'make' + self.PYLIB = '$(EXECPREFIX)/lib/python$(PYVERSION)' + self.LIBPL = '$(PYLIB)/config' + self.PYTHONLIB = '$(LIBPL)/libpython$(PYVERSION).a' + self.TARGETDIR = '$(EXECPREFIX)/lib/python$(PYVERSION)/site-packages/wxPython' + self.TARGET = '$(MODULE)module$(SO)' + self.OBJEXT = '.o' + self.HELPERLIB = 'wxPyHelpers' + self.HELPERLIBDIR = '/usr/local/lib' + self.CFLAGS = '-DSWIG_GLOBAL -DHAVE_CONFIG_H $(THREAD) -I. '\ + '`wx-config --cflags` -I$(PYINCLUDE) -I$(EXECINCLUDE) '\ + '-I$(WXPSRCDIR)' + self.LFLAGS = '-L$(WXPSRCDIR) `wx-config --libs`' + self.LIBS = '-l$(HELPERLIB)' + + # **** what to do when I start supporting Motif, etc.??? + self.GENCODEDIR = 'gtk' + self.SWIGTOOLKITFLAG = '-D__WXGTK__' + + # Extract a few things from Python's Makefile... + try: + filename = os.path.join(self.EXECPREFIX, + 'lib/python'+self.PYVERSION, + 'config/Makefile') + mfText = string.split(open(filename, 'r').read(), '\n') + except IOError: + raise SystemExit, "Python development files not found" + + self.CCC = self.findMFValue(mfText, 'CCC') + self.CC = self.findMFValue(mfText, 'CC') + self.OPT = self.findMFValue(mfText, 'OPT') + self.SO = self.findMFValue(mfText, 'SO') + self.LDSHARED = self.findMFValue(mfText, 'LDSHARED') + self.CCSHARED = self.findMFValue(mfText, 'CCSHARED') + #self.LINKFORSHARED = self.findMFValue(mfText, 'LINKFORSHARED') + #self. = self.findMFValue(mfText, '') + #self. = self.findMFValue(mfText, '') + + + # The majority of cases will require LDSHARED to be + # modified to use the C++ driver instead of the C driver + # for linking. We'll try to do it here and if we goof up + # then the user can correct it in their build.local file. + self.LDSHARED = string.join(['$(CCC)'] + + string.split(self.LDSHARED, ' ')[1:], + ' ') + + + #------------------------------------------------------------ + def findMFValue(self, mfText, st): + # Find line begining with st= and return the value + # Regex would probably be to cooler way to do this, but + # I think this is the most understandable. + for line in mfText: + if string.find(line, st+'=') == 0: + st = string.strip(line[len(st)+1:]) + return st + return None + + #------------------------------------------------------------ + def makeMakefile(self): + + # make a list of object file names + objects = "" + for name in self.SWIGFILES: + objects = objects + os.path.splitext(name)[0] + self.OBJEXT + ' ' + for name in self.SOURCES: + objects = objects + os.path.splitext(name)[0] + self.OBJEXT + ' ' + self.OBJECTS = splitlines(objects) + + + # now build the text for the dependencies + depends = "" + for name in self.SWIGFILES: + text = '$(GENCODEDIR)/%s.cpp $(GENCODEDIR)/%s.py : %s.i\n' \ + '$(TARGETDIR)\\%s.py : $(GENCODEDIR)\\%s.py\n' % \ + tuple([os.path.splitext(name)[0]] * 5) + depends = depends + text + for name in self.PYFILES: + text = '$(TARGETDIR)\\%s.py : %s.py\n' % \ + tuple([os.path.splitext(name)[0]] * 2) + depends = depends + text + self.DEPENDS = swapslash(depends) + + + # and the list of .py files + pymodules = "" + for name in self.SWIGFILES: + pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0] + for name in self.PYFILES: + pymodules = pymodules + '$(TARGETDIR)\\%s.py ' % os.path.splitext(name)[0] + self.PYMODULES = splitlines(swapslash(pymodules)) + + + + # finally, build the makefile + if sys.platform == 'win32': + if self.RESFILE: + self.RESFILE = '$(MODULE).res' + self.RESRULE = '$(MODULE).res : $(MODULE).rc $(WXDIR)\\include\\wx\\msw\\wx.rc\n\t'\ + '$(rc) -r /i$(WXDIR)\\include -fo$@ $(MODULE).rc' + text = win32Template % self.__dict__ + else: + text = unixTemplate % self.__dict__ + f = open(self.MAKEFILE, 'w') + f.write(text) + f.close() + + print "Makefile created: ", self.MAKEFILE + + + #------------------------------------------------------------ + def readConfigFiles(self, args): + return self.processFile(self.bldCfg, 1) and \ + self.processFile(os.path.join('../..', self.bldCfgLocal)) and \ + self.processFile(os.path.join('..', self.bldCfgLocal)) and \ + self.processFile(os.path.join('.', self.bldCfgLocal)) and \ + self.processArgs(args) + + #------------------------------------------------------------ + def processFile(self, filename, required=0): + try: + text = open(filename, 'r').read() + except IOError: + if required: + print "Unable to open %s" % filename + return 0 + else: + return 1 + + try: + exec(text, self.__dict__) + except: + print "Error evaluating %s" % filename + import traceback + traceback.print_exc() + return 0 + return 1 + + + #------------------------------------------------------------ + def processArgs(self, args): + try: + for st in args: + pair = string.split(st, '=') + name = pair[0] + value = pair[1] + self.__dict__[name] = value + except: + print "Error parsing command-line: %s" % st + return 0 + + return 1 + + + #------------------------------------------------------------ + + + + + +#---------------------------------------------------------------------------- +#---------------------------------------------------------------------------- + +win32Template = ''' +#---------------------------------------------------------------------- +# This makefile was autogenerated from build.py. Your changes will be +# lost if the generator is run again. You have been warned. +#---------------------------------------------------------------------- + +WXDIR = %(WXDIR)s +VERSION = %(VERSION)s +MODULE = %(MODULE)s +SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s +CFLAGS = %(CFLAGS)s %(OTHERCFLAGS)s +LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s +PYVERSION = %(PYVERSION)s +PYPREFIX = %(PYPREFIX)s +EXECPREFIX = %(EXECPREFIX)s +PYTHONLIB = %(PYTHONLIB)s +FINAL = %(FINAL)s +WXP_USE_THREAD = %(WXP_USE_THREAD)s +WXUSINGDLL = %(WXUSINGDLL)s +GENCODEDIR = %(GENCODEDIR)s +RESFILE = %(RESFILE)s +WXPSRCDIR = %(WXPSRCDIR)s + + +TARGETDIR = %(TARGETDIR)s + +OBJECTS = %(OBJECTS)s +PYMODULES = %(PYMODULES)s +TARGET = %(TARGET)s + + + + +!if "$(FINAL)" == "0" +DEBUGLFLAGS = /DEBUG /INCREMENTAL:YES +!else +DEBUGLFLAGS = /INCREMENTAL:NO +!endif +!if "$(WXP_USE_THREAD)" == "1" +THREAD=-DWXP_USE_THREAD=1 +!endif + + + + +NOPCH=1 +OVERRIDEFLAGS=%(OVERRIDEFLAGS)s %(OTHERCFLAGS)s +EXTRAFLAGS = %(CFLAGS)s + +LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s +EXTRALIBS = %(LIBS)s %(OTHERLIBS)s + +#---------------------------------------------------------------------- + +!include $(WXDIR)\\src\\makevc.env + +#---------------------------------------------------------------------- + +%(DEFAULTRULE)s %(OTHERTARGETS)s + + + +install: $(TARGETDIR) $(TARGETDIR)\\$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s + +clean: + -erase *.obj + -erase *.exe + -erase *.res + -erase *.map + -erase *.sbr + -erase *.pdb + -erase *.pch + -erase $(MODULE).exp + -erase $(MODULE).lib + -erase $(MODULE).ilk + -erase $(TARGET) + + +uninstall: + -erase $(TARGETDIR)\\$(TARGET) + -erase $(PYMODULES) + +#---------------------------------------------------------------------- +# implicit rule for compiling .cpp and .c files +{}.cpp{}.obj: + $(cc) @<< +$(CPPFLAGS) /c /Tp $< +<< + +{$(GENCODEDIR)}.cpp{}.obj: + $(cc) @<< +$(CPPFLAGS) /c /Tp $< +<< + +{}.c{}.obj: + $(cc) @<< +$(CPPFLAGS) /c $< +<< + +.SUFFIXES : .i .py + +# Implicit rules to run SWIG +{}.i{$(GENCODEDIR)}.cpp: + swig $(SWIGFLAGS) -c -o $@ $< + +{}.i{$(GENCODEDIR)}.py: + swig $(SWIGFLAGS) -c -o $(GENCODEDIR)\\tmp_wrap.cpp $< + -erase $(GENCODEDIR)\\tmp_wrap.cpp + + +{$(GENCODEDIR)}.py{$(TARGETDIR)}.py: + copy $< $@ + +{}.py{$(TARGETDIR)}.py: + copy $< $@ + +#---------------------------------------------------------------------- + +$(TARGET) : $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(RESFILE) + $(link) @<< +/out:$@ +$(LFLAGS) /def:$(MODULE).def /implib:./$(MODULE).lib +$(DUMMYOBJ) $(OBJECTS) $(RESFILE) +$(LIBS) +<< + + +%(RESRULE)s + + +$(TARGETDIR)\\$(TARGET) : $(TARGET) + copy $(TARGET) $@ + + +pycfiles : $(PYMODULES) + $(EXECPREFIX)\\python $(PYPREFIX)\\Lib\\compileall.py -l $(TARGETDIR) + $(EXECPREFIX)\\python -O $(PYPREFIX)\Lib\\compileall.py -l $(TARGETDIR) + + +$(TARGETDIR) : + mkdir $(TARGETDIR) + +$(GENCODEDIR): + mkdir $(GENCODEDIR) + +#---------------------------------------------------------------------- + +%(DEPENDS)s + +#---------------------------------------------------------------------- + + +%(OTHERRULES)s +''' + +#---------------------------------------------------------------------------- +#---------------------------------------------------------------------------- +#---------------------------------------------------------------------------- + +unixTemplate = ''' +#---------------------------------------------------------------------- +# This makefile was autogenerated from build.py. Your changes will be +# lost if the generator is run again. You have been warned. +#---------------------------------------------------------------------- + + + +WXDIR = %(WXDIR)s +VERSION = %(VERSION)s +MODULE = %(MODULE)s +SWIGFLAGS = %(SWIGFLAGS)s %(SWIGTOOLKITFLAG)s %(OTHERSWIGFLAGS)s +CFLAGS = %(CFLAGS)s %(OTHERCFLAGS)s +LFLAGS = %(LFLAGS)s %(OTHERLFLAGS)s +LIBS = %(LIBS)s %(OTHERLIBS)s +PYVERSION = %(PYVERSION)s +PYPREFIX = %(PYPREFIX)s +EXECPREFIX = %(EXECPREFIX)s +PYINCLUDE = $(PYPREFIX)/include/python$(PYVERSION) +EXECINCLUDE = $(EXECPREFIX)/include/python$(PYVERSION) +PYLIB = %(PYLIB)s +LIBPL = %(LIBPL)s +PYTHONLIB = %(PYTHONLIB)s +FINAL = %(FINAL)s +WXP_USE_THREAD = %(WXP_USE_THREAD)s +GENCODEDIR = %(GENCODEDIR)s +WXPSRCDIR = %(WXPSRCDIR)s +HELPERLIB = %(HELPERLIB)s +HELPERLIBDIR = %(HELPERLIBDIR)s + +TARGETDIR = %(TARGETDIR)s + + +CCC = %(CCC)s +CC = %(CC)s +OPT = %(OPT)s +SO = %(SO)s +LDSHARED = %(LDSHARED)s +CCSHARED = %(CCSHARED)s + + +OBJECTS = %(OBJECTS)s +PYMODULES = %(PYMODULES)s +TARGET = %(TARGET)s + + +ifeq ($(WXP_USE_THREAD), 1) +THREAD=-DWXP_USE_THREAD +endif + +#---------------------------------------------------------------------- + +%(DEFAULTRULE)s %(OTHERTARGETS)s + +install: $(TARGETDIR) $(TARGETDIR)/$(TARGET) pycfiles %(OTHERINSTALLTARGETS)s + +clean: + -rm -f *.o *.so *~ + -rm -f $(TARGET) + +uninstall: + -rm -f $(TARGETDIR)/$(TARGET) + -rm -f $(PYMODULES) + + +#---------------------------------------------------------------------- + +%%.o : %%.cpp + $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $< + +%%.o : $(GENCODEDIR)/%%.cpp + $(CCC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $< + +%%.o : %%.c + $(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $< + +%%.o : $(GENCODEDIR)/%%.c + $(CC) $(CCSHARED) $(CFLAGS) $(OTHERCFLAGS) -c $< + +$(GENCODEDIR)/%%.cpp : %%.i + swig $(SWIGFLAGS) -c -o $@ $< + +$(GENCODEDIR)/%%.py : %%.i + swig $(SWIGFLAGS) -c -o $(GENCODEDIR)/tmp_wrap.cpp $< + rm $(GENCODEDIR)/tmp_wrap.cpp + +$(TARGETDIR)/%% : %% + cp -f $< $@ + +$(TARGETDIR)/%% : $(GENCODEDIR)/%% + cp -f $< $@ + +#---------------------------------------------------------------------- + +%(DEPENDS)s + +#---------------------------------------------------------------------- + +$(TARGET) : $(OBJECTS) + $(LDSHARED) $(OBJECTS) $(LFLAGS) $(LIBS) $(OTHERLIBS) -o $(TARGET) + + + +pycfiles : $(PYMODULES) + $(EXECPREFIX)/bin/python $(PYLIB)/compileall.py -l $(TARGETDIR) + $(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py -l $(TARGETDIR) + + +$(TARGETDIR) : + mkdir $(TARGETDIR) + +$(GENCODEDIR): + mkdir $(GENCODEDIR) + +#---------------------------------------------------------------------- + + +%(OTHERRULES)s + + + +''' + + +#---------------------------------------------------------------------------- + +if __name__ == '__main__': + main(sys.argv) + +#---------------------------------------------------------------------------- + + + + + + + + diff --git a/utils/wxPython/modules/buildall.py b/utils/wxPython/modules/buildall.py new file mode 100755 index 0000000000..36128ae668 --- /dev/null +++ b/utils/wxPython/modules/buildall.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +#---------------------------------------------------------------------------- +# Name: buildall.py +# Purpose: Invokes the build script for all modules defined in +# MODULELIST +# +# Author: Robin Dunn +# +# Created: 18-Aug-1999 +# RCS-ID: $Id$ +# Copyright: (c) 1999 by Total Control Software +# Licence: wxWindows license +#---------------------------------------------------------------------------- + +import sys, os +sys.path.insert(0, '../distrib') +import build + +MODULELIST = ['html', 'glcanvas', 'utils', 'lseditor'] + + + +for module in MODULELIST: + cwd = os.getcwd() + print "**** Building %s" % module + build.main([sys.argv[0], '-C', module] + sys.argv[1:]) + os.chdir(cwd) diff --git a/utils/wxPython/modules/glcanvas/.cvsignore b/utils/wxPython/modules/glcanvas/.cvsignore index 61bf050b91..e8f0a7bd7a 100644 --- a/utils/wxPython/modules/glcanvas/.cvsignore +++ b/utils/wxPython/modules/glcanvas/.cvsignore @@ -1,10 +1,13 @@ -sedscript + +*.exp +*.lib +*.obj +*.pch +Makefile Makefile.pre Setup +build.local config.c -Makefile -*.obj -*.pch -*.lib -*.exp - +glcanvasc.ilk +glcanvasc.pyd +sedscript diff --git a/utils/wxPython/modules/glcanvas/build.cfg b/utils/wxPython/modules/glcanvas/build.cfg new file mode 100644 index 0000000000..bbe5de1450 --- /dev/null +++ b/utils/wxPython/modules/glcanvas/build.cfg @@ -0,0 +1,7 @@ +# -*- python -*- + +MODULE = 'glcanvasc' +SWIGFILES = ['glcanvas.i', ] +OTHERCFLAGS = '-DWITH_GLCANVAS -I$(WXDIR)\utils\glcanvas\win' +OTHERLIBS = '$(WXDIR)\lib\glcanvas.lib glu32.lib opengl32.lib' + diff --git a/utils/wxPython/modules/html/.cvsignore b/utils/wxPython/modules/html/.cvsignore index 61bf050b91..dc001de65d 100644 --- a/utils/wxPython/modules/html/.cvsignore +++ b/utils/wxPython/modules/html/.cvsignore @@ -1,10 +1,13 @@ -sedscript + +*.exp +*.lib +*.obj +*.pch +Makefile Makefile.pre Setup +build.local config.c -Makefile -*.obj -*.pch -*.lib -*.exp - +htmlc.ilk +htmlc.pyd +sedscript diff --git a/utils/wxPython/modules/html/build.cfg b/utils/wxPython/modules/html/build.cfg new file mode 100644 index 0000000000..2fab7d3bbb --- /dev/null +++ b/utils/wxPython/modules/html/build.cfg @@ -0,0 +1,6 @@ +# -*- python -*- + +MODULE = 'htmlc' +SWIGFILES = ['html.i', ] +PYFILES = ['htmlhelper.py'] + diff --git a/utils/wxPython/modules/lseditor/.cvsignore b/utils/wxPython/modules/lseditor/.cvsignore index 61bf050b91..68623efe14 100644 --- a/utils/wxPython/modules/lseditor/.cvsignore +++ b/utils/wxPython/modules/lseditor/.cvsignore @@ -1,10 +1,13 @@ -sedscript + +*.exp +*.lib +*.obj +*.pch +Makefile Makefile.pre Setup +build.local config.c -Makefile -*.obj -*.pch -*.lib -*.exp - +lseditorc.ilk +lseditorc.pyd +sedscript diff --git a/utils/wxPython/modules/lseditor/build.cfg b/utils/wxPython/modules/lseditor/build.cfg new file mode 100644 index 0000000000..4499dad9a3 --- /dev/null +++ b/utils/wxPython/modules/lseditor/build.cfg @@ -0,0 +1,9 @@ +# -*- python -*- + +MODULE = 'lseditorc' +SWIGFILES = ['lseditor.i'] + +SOURCES = ['finddlg.cpp', 'lseditorpl.cpp', 'markup.cpp', 'plugin.cpp', + 'sourcepainter.cpp', 'tdefs.cpp'] + + diff --git a/utils/wxPython/modules/utils/.cvsignore b/utils/wxPython/modules/utils/.cvsignore index 6107250406..1a429af104 100644 --- a/utils/wxPython/modules/utils/.cvsignore +++ b/utils/wxPython/modules/utils/.cvsignore @@ -1,4 +1,5 @@ Makefile +build.local utilsc.exp utilsc.ilk utilsc.pyd diff --git a/utils/wxPython/modules/utils/build.cfg b/utils/wxPython/modules/utils/build.cfg new file mode 100644 index 0000000000..7e1c3509f1 --- /dev/null +++ b/utils/wxPython/modules/utils/build.cfg @@ -0,0 +1,5 @@ +# -*- python -*- + +MODULE = 'utilsc' +SWIGFILES = ['utils.i', ] + diff --git a/utils/wxPython/src/.cvsignore b/utils/wxPython/src/.cvsignore index 702e2f8e0d..77c1ff0909 100644 --- a/utils/wxPython/src/.cvsignore +++ b/utils/wxPython/src/.cvsignore @@ -6,6 +6,7 @@ Setup.in.new Setup.save Setup.save Setup.test +build.local compile.py config.c glcanvas.h @@ -24,7 +25,10 @@ wxPython.dsw wxPython.ncb wxPython.opt wxc.exp +wxc.ilk wxc.lib +wxc.pch +wxc.pyd wxc.res wxp.pch wxpc.exp diff --git a/utils/wxPython/src/build.cfg b/utils/wxPython/src/build.cfg new file mode 100644 index 0000000000..41e5191f79 --- /dev/null +++ b/utils/wxPython/src/build.cfg @@ -0,0 +1,78 @@ +# -*- python -*- +import sys + +MODULE = 'wxc' +SWIGFILES = ['wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', + 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i', + 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', + 'image.i', 'printfw.i', + ] + +PYFILES = ['__init__.py'] + + +if sys.platform == 'win32': + RESFILE = 1 + SOURCES = ['helpers.cpp', 'libpy.c'] + LIBS = '$(PYTHONLIB)' + OTHERRULES = """ +dist: + cd ..\.. + wxPython\distrib\zipit.bat $(VERSION) +""" + +else: + DEFAULTRULE = 'default: $(GENCODEDIR) lib$(HELPERLIB)$(SO) $(TARGET)' + OTHERINSTALLTARGETS = 'installHelpers installLibDemo' + + + OTHERRULES = """ +lib$(HELPERLIB)$(SO) : helpers.o libpy.o + $(LDSHARED) helpers.o libpy.o $(LFLAGS) -o $@ + +installHelpers: $(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) + +$(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) : lib$(HELPERLIB)$(SO) + cp $< $@ + @echo --------------------------------------------------------- + @echo You may have to run ldconfig, or set an environment + @echo variable in order for $(HELPERLIBDIR)/lib$(HELPERLIB)$(SO) + @echo to be found at runtime. See your man pages for ld.so or + @echo equivalent. + @echo --------------------------------------------------------- + + +installLibDemo: + @if [ "$(TARGETDIR)" != ".." ]; then \\ + mkdir $(TARGETDIR)/lib; \\ + mkdir $(TARGETDIR)/lib/sizers; \\ + mkdir $(TARGETDIR)/demo; \\ + mkdir $(TARGETDIR)/demo/bitmaps; \\ + cp ../lib/*.py $(TARGETDIR)/lib; \\ + cp ../lib/sizers/*.py $(TARGETDIR)/lib/sizers; \\ + cp ../demo/*.py $(TARGETDIR)/demo; \\ + cp ../lib/*.txt $(TARGETDIR)/lib; \\ + cp ../lib/sizers/*.txt $(TARGETDIR)/lib/sizers; \\ + cp ../demo/*.txt $(TARGETDIR)/demo; \\ + cp ../demo/bitmaps/[a-z]* $(TARGETDIR)/demo/bitmaps; \\ + $(EXECPREFIX)/bin/python $(PYLIB)/compileall.py -l $(TARGETDIR); \\ + $(EXECPREFIX)/bin/python -O $(PYLIB)/compileall.py -l $(TARGETDIR); \\ + fi + + +dist: tgz rpm + +tgz: + cd ../..; wxPython/distrib/maketgz $(VERSION) + +rpm: + cd ../distrib; ./makerpm $(VERSION) + + + +""" + + + + + diff --git a/utils/wxPython/src/msw/wx.cpp b/utils/wxPython/src/msw/wx.cpp index ab8822d7a3..46af05e7ce 100644 --- a/utils/wxPython/src/msw/wx.cpp +++ b/utils/wxPython/src/msw/wx.cpp @@ -646,11 +646,6 @@ extern "C" SWIGEXPORT(void) initframesc(); extern "C" SWIGEXPORT(void) initwindows3c(); extern "C" SWIGEXPORT(void) initimagec(); extern "C" SWIGEXPORT(void) initprintfwc(); -#ifndef SEPARATE -extern "C" SWIGEXPORT(void) initutilsc(); -//extern "C" SWIGEXPORT(void) initoglc(); -extern "C" SWIGEXPORT(void) initglcanvasc(); -#endif #ifdef __cplusplus extern "C" { #endif @@ -2644,13 +2639,6 @@ SWIGEXPORT(void) initwxc() { initwindows3c(); initimagec(); initprintfwc(); -#ifndef SEPARATE - initutilsc(); -// initoglc(); -#ifdef WITH_GLCANVAS - initglcanvasc(); -#endif -#endif { int i; for (i = 0; _swig_mapping[i].n1; i++) diff --git a/utils/wxPython/src/wx.i b/utils/wxPython/src/wx.i index d266695535..a4f37d1d4f 100644 --- a/utils/wxPython/src/wx.i +++ b/utils/wxPython/src/wx.i @@ -144,11 +144,6 @@ extern "C" SWIGEXPORT(void) initframesc(); extern "C" SWIGEXPORT(void) initwindows3c(); extern "C" SWIGEXPORT(void) initimagec(); extern "C" SWIGEXPORT(void) initprintfwc(); -#ifndef SEPARATE -extern "C" SWIGEXPORT(void) initutilsc(); -//extern "C" SWIGEXPORT(void) initoglc(); -extern "C" SWIGEXPORT(void) initglcanvasc(); -#endif %} @@ -176,13 +171,6 @@ extern "C" SWIGEXPORT(void) initglcanvasc(); initwindows3c(); initimagec(); initprintfwc(); -#ifndef SEPARATE - initutilsc(); -// initoglc(); -#ifdef WITH_GLCANVAS - initglcanvasc(); -#endif -#endif %} //----------------------------------------------------------------------