diff -r b775a2029e8d -r 440fbe52b4a8 setup.py --- a/setup.py Mon Apr 14 18:21:26 2014 -0500 +++ b/setup.py Tue Apr 15 16:27:12 2014 -0400 @@ -61,6 +61,7 @@ "Couldn't import standard bz2 (incomplete Python install).") import os, subprocess, time +import re import shutil import tempfile from distutils import log @@ -73,7 +74,7 @@ from distutils.spawn import spawn, find_executable from distutils import cygwinccompiler from distutils.errors import CCompilerError, DistutilsExecError -from distutils.sysconfig import get_python_inc +from distutils.sysconfig import get_python_inc, get_config_var from distutils.version import StrictVersion convert2to3 = '--c2to3' in sys.argv @@ -505,22 +506,36 @@ setupversion = version.split('+', 1)[0] if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'): - # XCode 4.0 dropped support for ppc architecture, which is hardcoded in - # distutils.sysconfig version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines() if version: version = version[0] xcode4 = (version.startswith('Xcode') and StrictVersion(version.split()[1]) >= StrictVersion('4.0')) + xcode51 = re.match(r'^Xcode\s+5\.1\.', version) is not None else: # xcodebuild returns empty on OS X Lion with XCode 4.3 not # installed, but instead with only command-line tools. Assume # that only happens on >= Lion, thus no PPC support. xcode4 = True + xcode51 = False + # XCode 4.0 dropped support for ppc architecture, which is hardcoded in + # distutils.sysconfig if xcode4: os.environ['ARCHFLAGS'] = '' + # XCode 5.1 changes clang such that it now fails to compile if the + # -mno-fused-madd flag is passed, but the version of Python shipped with + # OS X 10.9 Mavericks includes this flag. This causes problems in all + # C extension modules, and a bug has been filed upstream at + # http://bugs.python.org/issue21244. We also need to patch this here + # so Mercurial can continue to compile in the meantime. + if xcode51: + cflags = get_config_var('CFLAGS') + if re.search(r'-mno-fused-madd\b', cflags) is not None: + os.environ['CFLAGS'] = ( + os.environ.get('CFLAGS', '') + ' -Qunused-arguments') + setup(name='mercurial', version=setupversion, author='Matt Mackall and many others',