diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2010-05-08 08:44:37 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2010-05-08 08:44:37 (GMT) |
commit | d875d3c36eb56f9d8d61f2643cbab9d667506955 (patch) | |
tree | 21444ba585bb8dd5e2536fe343a97bef2fc27dca /Lib | |
parent | 22ff664ff7850032118c712023a4882ab23d471b (diff) | |
download | cpython-d875d3c36eb56f9d8d61f2643cbab9d667506955.zip cpython-d875d3c36eb56f9d8d61f2643cbab9d667506955.tar.gz cpython-d875d3c36eb56f9d8d61f2643cbab9d667506955.tar.bz2 |
Fix for issue #7724: make it possible to build using
the OSX 10.4u SDK on MacOSX 10.6 by honoring the specified
SDK when looking for files.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/unixccompiler.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py index 783d4dc..ba831f7 100644 --- a/Lib/distutils/unixccompiler.py +++ b/Lib/distutils/unixccompiler.py @@ -15,7 +15,7 @@ the "typical" Unix-style command-line C compiler: __revision__ = "$Id$" -import os, sys +import os, sys, re from types import StringType, NoneType from distutils import sysconfig @@ -305,10 +305,29 @@ class UnixCCompiler(CCompiler): dylib_f = self.library_filename(lib, lib_type='dylib') static_f = self.library_filename(lib, lib_type='static') + if sys.platform == 'darwin': + # On OSX users can specify an alternate SDK using + # '-isysroot', calculate the SDK root if it is specified + # (and use it further on) + cflags = sysconfig.get_config_var('CFLAGS') + m = re.search(r'-isysroot\s+(\S+)', cflags) + if m is None: + sysroot = '/' + else: + sysroot = m.group(1) + + + 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) + + if sys.platform == 'darwin' and (dir.startswith('/System/') or dir.startswith('/usr/')): + shared = os.path.join(sysroot, dir[1:], shared_f) + dylib = os.path.join(sysroot, dir[1:], dylib_f) + static = os.path.join(sysroot, dir[1:], static_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 |