# HG changeset patch # User Jan Nieuwenhuizen # Date 1346173284 -7200 # Node ID 37158d8bead65f076acfe2e7b172654daa9250c6 # Parent 969b798f4d5c9c7ac2b0c213ffc0427ecb9293c4 python-2.4, python-2.6 tools and cross build fixes. diff -r 969b798f4d5c -r 37158d8bead6 gub/config_cache.py --- a/gub/config_cache.py Wed Aug 29 19:44:04 2012 +0200 +++ b/gub/config_cache.py Tue Aug 28 19:01:24 2012 +0200 @@ -195,6 +195,8 @@ ac_cv_have_dev_ptmx=${ac_cv_have_dev_ptmx=no} ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no} ac_cv_search_dlopen=${ac_cv_search_dlopen=no} +ac_cv_struct_addrinfo=${ac_cv_struct_addrinfo=yes} +ac_cv_struct_sockaddr_storage=${ac_cv_struct_sockaddr_storage=yes} ac_cv_type_struct_sockaddr_storage=${ac_cv_type_struct_sockaddr_storage=yes} ac_exeext=${ac_exeext=} libltdl_cv_lib_dl_dlopen=${libltdl_cv_lib_dl_dlopen=yes} diff -r 969b798f4d5c -r 37158d8bead6 gub/specs/python-2.4.py --- a/gub/specs/python-2.4.py Wed Aug 29 19:44:04 2012 +0200 +++ b/gub/specs/python-2.4.py Tue Aug 28 19:01:24 2012 +0200 @@ -31,9 +31,16 @@ 'python-2.4.5-native.patch', 'python-2.4.5-db4.7.patch', 'python-2.4.5-setup-cross.patch', + 'python-2.6.4-unixcompiler-libtool.patch', ] - dependencies = ['db-devel', 'expat-devel', 'zlib-devel', 'tools::python'] + dependencies = [ + 'db-devel', + 'expat-devel', + 'zlib-devel', + 'tools::python-2.4' + ] force_autoupdate = True + parallel_build_broken = True subpackage_names = ['doc', 'devel', 'runtime', ''] so_modules = [ 'itertools', @@ -41,9 +48,8 @@ 'time', ] not_supported = [] - make_flags = misc.join_lines (r''' -BLDLIBRARY='%(rpath)s -L. -lpython$(VERSION)' -''') + def python_version (self): + return '2.4' def get_conflict_dict (self): return { '': ['python-2.6', 'python-2.4'], @@ -55,7 +61,7 @@ target.AutoBuild.__init__ (self, settings, source) self.CROSS_ROOT = '%(targetdir)s' if 'stat' in misc.librestrict (): - self.install_command = ('LIBRESTRICT_ALLOW=/usr/lib/python2.4/lib-dynload:${LIBRESTRICT_ALLOW-/foo} ' + self.install_command = ('LIBRESTRICT_ALLOW=/usr/lib/python%(python_version)s/lib-dynload:${LIBRESTRICT_ALLOW-/foo} ' + target.AutoBuild.install_command) def patch (self): target.AutoBuild.patch (self) @@ -67,6 +73,16 @@ if self.settings.build_platform == self.settings.target_platform: self.file_sub ([('cross_compiling=(maybe|no|yes)', 'cross_compiling=no')], '%(srcdir)s/configure') + def configure (self): + target.AutoBuild.configure (self) + self.file_sub ([ + ('^CCSHARED=.*', 'CCSHARED = -fPIC'), + ('^LDSHARED=.*', 'LDSHARED = $(CC) -shared -fPIC'), + ('BLDSHARED=.*', 'BLDSHARED = $(CC) -shared -fPIC -L. -lpython%(python_version)s'), + ('^BLDLIBRARY=.*', 'BLDLIBRARY = %(rpath)s -L. -lpython$(VERSION)'), + ], '%(builddir)s/Makefile') + # avoid re-running makesetup and overwriting Makefile + self.system ('cd %(builddir)s && make Modules/config.c') def install (self): target.AutoBuild.install (self) misc.dump_python_config (self) @@ -94,9 +110,6 @@ class Python_2_4__mingw_binary (build.BinaryBuild): source = 'http://lilypond.org/~hanwen/python-2.4.2-windows.tar.gz' - def python_version (self): - return '2.4' - def install (self): build.BinaryBuild.install (self) self.system (''' @@ -109,8 +122,9 @@ def configure (self): Python_2_4.configure (self) self.file_sub ([ - ('^LDSHARED=.*', 'LDSHARED = $(CC) -shared'), - ('BLDSHARED=.*', 'BLDSHARED = $(CC) -shared'), + ('^CFLAGSFORSHARED=.*', 'CFLAGSFORSHARED = -fPIC'), + ('^LDLIBRARY=.*', 'LDLIBRARY = libpython$(VERSION).so'), + ('^INSTSONAME=.*', 'INSTSONAME = libpython$(VERSION).so.0.1'), ], '%(builddir)s/Makefile') class Python_2_4__mingw (Python_2_4): @@ -131,7 +145,7 @@ ''') def __init__ (self, settings, source): Python_2_4.__init__ (self, settings, source) - self.target_gcc_flags = '-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES -I%(system_prefix)s/include' % self.settings.__dict__ + self.target_gcc_flags = '-DMS_WINDOWS -DMS_WIN32 -DPy_WIN_WIDE_FILENAMES -I%(system_prefix)s/include' % self.settings.__dict__ dependencies = Python_2_4.dependencies + ['pthreads-w32-devel'] # FIXME: first is cross compile + mingw patch, backported to # 2.4.2 and combined in one patch; move to cross-Python? @@ -142,13 +156,26 @@ ], "%(srcdir)s/Lib/subprocess.py", must_succeed=True) def configure (self): - Python_2_4.configure (self) + target.AutoBuild.configure (self) self.dump (''' _subprocess ../PC/_subprocess.c msvcrt ../PC/msvcrtmodule.c ''', '%(builddir)s/Modules/Setup', mode='a') + # avoid re-running makesetup and overwriting Makefile + self.system ('cd %(builddir)s && make Modules/config.c') + if 0: + self.file_sub ([ +# ('^LDSHARED=.*', 'LDSHARED = $(CC) -shared -fPIC'), + ('^LIBC=.*', 'LIBC = -lpython%(python_version)s -lwsock32 -luuid -loleaut32 -lole32'), +# ('^EXT_LIBS=.*', 'EXT_LIBS = -lpython%(python_version)s -lwsock32 -luuid -loleaut32 -lole32'), + ], '%(builddir)s/Makefile') + self.dump (''' +EXT_LIBS = -lpython%(python_version)s -lwsock32 -luuid -loleaut32 -lole32 +''', + '%(builddir)s/Makefile', + mode='a') def compile (self): self.system (''' cd %(builddir)s && rm -f python.exe @@ -165,7 +192,7 @@ self.system (''' cd %(builddir)s && cp -p python-windows.exe python-console.exe %(install_prefix)s/bin ''') - self.file_sub ([('extra = ""', 'extra = "-L%(system_prefix)s/bin -L%(system_prefix)s/lib -lpython2.4 -lpthread"')], + self.file_sub ([('extra = ""', 'extra = "-L%(system_prefix)s/bin -L%(system_prefix)s/lib -lpython%(python_version)s -lpthread"')], '%(install_prefix)s%(cross_dir)s/bin/python-config') def rename_so (logger, fname): @@ -185,7 +212,10 @@ # This builds and runs in wine, but produces DLLs that # do not load in Windows Vista if 0: - self.generate_dll_a_and_la ('python2.4', '-lpthread') + self.generate_dll_a_and_la ('python%(python_version)s', '-lpthread') + +class Python_2_4__linux__ppc (Python_2_4): + pass class Python_2_4__tools (tools.AutoBuild, Python_2_4): patches = [ @@ -203,13 +233,15 @@ force_autoupdate = True parallel_build_broken = True not_supported = ['nis', 'crypt'] - make_flags = Python_2_4.make_flags - def get_conflict_dict (self): - return { - '': ['python-2.6', 'python-2.4'], - 'doc': ['python-2.6-doc', 'python-2.4-doc'], - 'devel': ['python-2.6-devel', 'python-2.4-devel'], - 'runtime': ['python-2.6-runtime', 'python-2.4-runtime'], - } + get_conflict_dict = Python_2_4.get_conflict_dict def patch (self): Python_2_4.patch (self) + def configure (self): + tools.AutoBuild.configure (self) + self.file_sub ([ + ('^CCSHARED=.*', 'CCSHARED = -fPIC'), + ('^LDSHARED=.*', 'LDSHARED = $(CC) -shared -fPIC'), + ('BLDSHARED=.*', 'BLDSHARED = $(CC) -shared -fPIC -L. -lpython%(python_version)s'), + ], '%(builddir)s/Makefile') + # avoid re-running makesetup and overwriting Makefile + self.system ('cd %(builddir)s && make Modules/config.c') diff -r 969b798f4d5c -r 37158d8bead6 gub/specs/python-2.6.py --- a/gub/specs/python-2.6.py Wed Aug 29 19:44:04 2012 +0200 +++ b/gub/specs/python-2.6.py Tue Aug 28 19:01:24 2012 +0200 @@ -16,8 +16,9 @@ dependencies = [ 'db-devel', 'expat-devel', + 'libffi-devel', 'zlib-devel', - 'tools::python', + 'tools::python-2.6', ] patches = [ 'python-2.6.4.patch', @@ -33,6 +34,7 @@ 'python-2.6.4-configure.in-cross.patch', 'python-2.6.4-include-pc.patch', 'python-2.6.4-setup-cross.patch', + 'python-2.6.4-unixcompiler-libtool.patch', ] config_cache_overrides = python.Python_2_4.config_cache_overrides + ''' ac_cv_have_chflags=no @@ -45,7 +47,11 @@ 'itertools', 'time', ] + configure_flags = (python.Python_2_4.configure_flags + + ' --with-system-ffi') get_conflict_dict = get_conflict_dict + def python_version (self): + return '2.6' class Python_2_6__mingw (python.Python_2_4__mingw): source = Python_2_6.source @@ -53,15 +59,11 @@ 'python-2.4.2-winsock2.patch', 'python-2.4.2-setup.py-selectmodule.patch', 'python-2.4.5-disable-pwd-mingw.patch', - 'python-2.4.5-mingw-site.patch', + 'python-2.6.4-mingw-site.patch', 'python-2.4.5-mingw-socketmodule.patch', + 'python-2.6.4-mingw-ctypes.patch', ] - dependencies = [ - 'db-devel', - 'expat-devel', - 'zlib-devel', - 'tools::python', - ] + dependencies = Python_2_6.dependencies + ['pthreads-w32-devel'] config_cache_overrides = python.Python_2_4__mingw.config_cache_overrides + ''' ac_cv_have_chflags=no ac_cv_have_lchflags=no @@ -69,27 +71,53 @@ ''' so_modules = Python_2_6.so_modules get_conflict_dict = get_conflict_dict + configure_flags = (python.Python_2_4__mingw.configure_flags + + ' --with-system-ffi') def patch (self): python.Python_2_4__mingw.patch (self) self.system ('cd %(srcdir)s && cp -pv PC/dl_nt.c Python/fileblocks.c') def generate_dll_a_and_la (self, libname, depend=''): - target.AutoBuild.generate_dll_a_and_la (self, 'python2.6', depend) + target.AutoBuild.generate_dll_a_and_la (self, 'python%(python_version)s', depend) + def configure (self): + Python_2_4__mingw.configure (self) + +class Python_2_6__linux__ppc (Python_2_6): + pass -class Python_2_6__mingw_binary (python.Python_2_4__mingw_binary): - get_conflict_dict = get_conflict_dict -class Python_2_6__freebsd (python.Python_2_4__freebsd): - get_conflict_dict = get_conflict_dict +class Python_2_6__freebsd (Python_2_6): + def configure (self): + Python_2_6.configure (self) + self.file_sub ([ + ('^CFLAGSFORSHARED=.*', 'CFLAGSFORSHARED = -fPIC'), + ('^LDLIBRARY=.*', 'LDLIBRARY = libpython$(VERSION).so'), + ('^INSTSONAME=.*', 'INSTSONAME = libpython$(VERSION).so.0.1'), + ], '%(builddir)s/Makefile') + # avoid re-running makesetup and overwriting Makefile + self.system ('cd %(builddir)s && make Modules/config.c') -class Python_2_6__tools (python.Python_2_4__tools): - source = Python_2_6.source +class Python_2_6__tools (tools.AutoBuild, Python_2_6): patches = [ 'python-2.6.4-readline.patch', 'python-2.6.4-setup-cross.patch', ] - dependencies = ['autoconf', 'libtool'] + dependencies = [ + 'autoconf', + 'db', # _bsddb + 'libffi', + 'libtool', + ] force_autoupdate = True - make_flags = python.Python_2_4__tools.make_flags - so_modules = Python_2_6.so_modules - get_conflict_dict = get_conflict_dict + parallel_build_broken = True + not_supported = ['nis', 'crypt'] + configure_flags = (tools.AutoBuild.configure_flags + + ' --with-system-ffi') def patch (self): - tools.AutoBuild.patch (self) + Python_2_6.patch (self) + def configure (self): + tools.AutoBuild.configure (self) + self.file_sub ([ + ('^LDSHARED=.*', 'LDSHARED = $(CC) -shared -fPIC'), + ('BLDSHARED=.*', 'BLDSHARED = $(CC) -shared -fPIC -L. -lpython%(python_version)s'), + ], '%(builddir)s/Makefile') + # avoid re-running makesetup and overwriting Makefile + self.system ('cd %(builddir)s && make Modules/config.c') diff -r 969b798f4d5c -r 37158d8bead6 gub/specs/python.py --- a/gub/specs/python.py Wed Aug 29 19:44:04 2012 +0200 +++ b/gub/specs/python.py Tue Aug 28 19:01:24 2012 +0200 @@ -11,27 +11,41 @@ 'runtime': ['python-2.6-runtime', 'python-2.4-runtime'], } +def unver (dependencies): + return [x.replace ('python-' + tools.python_version, 'python') + for x in dependencies] + if tools.python_version == '2.4': class Python (python.Python_2_4): get_conflict_dict = get_conflict_dict + dependencies = unver (python.Python_2_4.dependencies) class Python__mingw (python.Python_2_4__mingw): get_conflict_dict = get_conflict_dict - class Python__mingw_binary (python.Python_2_4__mingw_binary): + dependencies = unver (python.Python_2_4__mingw.dependencies) + class Python__linux__ppc (python.Python_2_4__linux__ppc): get_conflict_dict = get_conflict_dict + dependencies = unver (python.Python_2_4__linux__ppc.dependencies) class Python__freebsd (python.Python_2_4__freebsd): get_conflict_dict = get_conflict_dict + dependencies = unver (python.Python_2_4__freebsd.dependencies) class Python__tools (python.Python_2_4__tools): get_conflict_dict = get_conflict_dict + dependencies = unver (python.Python_2_4__tools.dependencies) elif tools.python_version == '2.6': class Python (python.Python_2_6): get_conflict_dict = get_conflict_dict + dependencies = unver (python.Python_2_6.dependencies) class Python__mingw (python.Python_2_6__mingw): get_conflict_dict = get_conflict_dict - class Python__mingw_binary (python.Python_2_6__mingw_binary): + dependencies = unver (python.Python_2_6__mingw.dependencies) + class Python__linux__ppc (python.Python_2_6__linux__ppc): get_conflict_dict = get_conflict_dict + dependencies = unver (python.Python_2_6__linux__ppc.dependencies) class Python__freebsd (python.Python_2_6__freebsd): get_conflict_dict = get_conflict_dict + dependencies = unver (python.Python_2_6__freebsd.dependencies) class Python__tools (python.Python_2_6__tools): get_conflict_dict = get_conflict_dict + dependencies = unver (python.Python_2_6__tools.dependencies) else: raise Exception ('No such Python version:' + tools.python_version) diff -r 969b798f4d5c -r 37158d8bead6 patches/python-2.4.5-1.patch --- a/patches/python-2.4.5-1.patch Wed Aug 29 19:44:04 2012 +0200 +++ b/patches/python-2.4.5-1.patch Tue Aug 28 19:01:24 2012 +0200 @@ -275,8 +275,8 @@ Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";; CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";; + mingw*) LDSHARED='$(CC) -mdll' -+ BLDSHARED='$(CC) -mdll libpython$(VERSION).dll' -+ LIBC='-lwsock32';; ++ BLDSHARED='$(CC) -mdll -L. -lpython$(VERSION) -lwsock32 -luuid -loleaut32 -lole32 ' ++ LIBC='-lwsock32 -luuid -loleaut32 -lole32';; atheos*) LDSHARED="gcc -shared";; *) LDSHARED="ld";; esac diff -r 969b798f4d5c -r 37158d8bead6 patches/python-2.4.5-setup-cross.patch --- a/patches/python-2.4.5-setup-cross.patch Wed Aug 29 19:44:04 2012 +0200 +++ b/patches/python-2.4.5-setup-cross.patch Tue Aug 28 19:01:24 2012 +0200 @@ -2,18 +2,23 @@ --- python-2.4.5/setup.py~ 2012-08-27 11:07:07.049617420 +0200 +++ python-2.4.5/setup.py 2012-08-27 11:46:45.350781819 +0200 -@@ -14,6 +14,20 @@ +@@ -5,6 +5,8 @@ + + import sys, os, getopt, imp, re + ++if os.environ.get ('system_root', ''): ++ sys.path.insert (0, os.environ.get ('srcdir', '') + '/Lib') + from distutils import log + from distutils import sysconfig + from distutils import text_file +@@ -14,6 +14,16 @@ from distutils.command.install import install from distutils.command.install_lib import install_lib +def exists_in_sysroot (f): -+ print >>sys.stderr, 'GUB: ', f -+ print >>sys.stderr, 'targetdir', os.environ.get ('targetdir', '') -+ print >>sys.stderr, 'system_root', os.environ.get ('system_root', '') + if (f.startswith ('/') + and not f.startswith (os.environ.get ('alltargetdir', ''))): + f = os.environ.get ('system_root', '') + f -+ print >>sys.stderr, 'GUB: looking for', f + if os_path_exists (f): + return f + return False @@ -40,6 +45,14 @@ # Not found anywhere return None +@@ -174,6 +174,7 @@ class PyBuildExt(build_ext): + headers = glob("Include/*.h") + ["pyconfig.h"] + + for ext in self.extensions[:]: ++ ext.libraries += (sysconfig.get_config_var ('EXT_LIBS') or '').replace ('-l', '').split () + ext.sources = [ find_module_file(filename, moddirlist) + for filename in ext.sources ] + if ext.depends is not None: @@ -590,7 +590,8 @@ for d in inc_dirs + db_inc_paths: f = os.path.join(d, "db.h") @@ -100,3 +113,14 @@ if sys.platform[:6] == "darwin": # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir +--- python-2.4-2.4.5/Lib/distutils/sysconfig.py~ 2009-09-22 21:31:34.000000000 +0200 ++++ python-2.4-2.p.5/Lib/distutils/sysconfig.py 2012-08-28 17:08:01.256687224 +0200 +@@ -217,6 +223,8 @@ def get_config_h_filename(): + + def get_makefile_filename(): + """Return full pathname of installed Makefile from the Python build.""" ++ if os.environ.get('system_root', ''): ++ return 'Makefile' + if python_build: + return os.path.join(os.path.dirname(sys.executable), "Makefile") + lib_dir = get_python_lib(plat_specific=1, standard_lib=1) diff -r 969b798f4d5c -r 37158d8bead6 patches/python-2.6.4-mingw-ctypes.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/python-2.6.4-mingw-ctypes.patch Tue Aug 28 19:01:24 2012 +0200 @@ -0,0 +1,11 @@ +--- python-2.6.4/Modules/_ctypes/callproc.c~ 2009-09-18 22:12:29.000000000 +0200 ++++ python-2.6.4/Modules/_ctypes/callproc.c 2012-08-30 13:55:18.392622132 +0200 +@@ -811,7 +811,7 @@ + #ifndef DONT_USE_SEH + __try { + #endif +- delta = ++ delta = 0; + #endif + ffi_call(&cif, (void *)pProc, resmem, avalues); + #ifdef MS_WIN32 diff -r 969b798f4d5c -r 37158d8bead6 patches/python-2.6.4-mingw-site.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/python-2.6.4-mingw-site.patch Tue Aug 28 19:01:24 2012 +0200 @@ -0,0 +1,11 @@ +--- python-2.6.4/Lib/site.py.orig 2008-05-10 19:36:24.000000000 +0200 ++++ python-2.6.4/Lib/site.py 2012-08-28 22:38:35.384029434 +0200 +@@ -264,7 +264,7 @@ def addsitepackages(known_paths): + + if sys.platform in ('os2emx', 'riscos'): + sitedirs.append(os.path.join(prefix, "Lib", "site-packages")) +- elif os.sep == '/': ++ elif True or os.sep == '/': + sitedirs.append(os.path.join(prefix, "lib", + "python" + sys.version[:3], + "site-packages")) diff -r 969b798f4d5c -r 37158d8bead6 patches/python-2.6.4-setup-cross.patch --- a/patches/python-2.6.4-setup-cross.patch Wed Aug 29 19:44:04 2012 +0200 +++ b/patches/python-2.6.4-setup-cross.patch Tue Aug 28 19:01:24 2012 +0200 @@ -2,18 +2,23 @@ --- python-2-6-2.6.4/setup.py.orig 2012-08-28 08:30:53.821113419 +0200 +++ python-2-6-2.6.4/setup.py 2012-08-28 08:34:36.604832292 +0200 -@@ -16,6 +16,20 @@ +@@ -5,6 +5,8 @@ __version__ = "$Revision: 75282 $" + + import sys, os, imp, re, optparse + from glob import glob ++if os.environ.get ('system_root', ''): ++ sys.path.insert (0, os.environ.get ('srcdir', '') + '/Lib') + from platform import machine as platform_machine + + from distutils import log +@@ -16,6 +16,16 @@ from distutils.command.install import install from distutils.command.install_lib import install_lib +def exists_in_sysroot (f): -+ print >>sys.stderr, 'GUB: ', f -+ print >>sys.stderr, 'targetdir', os.environ.get ('targetdir', '') -+ print >>sys.stderr, 'system_root', os.environ.get ('system_root', '') + if (f.startswith ('/') + and not f.startswith (os.environ.get ('alltargetdir', ''))): + f = os.environ.get ('system_root', '') + f -+ print >>sys.stderr, 'GUB: looking for', f + if os_path_exists (f): + return f + return False @@ -40,6 +45,14 @@ # Not found anywhere return None +@@ -174,6 +174,7 @@ class PyBuildExt(build_ext): + headers = glob("Include/*.h") + ["pyconfig.h"] + + for ext in self.extensions[:]: ++ ext.libraries += (sysconfig.get_config_var ('EXT_LIBS') or '').replace ('-l', '').split () + ext.sources = [ find_module_file(filename, moddirlist) + for filename in ext.sources ] + if ext.depends is not None: @@ -796,7 +811,8 @@ for d in inc_dirs + db_inc_paths: f = os.path.join(d, "db.h") @@ -113,3 +126,14 @@ if sys.platform[:6] == "darwin": # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir +--- python-2.6-2.6.4/Lib/distutils/sysconfig.py~ 2009-09-22 21:31:34.000000000 +0200 ++++ python-2.6-2.6.4/Lib/distutils/sysconfig.py 2012-08-28 17:08:01.256687224 +0200 +@@ -217,6 +223,8 @@ def get_config_h_filename(): + + def get_makefile_filename(): + """Return full pathname of installed Makefile from the Python build.""" ++ if os.environ.get('system_root', ''): ++ return 'Makefile' + if python_build: + return os.path.join(os.path.dirname(sys.executable), "Makefile") + lib_dir = get_python_lib(plat_specific=1, standard_lib=1) diff -r 969b798f4d5c -r 37158d8bead6 patches/python-2.6.4-unixcompiler-libtool.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/python-2.6.4-unixcompiler-libtool.patch Tue Aug 28 19:01:24 2012 +0200 @@ -0,0 +1,25 @@ +--- python-2.6.4/Lib/distutils/unixccompiler.py~ 2012-08-30 08:52:27.832868332 +0200 ++++ python-2.6.4/Lib/distutils/unixccompiler.py 2012-08-30 09:20:59.939718180 +0200 +@@ -301,11 +301,13 @@ + shared_f = self.library_filename(lib, lib_type='shared') + dylib_f = self.library_filename(lib, lib_type='dylib') + static_f = self.library_filename(lib, lib_type='static') ++ libtool_f = static_f.replace ('.a', '.la') + + for dir in dirs: + shared = os.path.join(dir, shared_f) + dylib = os.path.join(dir, dylib_f) + static = os.path.join(dir, static_f) ++ libtool = os.path.join(dir, libtool_f) + # We're second-guessing the linker here, with not much hard + # data to go on: GCC seems to prefer the shared library, so I'm + # assuming that *all* Unix C compilers do. And of course I'm +@@ -316,6 +318,8 @@ + return shared + elif os.path.exists(static): + return static ++ elif os.path.exists(libtool): ++ return libtool + + # Oops, didn't find it in *any* of 'dirs' + return None