Hello community,

here is the log from the commit of package ghc for openSUSE:Factory checked in 
at 2013-08-01 17:14:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc (Old)
 and      /work/SRC/openSUSE:Factory/.ghc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc/ghc.changes  2013-06-05 11:52:03.000000000 
+0200
+++ /work/SRC/openSUSE:Factory/.ghc.new/ghc.changes     2013-08-01 
17:14:25.000000000 +0200
@@ -2 +2 @@
-Sun May 19 07:05:39 UTC 2013 - [email protected]
+Tue Jul 16 15:01:54 UTC 2013 - [email protected]
@@ -4,2 +4 @@
-- ghc-pkg allocates memeory in an infinite loop and then crashes
-  when glibc-locale is not installed, so require glibc-locale for
+- add comment to explain why glibc-locale is required by
@@ -6,0 +6,25 @@
+
+-------------------------------------------------------------------
+Fri May 17 15:53:07 UTC 2013 - [email protected]
+
+- glibc-locale required by ghc-pkg 
+
+-------------------------------------------------------------------
+Fri May  3 07:38:55 UTC 2013 - [email protected]
+
+- update to 7.6.3 from upstream
+- part of Haskell Platform 2013.2
+- new languages features (polymorphic kinds, ...)
+- do compiler upgrade in one submit request by bootstrapping
+  ghc if necessary and use that ghc to selfbootstrap new
+  ghc
+- replaced ghc-use-system-libffi.patch with new patch for
+  Haskell trac #5743 (add configure option to use system libffi)
+- drop Cabal-fix-dynamic-exec-for-TH.patch: Fixed upstream
+- drop ghc-6.12.1-gen_contents_index-haddock-path.patch which used
+  system provided haddock and that causes trouble when bootstrapping
+- drop ghc-gen_contents_index-type-level.patch: fixed upstream
+- drop patch ghc-fix-undefined-openpty.patch: Fixed upstream
+- drop patch 0001-Add-missing-flag-for-respecting-EXTRA_LIBDIR.patch:
+  Fixed upstream
+- port to new ghc-rpm-macros

Old:
----
  0001-Add-missing-flag-for-respecting-EXTRA_LIBDIR.patch
  Cabal-fix-dynamic-exec-for-TH.patch
  ghc-6.12.1-gen_contents_index-haddock-path.patch
  ghc-7.4.2-src.tar.bz2
  ghc-fix-undefined-openpty.patch
  ghc-gen_contents_index-type-level.patch

New:
----
  ghc-7.6.3-src.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc.spec ++++++
--- /var/tmp/diff_new_pack.pXBdga/_old  2013-08-01 17:14:27.000000000 +0200
+++ /var/tmp/diff_new_pack.pXBdga/_new  2013-08-01 17:14:27.000000000 +0200
@@ -16,14 +16,8 @@
 #
 
 
-# To bootstrap a new version of ghc, uncomment the following:
-#%%global ghc_bootstrapping 1
-#%%{?ghc_bootstrap}
-#%%global without_hscolour 1
-#%%global without_manual 1
-
 Name:           ghc
-Version:        7.4.2
+Version:        7.6.3
 Release:        0
 Url:            
http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.bz2
 Summary:        The Glorious Glasgow Haskell Compiler
@@ -31,12 +25,8 @@
 Group:          Development/Languages/Other
 ExclusiveArch:  %{ix86} x86_64
 
-%if %{defined ghc_bootstrapping}
-BuildRequires:  ghc-compiler >= 6.12
-%else
-BuildRequires:  ghc-compiler = %version
-%endif
 BuildRequires:  ghc-bytestring-devel
+BuildRequires:  ghc-compiler >= 7.0
 BuildRequires:  ghc-containers-devel
 BuildRequires:  ghc-directory-devel
 BuildRequires:  ghc-haskell98-devel
@@ -72,7 +62,7 @@
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  gcc
-BuildRequires:  ghc-rpm-macros >= 0.91
+BuildRequires:  ghc-rpm-macros-extra
 BuildRequires:  glibc-devel
 BuildRequires:  gmp-devel
 BuildRequires:  libffi-devel
@@ -83,26 +73,15 @@
 BuildRequires:  docbook-xsl-stylesheets
 BuildRequires:  libxslt
 %endif
