Commits

Lenard Lindstrom committed 2d530d8

In build process merged Setup.in and Setup_win.in

  • Participants
  • Parent commits d971d16

Comments (0)

Files changed (11)

-#This Setup file is used by the setup.py script to configure the
-#python extensions. You will likely use the "config.py" which will
-#build a correct Setup file for you based on your system settings.
-#If not, the format is simple enough to edit by hand. First change
-#the needed commandline flags for each dependency, then comment out
-#any unavailable optional modules in the first optional section.
-
-
-#--StartConfig
-SDL = -I/usr/include/SDL -D_REENTRANT -lSDL
-FONT = -lSDL_ttf
-IMAGE = -lSDL_image
-MIXER = -lSDL_mixer
-SMPEG = -lsmpeg
-PNG = -lpng
-JPEG = -ljpeg
-SCRAP = -lX11
-#--EndConfig
-
-#DEBUG = -C-W -C-Wall
-DEBUG = 
-
-#the following modules are optional. you will want to compile
-#everything you can, but you can ignore ones you don't have
-#dependencies for, just comment them out
-
-imageext src/imageext.c $(SDL) $(IMAGE) $(PNG) $(JPEG) $(DEBUG)
-font src/font.c $(SDL) $(FONT) $(DEBUG)
-mixer src/mixer.c $(SDL) $(MIXER) $(DEBUG)
-mixer_music src/music.c $(SDL) $(MIXER) $(DEBUG)
-_numericsurfarray src/_numericsurfarray.c $(SDL) $(DEBUG)
-_numericsndarray src/_numericsndarray.c $(SDL) $(MIXER) $(DEBUG)
-movie src/movie.c $(SDL) $(SMPEG) $(DEBUG)
-scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
-
-#experimental new movie movie. requires libavcodec and libavformat.
-#add any necessary compile flags to this line and uncomment.
-#movieext src/movie.c  src/ffmovie.c $(SDL) -lavcodec -lavformat
-
-
-#these modules are required for pygame to run. they only require
-#SDL as a dependency. these should not be altered
-
-base src/base.c $(SDL) $(DEBUG)
-cdrom src/cdrom.c $(SDL) $(DEBUG)
-constants src/constants.c $(SDL) $(DEBUG)
-display src/display.c $(SDL) $(DEBUG)
-event src/event.c $(SDL) $(DEBUG)
-fastevent src/fastevent.c src/fastevents.c $(SDL) $(DEBUG)
-key src/key.c $(SDL) $(DEBUG)
-mouse src/mouse.c $(SDL) $(DEBUG)
-rect src/rect.c $(SDL) $(DEBUG)
-rwobject src/rwobject.c $(SDL) $(DEBUG)
-surface src/surface.c src/alphablit.c src/surface_fill.c $(SDL) $(DEBUG)
-surflock src/surflock.c $(SDL) $(DEBUG)
-time src/time.c $(SDL) $(DEBUG)
-joystick src/joystick.c $(SDL) $(DEBUG)
-draw src/draw.c $(SDL) $(DEBUG)
-image src/image.c $(SDL) $(DEBUG)
-overlay src/overlay.c $(SDL) $(DEBUG)
-transform src/transform.c src/rotozoom.c src/scale2x.c $(SDL) $(DEBUG)
-mask src/mask.c src/bitmask.c $(SDL) $(DEBUG)
-bufferproxy src/bufferproxy.c $(SDL) $(DEBUG)
-pixelarray src/pixelarray.c $(SDL) $(DEBUG)
-
-#the following are placeholders. setup.py can use them to help
-#auto-copy needed DLLs into the pygame installation folder.
-#you can simply ignore these lines under non-windows, no need to
-#comment out.
-COPYLIB_smpeg $(SDL) $(SMPEG) $(DEBUG)
+#This Setup file is used by the setup.py script to configure the
+#python extensions. You will likely use the "config.py" which will
+#build a correct Setup file for you based on your system settings.
+#If not, the format is simple enough to edit by hand. First change
+#the needed commandline flags for each dependency, then comment out
+#any unavailable optional modules in the first optional section.
+
+
+#--StartConfig
+SDL = -I/usr/include/SDL -D_REENTRANT -lSDL
+FONT = -lSDL_ttf
+IMAGE = -lSDL_image
+MIXER = -lSDL_mixer
+SMPEG = -lsmpeg
+PNG = -lpng
+JPEG = -ljpeg
+SCRAP = -lX11
+COPYLIB_SDL $(SDL) -Lprebuilt/lib/SDL.dll
+COPYLIB_FONT $(FONT) -Lprebuilt/lib/SDL_ttf.dll
+COPYLIB_IMAGE $(IMAGE) -Lprebuilt/lib/SDL_image.dll
+COPYLIB_MIXER $(MIXER) -Lprebuilt/lib/SDL_mixer.dll
+COPYLIB_SMPEG $(SMPEG) -Lprebuilt/lib/smpeg.dll
+COPYLIB_TIFF -ltiff -Lprebuilt/lib/libtiff.dll
+COPYLIB_PNG $(PNG) -Lprebuilt/lib/libpng13.dll
+COPYLIB_JPEG $(JPEG) -Lprebuilt/lib/jpeg.dll
+COPYLIB_Z -lz -Lprebuilt/lib/zlib1.dll
+COPYLIB_VORBISFILE -lvorbisfile -Lprebuilt/lib/libvorbisfile-3.dll
+COPYLIB_VORBIS -lvorbis -Lprebuilt/lib/libvorbis-0.dll
+COPYLIB_OGG -logg -Lprebuilt/lib/libogg-0.dll
+#--EndConfig
+
+#DEBUG = -C-W -C-Wall
+DEBUG = 
+
+#the following modules are optional. you will want to compile
+#everything you can, but you can ignore ones you don't have
+#dependencies for, just comment them out
+
+imageext src/imageext.c $(SDL) $(IMAGE) $(PNG) $(JPEG) $(DEBUG)
+font src/font.c $(SDL) $(FONT) $(DEBUG)
+mixer src/mixer.c $(SDL) $(MIXER) $(DEBUG)
+mixer_music src/music.c $(SDL) $(MIXER) $(DEBUG)
+_numericsurfarray src/_numericsurfarray.c $(SDL) $(DEBUG)
+_numericsndarray src/_numericsndarray.c $(SDL) $(MIXER) $(DEBUG)
+movie src/movie.c $(SDL) $(SMPEG) $(DEBUG)
+scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
+
+#experimental new movie movie. requires libavcodec and libavformat.
+#add any necessary compile flags to this line and uncomment.
+#movieext src/movie.c  src/ffmovie.c $(SDL) -lavcodec -lavformat
+
+
+#these modules are required for pygame to run. they only require
+#SDL as a dependency. these should not be altered
+
+base src/base.c $(SDL) $(DEBUG)
+cdrom src/cdrom.c $(SDL) $(DEBUG)
+constants src/constants.c $(SDL) $(DEBUG)
+display src/display.c $(SDL) $(DEBUG)
+event src/event.c $(SDL) $(DEBUG)
+fastevent src/fastevent.c src/fastevents.c $(SDL) $(DEBUG)
+key src/key.c $(SDL) $(DEBUG)
+mouse src/mouse.c $(SDL) $(DEBUG)
+rect src/rect.c $(SDL) $(DEBUG)
+rwobject src/rwobject.c $(SDL) $(DEBUG)
+surface src/surface.c src/alphablit.c src/surface_fill.c $(SDL) $(DEBUG)
+surflock src/surflock.c $(SDL) $(DEBUG)
+time src/time.c $(SDL) $(DEBUG)
+joystick src/joystick.c $(SDL) $(DEBUG)
+draw src/draw.c $(SDL) $(DEBUG)
+image src/image.c $(SDL) $(DEBUG)
+overlay src/overlay.c $(SDL) $(DEBUG)
+transform src/transform.c src/rotozoom.c src/scale2x.c $(SDL) $(DEBUG)
+mask src/mask.c src/bitmask.c $(SDL) $(DEBUG)
+bufferproxy src/bufferproxy.c $(SDL) $(DEBUG)
+pixelarray src/pixelarray.c $(SDL) $(DEBUG)
+

