changeset 13583:e42d18538e1d stable

fix compiling of extensions for OS X and XCode 4.0
author Alexander Solovyov <alexander@solovyov.net>
date Sat, 12 Mar 2011 12:42:20 +0100
parents b30a488762e1
children 64a458707fd4
files setup.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Sat Mar 12 12:11:09 2011 +0100
+++ b/setup.py	Sat Mar 12 12:42:20 2011 +0100
@@ -373,6 +373,15 @@
     # form W.X.Y.Z, where W,X,Y,Z are numbers in the range 0..65535
     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'], {}).splitlines()[0]
+    # Also parse only first digit, because 3.2.1 can't be parsed nicely
+    if (version.startswith('Xcode') and
+        int(version.split()[1].split('.')[0]) >= 4):
+        os.environ['ARCHFLAGS'] = '-arch i386 -arch x86_64'
+
 setup(name='mercurial',
       version=setupversion,
       author='Matt Mackall',