From 92246276fae529f13769165215aeb0a7f7cadf8e Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Mon, 28 Jun 2010 07:41:52 +0000 Subject: [PATCH] backport 0.7.1 from devel: - support hscolour'ing of src from haddock - new ghc_bin_build, ghc_bin_install, ghc_lib_build, ghc_lib_install - a couple more fallback summary tweaks - drop the summary -s and description -d package options since rpm does not seem to allow white\ space in macro option args anyway - add ghc_strip_dynlinked, conditional on no debug_package - add comments over macros - drop unused cabal_makefile --- ghc-rpm-macros.ghc | 79 +++++++++++++++++++++++++++++++++++---------- ghc-rpm-macros.spec | 29 ++++++++++++++++- 2 files changed, 90 insertions(+), 18 deletions(-) diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc index 8868530..a22fdd2 100644 --- a/ghc-rpm-macros.ghc +++ b/ghc-rpm-macros.ghc @@ -1,20 +1,23 @@ +# "cabal" %cabal %{_bindir}/runghc Setup +# configure %cabal_configure \ %cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' %{?with_shared:--enable-shared} %{?with_dynamic:--ghc-option=-dynamic} -%cabal_makefile \ -%cabal makefile -f cabal-rpm.mk \ -make -f cabal-rpm.mk %{_smp_mflags} \ -%{nil} - +# install %cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v +# root dir for ghc docs %ghcdocbasedir %{_docdir}/ghc/html +# ghcdocdir [pkgname] %ghcdocdir() %{ghcdocbasedir}/libraries/%{?1}%{!?1:%{pkg_name}}-%{version} +# top library dir %ghcpkgbasedir %{_libdir}/ghc-%{ghc_version} +# ghcpkgdir [pkgname] %ghcpkgdir() %{ghcpkgbasedir}/%{?1}%{!?1:%{pkg_name}}-%{version} +# ghc_gen_filelists [pkgname] %ghc_gen_filelists() \ pkgname=%{?1}%{!?1:%{pkg_name}} \ basefile=ghc-${pkgname} \ @@ -47,13 +50,17 @@ fi \ sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \ %{nil} +# compiler version %ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override} +# create and install package.conf file +# cabal_pkg_conf [pkgname] %cabal_pkg_conf \ %cabal register --gen-pkg-config \ mkdir -p $RPM_BUILD_ROOT%{_libdir}/ghc-%{ghc_version}/package.conf.d \ install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{_libdir}/ghc-%{ghc_version}/package.conf.d +# devel pkg basic requires %ghc_requires Requires: ghc = %{ghc_version}\ Requires(post): ghc = %{ghc_version}\ Requires(postun): ghc = %{ghc_version}\ @@ -61,13 +68,16 @@ Requires(postun): ghc = %{ghc_version}\ Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\ %endif +# doc pkg basic requires %ghc_doc_requires Requires: ghc-doc = %{ghc_version}\ Requires(post): ghc-doc = %{ghc_version}\ Requires(postun): ghc-doc = %{ghc_version} +# prof pkg basic requires %ghc_prof_requires Requires: ghc-prof = %{ghc_version}\ Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{version}}-%{release} +# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] %ghc_lib_package(n:c:h:)\ %define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\ %if %{with shared}\ @@ -82,17 +92,18 @@ Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{v %ghc_package_prof\ %{nil} -%ghc_binlib_package(n:c:h:l:v:s:d:)\ +# ghc_binlib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] +%ghc_binlib_package(n:c:h:l:v:)\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\ %define ghc_pkg_name ghc-%{local_pkg_name}\ %package -n %{ghc_pkg_name}\ -Summary: %{-s:%{-s*}}%{!-s:%{?common_summary}%{!?common_summary:%{local_pkg_name}}}\ +Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library}\ Group: System Environment/Libraries\ %{-v:Version: %{-v*}}\ %{-l:License: %{-l*}}\ \ %description -n %{ghc_pkg_name}\ -%{-d:%{-d*}}%{!-d:%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}}\ +%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ \ This package provides the shared library.\ \ @@ -101,11 +112,12 @@ This package provides the shared library.\ %ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-conf || : -%ghc_package_devel(n:c:h:l:v:s:d:)\ +# ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] +%ghc_package_devel(n:c:h:l:v:)\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\ %define ghc_pkg_name ghc-%{local_pkg_name}\ %package -n %{ghc_pkg_name}-devel\ -Summary: %{-s:%{-s*}}%{!-s:%{?common_summary}%{!?common_summary:%{local_pkg_name}}} development files\ +Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library} development files\ Group: Development/Libraries\ %{-v:Version: %{-v*}}\ %{-l:License: %{-l*}}\ @@ -116,7 +128,7 @@ Group: Development/Libraries\ %{-c:Requires: %{-c*}}\ \ %description -n %{ghc_pkg_name}-devel\ -%{-d:%{-d*}}%{!-d:%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}}\ +%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ \ This package contains the development files.\ \ @@ -130,13 +142,16 @@ This package contains the development files.\ %defattr(-,root,root,-)\ %{nil} +# for docs post and postun +# re-index haddock %ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || : -%ghc_package_doc(n:h:l:v:s:d:)\ +# ghc_package_doc [-n pkgname] [-h pkgdepslist] [-l licensetag] [-v version] +%ghc_package_doc(n:h:l:v:)\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\ %define ghc_pkg_name ghc-%{local_pkg_name}\ %package -n %{ghc_pkg_name}-doc\ -Summary: Documentation for %{-s:%{-s*}}%{!-s:%{?common_summary}%{!?common_summary:%{local_pkg_name}}}\ +Summary: Documentation for %{?common_summary}%{!?common_summary:%{local_pkg_name} library}\ Group: Development/Libraries\ %{-v:Version: %{-v*}}\ %{-l:License: %{-l*}}\ @@ -145,7 +160,7 @@ Group: Development/Libraries\ %{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\ \ %description -n %{ghc_pkg_name}-doc\ -%{-d:%{-d*}}%{!-d:%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}}\ +%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ \ This package contains development documentation files.\ \ @@ -161,11 +176,12 @@ fi\ %defattr(-,root,root,-)\ %{nil} -%ghc_package_prof(n:h:l:v:s:d:)\ +# ghc_package_prof [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] +%ghc_package_prof(n:h:l:v:)\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\ %define ghc_pkg_name ghc-%{local_pkg_name}\ %package -n %{ghc_pkg_name}-prof\ -Summary: Profiling libraries for %{-s:%{-s*}}%{!-s:%{?common_summary}%{!?common_summary:%{local_pkg_name}}}\ +Summary: Profiling libraries for %{?common_summary}%{!?common_summary:%{local_pkg_name}}\ Group: Development/Libraries\ %{-v:Version: %{-v*}}\ %{-l:License: %{-l*}}\ @@ -174,10 +190,39 @@ Group: Development/Libraries\ %{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\ \ %description -n %{ghc_pkg_name}-prof\ -%{-d:%{-d*}}%{!-d:%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}}\ +%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ \ This package contains the profiling library.\ \ %files -n %{ghc_pkg_name}-prof -f %{ghc_pkg_name}-prof.files\ %defattr(-,root,root,-)\ %{nil} + +# ghc_strip_dynlinked +%ghc_strip_dynlinked\ +%if 0%{!?__debug_package:1}\ +find $RPM_BUILD_ROOT -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -print | xargs strip\ +%endif + +# ghc_bin_build +%ghc_bin_build\ +%cabal_configure --ghc\ +%cabal build + +# ghc_lib_build +%ghc_lib_build\ +%cabal_configure --ghc -p\ +%cabal build\ +%cabal haddock %{?with_hscolour:--hyperlink-source} + +# ghc_bin_install +%ghc_bin_install\ +%cabal_install\ +%ghc_strip_dynlinked + +# ghc_lib_install +%ghc_lib_install\ +%cabal_install\ +%cabal_pkg_conf\ +%ghc_gen_filelists\ +%ghc_strip_dynlinked diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index 92dce43..29e0ce5 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -1,5 +1,5 @@ Name: ghc-rpm-macros -Version: 0.5.6 +Version: 0.7.1 Release: 1%{?dist} Summary: Macros for building packages for GHC @@ -48,6 +48,33 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Mon Jun 28 2010 Jens Petersen - 0.7.1-1 +- support hscolour'ing of src from haddock +- really remove redundant summary and description option flags + +* Sat Jun 26 2010 Jens Petersen - 0.7.0-1 +- new ghc_bin_build, ghc_bin_install, ghc_lib_build, ghc_lib_install + +* Thu Jun 24 2010 Jens Petersen - 0.6.2-1 +- a couple more fallback summary tweaks + +* Thu Jun 24 2010 Jens Petersen - 0.6.1-1 +- drop the summary -s and description -d package options since rpm does not + seem to allow white\ space in macro option args anyway + +* Wed Jun 23 2010 Jens Petersen - 0.6.0-1 +- make ghc_strip_dynlinked conditional on no debug_package + +* Wed Jun 23 2010 Jens Petersen - 0.5.9-1 +- replace ghc_strip_shared with ghc_strip_dynlinked + +* Sun Jun 20 2010 Jens Petersen - 0.5.8-1 +- add ghc_strip_shared to strip shared libraries + +* Sun Jun 20 2010 Jens Petersen - 0.5.7-1 +- add comments over macros +- drop unused cabal_makefile + * Mon Apr 12 2010 Jens Petersen - 0.5.6-1 - drop unused ghc_pkg_ver macro - add ghc_pkg_recache macro