Setup_win.in

-#This Setup file is used by the setup.py script to configure the
-#python extensions. You will likely use the "config.py" which will
-#build a correct Setup file for you based on your system settings.
-#If not, the format is simple enough to edit by hand. First change
-#the needed commandline flags for each dependency, then comment out
-#any unavailable optional modules in the first optional section.
-
-
-#--StartConfig
-SDL = -I/usr/include/SDL -D_REENTRANT -lSDL
-FONT = -lSDL_ttf
-IMAGE = -lSDL_image
-MIXER = -lSDL_mixer
-SMPEG = -lsmpeg
-PNG = -lpng
-JPEG = -ljpeg
-SCRAP = -lX11
-DLL_SDL = -Lprebuilt/lib/SDL.dll
-DLL_FONT = -Lprebuilt/lib/SDL_ttf.dll
-DLL_IMAGE = -Lprebuilt/lib/SDL_image.dll
-DLL_MIXER = -Lprebuilt/lib/SDL_mixer.dll
-DLL_SMPEG = -Lprebuilt/lib/smpeg.dll
-DLL_TIFF = -Lprebuilt/lib/libtiff.dll
-DLL_PNG = -Lprebuilt/lib/libpng13.dll
-DLL_JPEG = -Lprebuilt/lib/jpeg.dll
-DLL_Z = -Lprebuilt/lib/zlib1.dll
-DLL_VORBISFILE = -Lprebuilt/lib/libvorbisfile-3.dll
-DLL_VORBIS = -Lprebuilt/lib/libvorbis-0.dll
-DLL_OGG = -Lprebuilt/lib/libogg-0.dll
-#--EndConfig
-
-#DEBUG = -C-W -C-Wall
-DEBUG = 
-
-#the following modules are optional. you will want to compile
-#everything you can, but you can ignore ones you don't have
-#dependencies for, just comment them out
-
-imageext src/imageext.c $(SDL) $(IMAGE) $(PNG) $(JPEG) $(DEBUG)
-font src/font.c $(SDL) $(FONT) $(DEBUG)
-mixer src/mixer.c $(SDL) $(MIXER) $(DEBUG)
-mixer_music src/music.c $(SDL) $(MIXER) $(DEBUG)
-_numericsurfarray src/_numericsurfarray.c $(SDL) $(DEBUG)
-sndarray src/sndarray.c $(SDL) $(MIXER) $(DEBUG)
-movie src/movie.c $(SDL) $(SMPEG) $(DEBUG)
-scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
-
-#experimental new movie movie. requires libavcodec and libavformat.
-#add any necessary compile flags to this line and uncomment.
-#movieext src/movie.c  src/ffmovie.c $(SDL) -lavcodec -lavformat
-
-
-#these modules are required for pygame to run. they only require
-#SDL as a dependency. these should not be altered
-
-base src/base.c $(SDL) $(DEBUG)
-cdrom src/cdrom.c $(SDL) $(DEBUG)
-constants src/constants.c $(SDL) $(DEBUG)
-display src/display.c $(SDL) $(DEBUG)
-event src/event.c $(SDL) $(DEBUG)
-fastevent src/fastevent.c src/fastevents.c $(SDL) $(DEBUG)
-key src/key.c $(SDL) $(DEBUG)
-mouse src/mouse.c $(SDL) $(DEBUG)
-rect src/rect.c $(SDL) $(DEBUG)
-rwobject src/rwobject.c $(SDL) $(DEBUG)
-surface src/surface.c src/alphablit.c src/surface_fill.c $(SDL) $(DEBUG)
-surflock src/surflock.c $(SDL) $(DEBUG)
-time src/time.c $(SDL) $(DEBUG)
-joystick src/joystick.c $(SDL) $(DEBUG)
-draw src/draw.c $(SDL) $(DEBUG)
-image src/image.c $(SDL) $(DEBUG)
-overlay src/overlay.c $(SDL) $(DEBUG)
-transform src/transform.c src/rotozoom.c src/scale2x.c $(SDL) $(DEBUG)
-mask src/mask.c src/bitmask.c $(SDL) $(DEBUG)
-bufferproxy src/bufferproxy.c $(SDL) $(DEBUG)
-pixelarray src/pixelarray.c $(SDL) $(DEBUG)
-
-#the following are placeholders. setup.py can use them to help
-#auto-copy needed DLLs into the pygame installation folder.
-#you can simply ignore these lines under non-windows, no need to
-#comment out.
-COPYLIB__SDL $(DLL_SDL)
-COPYLIB__SDL_ttf $(DLL_FONT)
-COPYLIB__SDL_image $(DLL_IMAGE)
-COPYLIB__SDL_mixer $(DLL_MIXER)
-COPYLIB__smpeg $(DLL_SMPEG)
-COPYLIB__tiff $(DLL_TIFF)
-COPYLIB__png $(DLL_PNG)
-COPYLIB__jpeg $(DLL_JPEG)
-COPYLIB__z $(DLL_Z)
-COPYLIB__vorbisfile $(DLL_VORBISFILE)
-COPYLIB__vorbis $(DLL_VORBIS)
-COPYLIB__ogg $(DLL_OGG)
 is backed up as specs-original so the changes can be easily undone.
 
 Python 2.4 and later are linked against msvcr71.dll. By default MinGW links
