summaryrefslogtreecommitdiff
path: root/rules/distdir-way-opts.mk
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-11-08 21:46:46 +0000
committerIan Lynagh <ian@well-typed.com>2012-11-08 21:46:46 +0000
commit7dd7008f98c76024288899b8cea607141c91ada5 (patch)
tree05855c7a8096b5e7809be322ef188ebc048b6a21 /rules/distdir-way-opts.mk
parent1a0af0ece368caf0b6752f05e5e571cd4137ef36 (diff)
downloadhaskell-7dd7008f98c76024288899b8cea607141c91ada5.tar.gz
Give dynamic libraries, as well as programs, RPATHs
Based on a patch from markwright in #3072.
Diffstat (limited to 'rules/distdir-way-opts.mk')
-rw-r--r--rules/distdir-way-opts.mk12
1 files changed, 12 insertions, 0 deletions
diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
index ed2a4d0b27..4d27bbfdc8 100644
--- a/rules/distdir-way-opts.mk
+++ b/rules/distdir-way-opts.mk
@@ -172,6 +172,18 @@ $1_$2_DIST_LD_OPTS = \
$$(foreach opt,$$($1_$2_DEP_EXTRA_LIBS),-l$$(opt)) \
$$($1_$2_DEP_LD_OPTS)
+ifeq "$3" "dyn"
+ifneq "$4" "0"
+ifeq "$$(TargetOS_CPP)" "linux"
+$1_$2_$3_GHC_LD_OPTS += \
+ -fno-use-rpaths \
+ $$(foreach d,$$($1_$2_TRANSITIVE_DEPS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'$$$$ORIGIN/../$$d')
+else ifeq "$$(TargetOS_CPP)" "darwin"
+$1_$2_$3_GHC_LD_OPTS += -optl-Wl,-headerpad_max_install_names
+endif
+endif
+endif
+
# c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs
# We use '' around cflags and lflags to handle paths with backslashes in
# on Windows