-%if %{undefined without_haddock} && %{undefined without_hscolour}
-BuildRequires:  hscolour
-%endif
 PreReq:         update-alternatives
 Requires:       ghc-compiler = %{version}-%{release}
 Requires:       ghc-ghc-devel = %{version}-%{release}
 Requires:       ghc-libraries = %{version}-%{release}
 Source:         
http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.bz2
-# PATCH-FIX-UPSTREAM ghc-use-system-libffi.patch 
[email protected] - See Haskell trac #4496 and #5743
+# PATCH-FIX-UPSTREAM ghc-use-system-libffi.patch 
[email protected] - See Haskell trac #4496 and #5743; backport 
of our patch accepted upstream for next major release.
 Patch:          ghc-use-system-libffi.patch
 # PATCH-FIX-UPSTREAM ghc-suse-as-needed.patch [email protected] 
-- temporary fix for Haskell trac #7062, ghc libraries do not work with 
as_needed and new-dtags both enabled
 Patch1:         ghc-suse-as-needed.patch
-# fedora patch 9: fix dynamic linking of executables using Template Haskell
-Patch2:         Cabal-fix-dynamic-exec-for-TH.patch
-Patch3:         ghc-6.12.1-gen_contents_index-haddock-path.patch
-Patch4:         ghc-gen_contents_index-type-level.patch
-# PATCH-FIX-UPSTREAM ghc-fix-undefined-openpty.patch 
[email protected] -- backport of upstream fix for #7062
-Patch5:         ghc-fix-undefined-openpty.patch
-# PATCH-FIX-UPSTREAM 0001-Add-missing-flag-for-respecting-EXTRA_LIBDIR.patch 
[email protected] -- backport of upstream fix for #7062
-Patch6:         0001-Add-missing-flag-for-respecting-EXTRA_LIBDIR.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
@@ -128,6 +107,9 @@
 Group:          Development/Languages/Other
 Requires:       gcc
 Requires:       ghc-base-devel
+# This Requires fixes an issue in ghc's runtime system (rts) when
+# locale files are missing. RTS loops and a memory leak eventually
+# exhausts all memory and the program crashes. 
 Requires:       glibc-locale
 Requires(post): update-alternatives
 Requires(postun): update-alternatives
@@ -148,30 +130,29 @@
 %global ghc_pkg_c_deps ghc-compiler = %{ghc_version_override}-%{release}
 
 %if %{defined ghclibdir}
-%ghc_lib_subpackage Cabal 1.14.0
-%ghc_lib_subpackage array 0.4.0.0
-%ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.5.1.0
-%ghc_lib_subpackage binary 0.5.1.0
-%ghc_lib_subpackage bytestring 0.9.2.1
-%ghc_lib_subpackage containers 0.4.2.1
-%ghc_lib_subpackage deepseq 1.3.0.0
-%ghc_lib_subpackage directory 1.1.0.2
-%ghc_lib_subpackage extensible-exceptions 0.1.1.4
-%ghc_lib_subpackage filepath 1.3.0.0
+%ghc_lib_subpackage Cabal 1.16.0
+%ghc_lib_subpackage array 0.4.0.1
+%ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.6.0.1
+%ghc_lib_subpackage binary 0.5.1.1
+%ghc_lib_subpackage bytestring 0.10.0.2
+%ghc_lib_subpackage containers 0.5.0.0
+%ghc_lib_subpackage deepseq 1.3.0.1
+%ghc_lib_subpackage directory 1.2.0.1
+%ghc_lib_subpackage filepath 1.3.0.1
 %define ghc_pkg_obsoletes ghc-bin-package-db-devel < 0.0.0.0-%{release}
 %ghc_lib_subpackage -x ghc %{ghc_version_override}
 %undefine ghc_pkg_obsoletes
