diff options
| author | Stefan Behnel <stefan_ml@behnel.de> | 2012-07-30 10:33:54 +0200 |
|---|---|---|
| committer | Stefan Behnel <stefan_ml@behnel.de> | 2012-07-30 10:33:54 +0200 |
| commit | 3a6bffbf76a9b04b86ad3d9b5daf2a54c86f3155 (patch) | |
| tree | 9ebbb53abd8f6b7f3e9cbadf87a533f3cd4ffad3 /buildlibxml.py | |
| parent | e64c6e90af64b4d41560ec0905ec85afb627a003 (diff) | |
| download | python-lxml-3a6bffbf76a9b04b86ad3d9b5daf2a54c86f3155.tar.gz | |
exclude ppc target from MacOS-X build with XCode 4.0+, patch by John Boiles
Diffstat (limited to 'buildlibxml.py')
| -rw-r--r-- | buildlibxml.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/buildlibxml.py b/buildlibxml.py index ef72112b..eb8f5dcf 100644 --- a/buildlibxml.py +++ b/buildlibxml.py @@ -1,5 +1,5 @@ -import os, re, sys -from distutils import log, sysconfig +import os, re, sys, subprocess +from distutils import log, sysconfig, version try: from urlparse import urlsplit, urljoin @@ -287,18 +287,31 @@ def build_libxml2xslt(download_dir, build_dir, import platform # We compile Universal if we are on a machine > 10.3 major_version, minor_version = tuple(map(int, platform.mac_ver()[0].split('.')[:2])) + # Check to see if ppc is supported (XCode4 drops ppc support) + include_ppc = True + if os.path.exists('/usr/bin/xcodebuild'): + pipe = subprocess.Popen(['/usr/bin/xcodebuild', '-version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = pipe.communicate() + xcode_version = out.splitlines()[0] + # Also parse only first digit, because 3.2.1 can't be parsed nicely + if (xcode_version.startswith('Xcode') and + version.StrictVersion(xcode_version.split()[1]) >= version.StrictVersion('4.0')): + include_ppc = False if major_version > 7: env = os.environ.copy() + arch_string = "" + if include_ppc: + arch_string = "-arch ppc " if minor_version < 6: env.update({ - 'CFLAGS' : "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2", - 'LDFLAGS' : "-arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk", + 'CFLAGS' : arch_string + "-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -O2", + 'LDFLAGS' : arch_string + "-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk", 'MACOSX_DEPLOYMENT_TARGET' : "10.3" }) else: env.update({ - 'CFLAGS' : "-arch ppc -arch i386 -arch x86_64 -O2", - 'LDFLAGS' : "-arch ppc -arch i386 -arch x86_64", + 'CFLAGS' : arch_string + "-arch i386 -arch x86_64 -O2", + 'LDFLAGS' : arch_string + "-arch i386 -arch x86_64", 'MACOSX_DEPLOYMENT_TARGET' : "10.6" }) call_setup['env'] = env |
