Commit 0ed2d85ce2cd2a54c06832399948c775532df83a

Authored by Jürgen Knödlseder
1 parent 770ed30e

Post-process Python modules for El Capitan (#1563).

pyext/Makefile.am
... ... @@ -51,7 +51,7 @@ INST_SWIG_TARGETS = $(MWL_SWIG_TARGETS) \
51 51 $(LAT_SWIG_TARGETS) \
52 52 $(COM_SWIG_TARGETS)
53 53  
54   -# Test scripts to be distributed in $(pyexecdir)/ctools/tests
  54 +# Test scripts to be distributed in $(pyexecdir)/gammalib/tests
55 55 testscripts = gammalib/tests/__init__.py \
56 56 ../test/test_python.py \
57 57 ../test/test_GApplication.py \
... ... @@ -139,6 +139,14 @@ all-local: build
139 139 # Build the gammalib extension module
140 140 build: $(BUILT_SOURCES)
141 141 @PYTHON_BUILD_PREFIX@ $(PYTHON) setup.py build_ext
  142 +if IS_ELCAPITAN
  143 + for f in build/gammalib/_*.so; do \
  144 + echo "Post process module "$$f; \
  145 + install_name_tool -change $(libdir)/libgamma.0.dylib @rpath/libgamma.0.dylib $$f; \
  146 + install_name_tool -add_rpath $(libdir) $$f; \
  147 + install_name_tool -add_rpath $(abs_top_srcdir)/src/.libs $$f; \
  148 + done
  149 +endif
142 150  
143 151 # Do nothing for 'make check'
144 152 #check-local:
... ...
pyext/setup.py.in
... ... @@ -139,6 +139,10 @@ else:
139 139 extra_compile_args = []
140 140 extra_link_args = []
141 141  
  142 +# Optionally add link flag for El Capitan post-processing of modules
  143 +if '@IS_ELCAPITAN_TRUE@' != '#':
  144 + extra_link_args.append('-headerpad_max_install_names')
  145 +
142 146 # Loop over all core modules
143 147 for module in core_modules:
144 148  
... ...