-%ghc_lib_subpackage haskell2010 1.1.0.1
-%ghc_lib_subpackage haskell98 2.0.0.1
-%ghc_lib_subpackage hoopl 3.8.7.3
-%ghc_lib_subpackage hpc 0.5.1.1
-%ghc_lib_subpackage old-locale 1.0.0.4
-%ghc_lib_subpackage old-time 1.1.0.0
+%ghc_lib_subpackage haskell2010 1.1.1.0
+%ghc_lib_subpackage haskell98 2.0.0.2
+%ghc_lib_subpackage hoopl 3.9.0.0
+%ghc_lib_subpackage hpc 0.6.0.0
+%ghc_lib_subpackage old-locale 1.0.0.5
+%ghc_lib_subpackage old-time 1.1.0.1
 %ghc_lib_subpackage pretty 1.1.1.0
-%ghc_lib_subpackage process 1.1.0.1
-%ghc_lib_subpackage template-haskell 2.7.0.0
-%ghc_lib_subpackage time 1.4
-%ghc_lib_subpackage unix 2.5.1.1
+%ghc_lib_subpackage process 1.1.0.2
+%ghc_lib_subpackage template-haskell 2.8.0.0
+%ghc_lib_subpackage time 1.4.0.1
+%ghc_lib_subpackage unix 2.6.0.1
 %endif
 
 %global version %{ghc_version_override}
@@ -192,22 +173,31 @@
 
 %prep
 %setup -q
-rm -r ghc-tarballs/{mingw,perl}
+rm -r ghc-tarballs/{mingw,mingw64,perl}
 %patch -p1 -b .libffi
 rm -r ghc-tarballs/libffi
-mkdir -p rts/dist/build
-ln -s $(pkg-config --variable=includedir libffi)/*.h rts/dist/build
 %patch1 -p1 -b .suse
-%patch2 -p1 -b .orig
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
-%patch6 -p1
 
 %build
-# required for patch1
+# required for patch and patch1
 autoreconf -fi
 
+# Check if bootstrap is required, i.e. version is different from ghc's version
+# Note: Cannot use ghc_version macro here as we defined version override 
earlier
+%if "%version" != "%(ghc --numeric-version)"
+%define ghc_boot 1
+cat > mk/build.mk <<EOF
+GhcLibWays = v
+HADDOCK_DOCS = NO
+BUILD_DOCBOOK_HTML = NO
+HSCOLOUR_SRCS = NO
+EOF
+./configure --prefix=%{_builddir}/ghc-boot --with-system-libffi
+make %{?_smp_mflags}
+make install
+make clean
+%endif
+
 # http://hackage.haskell.org/trac/ghc/wiki/Platforms
 # cf https://github.com/gentoo-haskell/gentoo-haskell/tree/master/dev-lang/ghc
 cat > mk/build.mk << EOF
@@ -230,6 +220,8 @@
   --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \
   --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \
   --docdir=%{ghcdocroot} \
+  %{?ghc_boot:--with-ghc=%{_builddir}/ghc-boot/bin/ghc} \
+  --with-system-libffi \
   --with-gcc=%{_bindir}/gcc
 
 make %{?_smp_mflags}
@@ -242,18 +234,19 @@
 name=$(echo $i | sed -e "s/\(.*\)-.*/\1/")
 ver=$(echo $i | sed -e "s/.*-\(.*\)/\1/")
 %ghc_gen_filelists $name $ver
-echo "%doc libraries/$name/LICENSE" >> 
ghc-$name%{?ghc_without_shared:-devel}.files
+echo "%doc libraries/$name/LICENSE" >> ghc-$name.files
 done
 
+# ghc-base should own ghclibdir
+echo "%dir %{ghclibdir}" >> ghc-base.files
+
 %ghc_gen_filelists bin-package-db 0.0.0.0
 %ghc_gen_filelists ghc %{ghc_version_override}
-%ghc_gen_filelists ghc-prim 0.2.0.0
-%ghc_gen_filelists integer-gmp 0.4.0.0
+%ghc_gen_filelists ghc-prim 0.3.0.0
+%ghc_gen_filelists integer-gmp 0.5.0.0
 
 %define merge_filelist()\
-%if %{undefined ghc_without_shared}\
 cat ghc-%1.files >> ghc-%2.files\
-%endif\
 cat ghc-%1-devel.files >> ghc-%2-devel.files\
 cp -p libraries/%1/LICENSE libraries/LICENSE.%1\
 echo "%doc libraries/LICENSE.%1" >> ghc-%2.files
