From b2f46c4721ab9a11af8d683323d776dc45310738 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Fri, 5 Nov 2010 11:33:43 +1000 Subject: [PATCH] use system libffi with ghc-use-system-libffi-debian.patch --- ghc-use-system-libffi-debian.patch | 110 +++++++++++++++++++++++++++++ ghc.spec | 11 +-- 2 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 ghc-use-system-libffi-debian.patch diff --git a/ghc-use-system-libffi-debian.patch b/ghc-use-system-libffi-debian.patch new file mode 100644 index 0000000..7284553 --- /dev/null +++ b/ghc-use-system-libffi-debian.patch @@ -0,0 +1,110 @@ +Index: ghc6-6.12.3/ghc.mk +=================================================================== +--- ghc6-6.12.3.orig/ghc.mk 2010-06-09 21:10:12.000000000 +0300 ++++ ghc6-6.12.3/ghc.mk 2010-07-17 11:52:25.000000000 +0300 +@@ -369,11 +369,6 @@ + endif + BOOT_LIBS = $(foreach lib,$(BOOT_PKGS),$(libraries/$(lib)_dist-boot_v_LIB)) + +-OTHER_LIBS = libffi/dist-install/build/libHSffi$(v_libsuf) libffi/dist-install/build/HSffi.o +-ifeq "$(BuildSharedLibs)" "YES" +-OTHER_LIBS += libffi/dist-install/build/libHSffi$(dyn_libsuf) +-endif +- + # We cannot run ghc-cabal to configure a package until we have + # configured and registered all of its dependencies. So the following + # hack forces all the configure steps to happen in exactly the order +@@ -406,7 +401,6 @@ + # add the final two package.conf dependencies: ghc-prim depends on RTS, + # and RTS depends on libffi. + libraries/ghc-prim/dist-install/package-data.mk : rts/package.conf.inplace +-rts/package.conf.inplace : libffi/package.conf.inplace + endif + + # ----------------------------------------------------------------------------- +@@ -518,7 +512,6 @@ + driver \ + driver/ghci \ + driver/ghc \ +- libffi \ + includes \ + rts + +@@ -863,11 +856,10 @@ + $(addprefix libraries/,$(PACKAGES_STAGE2)) + + install_packages: install_libexecs +-install_packages: libffi/package.conf.install rts/package.conf.install ++install_packages: rts/package.conf.install + $(INSTALL_DIR) "$(DESTDIR)$(topdir)" + "$(RM)" -r $(RM_OPTS) "$(INSTALLED_PACKAGE_CONF)" + $(INSTALL_DIR) "$(INSTALLED_PACKAGE_CONF)" +- "$(INSTALLED_GHC_PKG_REAL)" --force --global-conf "$(INSTALLED_PACKAGE_CONF)" update libffi/package.conf.install + "$(INSTALLED_GHC_PKG_REAL)" --force --global-conf "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install + $(foreach p, $(ALL_INSTALLED_PACKAGES),\ + "$(GHC_CABAL_INPLACE)" install \ +@@ -942,7 +934,7 @@ + unix-binary-dist-prep: + "$(RM)" $(RM_OPTS) -r bindistprep/ + "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR) +- set -e; for i in LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.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 LICENSE compiler ghc rts libraries utils docs includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.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) +@@ -1020,7 +1012,7 @@ + # + # Files to include in source distributions + # +-SRC_DIST_DIRS = mk rules docs distrib bindisttest libffi includes utils docs rts compiler ghc driver libraries ghc-tarballs ++SRC_DIST_DIRS = mk rules docs distrib bindisttest includes utils docs rts compiler ghc driver libraries ghc-tarballs + SRC_DIST_FILES += \ + configure.ac config.guess config.sub configure \ + aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \ +Index: ghc6-6.12.3/rts/ghc.mk +=================================================================== +--- ghc6-6.12.3.orig/rts/ghc.mk 2010-06-09 21:10:14.000000000 +0300 ++++ ghc6-6.12.3/rts/ghc.mk 2010-07-17 11:52:25.000000000 +0300 +@@ -333,15 +333,13 @@ + + $(eval $(call build-dependencies,rts,dist,1)) + +-$(rts_dist_depfile) : libffi/dist-install/build/ffi.h +- + #----------------------------------------------------------------------------- + # libffi stuff + +-rts_CC_OPTS += -Ilibffi/build/include +-rts_HC_OPTS += -Ilibffi/build/include +-rts_HSC2HS_OPTS += -Ilibffi/build/include +-rts_LD_OPTS += -Llibffi/build/include ++rts_CC_OPTS += $(shell pkg-config --cflags libffi) ++rts_HC_OPTS += $(shell pkg-config --cflags libffi) ++rts_HSC2HS_OPTS += $(shell pkg-config --cflags libffi) ++rts_LD_OPTS += $(shell pkg-config --libs libffi) + + # ----------------------------------------------------------------------------- + # compile generic patchable dyn-wrapper +Index: ghc6-6.12.3/rts/package.conf.in +=================================================================== +--- ghc6-6.12.3.orig/rts/package.conf.in 2010-06-09 21:10:14.000000000 +0300 ++++ ghc6-6.12.3/rts/package.conf.in 2010-07-17 11:53:57.000000000 +0300 +@@ -28,8 +28,9 @@ + hs-libraries: "HSrts" + + extra-libraries: ++ "ffi" + #ifdef HAVE_LIBM +- "m" /* for ldexp() */ ++ , "m" /* for ldexp() */ + #endif + #ifdef HAVE_LIBRT + , "rt" +@@ -59,7 +60,6 @@ + #endif + + includes: Stg.h +-depends: builtin_ffi + hugs-options: + cc-options: + diff --git a/ghc.spec b/ghc.spec index 226ee6f..1e8fd71 100644 --- a/ghc.spec +++ b/ghc.spec @@ -53,10 +53,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 +BuildRequires: libffi-devel Requires: gcc, gmp-devel %if %{with shared} -# not sure if this is actually needed: -BuildRequires: libffi-devel Requires: %{name}-libs = %{version}-%{release} %endif %if %{with manual} @@ -71,6 +70,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 %description GHC is a state-of-the-art programming suite for Haskell, a purely @@ -117,9 +117,11 @@ They should be installed when GHC's profiling subsystem is needed. %patch2 -p1 # disable gen_contents_index when not --batch for cron %patch3 -p1 +# use system libffi +%patch4 -p1 -b .libffi -# make sure we don't use these -rm -r ghc-tarballs/{mingw,perl} +# prefer system libraries +rm -r ghc-tarballs %build cat > mk/build.mk << EOF @@ -294,6 +296,7 @@ fi * Thu Nov 4 2010 Jens Petersen - 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 * Thu Nov 4 2010 Jens Petersen - 6.12.3-7 - skip huge type-level docs from haddock re-indexing (#649228)