-against the older msvcrt.dll. By default when --prepare-mingw option is chosen
-the MinGW specs file is updated so MinGW completely links against msvcr71.dll.
-These changes can be omitted using the --no-msvcr17 option. Restoring the specs
-file undoes the changes.
+against the older msvcrt.dll. Unless the --no-msvcr71 option is closen the
+--prepare-mingw option updates the MinGW specs file so MingGW links against
+msvcr71.dll. Restoring the specs file undoes the changes.
 
 Useful environment variables are "SHELL", the MSYS shell program (already defined
 in the MSYS console), and "MINGW_ROOT_DIRECTORY". The program will prompt for any
         else:
             return None
 
-class MinGWPreparation(object):
-    def __init__(self, name, wild_cards, shell_script):
+class Preparation(object):
+    def __init__(self, name, shell_script):
         self.name = name
         self.path = 'n/a'
         self.paths = []
     os.environ['MINGW_ROOT_DIRECTORY'] = dir_path
     mingw_root = dir_path.lower()
 
-def main(dependencies, mingw_preparation):
+def main(dependencies, mingw_preparation, msys_preparation):
     names = [d.name for d in dependencies]
     usage = ("usage: %prog [options] --all\n"
              "       %prog [options] [args]\n"
         deps = []
     if options.prepare_mingw:
         deps.insert(0, mingw_preparation)
+    if deps:
+        deps.insert(0, msys_preparation)
 
     init(options.msys_directory, options.mingw_directory)
     configure(deps)
     ]  # End dependencies = [.
 
 
