summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-10-16 21:37:16 +0100
committerIan Lynagh <igloo@earth.li>2011-10-16 21:37:16 +0100
commit4dd52f2ad3347e604d6a77bac1f8cdd8120dcd03 (patch)
treee2bea3c181f15fa088bbdb6f3860e8f105269c0d
parentceef80b2fbd414c701bb2a346226a357475983ad (diff)
downloadhaskell-4dd52f2ad3347e604d6a77bac1f8cdd8120dcd03.tar.gz
On non-Windows, go back to using the libffi dynlib for the dyn way
-rw-r--r--libffi/ghc.mk31
-rw-r--r--rts/ghc.mk27
2 files changed, 43 insertions, 15 deletions
diff --git a/libffi/ghc.mk b/libffi/ghc.mk
index 22ce6389bc..a693bcb44e 100644
--- a/libffi/ghc.mk
+++ b/libffi/ghc.mk
@@ -11,15 +11,37 @@
# -----------------------------------------------------------------------------
-libffi_STAMP_CONFIGURE = libffi/stamp.ffi.configure
-libffi_STAMP_BUILD = libffi/stamp.ffi.build
-libffi_STAMP_INSTALL = libffi/stamp.ffi.install
+libffi_STAMP_STATIC_CONFIGURE = libffi/stamp.ffi.static.configure
+libffi_STAMP_STATIC_BUILD = libffi/stamp.ffi.static.build
+libffi_STAMP_STATIC_INSTALL = libffi/stamp.ffi.static.install
+
+libffi_STAMP_STATIC_SHARED_CONFIGURE = libffi/stamp.ffi.static-shared.configure
+libffi_STAMP_STATIC_SHARED_BUILD = libffi/stamp.ffi.static-shared.build
+libffi_STAMP_STATIC_SHARED_INSTALL = libffi/stamp.ffi.static-shared.install
+
+ifeq "$(BuildSharedLibs)" "YES"
+libffi_STAMP_CONFIGURE = $(libffi_STAMP_STATIC_SHARED_CONFIGURE)
+libffi_STAMP_BUILD = $(libffi_STAMP_STATIC_SHARED_BUILD)
+libffi_STAMP_INSTALL = $(libffi_STAMP_STATIC_SHARED_INSTALL)
+libffi_EnableShared = yes
+else
+libffi_STAMP_CONFIGURE = $(libffi_STAMP_STATIC_CONFIGURE)
+libffi_STAMP_BUILD = $(libffi_STAMP_STATIC_BUILD)
+libffi_STAMP_INSTALL = $(libffi_STAMP_STATIC_INSTALL)
+libffi_EnableShared = no
+endif
libffi_STATIC_LIB = libffi/build/inst/lib/libffi.a
ffi_HEADER = rts/dist/build/ffi.h
ifneq "$(BINDIST)" "YES"
$(libffi_STAMP_CONFIGURE):
+ "$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_CONFIGURE)
+ "$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_BUILD)
+ "$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_INSTALL)
+ "$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_SHARED_CONFIGURE)
+ "$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_SHARED_BUILD)
+ "$(RM)" $(RM_OPTS) $(libffi_STAMP_STATIC_SHARED_INSTALL)
"$(RM)" $(RM_OPTS_REC) $(LIBFFI_DIR) libffi/build
cat ghc-tarballs/libffi/libffi*.tar.gz | $(GZIP_CMD) -d | { cd libffi && $(TAR_CMD) -xf - ; }
mv libffi/libffi-* libffi/build
@@ -43,9 +65,8 @@ $(libffi_STAMP_CONFIGURE):
LDFLAGS="$(SRC_LD_OPTS) $(CONF_GCC_LINKER_OPTS_STAGE1) -w" \
"$(SHELL)" configure \
--prefix=$(TOP)/libffi/build/inst \
- --with-pic \
--enable-static=yes \
- --enable-shared=no \
+ --enable-shared=$(libffi_EnableShared) \
--host=$(HOSTPLATFORM) --build=$(BUILDPLATFORM)
# wc on OS X has spaces in its output, which libffi's Makefile
diff --git a/rts/ghc.mk b/rts/ghc.mk
index a007f1aeb7..fa118c17e9 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -21,7 +21,7 @@ rts_WAYS = $(GhcLibWays) $(filter-out $(GhcLibWays),$(GhcRTSWays))
rts_dist_WAYS = $(rts_WAYS)
ALL_RTS_LIBS = rts/dist/build/libHSrtsmain.a \
- $(foreach way,$(rts_WAYS),rts/dist/build/libHSrts$($(way)_libsuf))
+ $(foreach way,$(rts_WAYS),rts/dist/build/libHSrts$($(way)_libsuf))
all_rts : $(ALL_RTS_LIBS)
# -----------------------------------------------------------------------------
@@ -119,6 +119,18 @@ rts/dist/build/win32/libHSffi.dll.a : rts/dist/build/win32/libHSffi.def
endif
endif
+ifneq "$(BINDIST)" "YES"
+rts_ffi_objs_stamp = rts/dist/ffi/stamp
+rts_ffi_objs = rts/dist/ffi/*.o
+$(rts_ffi_objs_stamp): $(libffi_STATIC_LIB) | $$(dir $$@)/.
+ cd rts/dist/ffi && $(AR) x ../../../$(libffi_STATIC_LIB)
+ touch $@
+
+# 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)
+ cp libffi/build/inst/lib/libffi$(soext)* rts/dist/build
+endif
#-----------------------------------------------------------------------------
# Building one way
@@ -177,14 +189,14 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend
"$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
-no-auto-link-packages `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
else
-$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend $$(rts_ffi_objs_stamp)
+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend rts/dist/build/libffi$$(soext)
"$$(RM)" $$(RM_OPTS) $$@
"$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
- -no-auto-link-packages `cat rts/libs.depend` $$(rts_ffi_objs) $$(rts_$1_OBJS) \
+ -no-auto-link-packages -Lrts/dist/build -lffi `cat rts/libs.depend` $$(rts_$1_OBJS) \
$$(rts_$1_DTRACE_OBJS) -o $$@
ifeq "$$(darwin_HOST_OS)" "1"
# Ensure library's install name is correct before anyone links with it.
- install_name_tool -id $(ghclibdir)/$$(rts_$1_LIB_NAME) $$@
+ install_name_tool -id $$(ghclibdir)/$$(rts_$1_LIB_NAME) $$@
endif
endif
else
@@ -198,12 +210,6 @@ endif
endef
-rts_ffi_objs_stamp = rts/dist/ffi/stamp
-rts_ffi_objs = rts/dist/ffi/*.o
-$(rts_ffi_objs_stamp): $(libffi_STATIC_LIB) | $$(dir $$@)/.
- cd rts/dist/ffi && $(AR) x ../../../$(libffi_STATIC_LIB)
- touch $@
-
# And expand the above for each way:
$(foreach way,$(rts_WAYS),$(eval $(call build-rts-way,$(way))))
@@ -519,6 +525,7 @@ endif
# installing
INSTALL_LIBS += $(ALL_RTS_LIBS)
+INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*)
# -----------------------------------------------------------------------------
# cleaning