From 6667903199f82dd982e2511c06329b80dd419742 Mon Sep 17 00:00:00 2001 From: knodlseder <> Date: Wed, 23 Feb 2011 00:38:12 +0000 Subject: [PATCH] remove compile options for darwin --- pyext/setup.py.in | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+), 0 deletions(-) diff --git a/pyext/setup.py.in b/pyext/setup.py.in index 4b67be3..1ef4755 100644 --- a/pyext/setup.py.in +++ b/pyext/setup.py.in @@ -1,6 +1,35 @@ from distutils.core import setup, Extension +from distutils import sysconfig import glob import os +import sys + +# Removes list of bad prefixes from list +def remove_prefixes(optlist, bad_prefixes): + for bad_prefix in bad_prefixes: + for i, flag in enumerate(optlist): + if flag.startswith(bad_prefix): + optlist.pop(i) + break + return optlist + +# Adjust compile options for darwin +if sys.platform.lower().startswith("darwin"): + + # Remove some time consuming options + cvars = sysconfig.get_config_vars() + cflags = cvars.get('OPT') + if cflags: + cflags = remove_prefixes(cflags.split(), + ['-g', '-O', '-Wstrict-prototypes', '-DNDEBUG']) + cvars['OPT'] = str.join(' ', cflags) + cvars['CFLAGS'] = cvars['BASECFLAGS'] + ' ' + cvars['OPT'] + + # Remove -arch flags. This prevents building a fat library + cvars['ARCHFLAGS'] = '' + + # Signal darwin compiler adjustments + print 'Adjust default distutils compiler options for darwin.' # Remove any existing symbolic link to libctatools.a # This will prevent any exception in creating the symbolic link due to -- libgit2 0.21.4