summaryrefslogtreecommitdiff
blob: f3b0c71c5454d8c9cd6c8f796ad7357b35954db5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
--- ghc-7.5.20120505-orig/ghc.mk	2012-05-06 03:01:29.000000000 +1000
+++ ghc-7.5.20120505/ghc.mk	2012-05-06 17:22:01.023416003 +1000
@@ -584,7 +584,6 @@
    $(MAYBE_GHCI) \
    driver/ghc \
    driver/haddock \
-   libffi \
    includes \
    rts
 
--- ghc-7.5.20120505-orig/rts/ghc.mk	2012-05-06 03:01:30.000000000 +1000
+++ ghc-7.5.20120505/rts/ghc.mk	2012-05-06 17:28:31.925897226 +1000
@@ -171,12 +171,12 @@
 # Making a shared library for the RTS.
 ifneq "$$(findstring dyn, $1)" ""
 ifeq "$$(HostOS_CPP)" "mingw32" 
-$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend rts/dist/build/$$(LIBFFI_DLL)
+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend
 	"$$(RM)" $$(RM_OPTS) $$@
 	"$$(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
-$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend rts/dist/build/libffi$$(soext)
+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend
 	"$$(RM)" $$(RM_OPTS) $$@
 	"$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
 	  -no-auto-link-packages -Lrts/dist/build -lffi `cat rts/libs.depend` $$(rts_$1_OBJS) \
@@ -187,9 +187,9 @@
 endif
 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) $$@
 endif
 
@@ -407,6 +407,12 @@
 rts/dist/build/sm/Evac_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
 rts/dist/build/sm/Scav_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
 
+# Use system libffi
+libffi_include_flags:=$(shell pkg-config --cflags-only-I libffi)
+rts/Adjustor_CC_OPTS += $(libffi_include_flags)
+rts/Interpreter_CC_OPTS += $(libffi_include_flags)
+rts/sm/Storage_CC_OPTS += $(libffi_include_flags)
+
 #-----------------------------------------------------------------------------
 # Add PAPI library if needed
 
@@ -508,10 +514,8 @@
 # installing
 
 INSTALL_LIBS += $(ALL_RTS_LIBS)
-INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*)
-INSTALL_LIBS += $(wildcard rts/dist/build/$(LIBFFI_DLL))
 
-install: install_libffi_headers
+install:
 
 .PHONY: install_libffi_headers
 install_libffi_headers :
--- ghc-7.5.20120505-orig/rts/package.conf.in	2012-05-06 03:01:30.000000000 +1000
+++ ghc-7.5.20120505/rts/package.conf.in	2012-05-06 17:22:01.025416056 +1000
@@ -24,8 +24,9 @@
 hs-libraries:   "HSrts"
 
 extra-libraries:
+				"ffi"
 #ifdef HAVE_LIBM
-                		"m"		/* for ldexp() */
+			      , "m"		/* for ldexp() */
 #endif
 #ifdef HAVE_LIBRT
 			      , "rt"
--- ghc-7.5.20120505-orig/compiler/ghc.mk	2012-05-06 03:01:29.000000000 +1000
+++ ghc-7.5.20120505/compiler/ghc.mk	2012-05-06 17:22:01.026416083 +1000
@@ -260,6 +260,8 @@
 
 compiler_CPP_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
 compiler_CPP_OPTS += ${GhcCppOpts}
+libffi_include_flags := $(shell pkg-config --cflags-only-I libffi)
+compiler/ghci/LibFFI_HSC2HS_OPTS += $(addprefix --cflag=,$(libffi_include_flags))
 
 $(PRIMOPS_TXT) compiler/parser/Parser.y: %: %.pp compiler/stage1/$(PLATFORM_H)
 	$(CPP) $(RAWCPP_FLAGS) -P $(compiler_CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@