Fix build with non-Linux ELF OSes
authorIan Lynagh <ian@well-typed.com>
Wed, 20 Mar 2013 19:25:27 +0000 (19:25 +0000)
committerIan Lynagh <ian@well-typed.com>
Wed, 20 Mar 2013 19:25:27 +0000 (19:25 +0000)
We were only setting an RPATH for the RTS DLL on Linux, but as far
as I can see we should be doing it for all ELF OSes. Hopefully this
will fix the problem where the installed ghc-pkg can't find libffi.dll
on FreeBSD.

mk/config.mk.in
rts/ghc.mk

index c818a32..275c21a 100644 (file)
@@ -88,7 +88,13 @@ GhcDynamic=NO
 # GhcProfiled=YES means compile a profiled stage-2 compiler
 GhcProfiled=NO
 
-# Soem platforms don't support shared libraries
+ifeq "$(findstring $(TargetOS_CPP),linux freebsd dragonfly openbsd netbsd solaris2 kfreebsdgnu haiku linux-android)" ""
+TargetElf = NO
+else
+TargetElf = YES
+endif
+
+# Some platforms don't support shared libraries
 NoSharedLibsPlatformList =
 
 ifeq "$(SOLARIS_BROKEN_SHLD)" "YES"
index 09c2874..ce17b74 100644 (file)
@@ -194,7 +194,7 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend rts/dist/b
 else
 ifneq "$(UseSystemLibFFI)" "YES"
 LIBFFI_LIBS = -Lrts/dist/build -lffi 
-ifeq "$$(TargetOS_CPP)" "linux"
+ifeq "$$(TargetElf)" "YES"
 LIBFFI_LIBS += -optl-Wl,-rpath -optl-Wl,'$$$$ORIGIN'
 endif