Commit 282561611327b414a55573333cdcc6dfbaa9cde7
1 parent
529eb787
adjust LDSHARED variable for Darwin's MacPorts so that the desired libraries are linked
Showing
1 changed file
with
23 additions
and
0 deletions
pyext/setup.py.in
| ... | ... | @@ -32,6 +32,29 @@ if (len(sys.argv) >= 3): |
| 32 | 32 | print "This build is for unit testing." |
| 33 | 33 | is_unit_test = True |
| 34 | 34 | |
| 35 | +# Darwin MacPorts kluge: Remove -L/opt/local/lib path from LDSHARED as this | |
| 36 | +# overrides the GammaLib settings. Otherwise, MacPorts libraries would be | |
| 37 | +# used instead of the libraries selected by GammaLib | |
| 38 | +if sys.platform.lower().startswith("darwin"): | |
| 39 | + | |
| 40 | + # Get configuration variables | |
| 41 | + cvars = sysconfig.get_config_vars() | |
| 42 | + | |
| 43 | + # Extract LDSHARED | |
| 44 | + ldshared_old = cvars.get('LDSHARED') | |
| 45 | + ldshared_new = '' | |
| 46 | + ldshared_rm = '' | |
| 47 | + for option in ldshared_old.split(' '): | |
| 48 | + if option.lstrip().find('-L/opt/local/lib') != 0: | |
| 49 | + ldshared_new += option + ' ' | |
| 50 | + else: | |
| 51 | + ldshared_rm += option + ' ' | |
| 52 | + if (len(ldshared_rm) > 0): | |
| 53 | + print 'Removed following option(s) from LDSHARED: '+ldshared_rm | |
| 54 | + | |
| 55 | + # Set LDSHARED | |
| 56 | + cvars['LDSHARED'] = ldshared_new | |
| 57 | + | |
| 35 | 58 | # Set ctools library name. If we're about to make the test build then |
| 36 | 59 | # create a symbolic link to the static library to enforce static linking. |
| 37 | 60 | # This is required on some system (such as Mac OS X) to avoid problems | ... | ... |