- add ghcdocbasedir

- revert ghcdocdir to match upstream ghc
- ghcdocdir and ghcpkgdir now take optional name version args
- update ghc_gen_filelists to new optional name version args
- handle docdir in ghc_gen_filelists
- ghc_reindex_haddock uses ghcdocbasedir
- summary and description options added to ghc_binlib_package,
    ghc_package_devel, ghc_package_doc, and ghc_package_prof
This commit is contained in:
Jens Petersen 2010-01-10 14:59:10 +00:00
parent 23340a3f97
commit c97ee70960
2 changed files with 54 additions and 38 deletions

View File

@ -10,27 +10,33 @@ make -f cabal-rpm.mk %{_smp_mflags} \
%cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v %cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
%ghcdocdir %{_docdir}/ghc/libraries/%{pkg_name}-%{version} %ghcdocbasedir %{_docdir}/ghc/html
%ghcpkgdir %{_libdir}/ghc-%{ghc_version}/%{pkg_name}-%{version} %ghcdocdir() %{ghcdocbasedir}/libraries/%{?1}%{!?1:%{pkg_name}}-%{?2}%{!?2:%{version}}
%ghcpkgdir() %{_libdir}/ghc-%{ghc_version}/%{?1}%{!?1:%{pkg_name}}-%{?2}%{!?2:%{version}}
%ghc_gen_filelists() \ %ghc_gen_filelists() \
basepkg=%{?1}%{!?1:ghc-%{pkg_name}} \ basepkg=%{?1}%{!?1:%{pkg_name}} \
rm -f ${basepkg}.files ${basepkg}-devel.files ${basepkg}-prof.files ${basepkg}-doc.files \ basefile=ghc-${basepkg} \
echo '%defattr(-,root,root,-)' > ${basepkg}.files \ version=%{?2}%{!?2:%{version}} \
echo '%dir %{ghcpkgdir}' >> ${basepkg}.files \ rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files ${basefile}-doc.files \
echo '%attr(755,root,root) %{ghcpkgdir}/libHS%{pkg_name}-%{version}-ghc%{ghc_version}.so' >> ${basepkg}.files \ echo "%defattr(-,root,root,-)" > ${basefile}.files \
echo '%defattr(-,root,root,-)' > ${basepkg}-devel.files \ if [ -d "${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" ]; then \
echo '%{_libdir}/ghc-%{ghc_version}/package.conf.d/%{pkg_name}-%{version}*.conf' >> ${basepkg}-devel.files \ %{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{!?with_shared:-devel}.files} %{?1::} \
find ${RPM_BUILD_ROOT}%{ghcpkgdir} -type d | sed 's/^/%dir /' >> ${basepkg}-devel.files \ fi \
find ${RPM_BUILD_ROOT}%{ghcpkgdir} ! \\( -type d -o -name '*_p.a' -o -name '*.p_hi' -o -name 'libHS*.so' \\) >> ${basepkg}-devel.files \ echo "%dir %{ghcpkgdir}" >> ${basefile}.files \
echo '%defattr(-,root,root,-)' > ${basepkg}-prof.files \ echo "%attr(755,root,root) %{ghcpkgdir}/libHS${basepkg}-${version}-ghc%{ghc_version}.so" >> ${basefile}.files \
find ${RPM_BUILD_ROOT}%{ghcpkgdir} \\( -name '*_p.a' -o -name '*.p_hi' \\) >> ${basepkg}-prof.files \ echo "%defattr(-,root,root,-)" > ${basefile}-devel.files \
sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basepkg}.files ${basepkg}-devel.files ${basepkg}-prof.files \ echo "%{_libdir}/ghc-%{ghc_version}/package.conf.d/${basepkg}-${version}*.conf" >> ${basefile}-devel.files \
echo '%defattr(-,root,root,-)' > ${basepkg}-doc.files \ find ${RPM_BUILD_ROOT}%{ghcpkgdir} -type d | sed "s/^/%dir /" >> ${basefile}-devel.files \
echo '%{ghcdocdir}' >> ${basepkg}-doc.files \ find ${RPM_BUILD_ROOT}%{ghcpkgdir} ! \\( -type d -o -name "*_p.a" -o -name "*.p_hi" -o -name "libHS*.so" \\) >> ${basefile}-devel.files \
echo "%defattr(-,root,root,-)" > ${basefile}-prof.files \
find ${RPM_BUILD_ROOT}%{ghcpkgdir} \\( -name "*_p.a" -o -name "*.p_hi" \\) >> ${basefile}-prof.files \
sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \
echo "%defattr(-,root,root,-)" > ${basefile}-doc.files \
echo "%{ghcdocdir}" >> ${basefile}-doc.files \
%{nil} %{nil}
%ghc_reindex_haddock ( cd %{_docdir}/ghc/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || : %ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || :
%ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override} %ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
@ -60,7 +66,6 @@ Requires: ghc-%{pkg_name}-devel = %{version}-%{release}
%if %{with shared}\ %if %{with shared}\
%files -n %{ghc_pkg_name} -f %{ghc_pkg_name}.files\ %files -n %{ghc_pkg_name} -f %{ghc_pkg_name}.files\
%defattr(-,root,root,-)\ %defattr(-,root,root,-)\
%{_docdir}/%{name}-%{version}\
%endif\ %endif\
\ \
%ghc_package_devel\ %ghc_package_devel\
@ -70,26 +75,28 @@ Requires: ghc-%{pkg_name}-devel = %{version}-%{release}
%ghc_package_prof\ %ghc_package_prof\
%ghc_binlib_package(n:c:h:l:v:)\ %ghc_binlib_package(n:c:h:l:v:s:d:)\
%define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
%define ghc_pkg_name ghc-%{local_pkg_name}\
%package -n %{ghc_pkg_name}\ %package -n %{ghc_pkg_name}\
Summary: Library for %{common_summary}\ Summary: Library for %{-s:%{-s*}}%{!-s:%{?common_summary}%{!?common_summary:%{local_pkg_name}}}\
Group: System Environment/Libraries\ Group: System Environment/Libraries\
%{-v:Version: %{-v*}}\ %{-v:Version: %{-v*}}\
%{-l:License: %{-l*}}\ %{-l:License: %{-l*}}\
\ \
%description -n %{ghc_pkg_name}\ %description -n %{ghc_pkg_name}\
%{common_description}\ %{-d:%{-d*}}%{!-d:%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}}\
\ \
This package provides the shared library.\ This package provides the shared library.\
\ \
%ghc_lib_package\ %ghc_lib_package\
%ghc_package_devel(n:c:h:l:v:)\ %ghc_package_devel(n:c:h:l:v:s:d:)\
%define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
%define ghc_pkg_name ghc-%{local_pkg_name}\
%package -n %{ghc_pkg_name}-devel\ %package -n %{ghc_pkg_name}-devel\
Summary: %{common_summary} development files\ Summary: %{-s:%{-s*}}%{!-s:%{?common_summary}%{!?common_summary:%{local_pkg_name}}} development files\
Group: Development/Libraries\ Group: Development/Libraries\
%{-v:Version: %{-v*}}\ %{-v:Version: %{-v*}}\
%{-l:License: %{-l*}}\ %{-l:License: %{-l*}}\
@ -100,7 +107,7 @@ Group: Development/Libraries\
%{-c:Requires: %{-c*}}\ %{-c:Requires: %{-c*}}\
\ \
%description -n %{ghc_pkg_name}-devel\ %description -n %{ghc_pkg_name}-devel\
%{common_description}\ %{-d:%{-d*}}%{!-d:%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}}\
\ \
This package contains the development files.\ This package contains the development files.\
\ \
@ -112,14 +119,12 @@ ghc-pkg recache\
\ \
%files -n %{ghc_pkg_name}-devel -f %{ghc_pkg_name}-devel.files\ %files -n %{ghc_pkg_name}-devel -f %{ghc_pkg_name}-devel.files\
%defattr(-,root,root,-)\ %defattr(-,root,root,-)\
%if %{without shared}\
%{_docdir}/%{name}-%{version}\
%endif\
%ghc_package_doc(n:h:l:v:)\ %ghc_package_doc(n:h:l:v:s:d:)\
%define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
%define ghc_pkg_name ghc-%{local_pkg_name}\
%package -n %{ghc_pkg_name}-doc\ %package -n %{ghc_pkg_name}-doc\
Summary: Documentation for %{common_summary}\ Summary: Documentation for %{-s:%{-s*}}%{!-s:%{?common_summary}%{!?common_summary:%{local_pkg_name}}}\
Group: Development/Libraries\ Group: Development/Libraries\
%{-v:Version: %{-v*}}\ %{-v:Version: %{-v*}}\
%{-l:License: %{-l*}}\ %{-l:License: %{-l*}}\
@ -128,7 +133,7 @@ Group: Development/Libraries\
%{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\ %{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
\ \
%description -n %{ghc_pkg_name}-doc\ %description -n %{ghc_pkg_name}-doc\
%{common_description}\ %{-d:%{-d*}}%{!-d:%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}}\
\ \
This package contains development documentation files.\ This package contains development documentation files.\
\ \
@ -143,10 +148,11 @@ fi\
%files -n %{ghc_pkg_name}-doc -f %{ghc_pkg_name}-doc.files\ %files -n %{ghc_pkg_name}-doc -f %{ghc_pkg_name}-doc.files\
%defattr(-,root,root,-)\ %defattr(-,root,root,-)\
%ghc_package_prof(n:h:l:v:)\ %ghc_package_prof(n:h:l:v:s:d:)\
%define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
%define ghc_pkg_name ghc-%{local_pkg_name}\
%package -n %{ghc_pkg_name}-prof\ %package -n %{ghc_pkg_name}-prof\
Summary: Profiling libraries for %{common_summary}\ Summary: Profiling libraries for %{-s:%{-s*}}%{!-s:%{?common_summary}%{!?common_summary:%{local_pkg_name}}}\
Group: Development/Libraries\ Group: Development/Libraries\
%{-v:Version: %{-v*}}\ %{-v:Version: %{-v*}}\
%{-l:License: %{-l*}}\ %{-l:License: %{-l*}}\
@ -155,7 +161,7 @@ Group: Development/Libraries\
%{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\ %{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\
\ \
%description -n %{ghc_pkg_name}-prof\ %description -n %{ghc_pkg_name}-prof\
%{common_description}\ %{-d:%{-d*}}%{!-d:%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}}\
\ \
This package contains the profiling library.\ This package contains the profiling library.\
\ \

View File

@ -1,5 +1,5 @@
Name: ghc-rpm-macros Name: ghc-rpm-macros
Version: 0.5.0 Version: 0.5.1
Release: 1%{?dist} Release: 1%{?dist}
Summary: Macros for building packages for GHC Summary: Macros for building packages for GHC
@ -48,6 +48,16 @@ rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Mon Jan 11 2010 Jens Petersen <petersen@redhat.com> - 0.5.1-1
- add ghcdocbasedir
- revert ghcdocdir to match upstream ghc
- ghcdocdir and ghcpkgdir now take optional name version args
- update ghc_gen_filelists to new optional name version args
- handle docdir in ghc_gen_filelists
- ghc_reindex_haddock uses ghcdocbasedir
- summary and description options to ghc_binlib_package, ghc_package_devel,
ghc_package_doc, and ghc_package_prof
* Sun Jan 10 2010 Jens Petersen <petersen@redhat.com> - 0.5.0-1 * Sun Jan 10 2010 Jens Petersen <petersen@redhat.com> - 0.5.0-1
- pkg_name must be set now for binlib packages too - pkg_name must be set now for binlib packages too
- new ghc_lib_package and ghc_binlib_package macros make packaging too easy - new ghc_lib_package and ghc_binlib_package macros make packaging too easy