[ghc] add bcond for system libffi and fix system libffi build

Jens Petersen petersen at fedoraproject.org
Fri Nov 5 08:32:20 UTC 2010


commit 8b84ee0dba6d4c04b10be038c936a1739f41fc52
Author: Jens Petersen <petersen at redhat.com>
Date:   Fri Nov 5 18:28:54 2010 +1000

    add bcond for system libffi and fix system libffi build
    
    - rename ghc-use-system-libffi-debian.patch to ghc-use-system-libffi.patch.
    - add ffi to SRC_HC_OPTS
    - use pkgconfig-depends in compiler/ghc.cabal for libffi

 ...ffi-debian.patch => ghc-use-system-libffi.patch |   12 ++++++++++++
 ghc.spec                                           |   16 +++++++++++++---
 2 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/ghc-use-system-libffi-debian.patch b/ghc-use-system-libffi.patch
similarity index 90%
rename from ghc-use-system-libffi-debian.patch
rename to ghc-use-system-libffi.patch
index 7284553..04ecde7 100644
--- a/ghc-use-system-libffi-debian.patch
+++ b/ghc-use-system-libffi.patch
@@ -108,3 +108,15 @@ Index: ghc6-6.12.3/rts/package.conf.in
  hugs-options:
  cc-options:
  
+diff -u ghc-6.12.3/compiler/ghc.cabal.in\~ ghc-6.12.3/compiler/ghc.cabal.in
+--- ghc-6.12.3/compiler/ghc.cabal.in~	2010-06-10 04:10:09.000000000 +1000
++++ ghc-6.12.3/compiler/ghc.cabal.in	2010-11-05 18:08:11.000000000 +1000
+@@ -83,7 +83,7 @@
+     if flag(ghci)
+         Build-Depends: template-haskell
+         CPP-Options: -DGHCI
+-        Include-Dirs: ../libffi/build/include
++        pkgconfig-depends: libffi
+ 
+     if !flag(ncg)
+         CPP-Options: -DOMIT_NATIVE_CODEGEN
diff --git a/ghc.spec b/ghc.spec
index 1e8fd71..b9de313 100644
--- a/ghc.spec
+++ b/ghc.spec
@@ -13,6 +13,8 @@
 %bcond_without testsuite
 # include colored html src
 %bcond_without hscolour
+# use system libffi
+%bcond_without libffi
 
 ## default disabled options ##
 # include extralibs
@@ -53,7 +55,9 @@ Obsoletes: ghc-time-devel < 1.1.2.4-5
 Obsoletes: ghc-time-doc < 1.1.2.4-5
 BuildRequires: ghc, ghc-rpm-macros >= 0.8.2
 BuildRequires: gmp-devel, ncurses-devel
+%if %{with libffi}
 BuildRequires: libffi-devel
+%endif
 Requires: gcc, gmp-devel
 %if %{with shared}
 Requires: %{name}-libs = %{version}-%{release}
@@ -70,7 +74,7 @@ BuildRequires: python
 Patch1: ghc-6.12.1-gen_contents_index-haddock-path.patch
 Patch2: ghc-gen_contents_index-type-level.patch
 Patch3: ghc-gen_contents_index-cron-batch.patch
-Patch4: ghc-use-system-libffi-debian.patch
+Patch4: ghc-use-system-libffi.patch
 
 %description
 GHC is a state-of-the-art programming suite for Haskell, a purely
@@ -118,9 +122,11 @@ They should be installed when GHC's profiling subsystem is needed.
 # disable gen_contents_index when not --batch for cron
 %patch3 -p1
 # use system libffi
+%if %{with libffi}
 %patch4 -p1 -b .libffi
+%endif
 
-# prefer system libraries
+# use system libraries
 rm -r ghc-tarballs
 
 %build
@@ -142,6 +148,9 @@ SplitObjs          = NO
 %if %{without hscolour}
 HSCOLOUR_SRCS = NO
 %endif
+%if %{with libffi}
+SRC_HC_OPTS += -lffi
+%endif
 EOF
 
 export CFLAGS="${CFLAGS:-%optflags}"
@@ -296,7 +305,8 @@ fi
 * Thu Nov  4 2010 Jens Petersen <petersen at redhat.com> - 6.12.3-8
 - add a cronjob for doc indexing
 - disable gen_contents_index when not run with --batch for cron
-- use system libffi with ghc-use-system-libffi-debian.patch
+- use system libffi with ghc-use-system-libffi.patch from debian
+- add bcond for system libffi
 
 * Thu Nov  4 2010 Jens Petersen <petersen at redhat.com> - 6.12.3-7
 - skip huge type-level docs from haddock re-indexing (#649228)


More information about the scm-commits mailing list