summaryrefslogtreecommitdiff
path: root/rts/ghc.mk
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2013-03-23 23:55:56 +0000
committerIan Lynagh <ian@well-typed.com>2013-03-23 23:55:56 +0000
commitb30015e78db99d79cdb48c6c810e3fd49573c5cd (patch)
tree9af9da2639751ba9102486e51591d3501f8cbc27 /rts/ghc.mk
parentf4a2796d85c60ba7d0e3fbc1c5061b30bfb85ca6 (diff)
downloadhaskell-b30015e78db99d79cdb48c6c810e3fd49573c5cd.tar.gz
Change how we handle libffi
I think overall the new approach is simpler. Rather than unpacking the libffi.a and putting the .o files into our libHSrts.a, we just use the libffi.a. This change also means that when compiling programs for the dyn way, they get explicitly linked against libffi.so (rather than relying on librts.so being linked against it). This might fix a problem on FreeBSD, where programs cannot find libffi.so.
Diffstat (limited to 'rts/ghc.mk')
-rw-r--r--rts/ghc.mk39
1 files changed, 22 insertions, 17 deletions
diff --git a/rts/ghc.mk b/rts/ghc.mk
index c56788554a..7324ba07a7 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -104,13 +104,6 @@ endif
ifneq "$(BINDIST)" "YES"
ifneq "$(UseSystemLibFFI)" "YES"
-rts_ffi_objs_stamp = rts/dist/ffi/stamp
-rts_ffi_objs = rts/dist/ffi/*.o
-
-$(rts_ffi_objs_stamp): $(libffi_STATIC_LIB) $(TOUCH_DEP) | $$(dir $$@)/.
- cd rts/dist/ffi && $(AR) x ../../../$(libffi_STATIC_LIB)
- "$(TOUCH_CMD)" $@
-
# This is a little hacky. We don't know the SO version, so we only
# depend on libffi.so, but copy libffi.so*
rts/dist/build/libffi$(soext): libffi/build/inst/lib/libffi$(soext)
@@ -174,8 +167,8 @@ endif
rts_dist_$1_CC_OPTS += -DRtsWay=\"rts_$1\"
-ifneq "$(UseSystemLibFFI)" "YES"
-rts_dist_FFI_SO = rts/dist/build/libffi$(soext)
+ifneq "$$(UseSystemLibFFI)" "YES"
+rts_dist_FFI_SO = rts/dist/build/libffi$$(soext)
else
rts_dist_FFI_SO =
endif
@@ -188,7 +181,7 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend rts/dist/b
"$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
-no-auto-link-packages -Lrts/dist/build -l$(LIBFFI_WINDOWS_LIB) `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
else
-ifneq "$(UseSystemLibFFI)" "YES"
+ifneq "$$(UseSystemLibFFI)" "YES"
LIBFFI_LIBS = -Lrts/dist/build -lffi
ifeq "$$(TargetElf)" "YES"
LIBFFI_LIBS += -optl-Wl,-rpath -optl-Wl,'$$$$ORIGIN'
@@ -205,10 +198,17 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend $$(rts_d
$$(rts_$1_DTRACE_OBJS) -o $$@
endif
else
-$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) $$(rts_ffi_objs_stamp)
+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS)
"$$(RM)" $$(RM_OPTS) $$@
- echo $$(rts_ffi_objs) $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR_STAGE1)" \
+ echo $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR_STAGE1)" \
$$(AR_OPTS_STAGE1) $$(EXTRA_AR_ARGS_STAGE1) $$@
+
+ifneq "$$(UseSystemLibFFI)" "YES"
+$$(rts_$1_LIB) : rts/dist/build/libCffi$$($1_libsuf)
+rts/dist/build/libCffi$$($1_libsuf): libffi/build/inst/lib/libffi.a
+ cp $$< $$@
+endif
+
endif
endif
@@ -459,13 +459,15 @@ endif
ifeq "$(UseSystemLibFFI)" "YES"
-rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR=$(FFIIncludeDir)
-rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR=$(FFILibDir)
+rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR=$(FFIIncludeDir)
+rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR=$(FFILibDir)
+rts_PACKAGE_CPP_OPTS += '-DFFI_LIB='
else # UseSystemLibFFI==YES
-rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR=""
-rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR=""
+rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR=
+rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR=
+rts_PACKAGE_CPP_OPTS += '-DFFI_LIB="Cffi"'
endif
@@ -544,8 +546,11 @@ rts/package.conf.inplace : $(includes_H_CONFIG) $(includes_H_PLATFORM)
# installing
RTS_INSTALL_LIBS += $(ALL_RTS_LIBS)
+ifneq "$(UseSystemLibFFI)" "YES"
RTS_INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*)
-RTS_INSTALL_LIBS += $(wildcard rts/dist/build/$(LIBFFI_DLL))
+RTS_INSTALL_LIBS += $(foreach w,$(filter-out dyn,$(rts_WAYS)),rts/dist/build/libffi$($w_libsuf))
+RTS_INSTALL_LIBS += rts/dist/build/$(LIBFFI_DLL)
+endif
ifneq "$(UseSystemLibFFI)" "YES"
install: install_libffi_headers