Commits

Anonymous committed 5e789c3

Added pgreloaded branch.

Comments (0)

Files changed (254)

+include *.txt *.py Makefile
+recursive-include config *.py *.cfg
+recursive-include doc *.py *.xml *.txt LGPL
+recursive-include examples *
+recursive-include lib *
+recursive-include src *
+recursive-include test *
+PYTHON = python
+top_srcdir = `pwd`
+SUBDIRS = \
+	$(top_srcdir)/config \
+	$(top_srcdir)/examples \
+	$(top_srcdir)/doc \
+	$(top_srcdir)/doc/src \
+	$(top_srcdir)/test \
+	$(top_srcdir)/test/util \
+	$(top_srcdir)/lib \
+	$(top_srcdir)/lib/sdl \
+	$(top_srcdir)/lib/sdlext \
+	$(top_srcdir)/lib/sdlgfx \
+	$(top_srcdir)/lib/sdlimage \
+	$(top_srcdir)/lib/sdlmixer \
+	$(top_srcdir)/lib/sdlttf \
+	$(top_srcdir)/lib/sprite \
+	$(top_srcdir)/lib/threads \
+	$(top_srcdir)/src \
+	$(top_srcdir)/src/base \
+	$(top_srcdir)/src/mask \
+	$(top_srcdir)/src/physics \
+	$(top_srcdir)/src/sdl \
+	$(top_srcdir)/src/sdlext \
+	$(top_srcdir)/src/sdlgfx \
+	$(top_srcdir)/src/sdlimage \
+	$(top_srcdir)/src/sdlmixer \
+	$(top_srcdir)/src/sdlttf
+
+all: clean build
+
+dist: clean
+	@echo "Creating dist..."
+	@$(PYTHON) setup.py sdist
+
+bdist: clean
+	@echo "Creating bdist..."
+	@$(PYTHON) setup.py bdist
+
+build:
+	@echo "Running build..."
+	@$(PYTHON) setup.py build #-c mingw32
+	@echo "Build finished, invoke 'make install' to install."
+
+install:
+	@echo "Installing..."
+	@$(PYTHON) setup.py install 
+
+clean:
+	@echo "Cleaning up in $(top_srcdir)/ ..."
+	@rm -f *.cache *.core *~ MANIFEST *.pyc
+	@rm -rf src/doc
+	@rm -rf build dist
+
+	@for dir in $(SUBDIRS); do \
+		if test -f $$dir/Makefile; then \
+			make -C $$dir clean; \
+		else \
+			cd $$dir; \
+			echo "Cleaning up in $$dir..."; \
+			rm -f *~ *.cache *.core *.pyc; \
+		fi \
+	done
+
+docs:
+	@echo "Creating docs package"
+	@$(PYTHON) config/bundle_docs.py
+
+release: clean dist
+
+# Do not run these in production environments! They are for testing
+# only!
+
+buildall: clean
+	@python2.4 setup.py build
+	@python2.5 setup.py build
+	@python2.6 setup.py build
+	@python3.0 setup.py build
+
+installall:
+	@python2.4 setup.py install
+	@python2.5 setup.py install
+	@python2.6 setup.py install
+	@python3.0 setup.py install
+
+purge_installs:
+	rm -rf /usr/local/include/python2.4/pygame2*
+	rm -rf /usr/local/include/python2.5/pygame2*
+	rm -rf /usr/local/include/python2.6/pygame2*
+	rm -rf /usr/local/include/python3.0/pygame2*
+	rm -rf /usr/local/lib/python2.4/site-packages/pygame2*
+	rm -rf /usr/local/lib/python2.5/site-packages/pygame2*
+	rm -rf /usr/local/lib/python2.6/site-packages/pygame2*
+	rm -rf /usr/local/lib/python3.0/site-packages/pygame2*
+Pygame2 Readme
+
+Content:
+--------
+0. Description
+1. Installation
+    1.1 Dependencies
+    1.2 Notes on SVN usage
+    1.3 Notes for Windows users
+    1.4 Notes for Mac OS users
+2. Getting started
+3. Credits
+4. License
+
+0. Description
+--------------
+Pygame2 is a cross-platform multimedia framework for the excellent Python
+programmling language. It's purpose is to make writing multimedia applications,
+such as games, with Python as easy as possible, while providing the developer a
+reliable and extensible programming interface.
+
+Pygame2 can be configured in numerous ways to tweak it to the specific needs
+of the target application and environment. It can make use of different
+3rd party libraries, such as SDL, to provide enhanced functionality.
+
+1. Installation
+---------------
+You can either use the python way of installing the package or the make
+command using the Makefile.
+Simply type
+
+  python setup.py install 
+
+for the traditional python way or
+
+  make install
+
+for using the Makefile. This will try to perform a default installation with
+as many features as possible. If it does not suit your needs or you do not have
+all the dependencies available (see the section 1.1), you can tweak the
+features to build and install by making the necessary adjustments within the
+"cfg.py" file. 
+
+1.1 Dependencies
+----------------
+Pygame2 is designed to run in as many environments as possible. As such, the
+only absolutely necessary dependency is a working Python installation.
+Additionally other librarie are needed, if you want to enable certain features
+of Pygame2.
+
+* Python 2.4, 2.5, 2.6, 3.0 supported   (http://www.python.org)
+
+[Optional dependencies]
+* SDL >= 1.2.10              (http://www.libsdl.org)
+* SDL_mixer >= 1.2.8         (http://www.libsdl.org/projects/SDL_mixer/)
+* SDL_ttf >= 2.0.9           (http://www.libsdl.org/projects/SDL_ttf/)
+* SDL_image >= 1.2.7         (http://www.libsdl.org/projects/SDL_image/)
+* SDL_gfx >= 2.0.17          (http://www.ferzkopp.net/Software/SDL_gfx-2.0/)
+* libpng >= 1.2.24           (http://www.libpng.org)
+* libjpeg >= 6b              (http://www.ijg.org/)
+
+1.2 Notes on SVN usage
+----------------------
+The SVN version of Pygame2 is not intended to be used in a production
+environment. Interfaces may change from one checkin to another, methods,
+classes or modules can be broken and so on. If you want more reliable
+code, please refer to the official releases.
+
+1.3 Notes for Windows users
+---------------------------
+Bulding Pygame2 from its source code is only supported in combination with the
+MinGW compiler suite at the moment.
+
+TODO
+
+1.4 Notes for Mac OS users
+--------------------------
+TODO
+
+2. Getting started
+------------------
+To gain ground quickly, you can find many examples, the reference and tutorials
+within the doc/ directory.
+
+3. Credits
+----------
+TODO
+
+4. License
+----------
+This library is distributed under GNU LGPL version 2.1, which can be found in
+the file "doc/LGPL".
+
+This basically means you can use Pygame2 in any project you want, but if
+you make any changes or additions to pygame itself, those must be
+released with a compatible license (preferably submitted back to the
+pygame project). Closed source and commercial games are fine.
+
+The programs in the "doc/examples" subdirectory are in the public domain.
+The documentation generators in the doc/ directory are in the public domain.
+CRITICAL:
+=========
+* PyFile_* and PyString_* API under python 3.x (see pgcompat.h)
+* recheck and redesign X11 implementation for pygame.sdlext.scrap
+* merge transform/scale asm changes in rev. 1657:1669
+* complete physics collision and contacts and merge it back to the branch
+* make LayeredGroups class independent from sdl surfaces, where possible
+* check all BuildValue and ParseTuple calls for the correct value range
+
+Things to ADD:
+==============
+* (re)add tests
+* add examples
+* reorganise and add camera module
+* add proper config_win support to make use of VC++
+* add a Point class to make position arguments such as in Surface.blit
+  easier to use
+
+Things to FIX:
+==============
+* respect surface->clip_rect where necessary!
+* sdl.mouse.cursors, NOT pygame2.sdl.cursors or whatever
+* sdlext.transform.threshod_* -> clip_rect, surfaces with different sizes
+* documentation
+* finish html converter for docs
+* get rid of os.system() output under msys (2>/dev/null does not seem to work)
+* correct argument checks in pyg_scrap* functions
+* check for clipboard resource destruction within pygame.sdlext.scrap.
+* surfarray problems (naming, 32/24bpp, see mailing list around 2008-10-21/22)
+* SDL_gfx has to set the correct errors (SDL_SetError()). Fix that and
+  merge it back to the SDL_gfx upstream
+
+Things to WRAP:
+===============
+* SDL_LoadObject
+* SDL_LoadFunction
+* SDL_UnloadObject
+* SDL_Audio*
+* SDL_Thread*
+* SDL_gfx image filter functions
+
+##
+## You can disable the components you do not want to support by setting them
+## to False. If you e.g. do not need or want SDL_mixer support, simply set
+##
+##    WITH_SDL_MIXER = False
+##
+## In case certain parts do not build, try to disable them.
+## 
+##
+
+# SDL support.
+# This MUST be enabled for the other SDL related modules.
+WITH_SDL = True
+
+# SDL_mixer support
+WITH_SDL_MIXER = True
+
+# SDL_image support
+WITH_SDL_IMAGE = True
+
+# SDL_ttf support
+WITH_SDL_TTF = True
+
+# SDL_gfx support
+WITH_SDL_GFX = True
+
+# libpng support
+# This is used by Surface.save() to enable PNG saving.
+WITH_PNG = True
+
+# libjpeg support
+# This is used by Surface.save() to enable JPEG saving.
+WITH_JPEG = True

config/__init__.py

+__all__ = [ "config_modules", "config_msys", "config_unix", "config_win",
+            "dll", "helpers", "mingw32ccompiler", "mingw32distutils",
+            "mingwcfg", "msys", "msysio", "pkgconfig", "sdlconfig" ]

config/bundle_docs.py

+#! /usr/bin/env python
+"""Tar-zip the Pygame documents and examples
+
+Run this script from the Pygame source root directory.
+"""
+
+import os, sys
+import tarfile
+import re
+
+sys.path.append (os.path.pardir)
+
+# Exclude list that cannot be easily regexp'd.
+excludes = [ "create_cref.py", "create_htmlref.py", "create_doc.py" ]
+
+def add_files (bundle, root, alias, file_names):
+    for file_name in file_names:
+        file_alias = os.path.join (alias, file_name)
+        print ("  %s --> %s" % (file_name, file_alias))
+        bundle.add (os.path.join (root, file_name), file_alias)
+
+def add_directory (bundle, root, alias):
+    reject_dirs = re.compile (r'(src)|(.svn)$')
+
+    # Since it is the file extension that is of interest the reversed
+    # file name is checked.
+    reject_files_reversed = re.compile(r'((~.*)|(cyp\..*)|(lmx\..*))')
+    for sub_root, directories, files in os.walk (root):
+        directories[:] = [d for d in directories if reject_dirs.match(d) is None]
+        files[:] = [f for f in files \
+                    if reject_files_reversed.match(f[-1::-1]) is None and \
+                    f not in excludes]
+        sub_alias = os.path.join (alias, sub_root[len (root)+1:])
+        add_files (bundle, sub_root, sub_alias, files)
+
+def main():
+    bundle_name_elements = ['pygame', 'docs']
+    fp = open ("setup.py", "r")
+    try:
+        match = re.search (r'VERSION = "([0-9]+\.[0-9]+\.[0-9])"', fp.read ())
+    finally:
+        fp.close ()
+    if match is None:
+        print ("*** Unable to find version in setup.py")
+        version = ''
+    else:
+        version = '-%s' % match.group(1)
+
+    bundle_name = "dist/pygame2%s-docs-and-examples.tar.gz" % version
+    print ("Creating bundle %s" % bundle_name)
+
+    if not os.path.exists ("dist"):
+        os.mkdir ("dist")
+        
+    bundle = tarfile.open (bundle_name, "w:gz")
+    try:
+        root = os.path.abspath (".")
+        alias = "pygame2"
+        add_files (bundle, root, alias, ['README.txt', ])
+        add_directory (bundle, os.path.join(root, 'doc'),
+                       os.path.join(alias, 'doc'))
+        print ("\nFinished: %s" % bundle_name)
+    finally:
+        bundle.close()
+
+if __name__ == '__main__':
+    main()

config/config_modules.py

+import os, sys
+from config import sdlconfig, pkgconfig, helpers
+from config import config_msys, config_unix, config_win
+
+def get_install_libs (buildsystem, cfg):
+    # Gets the libraries to install for the target platform.
+    if buildsystem == "unix":
+        return config_unix.get_install_libs (cfg)
+    elif buildsystem == "msys":
+        return config_msys.get_install_libs (cfg)
+    elif buildsystem == "win":
+        return config_win.get_install_libs (cfg)
+
+def find_incdir (buildsystem, header):
+    # Gets the include directory for the specified header file.
+    if buildsystem == "msys":
+        return config_msys.find_incdir (header)
+    elif buildsystem == "unix":
+        return config_unix.find_incdir (header)
+    elif buildsystem == "win":
+        return config_win.find_incdir (header)
+
+def find_libdir (buildsystem, lib):
+    # Gets the library directory for the specified library file.
+    if buildsystem == "msys":
+        return config_msys.find_libdir (lib)
+    elif buildsystem == "unix":
+        return config_unix.find_libdir (lib)
+    elif buildsystem == "win":
+        return config_win.find_libdir (lib)
+
+def get_sys_libs (buildsystem, module):
+    # Gets a list of system libraries to link the module against.
+    if buildsystem == "msys":
+        return config_msys.get_sys_libs (module) or []
+    elif buildsystem == "unix":
+        return config_unix.get_sys_libs (module) or []
+    elif buildsystem == "win":
+        return config_win.get_sys_libs (module) or []
+    
+def sdl_get_version (buildsystem):
+    # Gets the SDL version.
+    if buildsystem == "msys":
+        return config_msys.sdl_get_version ()
+    elif buildsystem == "unix":
+        return config_unix.sdl_get_version ()
+    elif buildsystem == "win":
+        return config_win.sdl_get_version ()
+
+def prepare_modules (buildsystem, modules, cfg):
+    # Prepares all passed modules, setting up their compile and linkage flags,
+    # the necessary includes and the inter-module dependencies.
+    haspkgconfig = hassdlconfig = False
+    if buildsystem in ("unix", "msys"):
+        haspkgconfig = pkgconfig.has_pkgconfig ()
+        hassdlconfig = sdlconfig.has_sdlconfig ()
+
+    sdlincpath = os.path.join ("src", "sdl")
+    sdlincdirs = []
+    sdllibdirs = []
+    sdllibs = None
+    sdlcflags = None
+    sdllflags = None
+    hassdl = sdl_get_version (buildsystem) != None
+
+    pngincdirs = []
+    pnglibdirs = []
+    pnglibs = None
+    pngcflags = None
+    pnglflags = None
+    haspng = False
+
+    jpgincdirs = []
+    jpglibdirs = []
+    jpglibs = None
+    jpgcflags = None
+    jpglflags = None
+    hasjpg = False
+
+    if haspkgconfig:
+        sdlincdirs = pkgconfig.get_incdirs ("sdl") + [ sdlincpath ]
+        sdllibdirs = pkgconfig.get_libdirs ("sdl")
+        sdllibs = pkgconfig.get_libs ("sdl")
+        sdlcflags = pkgconfig.get_cflags ("sdl")
+        sdllflags = pkgconfig.get_lflags ("sdl")
+        if cfg.WITH_PNG and pkgconfig.exists ("libpng"):
+            pngincdirs = pkgconfig.get_incdirs ("libpng")
+            pnglibdirs = pkgconfig.get_libdirs ("libpng")
+            pngcflags = pkgconfig.get_cflags ("libpng") + [ "-DHAVE_PNG" ]
+            pnglflags = pkgconfig.get_lflags ("libpng")
+            pnglibs = pkgconfig.get_libs ("libpng")
+            haspng = True
+    elif hassdlconfig:
+        sdlincdirs = sdlconfig.get_incdirs () + [ sdlincpath ]
+        sdllibdirs = sdlconfig.get_libdirs ()
+        sdllibs = sdlconfig.get_libs ()
+        sdlcflags = sdlconfig.get_cflags ()
+        sdllflags = sdlconfig.get_lflags ()
+    else:
+        # TODO: Try to find all necessary things manually.
+        pass
+
+    if cfg.WITH_PNG and not haspng:
+        d = find_incdir (buildsystem, "png.h")
+        if d != None:
+            pngincdirs = [ d ]
+            pnglibdirs = [ find_libdir (buildsystem, "libpng") ]
+            pnglibs = [ "png" ]
+            pngcflags = [ "-DHAVE_PNG" ]
+            pnglflags = []
+            haspng = True
+
+    if cfg.WITH_JPEG:
+        d = find_incdir (buildsystem, "jpeglib.h")
+        if d != None:
+            jpgincdirs = [ d ]
+            jpglibdirs = [ find_libdir (buildsystem, "libjpeg") ]
+            jpglibs = [ "jpeg" ]
+            jpgcflags = [ "-DHAVE_JPEG" ]
+            jpglflags = []
+            hasjpg = True
+
+    if buildsystem == "msys":
+        # Msys has to treat the paths differently.
+        sdlincdirs = [ config_msys.msys_to_windows (d) for d in sdlincdirs ]
+        sdllibdirs = [ config_msys.msys_to_windows (d) for d in sdllibdirs ]
+        jpgincdirs = [ config_msys.msys_to_windows (d) for d in jpgincdirs ]
+        jpglibdirs = [ config_msys.msys_to_windows (d) for d in jpglibdirs ]
+        pngincdirs = [ config_msys.msys_to_windows (d) for d in pngincdirs ]
+        pnglibdirs = [ config_msys.msys_to_windows (d) for d in pnglibdirs ]
+    
+    for mod in modules:
+        # Do not build the numericXXX modules on 3.x
+        if "numeric" in mod.name and helpers.getversion() >= (3, 0, 0):
+            mod.canbuild = False
+            continue
+        
+        # Get module-specific system libraries.
+        mod.libs = []
+        mod.libs += get_sys_libs (buildsystem, mod.name)
+        
+        # SDL based module
+        if mod.name.startswith ("sdl"):
+            mod.canbuild = cfg.WITH_SDL
+            mod.incdirs = list (sdlincdirs)
+            mod.libdirs = list (sdllibdirs)
+            mod.libs += list (sdllibs)
+            mod.cflags = list (sdlcflags)
+            mod.lflags = list (sdllflags)
+
+            # SDL Mixer linkage
+            if mod.name.startswith ("sdlmixer"):
+                mod.canbuild = cfg.WITH_SDL and cfg.WITH_SDL_MIXER
+                mod.libs += [ "SDL_mixer" ]
+
+            # SDL TTF linkage
+            if mod.name.startswith ("sdlttf"):
+                mod.canbuild = cfg.WITH_SDL and cfg.WITH_SDL_TTF
+                mod.libs += [ "SDL_ttf" ]
+
+            # SDL Image linkage
+            if mod.name.startswith ("sdlimage"):
+                mod.canbuild = cfg.WITH_SDL and cfg.WITH_SDL_IMAGE
+                mod.libs += [ "SDL_image" ]
+
+            # SDL GFX linkage
+            if mod.name.startswith ("sdlgfx"):
+                mod.canbuild = cfg.WITH_SDL and cfg.WITH_SDL_GFX
+                mod.libs += [ "SDL_gfx" ]
+
+            # PNG and JPEG support for Surface.save
+            if mod.name == "sdl.video":
+                if haspng:
+                    mod.cflags += list (pngcflags)
+                    mod.lflags += list (pnglflags)
+                    mod.incdirs += list (pngincdirs)
+                    mod.libdirs += list (pnglibdirs)
+                    mod.libs += list (pnglibs)
+                if hasjpg:
+                    mod.cflags += list (jpgcflags)
+                    mod.lflags += list (jpglflags)
+                    mod.incdirs += list (jpgincdirs)
+                    mod.libdirs += list (jpglibdirs)
+                    mod.libs += list (jpglibs)
+
+        # SDL linkage for pygame.mask
+        elif mod.name == "mask" and hassdl:
+            mod.incdirs = list (sdlincdirs)
+            mod.libdirs = list (sdllibdirs)
+            mod.libs += list (sdllibs)
+            mod.cflags = list (sdlcflags)
+            mod.lflags = list (sdllflags)

config/config_msys.py

+import os, glob
+from config import sdlconfig, pkgconfig, msys, helpers, dll
+
+msys_obj = msys.Msys (require_mingw=False)
+_searchdirs = [ "/usr", "/usr/local", "/mingw" ]
+_incdirs = [ "include", "X11/include" ]
+_libdirs = [ "lib", "X11/lib" ]
+
+def _hunt_libs (name, dirs):
+    # Used by get_install_libs(). It resolves the dependency libraries
+    # and returns them as dict.
+    libs = {}
+    x = dll.dependencies (name)
+    for key in x.keys ():
+        values = _get_libraries (key, dirs)
+        libs.update (values)
+    return libs
+
+def _get_libraries (name, directories):
+    # Gets the full qualified library path from directories.
+    libs = {}
+    dotest = dll.tester (name)
+    for d in directories:
+        try:
+            files = os.listdir (d)
+        except:
+            pass
+        else:
+            for f in files:
+                filename = os.path.join (d, f)
+                if dotest (f) and os.path.isfile (filename):
+                    # Found
+                    libs[filename] = 1
+    return libs
+
+def find_incdir (name):
+    # Gets the include directory for the specified header file.
+    for d in _searchdirs:
+        for g in _incdirs:
+            p = msys_obj.msys_to_windows (os.path.join (d, g))
+            f = os.path.join (p, name)
+            if os.path.isfile (f):
+                return p
+
+def find_libdir (name):
+    # Gets the library directory for the specified library file.
+    for d in _searchdirs:
+        for g in _libdirs:
+            p = msys_obj.msys_to_windows (os.path.join (d, g))
+            f = os.path.join (p, name)
+            if filter (os.path.isfile, glob.glob (f + '*')):
+                return p
+
+def sdl_get_version ():
+    # Gets the SDL version.
+    if pkgconfig.has_pkgconfig ():
+        return pkgconfig.get_version ("sdl")[0]
+    elif sdlconfig.has_sdlconfig ():
+        return sdlconfig.get_version ()[0]
+    return None
+
+def msys_to_windows (path):
+    # Converts a msys path to a Windows path.
+    return msys_obj.msys_to_windows (path)
+
+def get_sys_libs (module):
+    # Gets a list of system libraries to link the module against.
+    if module == "sdl.scrap":
+        return [ "-luser32", "-lgdi32" ]
+
+def get_install_libs (cfg):
+    # Gets the libraries to install for the target platform.
+    libraries = {}
+    values = {}
+    
+    dirs = []
+    for d in _searchdirs:
+        for g in _libdirs:
+            dirs.append (msys_obj.msys_to_windows (os.path.join (d, g)))
+        dirs.append (msys_obj.msys_to_windows (os.path.join (d, "bin")))
+    dirs += [ msys_obj.msys_to_windows ("/mingw/" + d) for d in _libdirs]
+    dirs += [ msys_obj.msys_to_windows ("/mingw/bin") ]
+    
+    if cfg.WITH_SDL:
+        libraries.update (_hunt_libs ("SDL", dirs))
+    if cfg.WITH_SDL_MIXER:
+        libraries.update (_hunt_libs ("SDL_mixer", dirs))
+    if cfg.WITH_SDL_IMAGE:
+        libraries.update (_hunt_libs ("SDL_image", dirs))
+    if cfg.WITH_SDL_TTF:
+        libraries.update (_hunt_libs ("SDL_ttf", dirs))
+    if cfg.WITH_SDL_GFX:
+        libraries.update (_hunt_libs ("SDL_gfx", dirs))
+    if cfg.WITH_PNG:
+        libraries.update (_hunt_libs ("png", dirs))
+    if cfg.WITH_JPEG:
+        libraries.update (_hunt_libs ("jpeg", dirs))
+    return [ k.replace ("/", os.sep) for k in libraries.keys() ]
+

config/config_unix.py

+import os, glob
+from config import sdlconfig, pkgconfig, helpers
+
+_searchdirs = [ "/usr", "/usr/local" ]
+_incdirs = [ "include", "X11/include" ]
+_libdirs = [ "lib", "X11/lib" ]
+
+def find_incdir (name):
+    # Gets the include directory for the specified header file.
+    for d in _searchdirs:
+        for g in _incdirs:
+            p = os.path.join (d, g)
+            f = os.path.join (p, name)
+            if os.path.isfile (f):
+                return p
+
+def find_libdir (name):
+    # Gets the library directory for the specified library file.
+    for d in _searchdirs:
+        for g in _libdirs:
+            p = os.path.join (d, g)
+            f = os.path.join (p, name)
+            if filter (os.path.isfile, glob.glob (f + '*')):
+                return p
+
+def sdl_get_version ():
+    # Gets the SDL version.
+    if pkgconfig.has_pkgconfig ():
+        return pkgconfig.get_version ("sdl")[0]
+    elif sdlconfig.has_sdlconfig ():
+        return sdlconfig.get_version ()[0]
+    return None
+
+def get_sys_libs (module):
+    # Gets a list of system libraries to link the module against.
+    if module == "sdl.scrap":
+        return [ "-lX11" ]
+
+def get_install_libs (cfg):
+    # Gets the libraries to install for the target platform.
+    #
+    # Assume plain shared libraries - do not add anything.
+    return []

config/config_win.py

+import os, glob
+from config import sdlconfig, pkgconfig, helpers, dll
+
+def _hunt_libs (name, dirs):
+    # Used by get_install_libs(). It resolves the dependency libraries
+    # and returns them as dict.
+    libs = {}
+    x = dll.dependencies (name)
+    for key in x.keys ():
+        values = _get_libraries (key, dirs)
+        libs.update (values)
+    return libs
+
+def _get_libraries (name, directories):
+    # Gets the full qualified library path from directories.
+    libs = {}
+    dotest = dll.tester (name)
+    for d in directories:
+        try:
+            files = os.listdir (d)
+        except:
+            pass
+        else:
+            for f in files:
+                filename = os.path.join (d, f)
+                if dotest (f) and os.path.isfile (filename):
+                    # Found
+                    libs[filename] = 1
+    return libs
+
+def find_incdir (name):
+    # Gets the include directory for the specified header file.
+    # TODO
+    return None
+
+def find_libdir (name):
+    # Gets the library directory for the specified library file.
+    # TODO
+    return None
+
+def sdl_get_version ():
+    # Gets the SDL version.
+    # TODO
+    return None
+
+
+def get_sys_libs (module):
+    # Gets a list of system libraries to link the module against.
+    if module == "sdl.scrap":
+        return [ "-luser32", "-lgdi32" ]
+
+def get_install_libs (cfg):
+    # Gets the libraries to install for the target platform.
+    # TODO
+    return []
+# dll.py module
+
+"""DLL specifics"""
+
+# Some definitions:
+
+#   Library file name (name): The library name used in linker -l options. It
+#   also represents the key identifier.
+#       e.g. SDL_mixer
+   
+import re
+
+# Table of dependencies.
+# name, File regex, Dependency list of file root names
+libraries = [
+    ('SDL', r'(lib){0,1}SDL\.dll$', []),
+    ('SDL_mixer', r'(lib){0,1}SDL_mixer\.dll$', ['SDL', 'vorbisfile', 'smpeg']),
+    ('SDL_image', r'(lib){0,1}SDL_image\.dll$', ['SDL', 'jpeg', 'png', 'tiff']),
+    ('SDL_ttf', r'(lib){0,1}SDL_ttf\.dll$', ['SDL', 'z', 'freetype']),
+    ('freetype', r'(lib){0,1}freetype(-6){0,1}\.dll$', []),
+    ('vorbisfile', r'(lib){0,1}vorbisfile(-3){0,1}\.dll$', ['vorbis']),
+    ('vorbis', r'(lib){0,1}vorbis(-0){0,1}\.dll$', ['ogg']),
+    ('ogg', r'(lib){0,1}ogg(-0){0,1}\.dll$', []),
+    ('smpeg', r'(lib){0,1}smpeg\.dll$', ['SDL']),
+    ('tiff', r'(lib){0,1}tiff\.dll$',  ['jpeg', 'z']),
+    ('jpeg', r'(lib){0,1}jpeg\.dll$', []),
+    ('png', r'(lib){0,1}png(1[23])\.dll$', ['z']),
+    ('z', r'zlib1\.dll$', []),
+]
+
+# regexs: Maps name to DLL file name regex.
+# lib_dependencies: Maps name to list of dependencies.
+
+regexs = {}
+lib_dependencies = {}
+for name, regex, deps in libraries:
+    regexs[name] = regex
+    lib_dependencies[name] = deps
+del name, regex, deps
+
+def tester (name):
+    """For a library name return a function which tests dll file names"""
+    
+    def test(file_name):
+        """Return true if file name f is a valid DLL name"""
+        
+        return match(file_name) is not None
+
+    match =  re.compile(regexs[name], re.I).match
+    test.library_name = name  # Available for debugging.
+    return test
+
+def dependencies(*names):
+    """Return a set of dependencies for the list of library file roots
+
+    The return set is a dictionary keyed on library root name with values of 1.
+    """
+
+    root_set = {}
+    for root in names:
+        try:
+            deps = lib_dependencies[root]
+        except KeyError:
+            pass
+        else:
+            root_set[root] = 1
+            root_set.update(dependencies(*deps))
+    return root_set

config/helpers.py

+import sys
+
+def getversion ():
+    return sys.version_info[0:3]
+
+def geterror ():
+    return sys.exc_info()[1]
+c:\MinGW

config/mingw32ccompiler.py

+# module mingw32ccompiler.py
+# Requires Python 2.1 or better.
+
+"""Win32 GUI/console versions of the distutils mingw32 compiler classes."""
+
+from distutils.cygwinccompiler import Mingw32CCompiler
+
+def intersect (sequence_a, sequence_b):
+    """Return true if the two sequences contain items in common
+
+    If sequence_a is a non-sequence then return false.
+    """
+    try:
+        for item in sequence_a:
+            if item in sequence_b:
+                return 1
+    except TypeError:
+        return 0
+    return 0
+
+def difference (sequence_a, sequence_b):
+    """Return a list of items in sequence_a but not in sequence_b
+
+    Will raise a ValueError if either argument is not a sequence.
+    """
+    new_sequence = []
+    for item in sequence_a:
+        if item not in sequence_b:
+            new_sequence.append(item)
+    return new_sequence
+
+subsystem_options = ['-mwindows', '-mconsole']  # Item position is critical.
+
+class Mingw32DefaultCCompiler (Mingw32CCompiler):
+    """This mingw32 compiler class builds a Win32 GUI DLL by default.
+
+    It is overridden by subsystem options in the linker extras.
+    """
+
+    def set_executables (self, **args):
+        """Has no linker subsystem option for shared libraries"""
+        Mingw32CCompiler.set_executables(self, **args)
+        try:
+            self.linker_so = difference (self.linker_so, subsystem_options)
+        except TypeError:
+            pass
+                          
+    def link (self,
+              target_desc,
+              objects,
+              output_filename,
+              output_dir=None,
+              libraries=None,
+              library_dirs=None,
+              runtime_library_dirs=None,
+              export_symbols=None,
+              debug=0,
+              extra_preargs=None,
+              extra_postargs=None,
+              build_temp=None,
+              target_lang=None):
+        """Do a Win32 GUI link if no subsystem option given."""
+
+        if (target_desc != self.EXECUTABLE and
+            not intersect(subsystem_options, extra_preargs) and
+            not intersect(subsystem_options, extra_postargs)):
+            try:
+                extra_preargs = extra_preargs + subsystem_options[0]
+            except TypeError:
+                extra_preargs = subsystem_options[0:1]
+
+        Mingw32CCompiler.link (self,
+                               target_desc,
+                               objects,
+                               output_filename,
+                               output_dir,
+                               libraries,
+                               library_dirs,
+                               runtime_library_dirs,
+                               export_symbols,
+                               debug,
+                               extra_preargs,
+                               extra_postargs,
+                               build_temp,
+                               target_lang)
+
+class Mingw32ConsoleCCompiler (Mingw32CCompiler):
+    """This mingw32 compiler class builds a console DLL.
+
+    It is not overridden by subsystem options in the linker extras.
+    """
+
+    def set_executables (self, **args):
+        """Has console subsystem linker option for shared libraries."""
+        Mingw32CCompiler.set_executables(self, **args)
+        try:
+            linker_so = difference(self.linker_so, subsystem_options)
+        except TypeError:
+            linker_so = subsystem_options[1:2]
+        else:
+            linker_so.append(subsystem_options[1])
+        self.linker_so = linker_so
+                          
+    def link (self,
+              target_desc,
+              objects,
+              output_filename,
+              output_dir=None,
+              libraries=None,
+              library_dirs=None,
+              runtime_library_dirs=None,
+              export_symbols=None,
+              debug=0,
+              extra_preargs=None,
+              extra_postargs=None,
+              build_temp=None,
+              target_lang=None):
+        """Do a console link."""
+
+        if target_desc != self.EXECUTABLE:
+            try:
+                extra_preargs = difference(extra_preargs, subsystem_options)
+            except TypeError:
+                pass
+            try:
+                extra_postargs = difference(extra_postargs, subsystem_options)
+            except TypeError:
+                pass
+        Mingw32CCompiler.link (self,
+                               target_desc,
+                               objects,
+                               output_filename,
+                               output_dir,
+                               libraries,
+                               library_dirs,
+                               runtime_library_dirs,
+                               export_symbols,
+                               debug,
+                               extra_preargs,
+                               extra_postargs,
+                               build_temp,
+                               target_lang)

config/mingw32distutils.py

+# module mingw32distutils.py
+# Requires Python 2.1 or better.
+
+"""Enhance distutils mingw32 compilation by adding Win32 GUI/console support."""
+
+from distutils import ccompiler
+from distutils.errors import DistutilsModuleError
+
+compilers = ['mingw32', 'mingw32-console']
+
+# Add the compiler classes to the ccompiler table. Unfortunate hacks follow.
+
+compiler_class = ccompiler.compiler_class
+value = compiler_class['mingw32']
+assert len(value) == 3, "distutils.ccompiler.compiler_class has changed"
+compiler_class['mingw32'] = ('', '',
+                             value[2] + ", Win32 GUI shared libraries defaullt")
+compiler_class['mingw32-console'] = ('', '',
+                                     value[2] + ", console shared libraries")
+
+original_new_compiler = ccompiler.new_compiler
+def new_compiler (plat=None,
+                  compiler=None,
+                  verbose=0,
+                  dry_run=0,
+                  force=0):
+    """Recognizes replacement mingw32 compiler classes"""
+
+    if compiler == 'mingw32':
+        from config.mingw32ccompiler import Mingw32DefaultCCompiler
+        return Mingw32DefaultCCompiler (None, dry_run, force)
+    if compiler == 'mingw32-console':
+        from config.mingw32ccompiler import Mingw32ConsoleCCompiler
+        return Mingw32ConsoleCCompiler (None, dry_run, force)
+    return original_new_compiler (plat, compiler, verbose, dry_run, force)
+
+ccompiler.new_compiler = new_compiler

config/mingwcfg.py

+# module mingwcfg.py
+
+"""Manage the MinGW configuration file for setup.py"""
+
+import os
+
+directory = os.path.abspath(os.path.split(__file__)[0])
+path = os.path.join(directory, 'mingw.cfg')
+
+def write(mingw_root):
+    cnf = open(path, 'w')
+    try:
+        cnf.write(os.path.abspath(mingw_root))
+        cnf.write('\n')
+    finally:
+        cnf.close
+
+def read():
+    cnf = open(path, 'r')
+    try:
+        for ln in cnf:
+            return ln.strip()
+    finally:
+        cnf.close()
+# module msys.py
+# Requires Python 2.4 or better and win32api.
+
+"""MSYS specifics for Msys terminal IO and for running shell scripts
+
+exports msys_raw_input, MsysException, Msys
+"""
+
+from config import helpers
+from config.msysio import raw_input_ as msys_raw_input, print_ as msys_print
+from config.msysio import is_msys
+import os
+import time
+import subprocess
+import re
+import glob
+try:
+    import _winreg
+except:
+    _winreg = None
+
+FSTAB_REGEX = (r'^[ \t]*(?P<path>'
+               r'([a-zA-Z]:){0,1}([\\/][^\s*^?:%\\/]+)+)'
+               r'[ \t]+/mingw(\s|$)'
+               )
+
+def has_drive(path):
+    """Return true if the MSYS path strats with a drive letter"""
+    
+    return re.match('/[A-Z]/', path, re.I) is not None
+
+class MsysException(Exception):
+    """Path retrieval problem"""
+    pass
+
+def find_msys_version_subdir(msys_dir):
+    """Return the full MSYS root directory path
+
+    If msys_dir path lacks the version subdirectory, e.g. 1.0, then the
+    path is searched for one. The user will be prompted to choose if more
+    than one version is found.
+    """
+
+    regex = r'[\\/][1-9][.][0-9]$'
+    if re.search(regex, msys_dir) is not None:
+        return msys_dir
+    
+    roots = glob.glob(os.path.join(msys_dir, '[1-9].[0-9]'))
+    roots.sort()
+    roots.reverse()
+    if not roots:
+        raise MsysException("No msys versions found.\n")
+    else:
+        if len(roots) == 1:
+            root = roots[0]
+        else:
+            msys_print("Select an Msys version:")
+            for i, path in enumerate(roots):
+                msys_print("  %d = %s" % (i+1, os.path.split(path)[1]))
+            choice = msys_raw_input("Select 1-%d (1 = default):")
+            if not choice:
+                root = roots[0]
+            else:
+                root = roots[int(choice)-1]
+        return root
+        
+def input_msys_dir():
+    """Return user entered MSYS directory path
+
+    May raise MsysException."""
+
+    while 1:
+        dir_path = msys_raw_input("Enter the MSYS directory path,\n"
+                              "(or press [Enter] to quit):")
+        dir_path = dir_path.strip()
+        if not dir_path:
+            raise MsysException("Input aborted by user")
+        dir_path = os.path.abspath(dir_path)
+        try:
+            return find_msys_version_subdir(dir_path)
+        except MsysException:
+            msys_print(helpers.geterror ())
+
+def find_msys_registry():
+    """Return the MSYS 1.0 directory path stored in the Windows registry
+
+    The return value is an encoded ascii str. The registry entry for the
+    uninstaller is used. Raise a LookupError if not found.
+    """
+    key = None
+    subkey = (
+        'Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS-1.0_is1')
+    try:
+        key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, subkey)
+        try:
+            return _winreg.QueryValueEx(key, 'Inno Setup: App Path')[0].encode()
+        except WindowsError:
+            raise LookupError("MSYS not found in the registry")
+    finally:
+        if key:
+            key.Close()
+
+def as_shell(msys_root):
+    """Append MSYS shell program to MSYS root directory path"""
+
+    return os.path.join(msys_root, 'bin', 'sh.exe')
+
+def check_for_shell(msys_directory=None):
+    """Check various locations for MSYS shell or root directory.
+
+    May raise MsysException.
+    """
+
+    if msys_directory is not None:
+        try:
+            dir_path = find_msys_version_subdir(msys_directory)
+        except MsysException:
+            pass
+        else:
+            return as_shell(dir_path)
+
+    try:
+        shell = os.environ['SHELL']
+    except KeyError:
+        pass
+    else:
+        if is_msys() and not shell.endswith ('.exe'):
+            return shell + '.exe'
+        return shell
+    
+    try:
+        dir_path = find_msys_registry()
+    except LookupError:
+        pass
+    else:
+        return as_shell(dir_path)
+
+    return as_shell(input_msys_dir())
+
+def find_msys_shell(msys_directory=None):
+    """Retrun the MSYS shell program path
+
+    MsysException is raised if the shell program is not found. The user
+    is prompt is prompted as a last resort if no directory is found or
+    there are multiple choices.
+    """
+
+    shell = check_for_shell(msys_directory)
+    while 1:
+    
+        shell = os.path.abspath(shell.replace('/', os.sep))
+        if os.path.isfile(shell):
+            break
+        msys_print("Directory %s has no MSYS shell." % shell)
+        shell = as_shell(input_msys_dir())
+    return shell
+
+def find_mingw_root(msys_directory):
+    """Return the Windows equivalent of /mingw"""
+
+    # Look it up in the fstabs file.
+    fstab_path = os.path.join(msys_directory, 'etc', 'fstab')
+    try:
+        fstab = open(fstab_path, 'r')
+    except IOError:
+        raise MsysException("Unable to open MSYS fstab file %s" % fstab_path)
+    else:
+        match = re.search(FSTAB_REGEX, fstab.read(), re.MULTILINE)
+        if match is None:
+            raise MsysException(
+                "The required MinGW path is not in the MSYS fstab file")
+
+        dir_path = os.path.abspath(match.groupdict()['path'])
+        if not os.path.isdir(dir_path):
+            raise MsysException("%s is not a directory" % dir_path)
+    return dir_path
+
+
+class Msys(object):
+    """Return a new Msys environment;  May raise MsysException
+
+    Msys([msys_directory, [require_mingw]])
+
+    msys_directory: A string giving the path of the MSYS directory.
+
+    Either or both keyword arguments can be omitted. If msys_directory
+    is not provided then the environment variable SHELL and the Windows
+    registry are checked. Finally the user is prompted for the directory
+    path. If require_mingw is True, the default, the mingw directory path
+    is retrieved from the MSYS fstab file. An MsysException is raised if
+    the required paths are not found.
+    """
+
+    _is_msys = is_msys()
+
+    def __init__(self, msys_directory=None, require_mingw=None):
+        """New environment
+
+        May raise MsysException"""
+
+        if require_mingw is None:
+            require_mingw = True
+        self._environ = os.environ.copy()
+        self._shell = find_msys_shell(msys_directory)
+        self._msys_root = os.path.split(os.path.split(self.shell)[0])[0].lower()
+        try:
+            self._mingw_root = find_mingw_root(self.msys_root)
+        except MsysException:
+            if require_mingw:
+                raise
+            self._mingw_root = None
+        else:
+            self.environ['MINGW_ROOT_DIRECTORY'] = self._mingw_root
+
+    environ = property(lambda self: self._environ,
+                       doc="Environment variables")
+    shell = property(lambda self: self._shell,
+                     doc="MSYS shell program path")
+    msys_root = property(lambda self: self._msys_root,
+                         doc="MSYS root directory path")
+    mingw_root = property(lambda self: self._mingw_root,
+                          doc="MinGW root directory path")
+    is_msys = property(lambda self: self._is_msys,
+                       doc="True if the execution environment is MSYS")
+
+    def windows_to_msys(self, path):
+        """Return an MSYS translation of an absolute Windows path"""
+        
+        msys_root = self.msys_root
+        mingw_root = self.mingw_root
+        path_lower = path.lower()
+        if path_lower.startswith(msys_root.lower()):
+            return '/usr' + path[len(msys_root):].replace(os.sep, '/')
+        if mingw_root is not None and path_lower.startswith(mingw_root.lower()):
+            return '/mingw' + path[len(mingw_root):].replace(os.sep, '/')
+        drive, tail = os.path.splitdrive(path)
+        return '/%s%s' % (drive[0], tail.replace(os.sep, '/'))
+
+    def msys_to_windows(self, path):
+        """Return a Windows translation of an MSYS path
+        
+        The Unix path separator is uses as it survives the distutils setup
+        file read process. Raises a ValueError if the path cannot be
+        translated.
+        """
+
+        msys_root = self.msys_root
+        mingw_root = self.mingw_root
+        if path.startswith('/usr'):
+            path =  msys_root + path[4:]
+        elif path.startswith('/mingw'):
+            if mingw_root is None:
+                raise ValueError('Unable to map the MinGW directory')
+            path =  mingw_root + path[6:]
+        elif has_drive(path):
+            path =  path[1] + ":" + path[2:]
+        elif path == '/':
+            path = msys_root
+        elif path.startswith('/'):
+            path =  msys_root + path
+        return path.replace(os.sep, '/')
+
+
+    def run_shell_script(self, script):
+        """Run the MSYS shell script and return the shell return code
+
+        script is a string representing the contents of the script.
+        """
+        
+        cmd = [self.shell]
+        if not self._is_msys:
+            cmd.append('--login')
+        previous_cwd = os.getcwd()
+        try:
+            process = subprocess.Popen(cmd,
+                                       stdin=subprocess.PIPE,
+                                       env=self.environ)
+            process.communicate(script)
+            return process.returncode
+        finally:
+            time.sleep(2)  # Allow shell subprocesses to terminate.
+            os.chdir(previous_cwd)
+
+    def run_shell_command(self, command):
+        """Run the MSYS shell command and return stdout output as a string
+
+        command is a list of strings giving the command and its arguments.
+        The first list entry  must be the MSYS path name of a bash shell
+        script file.
+        """
+        
+        args = [self.shell]
+        if not self._is_msys:
+            args.append('--login')
+        args.extend(command)
+        previous_cwd = os.getcwd()
+        try:
+            return subprocess.Popen(args,
+                                    stdout=subprocess.PIPE,
+                                    env=self.environ).communicate()[0]
+        finally:
+            time.sleep(3)  # Allow shell subprocesses to terminate.
+            os.chdir(previous_cwd)
+
+__all__ = ['Msys', 'msys_raw_input', 'msys_print', 'MsysException']
+# module msysio.py
+# Requires Python 2.2 or better.
+
+"""Provide helpful routines for interactive IO on the MSYS console"""
+
+# Output needs to be flushed to be seen. It is especially important
+# when prompting for user input.
+
+import sys
+import os
+
+def raw_input_(prompt=None):
+    """Prompt for user input in an MSYS console friendly way"""
+    if prompt is None:
+        prompt = ''
+    print_(prompt, end='')
+    return raw_input()
+
+def print_(*args, **kwds):
+    """Print arguments in an MSYS console friendly way
+
+    Keyword arguments:
+        file, sep, end
+    """
+
+    stream = kwds.get('file', sys.stdout)
+    sep = kwds.get('sep', ' ')
+    end = kwds.get('end', '\n')
+
+    if args:
+        stream.write(sep.join([str(arg) for arg in args]))
+    if end:
+        stream.write(end)
+    try:
+        stream.flush()
+    except AttributeError:
+        pass
+
+def is_msys():
+    """Return true if the execution environment is MSYS"""
+    
+    try:
+        return os.environ['OSTYPE'] == 'msys'
+    except KeyError:
+        return 0

config/pkgconfig.py

+import os
+from config import msys
+
+def exec_pkgconfig (package, flags, repl=None):
+    if msys.is_msys ():
+        pipe = os.popen ("sh pkg-config %s %s" % (flags, package), "r")
+    else:
+        pipe = os.popen ("pkg-config %s %s" % (flags, package), "r")
+    data = pipe.readline ().strip ()
+    pipe.close ()
+    if data and repl:
+        return data.replace (repl, "").split ()
+    return data.split ()
+
+def get_incdirs (package):
+    return exec_pkgconfig (package, "--cflags-only-I", "-I")
+
+def get_cflags (package):
+    return exec_pkgconfig (package, "--cflags-only-other")
+
+def get_libdirs (package):
+    return exec_pkgconfig (package, "--libs-only-L", "-L")
+
+def get_libs (package):
+    return exec_pkgconfig (package, "--libs-only-l", "-l")
+
+def get_lflags (package):
+    return exec_pkgconfig (package, "--libs-only-other")
+
+def get_version (package):
+    return exec_pkgconfig (package, "--modversion")
+
+def exists (package):
+    pipe = os.popen ("pkg-config --exists %s" % package, "r")
+    ret = pipe.close ()
+    return ret == None
+
+def has_pkgconfig ():
+    if msys.is_msys():
+        return os.system ("sh pkg-config --version") == 0
+    else:
+        return os.system ("pkg-config --version > /dev/null 2>&1") == 0

config/sdlconfig.py

+import os
+from config import msys
+
+def exec_sdlconfig (flags):
+    if msys.is_msys ():
+        pipe = os.popen ("sh sdl-config %s " % flags, "r")
+    else:
+        pipe = os.popen ("sdl-config %s " % flags, "r")
+    data = pipe.readline ().strip ()
+    pipe.close ()
+    return data.split ()
+
+def get_incdirs ():
+    flags = exec_sdlconfig ("--cflags")
+    newflags = []
+    for f in flags:
+        if f.startswith ('-I'):
+            newflags.append (f[2:])
+    return newflags
+
+def get_cflags ():
+    flags = exec_sdlconfig ("--cflags")
+    newflags = []
+    for f in flags:
+        if f.startswith ('-I'):
+            continue
+        newflags.append (f)
+    return newflags
+
+def get_libdirs ():
+    flags = exec_sdlconfig ("--libs")
+    newflags = []
+    for f in flags:
+        if f.startswith ('-L'):
+            newflags.append (f[2:])
+    return newflags
+
+def get_libs ():
+    flags = exec_sdlconfig ("--libs")
+    newflags = []
+    for f in flags:
+        if f.startswith ('-l'):
+            newflags.append (f[2:])
+    return newflags
+
+def get_lflags ():
+    flags = exec_sdlconfig ("--libs")
+    newflags = []
+    for f in flags:
+        if f.startswith ('-l') or f.startswith ('-L'):
+            continue
+        newflags.append (f)
+    return newflags
+
+def get_version ():
+    return exec_sdlconfig ("--version")
+
+def has_sdlconfig ():
+    if msys.is_msys ():
+        return os.system ("sh sdl-config --version") == 0
+    else:
+        return os.system ("sdl-config --version > /dev/null 2>&1") == 0
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library