@@ -263,20 +256,20 @@
 %merge_filelist bin-package-db ghc
 
 %if %{undefined ghc_without_shared}
-ls $RPM_BUILD_ROOT%{ghclibdir}/libHS*.so >> ghc-base.files
-sed -i -e "s|^$RPM_BUILD_ROOT||g" ghc-base.files
+ls %{buildroot}%{ghclibdir}/libHS*.so >> ghc-base.files
+sed -i -e "s|^%{buildroot}||g" ghc-base.files
 %endif
-ls -d $RPM_BUILD_ROOT%{ghclibdir}/libHS*.a  
$RPM_BUILD_ROOT%{ghclibdir}/package.conf.d/builtin_*.conf 
$RPM_BUILD_ROOT%{ghclibdir}/include >> ghc-base-devel.files
-sed -i -e "s|^$RPM_BUILD_ROOT||g" ghc-base-devel.files
+ls -d %{buildroot}%{ghclibdir}/libHS*.a  
%{buildroot}%{ghclibdir}/package.conf.d/builtin_*.conf 
%{buildroot}%{ghclibdir}/include >> ghc-base-devel.files
+sed -i -e "s|^%{buildroot}||g" ghc-base-devel.files
 
 # these are handled as alternatives
 for i in hsc2hs runhaskell; do
-  if [ -x ${RPM_BUILD_ROOT}%{_bindir}/$i-ghc ]; then
-    rm ${RPM_BUILD_ROOT}%{_bindir}/$i
+  if [ -x %{buildroot}%{_bindir}/$i-ghc ]; then
+    rm %{buildroot}%{_bindir}/$i
   else
-    mv ${RPM_BUILD_ROOT}%{_bindir}/$i{,-ghc}
+    mv %{buildroot}%{_bindir}/$i{,-ghc}
   fi
-  touch ${RPM_BUILD_ROOT}%{_bindir}/$i
+  touch %{buildroot}%{_bindir}/$i
 done
 
 %ghc_strip_dynlinked
@@ -343,9 +336,9 @@
 %ghost %attr(755,root,root) %{_bindir}/hsc2hs
 %{_bindir}/hsc2hs-ghc
 %{_bindir}/runghc
+%{_bindir}/runghc-%{version}
 %ghost %attr(755,root,root) %{_bindir}/runhaskell
 %{_bindir}/runhaskell-ghc
-%dir %{ghclibdir}
 %{ghclibdir}/settings
 %{ghclibdir}/ghc
 %{ghclibdir}/ghc-pkg
@@ -376,9 +369,10 @@
 %endif
 %{ghcdocbasedir}/libraries/frames.html
 %{ghcdocbasedir}/libraries/gen_contents_index
-%{ghcdocbasedir}/libraries/hscolour.css
+%{ghcdocbasedir}/libraries/hslogo-16.png
 %{ghcdocbasedir}/libraries/ocean.css
 %{ghcdocbasedir}/libraries/prologue.txt
+%{ghcdocbasedir}/libraries/synopsis.png
 %{ghcdocbasedir}/index.html
 %ghost %{ghcdocbasedir}/libraries/doc-index*.html
 %ghost %{ghcdocbasedir}/libraries/haddock-util.js

++++++ ghc-7.4.2-src.tar.bz2 -> ghc-7.6.3-src.tar.bz2 ++++++
/work/SRC/openSUSE:Factory/ghc/ghc-7.4.2-src.tar.bz2 
/work/SRC/openSUSE:Factory/.ghc.new/ghc-7.6.3-src.tar.bz2 differ: char 11, line 
1

++++++ ghc-suse-as-needed.patch ++++++
--- /var/tmp/diff_new_pack.pXBdga/_old  2013-08-01 17:14:27.000000000 +0200
+++ /var/tmp/diff_new_pack.pXBdga/_new  2013-08-01 17:14:27.000000000 +0200
@@ -1,7 +1,8 @@
-diff -Nur ghc-7.4.2/aclocal.m4 ghc-7.4.2-fix-rpath/aclocal.m4
---- ghc-7.4.2/aclocal.m4       2012-06-06 19:10:25.000000000 +0200
-+++ ghc-7.4.2-fix-rpath/aclocal.m4     2012-07-27 21:01:32.000000000 +0200
-@@ -437,6 +437,13 @@
+Index: ghc-7.6.3/aclocal.m4
+===================================================================
+--- ghc-7.6.3.orig/aclocal.m4
++++ ghc-7.6.3/aclocal.m4
+@@ -465,6 +465,13 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
          $4="$$4     $LdReduceMemoryOverheads"
      fi
  
