ghc/ghc-rpm-macros.ghc
2008-10-15 03:52:24 +00:00

66 lines
1.9 KiB
Plaintext

%cabal %{_bindir}/runhaskell Setup
%cabal_configure \
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{_docdir}/%{hsc_name}/libraries/%{pkg_name} --haddockdir=%{_docdir}/%{hsc_name}/libraries/%{pkg_name} --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} -v \
%{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}
%ghc_reindex_haddock \
if [ -f %{_bindir}/haddock -a -d %{_docdir}/%{hsc_name}/libraries ]; then \
cd %{_docdir}/%{hsc_name}/libraries && \
haddock --gen-index --gen-contents -o . -t 'Haskell Hierarchical Libraries' \\\
$(find . \\( \\( -path ./ghc -o -path ./ghc-prim \\) -prune \\) -o \\( -name '*.haddock' -print \\) \\\
| sed 's!.*/\\([^/]*\\).haddock!--read-interface=\\1,\\0!'); \
fi \
%{nil}