| 40 | def get_flags_linker_so(self): |
| 41 | opt = self.linker_so[1:] |
| 42 | if sys.platform=='darwin': |
| 43 | # MACOSX_DEPLOYMENT_TARGET must be at least 10.3. This is |
| 44 | # a reasonable default value even when building on 10.4 when using |
| 45 | # the official Python distribution and those derived from it (when |
| 46 | # not broken). |
| 47 | target = os.environ.get('MACOSX_DEPLOYMENT_TARGET', None) |
| 48 | if target is None or target == '': |
| 49 | target = '10.3' |
| 50 | major, minor = target.split('.') |
| 51 | if int(minor) < 3: |
| 52 | minor = '3' |
| 53 | warnings.warn('Environment variable ' |
| 54 | 'MACOSX_DEPLOYMENT_TARGET reset to %s.%s' % (major, minor)) |
| 55 | os.environ['MACOSX_DEPLOYMENT_TARGET'] = '%s.%s' % (major, |
| 56 | minor) |
| 57 | |
| 58 | opt.extend(['-undefined', 'dynamic_lookup', '-bundle']) |
| 59 | else: |
| 60 | opt.append("-shared") |
| 61 | if sys.platform[:5]=='sunos': |
| 62 | # SunOS often has dynamically loaded symbols defined in the |
| 63 | # static library libg2c.a The linker doesn't like this. To |
| 64 | # ignore the problem, use the -mimpure-text flag. It isn't |
| 65 | # the safest thing, but seems to work. 'man gcc' says: |
| 66 | # ".. Instead of using -mimpure-text, you should compile all |
| 67 | # source code with -fpic or -fPIC." |
| 68 | opt.append('-mimpure-text') |
| 69 | return opt |
| 70 | |