@@ -15,7 +16,7 @@
      rm -f conftest.c conftest.o
      AC_MSG_RESULT([done])
  ])
-@@ -833,6 +840,17 @@
+@@ -894,6 +901,17 @@ FP_PROG_LD_FLAG([--reduce-memory-overhea
  ])# FP_PROG_LD_ReduceMemoryOverheads
  
  
@@ -33,10 +34,11 @@
  # FP_PROG_LD_BUILD_ID
  # ------------
  
-diff -Nur ghc-7.4.2/configure.ac ghc-7.4.2-fix-rpath/configure.ac
---- ghc-7.4.2/configure.ac     2012-06-06 19:10:25.000000000 +0200
-+++ ghc-7.4.2-fix-rpath/configure.ac   2012-07-27 20:57:16.000000000 +0200
-@@ -426,6 +426,8 @@
+Index: ghc-7.6.3/configure.ac
+===================================================================
+--- ghc-7.6.3.orig/configure.ac
++++ ghc-7.6.3/configure.ac
+@@ -597,6 +597,8 @@ FP_CC_LLVM_BACKEND
  
  FP_PROG_LD_HashSize31
  FP_PROG_LD_ReduceMemoryOverheads

++++++ ghc-use-system-libffi.patch ++++++
--- /var/tmp/diff_new_pack.pXBdga/_old  2013-08-01 17:14:27.000000000 +0200
+++ /var/tmp/diff_new_pack.pXBdga/_new  2013-08-01 17:14:27.000000000 +0200
@@ -1,83 +1,298 @@
-This patch could be replaced by a configure call if
-http://hackage.haskell.org/trac/ghc/ticket/5743 were fixed.
-
-Index: ghc-7.4.0.20111219/rts/package.conf.in
-===================================================================
---- ghc-7.4.0.20111219.orig/rts/package.conf.in        2011-12-21 
23:21:03.000000000 +0100
-+++ ghc-7.4.0.20111219/rts/package.conf.in     2011-12-21 23:21:04.000000000 
+0100
-@@ -24,8 +24,9 @@
- hs-libraries:   "HSrts"
- 
- extra-libraries:
-+                              "ffi"
- #ifdef HAVE_LIBM
--                              "m"             /* for ldexp() */
-+                            , "m"             /* for ldexp() */
- #endif
- #ifdef HAVE_LIBRT
-                             , "rt"
-Index: ghc-7.4.0.20111219/ghc.mk
-===================================================================
---- ghc-7.4.0.20111219.orig/ghc.mk     2011-12-21 23:21:03.000000000 +0100
-+++ ghc-7.4.0.20111219/ghc.mk  2011-12-21 23:21:04.000000000 +0100
-@@ -579,7 +579,6 @@
-    driver/ghci \
+diff --git a/configure.ac b/configure.ac
+index e43a59b..fc67ca7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -89,6 +89,57 @@ AC_ARG_WITH([ghc],
+   fi
+   WithGhc="$GHC"])
+ 
++# system libffi
++
++AC_ARG_WITH([system-libffi],
++[AC_HELP_STRING([--with-system-libffi=ARG],
++  [Use system provided module ARG for libffi for RTS [default=no]])
++])
++
++AS_IF([test "x$with_system_libffi" = "xyes"], [
++  with_system_libffi=libffi])
++
++AS_IF([test "x$with_system_libffi" = "x" ], [
++  with_system_libffi=no])
++
++AS_IF([test "x$with_system_libffi" = "xno"], [
++ UseSystemLibFFI="NO"
++ FFIIncludeDir=
++ FFILibDir=
++ LIBFFI_CFLAGS=
++ LIBFFI_LIBS="-optl -Wl,-rpath=\${ghclibdir} -Lrts/dist/build -lffi"
++])
++
++# Should use this but we cannot run aclocal as it would overwrite
++# FP_* macros in aclocal.m4
++# PKG_CHECK_MODULES([LIBFFI], [libffi])
++
++AS_IF([test "x$with_system_libffi" != "xno"], [
++ UseSystemLibFFI="YES"
++ FFIIncludeDir=`pkg-config --variable=includedir $with_system_libffi`
++ FFILibDir=`pkg-config --variable=libdir $with_system_libffi`
++ LIBFFI_CFLAGS=`pkg-config --cflags $with_system_libffi`
++ LIBFFI_LIBS=`pkg-config --libs $with_system_libffi`
++# temporarily set CFLAGS and LIBS
++ CFLAGS2="$CFLAGS"
++ CFLAGS="$LIBFFI_CFLAGS"
++ LIBS2="$LIBS"
++ LIBS="$LIBFFI_LIBS"
++ AS_IF([test "$UseSystemLibFFI" = "YES"], [
++ AC_CHECK_LIB(ffi, ffi_call,
++  [AC_CHECK_HEADERS([ffi/ffi.h ffi.h], [break], [])
++   AC_DEFINE([HAVE_LIBFFI], [1], [Define to 1 if you have libffi.])],
++  [UseSystemLibFFI="NO"])])
++ CFLAGS="$CFLAGS2"
++ LIBS="$LIBS2"
++])
++
++   
++AC_SUBST(UseSystemLibFFI)
++AC_SUBST(FFIIncludeDir)
++AC_SUBST(FFILibDir)
++AC_SUBST(LIBFFI_CFLAGS)
++AC_SUBST(LIBFFI_LIBS)
+ 
+ dnl ** Tell the make system which OS we are using
+ dnl $OSTYPE is set by the operating system to "msys" or "cygwin" or something 
+diff --git a/ghc.mk b/ghc.mk
+index 48d247a..eed3fa5 100644
+--- a/ghc.mk
++++ b/ghc.mk
+@@ -52,7 +52,7 @@
+ #     * For each package:
+ #         o configure, generate package-data.mk and inplace-pkg-info
+ #           o register each package into inplace/lib/package.conf
+-#     * build libffi
++#     * build libffi (if not disabled by --with-system-libffi)
+ #     * With bootstrapping compiler:
+ #         o Build libraries/{filepath,hpc,Cabal}
+ #           o Build compiler (stage 1)
+@@ -595,12 +595,18 @@ else
+ MAYBE_GHCI=driver/ghci
+ endif
+ 
++ifeq "$(UseSystemLibFFI)" "YES"
++MAYBE_LIBFFI=
++else
++MAYBE_LIBFFI=libffi
++endif
++
+ BUILD_DIRS += \
+    driver \
+    $(MAYBE_GHCI) \
     driver/ghc \
     driver/haddock \
 -   libffi \
