From Fedora Project Wiki
(New page: These are the definitions for the macros for GHC. They are useful in debugging your spec files. <pre> %ghc_autotools(lf:p:) \ echo %{-p*} %{-f*} \ if [ -f configure.ac -a ! -f configure ...)
 
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
''This page is out of date and deprecated''
The macros now ship in Fedora's ghc-rpm-macros package.
These are the definitions for the macros for GHC.  They are useful in debugging your spec files.
These are the definitions for the macros for GHC.  They are useful in debugging your spec files.
Macros prefixed with cabal_ should portable, whereas those name ghc_ are specific to ghc.
(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.)


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


%ghc_build \
%cabal_build \
runghc Setup build \
%cabal build \
%{nil}
%{nil}


%ghc_haddock \
%cabal_makefile \
runghc Setup haddock || : \
%cabal makefile -f cabal-rpm.mk \
make -f cabal-rpm.mk %{_smp_mflags} \
%{nil}
%{nil}


%ghc_gen_scripts \
%cabal_haddock \
runghc Setup register --gen-script \
%cabal haddock \
runghc Setup unregister --gen-script \
%{nil}
%{nil}


%ghc_install \
%cabal_install \
runghc Setup copy --destdir=${RPM_BUILD_ROOT} \
%cabal copy --destdir=${RPM_BUILD_ROOT} \
%{nil}
%{nil}


%ghc_install_scripts \
%ghc_gen_filelists() \
install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir} \
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}
%{nil}


%ghc_tar_dir %{_builddir}/%{?buildsubdir}
%ghc_gen_scripts \
 
%cabal register --gen-script \
%ghc_gen_filelists() \
%cabal unregister --gen-script \
pushd ${RPM_BUILD_ROOT} \
echo "%defattr(-,root,root,-)" > %{ghc_tar_dir}/%1-files.prof \
find .%{pkg_libdir} \\\( -name '*_p.a' -o -name '*.p_hi' \\\) | sed s/^.// >> %{ghc_tar_dir}/%1-files.prof \
echo "%defattr(-,root,root,-)" > %{ghc_tar_dir}/%1-files \
find .%{pkg_libdir} -type d | sed 's/^./%dir /' >> %{ghc_tar_dir}/%1-files \
find .%{pkg_libdir} ! \\\( -type d -o -name '*_p.a' -o -name '*.p_hi' \\\) | sed s/^.// >> %{ghc_tar_dir}/%1-files \
sed 's,^/,%exclude /,' %{ghc_tar_dir}/%1-files.prof >> %{ghc_tar_dir}/%1-files \
pushd \
%{nil}
%{nil}


%ghc_preinst_script \
%ghc_install_scripts \
[ "$1" = 2 ] && %{pkg_libdir}/unregister.sh >&/dev/null || : \
install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir} \
%{nil}
%{nil}


Line 55: Line 56:


%ghc_preun_script \
%ghc_preun_script \
%{pkg_libdir}/unregister.sh >&/dev/null \
[ "$1" = 0 ] && %{pkg_libdir}/unregister.sh >&/dev/null \
%{nil}
%{nil}


%ghc_postun_script \
%ghc_reindex_haddock \
[ "$1" = 1 ] && %{pkg_libdir}/register.sh >& /dev/null || : \
( cd %{_docdir}/ghc/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || : \
%{nil}
%{nil}
</pre>
</pre>

Latest revision as of 03:46, 1 October 2010

This page is out of date and deprecated

The macros now ship in Fedora's ghc-rpm-macros package.

These are the definitions for the macros for GHC. They are useful in debugging your spec files. Macros prefixed with cabal_ should portable, whereas those name ghc_ are specific to ghc.


(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}/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_postinst_script \
%{pkg_libdir}/register.sh >&/dev/null \
%{nil}

%ghc_preun_script \
[ "$1" = 0 ] && %{pkg_libdir}/unregister.sh >&/dev/null \
%{nil}

%ghc_reindex_haddock \
( cd %{_docdir}/ghc/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || : \
%{nil}