diff --git a/ghc-mk-pkg-install-inplace.patch b/ghc-mk-pkg-install-inplace.patch new file mode 100644 index 0000000..f49bd30 --- /dev/null +++ b/ghc-mk-pkg-install-inplace.patch @@ -0,0 +1,24 @@ +diff -up ghc-6.11.20090421/mk/cabal-flags.mk~ ghc-6.11.20090421/mk/cabal-flags.mk +--- ghc-6.11.20090421/mk/cabal-flags.mk~ 2009-04-22 03:15:57.000000000 +1000 ++++ ghc-6.11.20090421/mk/cabal-flags.mk 2009-04-26 12:06:06.000000000 +1000 +@@ -3,7 +3,7 @@ nothing= + space=$(nothing) $(nothing) + comma=, + +-GHC_PKG_INSTALL_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/dist-install/build/ghc-pkg/ghc-pkg ++GHC_PKG_INSTALL_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/dist-inplace/build/ghc-pkg/ghc-pkg + + LIBRARIES_ABS = $(FPTOOLS_TOP_ABS)/libraries + UTILS_ABS = $(FPTOOLS_TOP_ABS)/utils +diff -up ghc-6.11.20090421/mk/package.mk~ ghc-6.11.20090421/mk/package.mk +--- ghc-6.11.20090421/mk/package.mk~ 2009-04-22 03:15:55.000000000 +1000 ++++ ghc-6.11.20090421/mk/package.mk 2009-04-26 10:52:55.000000000 +1000 +@@ -86,7 +86,7 @@ install:: + | sed -e 's/""//g' -e 's/:[ ]*,/: /g' \ + | $(GHC_PKG_INSTALL_PROG) --global-conf $(DESTDIR)$(datadir)/package.conf update - --force + +-GHC_PKG_INSTALL_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/dist-install/build/ghc-pkg/ghc-pkg ++GHC_PKG_INSTALL_PROG = $(FPTOOLS_TOP_ABS)/utils/ghc-pkg/dist-inplace/build/ghc-pkg/ghc-pkg + + # we could be more accurate here and add a dependency on + # driver/package.conf, but that doesn't work too well because of diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc index 28111ca..6103094 100644 --- a/ghc-rpm-macros.ghc +++ b/ghc-rpm-macros.ghc @@ -1,7 +1,7 @@ %cabal %{_bindir}/runghc Setup %cabal_configure \ -%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{pkg_docdir} --libsubdir='$compiler/$pkgid' +%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' %cabal_makefile \ %cabal makefile -f cabal-rpm.mk \ @@ -10,22 +10,29 @@ make -f cabal-rpm.mk %{_smp_mflags} \ %cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v +%ghcdocdir %{_docdir}/ghc/libraries/%{?pkg_name}%{!?pkg_name:%{name}}-%{version} +%ghcpkgdir %{_libdir}/ghc-%(ghc --numeric-version)/%{?pkg_name}%{!?pkg_name:%name}-%{version} + %ghc_gen_filelists() \ -rm -f %1-devel.files %1-prof.files \ +rm -f %1-devel.files %1-prof.files %1-doc.files \ echo '%defattr(-,root,root,-)' > %1-devel.files \ -find ${RPM_BUILD_ROOT}%{pkg_libdir} -type d | sed 's/^/%dir /' >> %1-devel.files \ -find ${RPM_BUILD_ROOT}%{pkg_libdir} ! \\( -type d -o -name '*_p.a' -o -name '*.p_hi' \\) >> %1-devel.files \ +find ${RPM_BUILD_ROOT}%{ghcpkgdir} -type d | sed 's/^/%dir /' >> %1-devel.files \ +find ${RPM_BUILD_ROOT}%{ghcpkgdir} ! \\( -type d -o -name '*_p.a' -o -name '*.p_hi' \\) >> %1-devel.files \ echo '%defattr(-,root,root,-)' > %1-prof.files \ -find ${RPM_BUILD_ROOT}%{pkg_libdir} \\( -name '*_p.a' -o -name '*.p_hi' \\) >> %1-prof.files \ +find ${RPM_BUILD_ROOT}%{ghcpkgdir} \\( -name '*_p.a' -o -name '*.p_hi' \\) >> %1-prof.files \ sed -i -e "s!${RPM_BUILD_ROOT}!!g" %1-devel.files %1-prof.files \ +echo '%defattr(-,root,root,-)' > %1-doc.files \ +echo '%{ghcdocdir}' >> %1-doc.files \ %{nil} %ghc_gen_scripts %cabal register --gen-script ; %cabal unregister --gen-script -%ghc_install_scripts install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir} +%ghc_install_scripts install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{ghcpkgdir} -%ghc_register_pkg %{pkg_libdir}/register.sh >/dev/null || : +%ghc_register_pkg %{ghcpkgdir}/register.sh >/dev/null || : -%ghc_unregister_pkg %{pkg_libdir}/unregister.sh >/dev/null || : +%ghc_unregister_pkg %{ghcpkgdir}/unregister.sh >/dev/null || : %ghc_reindex_haddock ( cd %{_docdir}/ghc/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || : + +%ghc_version %(ghc --numeric-version) diff --git a/ghc.spec b/ghc.spec index 72010ee..d0a7b2a 100644 --- a/ghc.spec +++ b/ghc.spec @@ -1,7 +1,13 @@ -# test builds can made faster by disabling profiled libraries +# test builds can made faster and smaller by disabling profiled libraries %bcond_without prof +# build users_guide, etc %bcond_without doc +# experimental +## shared libraries support available in ghc >= 6.11 +%bcond_with shared +%bcond_with hscolour + # Fixing packaging problems can be a tremendous pain because it # generally requires a complete rebuild, which takes hours. To offset # the misery, do a complete build once using "rpmbuild -bc", then copy @@ -16,7 +22,7 @@ Name: ghc Version: 6.10.2 -Release: 1%{?dist} +Release: 5%{?dist} Summary: Glasgow Haskell Compilation system # fedora ghc has only been bootstrapped on the following archs: ExclusiveArch: %{ix86} x86_64 ppc alpha @@ -24,6 +30,7 @@ License: BSD Group: Development/Languages Source0: http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src.tar.bz2 Source1: http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src-extralibs.tar.bz2 +# /etc/rpm/macros.ghc Source2: ghc-rpm-macros.ghc URL: http://haskell.org/ghc/ # libedit-devel > 2.11-2 correctly requires ncurses-devel @@ -31,13 +38,21 @@ Requires: gcc, gmp-devel, libedit-devel > 2.11-2 Requires(post): policycoreutils BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Obsoletes: ghc682, ghc681, ghc661, ghc66, haddock <= 2.0.0.0, haddock09 -# introduced for f11 and to be removed for f13: +# introduced for f11 and can be removed for f13: Provides: haddock = 2.3.0 BuildRequires: ghc, happy, sed BuildRequires: gmp-devel, libedit-devel > 2.11-2 +%if %{with shared} +# not sure if this is actually needed +BuildRequires: libffi-devel +%endif %if %{with doc} BuildRequires: libxslt, docbook-style-xsl +%if %{with hscolour} +BuildRequires: hscolour +%endif %endif +Patch1: ghc-mk-pkg-install-inplace.patch %description GHC is a state-of-the-art programming suite for Haskell, a purely @@ -74,11 +89,25 @@ Preformatted documentation for the Glorious Glasgow Haskell Compilation System (GHC) and its libraries. It should be installed if you like to have local access to the documentation in HTML format. +%if %{with shared} +%package libs +Summary: Shared libraries for GHC +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description libs +Shared libraries for Glorious Glasgow Haskell Compilation System +(GHC). They should be installed to build standalone programs. +%endif + # the debuginfo subpackage is currently empty anyway, so don't generate it %global debug_package %{nil} %prep %setup -q -n %{name}-%{version} -b1 +%if %{with shared} +%patch1 -p1 -b .orig-dist-install +%endif %build # hack for building a local test package quickly from a prebuilt tree @@ -90,24 +119,29 @@ popd exit 0 %endif -%if !%{with prof} -echo "GhcLibWays=" >> mk/build.mk -echo "GhcRTSWays=thr debug" >> mk/build.mk +%ifarch ppc +echo "GhcUnregisterised=YES" >> mk/build.mk +echo "GhcWithNativeCodeGen=NO" >> mk/build.mk +echo "SplitObjs=NO" >> mk/build.mk +%endif + +%if %{without prof} +echo "GhcLibWays=%{?with_shared:dyn}" >> mk/build.mk %endif %if %{with doc} echo "XMLDocWays = html" >> mk/build.mk -echo "HADDOCK_DOCS = YES" >> mk/build.mk %endif ./configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} \ --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} \ --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} \ --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \ - --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} + --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \ + %{?with_shared:--enable-shared} make %{_smp_mflags} -make %{_smp_mflags} -C libraries +#make %{_smp_mflags} -C libraries %if %{with doc} make %{_smp_mflags} html @@ -122,24 +156,26 @@ make DESTDIR=${RPM_BUILD_ROOT} install make DESTDIR=${RPM_BUILD_ROOT} install-docs %endif +%if %{with shared} +mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/ld.so.conf.d +echo %{_libdir}/%{name}-%{version} > ${RPM_BUILD_ROOT}/%{_sysconfdir}/ld.so.conf.d/ghc-%{_arch}.conf +%endif + # install rpm macros mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm cp -p %{SOURCE2} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc SRC_TOP=$PWD -rm -f rpm-*-filelist rpm-*.files +rm -f rpm-*.files ( cd $RPM_BUILD_ROOT find .%{_libdir}/%{name}-%{version} \( -type d -fprintf $SRC_TOP/rpm-dir.files "%%%%dir %%p\n" \) -o \( -type f \( -name '*.p_hi' -o -name '*_p.a' \) -fprint $SRC_TOP/rpm-prof.files \) -o \( -not -name 'package.conf*' -fprint $SRC_TOP/rpm-lib.files \) - find .%{_docdir}/%{name}/* -type d ! -name libraries > $SRC_TOP/rpm-doc-dir.files + find .%{_docdir}/%{name}/* -type d ! -name libraries %{?with_hscolour:! -name src} > $SRC_TOP/rpm-doc-dir.files ) # make paths absolute (filter "./usr" to "/usr") sed -i -e "s|\.%{_prefix}|%{_prefix}|" rpm-*.files -cat rpm-dir.files rpm-lib.files > rpm-base-filelist -%if %{with prof} -cat rpm-prof.files > rpm-prof-filelist -%endif +cat rpm-dir.files rpm-lib.files > rpm-base.files # these are handled as alternatives for i in hsc2hs runhaskell; do @@ -150,6 +186,20 @@ for i in hsc2hs runhaskell; do fi done +%check +# stolen from ghc6/debian/rules: +# Do some very simple tests that the compiler actually works +rm -rf testghc +mkdir testghc +echo 'main = putStrLn "Foo"' > testghc/foo.hs +ghc/stage2-inplace/ghc testghc/foo.hs -o testghc/foo +[ "$(testghc/foo)" = "Foo" ] +rm testghc/* +echo 'main = putStrLn "Foo"' > testghc/foo.hs +ghc/stage2-inplace/ghc testghc/foo.hs -o testghc/foo -O2 +[ "$(testghc/foo)" = "Foo" ] +rm testghc/* + %clean rm -rf $RPM_BUILD_ROOT @@ -174,9 +224,9 @@ update-alternatives --install %{_bindir}/runhaskell runhaskell \ update-alternatives --install %{_bindir}/hsc2hs hsc2hs \ %{_bindir}/hsc2hs-ghc 500 -# posttrans to make sure any old documentation has been removed first -%posttrans doc -( cd %{_docdir}/ghc/libraries && ./gen_contents_index ) || : +%if %{with shared} +%post libs -p /sbin/ldconfig +%endif %preun if [ "$1" = 0 ]; then @@ -184,25 +234,31 @@ if [ "$1" = 0 ]; then update-alternatives --remove hsc2hs %{_bindir}/hsc2hs-ghc fi -%files -f rpm-base-filelist +%if %{with shared} +%postun libs -p /sbin/ldconfig +%endif + +%posttrans doc +# (posttrans to make sure any old documentation has been removed first) +( cd %{_docdir}/ghc/libraries && ./gen_contents_index ) || : + +%files -f rpm-base.files %defattr(-,root,root,-) %doc ANNOUNCE HACKING LICENSE README -%doc %{_mandir}/man1/ghc.* %{_bindir}/* +%if %{with doc} +%{_mandir}/man1/ghc.* +%endif %{_sysconfdir}/rpm/macros.ghc %config(noreplace) %{_libdir}/ghc-%{version}/package.conf -%if %{with prof} -%files prof -f rpm-prof-filelist -%defattr(-,root,root,-) -%endif - -%if %{with doc} %files doc -f rpm-doc-dir.files %defattr(-,root,root,-) %dir %{_docdir}/%{name} %{_docdir}/%{name}/LICENSE +%if %{with doc} %{_docdir}/%{name}/index.html +%endif %{_docdir}/%{name}/libraries/gen_contents_index %{_docdir}/%{name}/libraries/prologue.txt %dir %{_docdir}/%{name}/libraries @@ -213,9 +269,48 @@ fi %ghost %{_docdir}/%{name}/libraries/index.html %ghost %{_docdir}/%{name}/libraries/minus.gif %ghost %{_docdir}/%{name}/libraries/plus.gif + +%if %{with shared} +%files libs +%defattr(-,root,root,-) +%{_sysconfdir}/ld.so.conf.d/ghc-%{_arch}.conf +%{_libdir}/libHS*-ghc%{version}.so +%endif + +%if %{with prof} +%files prof -f rpm-prof.files +%defattr(-,root,root,-) %endif %changelog +* Sat May 2 2009 Jens Petersen - 6.10.2-5 +- try unregisterised ppc to see if that stops the segfaulting with runghc + +* Tue Apr 28 2009 Jens Petersen - 6.10.2-4 +- add experimental bcond hscolour +- add experimental support for building shared libraries (for ghc-6.11) + - add libs subpackage for shared libraries + - create a ld.conf.d file for libghc*.so + - BR libffi-devel +- drop redundant setting of GhcLibWays in build.mk for no prof +- drop redundant setting of HADDOCK_DOCS +- simplify filelist names +- add a check section based on tests from debian's package +- be more careful about doc files in filelist + +* Fri Apr 24 2009 Jens Petersen - 6.10.2-3 +- define ghc_version in macros.ghc in place of ghcrequires +- drop ghc-requires script for now + +* Sun Apr 19 2009 Jens Petersen - 6.10.2-2 +- add ghc-requires rpm script to generate ghc version dependencies + (thanks to Till Maas) +- update macros.ghc: + - add %%ghcrequires to call above script + - pkg_libdir and pkg_docdir obsoleted in packages and replaced + by ghcpkgdir and ghcdocdir inside macros.ghc + - make filelist also for docs + * Wed Apr 08 2009 Bryan O'Sullivan - 6.10.2-1 - Update to 6.10.2