diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc new file mode 100644 index 0000000..d91b7e1 --- /dev/null +++ b/ghc-rpm-macros.ghc @@ -0,0 +1,57 @@ +%cabal %{_bindir}/runhaskell Setup + +%cabal_configure \ +%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --libsubdir='$compiler/$pkgid' + +%cabal_build \ +%cabal build \ +%{nil} + +%cabal_makefile \ +%cabal makefile -f cabal-rpm.mk \ +make -f cabal-rpm.mk %{_smp_mflags} \ +%{nil} + +%cabal_haddock \ +%cabal haddock \ +%{nil} + +%cabal_install \ +%cabal copy --destdir=${RPM_BUILD_ROOT} \ +%{nil} + +%ghc_gen_filelists() \ +rm -f %1.files %1-prof.files \ +echo '%defattr(-,root,root,-)' > %1-prof.files \ +find ${RPM_BUILD_ROOT}%{pkg_libdir} \\( -name '*_p.a' -o -name '*.p_hi' \\) >> %1-prof.files \ +echo '%defattr(-,root,root,-)' > %1.files \ +find ${RPM_BUILD_ROOT}%{pkg_libdir} -type d | sed 's/^/%dir /' >> %1.files \ +find ${RPM_BUILD_ROOT}%{pkg_libdir} ! \\( -type d -o -name '*_p.a' -o -name '*.p_hi' \\) >> %1.files \ +sed -i -e "s!${RPM_BUILD_ROOT}!!g" %1.files %1-prof.files \ +%{nil} + +%ghc_gen_scripts \ +%cabal register --gen-script \ +%cabal unregister --gen-script \ +%{nil} + +%ghc_install_scripts \ +install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir} \ +%{nil} + +%ghc_preinst_script \ +[ "$1" = 2 ] && %{pkg_libdir}/unregister.sh >&/dev/null || : \ +%{nil} + +%ghc_postinst_script \ +%{pkg_libdir}/register.sh >&/dev/null \ +%{nil} + +%ghc_preun_script \ +%{pkg_libdir}/unregister.sh >&/dev/null \ +%{nil} + +%ghc_postun_script \ +[ "$1" = 1 ] && %{pkg_libdir}/register.sh >& /dev/null || : \ +%{nil} + diff --git a/ghc.spec b/ghc.spec index 060a67f..f6c5a7a 100644 --- a/ghc.spec +++ b/ghc.spec @@ -16,7 +16,7 @@ Name: ghc Version: 6.8.3 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Glasgow Haskell Compilation system # See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=239713 ExcludeArch: alpha ppc64 @@ -24,6 +24,7 @@ License: BSD Group: Development/Languages Source0: http://www.haskell.org/ghc/dist/stable/dist/ghc-%{version}-src.tar.bz2 Source1: http://www.haskell.org/ghc/dist/stable/dist/ghc-%{version}-src-extralibs.tar.bz2 +Source2: ghc-rpm-macros.ghc Patch0: ghc-6.8.3-libraries-config.patch URL: http://haskell.org/ghc/ Requires: chkconfig, gcc, gmp-devel, readline-devel @@ -145,6 +146,10 @@ fi cp libraries/*.html ${RPM_BUILD_ROOT}/%{_docdir}/%{name}-%{version}/libraries %endif +# install rpm macros +mkdir -p ${RPM_BUILD_ROOT}/%{_systemconfdir}/rpm/macros.ghc +cp -p %{SOURCE2} ${RPM_BUILD_ROOT}/%{_systemconfdir}/rpm/macros.ghc + SRC_TOP=$PWD rm -f rpm-*-filelist rpm-*.files ( cd $RPM_BUILD_ROOT @@ -197,6 +202,7 @@ fi %doc ANNOUNCE HACKING LICENSE README %doc %{_mandir}/man1/ghc.* %{_bindir}/* +%{_systemconfdir}/rpm/macros.ghc %config(noreplace) %{_libdir}/ghc-%{version}/package.conf %ghost %{_libdir}/ghc-%{version}/package.conf.old @@ -215,6 +221,9 @@ fi %changelog +* Wed Sep 17 2008 Jens Petersen - 6.8.3-4 +- add macros.ghc for new Haskell Packaging Guidelines (#460304) + * Wed Jun 18 2008 Bryan O'Sullivan - 6.8.3-3 - Add symlinks from _libdir, where ghc looks, to _libexecdir - Patch libraries/gen_contents_index to use haddock-0.9