++   $(MAYBE_LIBFFI) \
     includes \
     rts
  
-Index: ghc-7.4.0.20111219/rts/ghc.mk
-===================================================================
---- ghc-7.4.0.20111219.orig/rts/ghc.mk 2011-12-21 19:56:29.000000000 +0100
-+++ ghc-7.4.0.20111219/rts/ghc.mk      2011-12-21 23:23:52.000000000 +0100
-@@ -86,8 +86,7 @@
- ALL_RTS_DEF_LIBNAMES  = base ghc-prim
- ALL_RTS_DEF_LIBS      = \
-       rts/dist/build/win32/libHSbase.dll.a \
--      rts/dist/build/win32/libHSghc-prim.dll.a \
--      libffi/build/inst/lib/libffi.dll.a
-+      rts/dist/build/win32/libHSghc-prim.dll.a 
- 
- # -- import libs for the regular Haskell libraries
- define make-importlib-def # args $1 = lib name
-@@ -172,12 +171,12 @@
+@@ -994,10 +1000,11 @@ endif
+ 
+ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
+ 
++# don't include libffi when building with system libffi
+ unix-binary-dist-prep:
+       $(call removeTrees,bindistprep/)
+       "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
+-      set -e; for i in packages LICENSE compiler ghc rts libraries utils docs 
libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess 
install-sh settings.in ghc.mk inplace distrib/configure.ac distrib/README 
distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
++      set -e; for i in packages LICENSE compiler ghc rts libraries utils docs 
$(MAYBE_LIBFFI) includes driver mk rules Makefile aclocal.m4 config.sub 
config.guess install-sh settings.in ghc.mk inplace distrib/configure.ac 
distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
+       echo "HADDOCK_DOCS       = $(HADDOCK_DOCS)"       >> $(BIN_DIST_MK)
+       echo "LATEX_DOCS         = $(LATEX_DOCS)"         >> $(BIN_DIST_MK)
+       echo "BUILD_DOCBOOK_HTML = $(BUILD_DOCBOOK_HTML)" >> $(BIN_DIST_MK)
+diff --git a/mk/config.mk.in b/mk/config.mk.in
+index 81298e4..258cdc0 100644
+--- a/mk/config.mk.in
++++ b/mk/config.mk.in
+@@ -362,6 +362,16 @@ GhcRtsWithPapi = NO
+ PapiLibDir=
+ PapiIncludeDir=
+ 
++# Configuration for libffi
++UseSystemLibFFI=@UseSystemLibFFI@
++# Flags to go into package.conf for rts
++FFILibDir=@FFILibDir@
++FFIIncludeDir=@FFIIncludeDir@
++# gcc flags needed for libffi
++LIBFFI_CFLAGS=@LIBFFI_CFLAGS@
++LIBFFI_LIBS=@LIBFFI_LIBS@
++
++
+ 
################################################################################
+ #
+ #             Paths (see paths.mk)
+diff --git a/rts/Adjustor.c b/rts/Adjustor.c
+index 1a0bc28..e088dce 100644
+--- a/rts/Adjustor.c
++++ b/rts/Adjustor.c
+@@ -43,7 +43,14 @@ Haskell side.
+ #include "Stable.h"
+ 
+ #if defined(USE_LIBFFI_FOR_ADJUSTORS)
++#include "ghcconfig.h"
++#ifdef HAVE_FFI_H
++#include <ffi.h>
++#elif defined(HAVE_FFI_FFI_H)
++#include <ffi/ffi.h>
++#else
+ #include "ffi.h"
++#endif
+ #include <string.h>
+ #endif
+ 
+diff --git a/rts/Interpreter.c b/rts/Interpreter.c
+index d879fd3..7819fc9 100644
+--- a/rts/Interpreter.c
++++ b/rts/Interpreter.c
+@@ -37,7 +37,14 @@
+ #endif
+ #endif
+ 
++#include "ghcconfig.h"
++#ifdef HAVE_FFI_H
++#include <ffi.h>
++#elif defined(HAVE_FFI_FFI_H)
++#include <ffi/ffi.h>
++#else
+ #include "ffi.h"
++#endif
+ 
+ /* --------------------------------------------------------------------------
+  * The bytecode interpreter
+diff --git a/rts/ghc.mk b/rts/ghc.mk
+index 9fdf6be..408e485 100644
+--- a/rts/ghc.mk
++++ b/rts/ghc.mk
+@@ -104,6 +104,10 @@ $(foreach lib,$(ALL_RTS_DEF_LIBNAMES),$(eval $(call 
make-importlib-def,$(lib))))
+ endif
+ 
+ ifneq "$(BINDIST)" "YES"
++ifeq "$(UseSystemLibFFI)" "YES"
++rts_ffi_objs_stamp =
++rts_ffi_objs       =
++else
+ 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 $$@)/.
+@@ -118,6 +122,7 @@ rts/dist/build/libffi$(soext): 
libffi/build/inst/lib/libffi$(soext)
+ rts/dist/build/$(LIBFFI_DLL): libffi/build/inst/bin/$(LIBFFI_DLL)
+       cp $< $@
+ endif
++endif
+ 
+ #-----------------------------------------------------------------------------
+ # Building one way
+@@ -174,6 +179,12 @@ endif
+ 
+ rts_dist_$1_CC_OPTS += -DRtsWay=\"rts_$1\"
+ 
++ifeq "$(UseSystemLibFFI)" "NO"
++rts_dist_FFI_SO = rts/dist/build/libffi$(soext)
++else
++rts_dist_FFI_SO =
++endif
++
  # Making a shared library for the RTS.
  ifneq "$$(findstring dyn, $1)" ""
- ifeq "$$(HOSTPLATFORM)" "i386-unknown-mingw32"
--$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend 
rts/dist/build/libffi-5.dll
-+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend
-       "$$(RM)" $$(RM_OPTS) $$@
+ ifeq "$$(HostOS_CPP)" "mingw32" 
+@@ -182,10 +193,10 @@ $$(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 -lffi-5 `cat rts/libs.depend` 
$$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
+         -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
++$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend 
$$(rts_dist_FFI_SO)
        "$$(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) \
-@@ -188,9 +187,9 @@
+-        -no-auto-link-packages -Lrts/dist/build -lffi `cat rts/libs.depend` 
$$(rts_$1_OBJS) \
++        -no-auto-link-packages $$(LIBFFI_LIBS) `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.
+@@ -374,10 +385,11 @@ rts/dist/build/AutoApply_HC_OPTS += -fno-PIC -static
  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) $$@
+ 
++# add CFLAGS for libffi
+ # ffi.h triggers prototype warnings, so disable them here:
+-rts/Interpreter_CC_OPTS += -Wno-strict-prototypes
+-rts/Adjustor_CC_OPTS    += -Wno-strict-prototypes
+-rts/sm/Storage_CC_OPTS  += -Wno-strict-prototypes
++rts/Interpreter_CC_OPTS += -Wno-strict-prototypes $(LIBFFI_CFLAGS)
++rts/Adjustor_CC_OPTS    += -Wno-strict-prototypes $(LIBFFI_CFLAGS)
++rts/sm/Storage_CC_OPTS  += -Wno-strict-prototypes $(LIBFFI_CFLAGS)
+ 
+ # inlining warnings happen in Compact
+ rts/sm/Compact_CC_OPTS += -Wno-inline
+@@ -435,6 +447,21 @@ rts_PACKAGE_CPP_OPTS += -DPAPI_LIB_DIR=""
+ 
  endif
  
-@@ -504,10 +503,8 @@
- # installing
++#-----------------------------------------------------------------------------
++# Use system provided libffi
++
++ifeq "$(UseSystemLibFFI)" "YES"
++
++rts_PACKAGE_CPP_OPTS    += -DFFI_INCLUDE_DIR=$(FFIIncludeDir)
++rts_PACKAGE_CPP_OPTS    += -DFFI_LIB_DIR=$(FFILibDir)
++
++else # UseSystemLibFFI==YES
++
++rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR=""
++rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR=""
++
++endif
++
+ # 
-----------------------------------------------------------------------------
+ # dependencies
  
- INSTALL_LIBS += $(ALL_RTS_LIBS)
--INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*)
--INSTALL_LIBS += $(wildcard rts/dist/build/libffi-5.dll)
+@@ -512,7 +539,11 @@ 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
++ifneq "$(UseSystemLibFFI)" "YES"
+ install: install_libffi_headers
++else
 +install:
++endif
  
  .PHONY: install_libffi_headers
  install_libffi_headers :
+diff --git a/rts/package.conf.in b/rts/package.conf.in
+index 727b586..6bf3b50 100644
+--- a/rts/package.conf.in
++++ b/rts/package.conf.in
+@@ -33,6 +33,9 @@ extra-libraries:
+ #ifdef HAVE_LIBDL
+                             , "dl"
+ #endif
++#ifdef HAVE_LIBFFI
++                              , "ffi"
++#endif
+ #ifdef mingw32_HOST_OS
+                             ,"wsock32"    /* for the linker */
+                             ,"gdi32"      /* for the linker */
+diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
+index f645cd4..0315d6f 100644
+--- a/rts/sm/Storage.c
++++ b/rts/sm/Storage.c
+@@ -32,7 +32,14 @@
+ 
+ #include <string.h>
+ 
++#include "ghcconfig.h"
++#ifdef HAVE_FFI_H
++#include <ffi.h>
++#elif defined(HAVE_FFI_FFI_H)
++#include <ffi/ffi.h>
++#else
+ #include "ffi.h"
++#endif
+ 
+ /* 
+  * All these globals require sm_mutex to access in THREADED_RTS mode.

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to