-mingw_prep = MinGWPreparation('MinGW Preparation', ['mingw-runtime-[2-9].*'], r"""
+msys_prep = Preparation('/usr/local', """
+
+# Ensure /usr/local and its subdirectories exist.
+mkdir -p /usr/local/lib
+mkdir -p /usr/local/include
+mkdir -p /usr/local/bin
+mkdir -p /usr/local/doc
+mkdir -p /usr/local/man
+mkdir -p /usr/local/share
+""")
+    
+mingw_prep = Preparation('MinGW Preparation', r"""
 
 set -e
 
 GCCVER=`gcc -dumpversion`
 SPECDIR="/mingw/lib/gcc/mingw32/$GCCVER"
 
-# Make a backup if one does not exist
+# Make a backup if one does not exist, else restore specs.
 if [ ! -f $SPECDIR/specs-original ]; then
   cp $SPECDIR/specs $SPECDIR/specs-original
+else
+  cp $SPECDIR/specs-original $SPECDIR/specs
 fi
 
 SEDOPTS="$SEDOPTSLD $SEDOPTSVC"
 """)
 
 if __name__ == '__main__':
-    sys.exit(main(dependencies, mingw_prep))
+    sys.exit(main(dependencies, mingw_prep, msys_prep))
     print 'Using WINDOWS configuration...\n'
     import config_win
     CFG = config_win
-    # !!! Cludgy fix to allow Windows extras in Setup.in while not
-    # breaking other builds. Hopefully temporary.
-    if os.path.exists('Setup_win.in'):
-        try:
-            os.rename('Setup.in', 'Setup_unix.in')
-        except IoError:
-            pass
-        os.rename('Setup_win.in', 'Setup.in')
 elif sys.platform == 'win32' and is_msys_mingw():
     print 'Using WINDOWS mingw/msys configuration...\n'
     import config_msys
     CFG = config_msys
-    # !!! Cludgy fix to allow Windows extras in Setup.in while not
-    # breaking other builds. Hopefully temporary.
-    if os.path.exists('Setup_win.in'):
-        try:
-            os.rename('Setup.in', 'Setup_unix.in')
-        except IoError:
-            pass
-        os.rename('Setup_win.in', 'Setup.in')
 elif sys.platform == 'darwin':
     print 'Using Darwin configuration...\n'
     import config_darwin
     libs = ''
     for lib in dep.libs: 
         libs += ' -l' + lib
-    dep.line = dep.name+' =' + inc + lid + ' ' + dep.cflags + libs
+
+    if dep.name.startswith('COPYLIB_'):
+        dep.line = dep.name + libs + lid
+    else:
+        dep.line = dep.name+' =' + inc + lid + ' ' + dep.cflags + libs
 
 def writesetupfile(deps, basepath):
     "create a modified copy of Setup.in"
 
 class DependencyProg:
     needs_dll = True
-    def __init__(self, name, envname, exename, minver, defaultlibs):
+    def __init__(self, name, envname, exename, minver, defaultlibs=None):
+        if defaultlibs is None:
+            defaultlibs = [dll.name_to_root(name)]
         self.name = name
         command = os.environ.get(envname, exename)
         drv, pth = os.path.splitdrive(command)
 
 class Dependency:
     needs_dll = True
-    def __init__(self, name, checkhead, checklib, libs):
+    def __init__(self, name, checkhead, checklib, libs=None):
+        if libs is None:
+            libs = [dll.name_to_root(name)]
         self.name = name
         self.inc_dir = None
         self.lib_dir = None
 
 class DependencyDLL:
     needs_dll = False
-    def __init__(self, name):
-        self.name = 'DLL_' + name
+    def __init__(self, name, libs=None):
+        if libs is None:
+            libs = [dll.name_to_root(name)]
+        self.name = 'COPYLIB_' + name
         self.inc_dir = None
         self.lib_dir = '_'
-        self.libs = []
+        self.libs = libs
         self.found = 1  # Alway found to make its COPYLIB work
         self.cflags = ''
         self.lib_name = name
 def main():
     print '\nHunting dependencies...'
     DEPS = [
-        DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['SDL']),
-        Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.dll.a', ['SDL_ttf']),
-        Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.dll.a', ['SDL_image']),
-        Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.dll.a', ['SDL_mixer']),
-        DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3', ['smpeg']),
-        Dependency('PNG', 'png.h', 'libpng.dll.a', ['png']),
-        Dependency('JPEG', 'jpeglib.h', 'libjpeg.dll.a', ['jpeg']),
+        DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2'),
+        Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.dll.a'),
+        Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.dll.a'),
+        Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.dll.a'),
+        DependencyProg('SMPEG', 'SMPEG_CONFIG', 'smpeg-config', '0.4.3'),
+        Dependency('PNG', 'png.h', 'libpng.dll.a'),
+        Dependency('JPEG', 'jpeglib.h', 'libjpeg.dll.a'),
         DependencyWin('SCRAP', ['user32', 'gdi32']),
         DependencyDLL('TIFF'),
         DependencyDLL('VORBISFILE'),
 huntpaths = ['..', '..\\..', '..\\*', '..\\..\\*']
 
 
-class Dependency:
+class Dependency(object):
     inc_hunt = ['include']
     lib_hunt = ['VisualC\\SDL\\Release', 'VisualC\\Release', 'Release', 'lib']
-    def __init__(self, name, wildcards, libs, required = 0):
+    def __init__(self, name, wildcards, libs=None, required = 0):
+        if libs is None:
+            libs = [dll.name_to_root(name)]
         self.name = name
         self.wildcards = wildcards
         self.required = required
             self.lib_dir = self.findhunt(self.path, Dependency.lib_hunt)
 
 
-class DependencyPython:
+class DependencyPython(object):
     def __init__(self, name, module, header):
         self.name = name
         self.lib_dir = ''
 
 
 class DependencyDLL(Dependency):
-    def __init__(self, name, wildcards=None, link=None):
-        Dependency.__init__(self, 'DLL_' + name, wildcards, [])
+    def __init__(self, name=None, wildcards=None, link=None, libs=None):
+        if libs is None:
+            if name is not None:
+                libs = [dll.name_to_root(name)]
+            elif link is not None:
+                libs = link.libs
+            else:
+                libs = []
+        if name is None:
+            name = link.name
+        Dependency.__init__(self, 'COPYLIB_' + name, wildcards, libs)
         self.lib_name = name
         self.test = dll.tester(name)
         self.lib_dir = '_'
         print "DLL for %s not found" % self.lib_name
 
                     
-class DependencyWin:
+class DependencyWin(object):
     def __init__(self, name, libs):
         self.name = name
         self.inc_dir = None
 
 
 DEPS = [
-    Dependency('SDL', ['SDL-[1-9].*'], ['SDL'], 1),
-    Dependency('FONT', ['SDL_ttf-[2-9].*'], ['SDL_ttf']),
-    Dependency('IMAGE', ['SDL_image-[1-9].*'], ['SDL_image']),
-    Dependency('MIXER', ['SDL_mixer-[1-9].*'], ['SDL_mixer']),
-    Dependency('SMPEG', ['smpeg-[0-9].*', 'smpeg'], ['smpeg']),
+    Dependency('SDL', ['SDL-[1-9].*'], required=1),
+    Dependency('FONT', ['SDL_ttf-[2-9].*']),
+    Dependency('IMAGE', ['SDL_image-[1-9].*']),
+    Dependency('MIXER', ['SDL_mixer-[1-9].*']),
+    Dependency('SMPEG', ['smpeg-[0-9].*', 'smpeg']),
     DependencyWin('SCRAP', ['user32', 'gdi32']),
-    Dependency('JPEG', ['jpeg-[6-9]*'], ['jpeg']),
-    Dependency('PNG', ['libpng-[1-9].*'], ['png']),
+    Dependency('JPEG', ['jpeg-[6-9]*']),
+    Dependency('PNG', ['libpng-[1-9].*']),
     DependencyDLL('TIFF', ['tiff-[3-9].*']),
     DependencyDLL('VORBIS', ['libvorbis-[1-9].*']),
     DependencyDLL('OGG', ['libogg-[1-9].*']),
     DependencyDLL('Z', ['zlib-[1-9].*']),
 ]
 
-DEPS += [
-    DependencyDLL('SDL', link=DEPS[0]),
-    DependencyDLL('FONT', link=DEPS[1]),
-    DependencyDLL('IMAGE', link=DEPS[2]),
-    DependencyDLL('MIXER', link=DEPS[3]),
-    DependencyDLL('SMPEG', link=DEPS[4]),
-    DependencyDLL('JPEG', link=DEPS[6]),
-    DependencyDLL('PNG', link=DEPS[7]),
-    DependencyDLL('VORBISFILE', link=DEPS[9]),
-]
+DEPS += [DependencyDLL(link=dep) for dep in DEPS[:] if type(dep) is Dependency]
+DEPS += [DependencyDLL('VORBISFILE', link=DEPS[9])]
 
 def setup_prebuilt():
     setup = open('Setup', 'w')

configtest/test_config_msys.py

 os.environ['LOCALBASE'] = test_dir
 sys.path.append('..')
 
+import dll
 import config_msys
 
 import unittest
 
     class Dependency(object):
         # Holds dependency info
-        def __init__(self, libs=None, inc_dir_rel=None, lib_dir_rel=None):
+        def __init__(self, name=None, inc_dir_rel=None, lib_dir_rel=None, libs=None):
             if libs is None:
-                libs = []
+                if name is None:
+                    libs = []
+                else:
+                    libs = [dll.name_to_root(name)]
             self.libs = libs
             self.inc_dir = None
             self.lib_dir = None
 
     # Pygame dependencies
     expectations = {
-        'SDL': Dependency(['SDL'], 'include/sdl', 'lib'),  # ? uses sdl-config script
-        'FONT': Dependency(['SDL_ttf'], 'include/sdl', 'lib'),
-        'IMAGE': Dependency(['SDL_image'], 'include/sdl', 'lib'),
-        'MIXER': Dependency(['SDL_mixer'], 'include', 'lib'),  # A deviant include dir
-        'SMPEG': Dependency(['smpeg'], 'include', 'lib'),  # ? uses smpeg-config script
-        'PNG': Dependency(['png'], 'include', 'lib'),
-        'JPEG': Dependency(['jpeg'], 'include/sdl', 'lib'),  # A deviant include dir
-        'SCRAP': Dependency(['user32', 'gdi32']),
-        'DLL_SDL': Dependency(lib_dir_rel='bin/sdl.dll'),
-        'DLL_FONT': Dependency(lib_dir_rel='bin/sdl_ttf.dll'),  # Where DLLs likely are
-        'DLL_IMAGE': Dependency(lib_dir_rel='bin/sdl_image.dll'),
-        'DLL_MIXER': Dependency(lib_dir_rel='lib/sdl_mixer.dll'),  # Where the search starts
-        'DLL_SMPEG': Dependency(lib_dir_rel='bin/smpeg.dll'),
-        'DLL_TIFF': Dependency(lib_dir_rel='bin/libtiff.dll'),
-        'DLL_PNG': Dependency(lib_dir_rel='bin/libpng13.dll'),
-        'DLL_JPEG': Dependency(lib_dir_rel='bin/jpeg.dll'),
-        'DLL_Z': Dependency(lib_dir_rel='bin/zlib1.dll'),
-        'DLL_VORBISFILE': Dependency(lib_dir_rel='bin/libvorbisfile-3.dll'),
-        'DLL_VORBIS': Dependency(lib_dir_rel='bin/libvorbis-0.dll'),
-        'DLL_OGG': Dependency(lib_dir_rel='bin/libogg-0.dll'),
+        'SDL': Dependency('SDL', 'include/sdl', 'lib'),  # ? uses sdl-config script
+        'FONT': Dependency('FONT', 'include/sdl', 'lib'),
+        'IMAGE': Dependency('IMAGE', 'include/sdl', 'lib'),
+        'MIXER': Dependency('MIXER', 'include', 'lib'),  # A deviant include dir
+        'SMPEG': Dependency('SMPEG', 'include', 'lib'),  # ? uses smpeg-config script
+        'PNG': Dependency('PNG', 'include', 'lib'),
+        'JPEG': Dependency('JPEG', 'include/sdl', 'lib'),  # A deviant include dir
+        'SCRAP': Dependency(libs=['user32', 'gdi32']),
+        'COPYLIB_SDL': Dependency('SDL', lib_dir_rel='bin/sdl.dll'),
+        'COPYLIB_FONT': Dependency('FONT', lib_dir_rel='bin/sdl_ttf.dll'),  # Where DLLs likely are
+        'COPYLIB_IMAGE': Dependency('IMAGE', lib_dir_rel='bin/sdl_image.dll'),
+        'COPYLIB_MIXER': Dependency('MIXER', lib_dir_rel='lib/sdl_mixer.dll'),  # Where the search starts
+        'COPYLIB_SMPEG': Dependency('SMPEG', lib_dir_rel='bin/smpeg.dll'),
+        'COPYLIB_TIFF': Dependency('TIFF', lib_dir_rel='bin/libtiff.dll'),
+        'COPYLIB_PNG': Dependency('PNG', lib_dir_rel='bin/libpng13.dll'),
+        'COPYLIB_JPEG': Dependency('JPEG', lib_dir_rel='bin/jpeg.dll'),
+        'COPYLIB_Z': Dependency('Z', lib_dir_rel='bin/zlib1.dll'),
+        'COPYLIB_VORBISFILE': Dependency('VORBISFILE', lib_dir_rel='bin/libvorbisfile-3.dll'),
+        'COPYLIB_VORBIS': Dependency('VORBIS', lib_dir_rel='bin/libvorbis-0.dll'),
+        'COPYLIB_OGG': Dependency('OGG', lib_dir_rel='bin/libogg-0.dll'),
         }
 
     def test_dependencies(self):
 
     def test_dll_match(self):
         """Ensure DLLs match with dll.py."""
-        import dll
-        
         for name in dll.regexs:
-            self.failUnless('DLL_' + name in dependencies, name)
+            self.failUnless('COPYLIB_' + name in dependencies, name)
 
     def test_found(self):
         """Ensure all dependencies were found"""

configtest/test_config_win.py

 import sys
 sys.path.append('..')
 import config_win
+import dll
 
 import unittest
 import os
 
     class Dependency(object):
         # Holds dependency info
-        def __init__(self, libs=None, inc_dir_rel=None, lib_dir_rel=None):
+        def __init__(self, name=None, inc_dir_rel=None, lib_dir_rel=None, libs=None):
             if libs is None:
-                libs = []
+                if name is None:
+                    libs = []
+                else:
+                    libs = [dll.name_to_root(name)]
             self.libs = libs
             self.inc_dir = None
             self.lib_dir = None
 
     # Pygame dependencies
     expectations = {
-        'SDL': Dependency(['SDL'], 'sdl-1.2.12/include', 'sdl-1.2.12/visualc/sdl/release'),
-        'FONT': Dependency(['SDL_ttf'], 'sdl_ttf-2.0.9', 'sdl_ttf-2.0.9/release'),
-        'IMAGE': Dependency(['SDL_image'], 'sdl_image-1.2.6', 'sdl_image-1.2.6/visualc/release'),
-        'MIXER': Dependency(['SDL_mixer'], 'sdl_mixer-1.2.8', 'sdl_mixer-1.2.8/release'),
-        'SMPEG': Dependency(['smpeg'], 'smpeg', 'smpeg/release'),
-        'PNG': Dependency(['png'], 'libpng-1.2.19', 'libpng-1.2.19/lib'),
-        'JPEG': Dependency(['jpeg'], 'jpeg-6b', 'jpeg-6b/release'),
-        'SCRAP': Dependency(['user32', 'gdi32']),
-        'DLL_SDL': Dependency(lib_dir_rel='sdl-1.2.12/visualc/sdl/release/sdl.dll'),
-        'DLL_FONT': Dependency(lib_dir_rel='sdl_ttf-2.0.9/release/sdl_ttf.dll'),
-        'DLL_IMAGE': Dependency(lib_dir_rel='sdl_image-1.2.6/visualc/release/sdl_image.dll'),
-        'DLL_MIXER': Dependency(lib_dir_rel='sdl_mixer-1.2.8/release/sdl_mixer.dll'),
-        'DLL_SMPEG': Dependency(lib_dir_rel='smpeg/release/smpeg.dll'),
-        'DLL_TIFF': Dependency(lib_dir_rel='tiff-3.8.2/release/libtiff.dll'),
-        'DLL_PNG': Dependency(lib_dir_rel='libpng-1.2.19/lib/libpng13.dll'),
-        'DLL_JPEG': Dependency(lib_dir_rel='jpeg-6b/release/jpeg.dll'),
-        'DLL_Z': Dependency(lib_dir_rel='zlib-1.2.3/release/zlib1.dll'),
-        'DLL_VORBISFILE': Dependency(lib_dir_rel='libvorbis-1.2.0/release/libvorbisfile-3.dll'),
-        'DLL_VORBIS': Dependency(lib_dir_rel='libvorbis-1.2.0/release/libvorbis-0.dll'),
-        'DLL_OGG': Dependency(lib_dir_rel='libogg-1.1.3/release/libogg-0.dll'),
+        'SDL': Dependency('SDL', 'sdl-1.2.12/include', 'sdl-1.2.12/visualc/sdl/release'),
+        'FONT': Dependency('FONT', 'sdl_ttf-2.0.9', 'sdl_ttf-2.0.9/release'),
+        'IMAGE': Dependency('IMAGE', 'sdl_image-1.2.6', 'sdl_image-1.2.6/visualc/release'),
+        'MIXER': Dependency('MIXER', 'sdl_mixer-1.2.8', 'sdl_mixer-1.2.8/release'),
+        'SMPEG': Dependency('SMPEG', 'smpeg', 'smpeg/release'),
+        'PNG': Dependency('PNG', 'libpng-1.2.19', 'libpng-1.2.19/lib'),
+        'JPEG': Dependency('JPEG', 'jpeg-6b', 'jpeg-6b/release'),
+        'SCRAP': Dependency(libs=['user32', 'gdi32']),
+        'COPYLIB_SDL': Dependency('SDL',
+                                  lib_dir_rel='sdl-1.2.12/visualc/sdl/release/sdl.dll'),
+        'COPYLIB_FONT': Dependency('FONT',
+                                   lib_dir_rel='sdl_ttf-2.0.9/release/sdl_ttf.dll'),
+        'COPYLIB_IMAGE': Dependency('IMAGE',
+                                    lib_dir_rel='sdl_image-1.2.6/visualc/release/sdl_image.dll'),
+        'COPYLIB_MIXER': Dependency('MIXER',
+                                    lib_dir_rel='sdl_mixer-1.2.8/release/sdl_mixer.dll'),
+        'COPYLIB_SMPEG': Dependency('SMPEG', lib_dir_rel='smpeg/release/smpeg.dll'),
+        'COPYLIB_TIFF': Dependency('TIFF', lib_dir_rel='tiff-3.8.2/release/libtiff.dll'),
+        'COPYLIB_PNG': Dependency('PNG', lib_dir_rel='libpng-1.2.19/lib/libpng13.dll'),
+        'COPYLIB_JPEG': Dependency('JPEG', lib_dir_rel='jpeg-6b/release/jpeg.dll'),
+        'COPYLIB_Z': Dependency('Z', lib_dir_rel='zlib-1.2.3/release/zlib1.dll'),
+        'COPYLIB_VORBISFILE': Dependency('VORBISFILE',
+                                         lib_dir_rel='libvorbis-1.2.0/release/libvorbisfile-3.dll'),
+        'COPYLIB_VORBIS': Dependency('VORBIS',
+                                     lib_dir_rel='libvorbis-1.2.0/release/libvorbis-0.dll'),
+        'COPYLIB_OGG': Dependency('OGG', lib_dir_rel='libogg-1.1.3/release/libogg-0.dll'),
         }
 
     def test_dependencies(self):
 
     def test_dll_match(self):
         """Ensure DLLs match with dll.py."""
-        import dll
-        
         for name in dll.regexs:
-            self.failUnless('DLL_' + name in dependencies, name)
+            self.failUnless('COPYLIB_' + name in dependencies, name)
 
     def test_found(self):
         """Ensure all dependencies were found"""

configtest/test_dll.py

         """Check special case of an empty library list"""
         self.failUnless(not dll.dependencies([]))
 
+class RootNameLookupTestCase(unittest.TestCase):
+    def test_found(self):
+        """Ensure name -> file root name works for at least one case"""
+        self.failUnlessEqual(dll.name_to_root('FONT'), 'SDL_ttf')
+
+    def test_not_found(self):
+        """Ensure an exception is raised for an unrecognized name"""
+        def test():
+            dll.name_to_root('*')
+        self.failUnlessRaises(KeyError, test)
+        
 if __name__ == '__main__':
     unittest.main()
 
 import re
 
-#re file patterns and dependencies of Pygame DLL dependencies
-regexs = {
-    'MIXER': r'(lib){0,1}SDL_mixer\.dll$',
-    'VORBISFILE': r'(lib){0,1}vorbisfile(-3){0,1}\.dll$',
-    'VORBIS': r'(lib){0,1}vorbis(-0){0,1}\.dll$',
-    'OGG': r'(lib){0,1}ogg(-0){0,1}\.dll$',
-    'SMPEG': r'(lib){0,1}smpeg\.dll$',
-    'IMAGE': r'(lib){0,1}SDL_image\.dll$',
-    'TIFF': r'(lib){0,1}tiff\.dll$',
-    'JPEG': r'(lib){0,1}jpeg\.dll$',
-    'PNG': r'(lib){0,1}png(1[23])\.dll$',
-    'FONT': r'(lib){0,1}SDL_ttf\.dll$',
-    'Z': r'zlib1\.dll$',
-    'SDL': r'(lib){0,1}SDL\.dll$',
-    }
+# Table of dependencies.
+# Name, File root name, File regex, Dependency list of file root names
+dependencies = [
+    ('MIXER', 'SDL_mixer',  r'(lib){0,1}SDL_mixer\.dll$', ['SDL', 'vorbisfile', 'smpeg']),
+    ('VORBISFILE', 'vorbisfile',  r'(lib){0,1}vorbisfile(-3){0,1}\.dll$',  ['vorbis']),
+    ('VORBIS', 'vorbis', r'(lib){0,1}vorbis(-0){0,1}\.dll$', ['ogg']),
+    ('OGG', 'ogg', r'(lib){0,1}ogg(-0){0,1}\.dll$', []),
+    ('SMPEG', 'smpeg', r'(lib){0,1}smpeg\.dll$', ['SDL']),
+    ('IMAGE', 'SDL_image', r'(lib){0,1}SDL_image\.dll$', ['SDL', 'jpeg', 'png', 'tiff']),
+    ('TIFF', 'tiff', r'(lib){0,1}tiff\.dll$',  ['jpeg', 'z']),
+    ('JPEG', 'jpeg', r'(lib){0,1}jpeg\.dll$', []),
+    ('PNG', 'png', r'(lib){0,1}png(1[23])\.dll$', ['z']),
+    ('FONT', 'SDL_ttf', r'(lib){0,1}SDL_ttf\.dll$', ['SDL', 'z']),
+    ('Z', 'z', r'zlib1\.dll$', []),
+    ('SDL', 'SDL', r'(lib){0,1}SDL\.dll$', [])
+]
 
-lib_dependencies = {
-    'SDL_mixer': ['SDL', 'vorbisfile', 'smpeg'],
-    'vorbisfile': ['vorbis'],
-    'vorbis': ['ogg'],
-    'ogg': [],
-    'smpeg': ['SDL'],
-    'SDL_image': ['SDL', 'jpeg', 'png', 'tiff'],
-    'tiff': ['jpeg', 'z'],
-    'jpeg': [],
-    'png': ['z'],
-    'SDL_ttf': ['SDL', 'z'],
-    'z': [],
-    'SDL': [],
-    }
+# regexs: Maps name to regex.
+# lib_dependencies: Maps file root name to list of dependencies.
+# file_root_name: Maps name to root name.
+
+regexs = {}
+lib_dependencies = {}
+file_root_names = {}
+for name, root, regex, deps in dependencies:
+    regexs[name] = regex
+    lib_dependencies[root] = deps
+    file_root_names[name] = root
 
 def tester(name):
     def test(f):
             r[lib] = 1
             r.update(dependencies(deps))
     return r
+
+def name_to_root(name):
+    return file_root_names[name]
     the_dlls = {}
     required_dlls = {}
     for e in extensions:
-        if e.name.startswith('COPYLIB__'):
-            the_dlls[e.name[9:]] = e.library_dirs[0]
+        if e.name.startswith('COPYLIB_'):
+            the_dlls[e.libraries[0]] = e.library_dirs[0]
         else:
             required_dlls.update(dll.dependencies(e.libraries))
     for lib in required_dlls:
 
 #clean up the list of extensions
 for e in extensions[:]:
-    if e.name[:8] == 'COPYLIB_':
+    if e.name.startswith('COPYLIB_'):
         extensions.remove(e) #don't compile the COPYLIBs, just clean them
     else:
         e.name = 'pygame.' + e.name #prepend package name on modules