Skip to content

Commit

Permalink
Fix rpath for python on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaerkl-sw committed Mar 6, 2019
1 parent aadfb60 commit 3b822e1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ ${PYTHON_SRC_DIR} ${QT_BIN_DIR} ${PATCHELF_SRC_DIR}:

# Python

ifeq (${PLATFORM},macos)
define macos_fix_python_lib_path
ORIGINAL_PERMS=$$(stat -f "%OLp" "$1") && \
chmod +w "$1" && \
install_name_tool -change `otool -L "$1" | sed -n "s/^[[:blank:]]*\([^[:blank:]]*Python\) (.*$$/\1/p"` "$2" "$1" && \
chmod "$$ORIGINAL_PERMS" "$1"
endef
endif

python: ${PYTHON_SRC_DIR} ${PATCHELF_TARGET}
@echo ""
@echo "#########################"
Expand Down Expand Up @@ -163,6 +172,12 @@ ifeq (${PLATFORM},linux)
done
endif

ifeq (${PLATFORM},macos)
${call macos_fix_python_lib_path,${PYTHON_PREFIX}/bin/python3,@executable_path/../Python}
${call macos_fix_python_lib_path,${PYTHON_PREFIX}/Python,@executable_path/Python}
${call macos_fix_python_lib_path,${PYTHON_PREFIX}/Resources/Python.app/Contents/MacOS/Python,@executable_path/../../../../Python}
endif



.PHONY: clean-python
Expand Down

0 comments on commit 3b822e1

Please sign in to comment.