diff options
author | Austin Seipp <austin@well-typed.com> | 2013-10-25 03:26:23 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2013-10-25 09:14:29 -0500 |
commit | f213e48447050bf468bc4d91fc4d810402c23b85 (patch) | |
tree | 1b90e343bb357755bbd90a97edb763e54484109f /rules/relative-dynlib-references.mk | |
parent | f65473bc4fa8c9664af829629d9d4fb5653154e2 (diff) | |
download | haskell-f213e48447050bf468bc4d91fc4d810402c23b85.tar.gz |
Correctly set relative rpath for OS X (#8266)
This includes both executables (by correcly setting the rpath to the
topDir) and libffi, and GHC itself, so that everything works with no
build tree.
Authored-by: Christiaan Baaj <christiaan.baaij@gmail.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'rules/relative-dynlib-references.mk')
-rw-r--r-- | rules/relative-dynlib-references.mk | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/rules/relative-dynlib-references.mk b/rules/relative-dynlib-references.mk index 923ef089bc..e117ddefb4 100644 --- a/rules/relative-dynlib-references.mk +++ b/rules/relative-dynlib-references.mk @@ -18,17 +18,37 @@ define relative-dynlib-references # $1 = dir # $2 = distdir # $3 = GHC stage to use (0 == bootstrapping compiler) +# $4 = RTSway ifeq "$$(TargetOS_CPP)" "darwin" ifneq "$3" "0" # Use relative paths for all the libraries ifneq "$$($1_$2_TRANSITIVE_DEP_NAMES)" "" - install_name_tool $$(foreach d,$$($1_$2_TRANSITIVE_DEP_NAMES), -change $$(TOP)/$$($$($$d_INSTALL_INFO)_dyn_LIB) @loader_path/../$$d-$$($$($$d_INSTALL_INFO)_VERSION)/$$($$($$d_INSTALL_INFO)_dyn_LIB_NAME)) $$@ + install_name_tool $$(foreach d,$$($1_$2_TRANSITIVE_DEP_NAMES), -change $$(TOP)/$$($$($$d_INSTALL_INFO)_dyn_LIB) @rpath/$$d-$$($$($$d_INSTALL_INFO)_VERSION)/$$($$($$d_INSTALL_INFO)_dyn_LIB_NAME)) $$@ +endif +# Change absolute library name/path to a relative name/path +ifeq "$$($1_$2_PROGNAME)" "" +ifeq "$1" "rts" + install_name_tool -id @rpath/rts-$$(rts_VERSION)/$$(rts_$4_LIB_NAME) $$@ +else + install_name_tool -id @rpath/$$($1_PACKAGE)-$$($1_$2_VERSION)/$$($1_$2_dyn_LIB_NAME) $$@ +endif endif # Use relative paths for the RTS. Rather than try to work out which RTS # way is being linked, we just change it for all ways - install_name_tool $$(foreach w,$$(rts_WAYS), -change $$(TOP)/$$(rts_$$w_LIB) @loader_path/../rts-$$(rts_VERSION)/$$(rts_$$w_LIB_NAME)) $$@ - install_name_tool -change $$(TOP)/$$(wildcard libffi/build/inst/lib/libffi.*.dylib) @loader_path/../rts-$$(rts_VERSION)/libffi.dylib $$@ + install_name_tool $$(foreach w,$$(rts_WAYS), -change $$(TOP)/$$(rts_$$w_LIB) @rpath/rts-$$(rts_VERSION)/$$(rts_$$w_LIB_NAME)) $$@ + install_name_tool -change $$(TOP)/$$(wildcard libffi/build/inst/lib/libffi.*.dylib) @rpath/rts-$$(rts_VERSION)/libffi.dylib $$@ +endif +endif + +endef + +define relative-dynlib-path +# $1 = GHC stage to use (0 == bootstrapping compiler) + +ifeq "$$(TargetOS_CPP)" "darwin" +ifneq "$1" "0" + install_name_tool -rpath $$(TOP)/inplace/lib @loader_path/.. $$@ endif endif |