From Fedora Project Wiki

< PackagingDrafts‎ | Haskell

Revision as of 08:00, 22 August 2008 by Petersen (talk | contribs) (add _cabal)

These are the definitions for the macros for GHC. They are useful in debugging your spec files.

If your GHC does not ship with them, but you would like to use them anyways, they belong either in /etc/rpm/macros.ghc or in ~/.rpmmacros

%_cabal %{_bindir}/runghc Setup

%ghc_autotools(lf:p:) \
echo %{-p*} %{-f*} \
if [ -f configure.ac -a ! -f configure ]; then autoreconf; fi \
%{_cabal} configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --libsubdir='$compiler/$pkgid' %{-f:--flags%{-f*}} --%{-p:%{-p*}}-library-profiling --ghc \
%{-l:if %{_cabal} makefile -f cabal-rpm.mk \
then \
    make -f cabal-rpm.mk %{_smp_mflags} || : \
fi }\
%{nil}

%ghc_build \
%{_cabal} build \
%{nil}

%ghc_haddock \
%{_cabal} haddock || : \
%{nil}

%ghc_gen_scripts \
%{_cabal} register --gen-script \
%{_cabal} unregister --gen-script \
%{nil}

%ghc_install \
%{_cabal} copy --destdir=${RPM_BUILD_ROOT} \
%{nil}

%ghc_install_scripts \
install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir} \
%{nil}

%ghc_gen_filelists() \
pushd ${RPM_BUILD_ROOT} \
echo "%defattr(-,root,root,-)" > %1-files.prof \
find .%{pkg_libdir} \\\( -name '*_p.a' -o -name '*.p_hi' \\\) | sed s/^.// >> %1-files.prof \
echo "%defattr(-,root,root,-)" > %1-files \
find .%{pkg_libdir} -type d | sed 's/^./%dir /' >> %1-files \
find .%{pkg_libdir} ! \\\( -type d -o -name '*_p.a' -o -name '*.p_hi' \\\) | sed s/^.// >> %1-files \
sed 's,^/,%exclude /,' %{ghc_tar_dir}/%1-files.prof >> %1-files \
pushd \
%{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}