[ghc-rpm-macros/f14/master] merge subpackaging support and other cleanup from 0.11.4
Jens Petersen
petersen at fedoraproject.org
Sat Jan 29 12:38:44 UTC 2011
commit 50de2873df50e6c052b47a0c806850e1c555b41f
Author: Jens Petersen <petersen at redhat.com>
Date: Sat Jan 29 22:38:32 2011 +1000
merge subpackaging support and other cleanup from 0.11.4
ghc-rpm-macros.ghc | 224 +++++++++++++++++++++++++++-----------------------
ghc-rpm-macros.spec | 27 +++++--
2 files changed, 140 insertions(+), 111 deletions(-)
---
diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc
index b57a1c7..160b0af 100644
--- a/ghc-rpm-macros.ghc
+++ b/ghc-rpm-macros.ghc
@@ -3,84 +3,90 @@
# configure
%cabal_configure \
-%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' %{!?without_shared:--enable-shared} %{?with_dynamic:--ghc-option=-dynamic}
+%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghclibdocdir}/%{pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --ghc %{!?without_shared:--enable-shared} %{?with_dynamic:--ghc-option=-dynamic}
# install
-%cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
+%cabal_install %cabal copy --destdir=%{buildroot} -v
# root dir for ghc docs
%ghcdocbasedir %{_docdir}/ghc/html
-# ghcdocdir [pkgname]
-%ghcdocdir() %{ghcdocbasedir}/libraries/%{?1}%{!?1:%{pkg_name}}-%{version}
+# libraries doc dir
+%ghclibdocdir %{ghcdocbasedir}/libraries
# 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} \
-pkgnamever=${pkgname}-%{version} \
-rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \
-%if 0%{!?without_shared:1} \
-echo "%defattr(-,root,root,-)" > ${basefile}.files \
-if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
-echo "%dir %{ghcpkgdir}" >> ${basefile}.files \
-echo "%attr(755,root,root) %{ghcpkgdir}/libHS${pkgnamever}-ghc%{ghc_version}.so" >> ${basefile}.files \
-fi \
-%endif \
-echo "%defattr(-,root,root,-)" > ${basefile}-devel.files \
-if [ -d "${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" ]; then \
- %{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{?without_shared:-devel}.files} %{?1::} \
-fi \
-echo "%{ghcpkgbasedir}/package.conf.d/${pkgnamever}*.conf" >> ${basefile}-devel.files \
-if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
-find ${RPM_BUILD_ROOT}%{ghcpkgdir} -type d | sed "s/^/%dir /" >> ${basefile}-devel.files \
-find ${RPM_BUILD_ROOT}%{ghcpkgdir} ! \\( -type d -o -name "*_p.a" -o -name "*.p_hi" -o -name "libHS*.so" \\) >> ${basefile}-devel.files \
-fi \
-echo "%defattr(-,root,root,-)" > ${basefile}-prof.files \
-if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
-find ${RPM_BUILD_ROOT}%{ghcpkgdir} \\( -name "*_p.a" -o -name "*.p_hi" \\) >> ${basefile}-prof.files \
-fi \
-if [ -d "${RPM_BUILD_ROOT}%{ghcdocdir}" ]; then \
-echo "%{ghcdocdir}" >> ${basefile}-devel.files \
-fi \
-sed -i -e "s!${RPM_BUILD_ROOT}!!g" %{!?without_shared:${basefile}.files} ${basefile}-devel.files ${basefile}-prof.files \
+%ghclibdir %{_libdir}/ghc-%{ghc_version}
+
+# ghc_gen_filelists [name] [version]
+%ghc_gen_filelists()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%define basepkg ghc-%{pkgname}\
+%define pkgdir %{ghclibdir}/%{pkgnamever}\
+%define docdir %{ghclibdocdir}/%{pkgnamever}\
+rm -f %{basepkg}.files %{basepkg}-devel.files %{basepkg}-prof.files\
+%if 0%{!?without_shared:1}\
+echo "%defattr(-,root,root,-)" > %{basepkg}.files\
+if [ -d "%{buildroot}%{pkgdir}" ]; then\
+echo "%dir %{pkgdir}" >> %{basepkg}.files\
+echo "%attr(755,root,root) %{pkgdir}/libHS%{pkgnamever}-ghc%{ghc_version}.so" >> %{basepkg}.files\
+fi\
+%endif\
+echo "%defattr(-,root,root,-)" > %{basepkg}-devel.files\
+%if 0%{!?1:1}\
+if [ -d "%{buildroot}%{_docdir}/%{name}-%{version}" ]; then\
+ echo "%{_docdir}/%{name}-%{version}" >> %{basepkg}%{?without_shared:-devel}.files\
+fi\
+%endif\
+echo "%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf" >> %{basepkg}-devel.files\
+if [ -d "%{buildroot}%{pkgdir}" ]; then\
+find %{buildroot}%{pkgdir} -type d | sed "s/^/%dir /" >> %{basepkg}-devel.files\
+find %{buildroot}%{pkgdir} ! \\( -type d -o -name "*_p.a" -o -name "*.p_hi" -o -name "libHS*.so" \\) >> %{basepkg}-devel.files\
+fi\
+echo "%defattr(-,root,root,-)" > %{basepkg}-prof.files\
+if [ -d "%{buildroot}%{pkgdir}" ]; then\
+find %{buildroot}%{pkgdir} \\( -name "*_p.a" -o -name "*.p_hi" \\) >> %{basepkg}-prof.files\
+fi\
+if [ -d "%{buildroot}%{docdir}" ]; then\
+echo "%{docdir}" >> %{basepkg}-devel.files\
+fi\
+sed -i -e "s!%{buildroot}!!g" %{!?without_shared:%{basepkg}.files} %{basepkg}-devel.files %{basepkg}-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%{ghcpkgbasedir}/package.conf.d \
-install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d
+# cabal_pkg_conf [name] [version]
+%cabal_pkg_conf()\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%cabal register --gen-pkg-config\
+mkdir -p %{buildroot}%{ghclibdir}/package.conf.d\
+install --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d\
+%{nil}
# devel pkg basic requires
-%ghc_requires Requires: ghc = %{ghc_version}\
+%ghc_devel_requires Requires: ghc = %{ghc_version}\
Requires(post): ghc = %{ghc_version}\
Requires(postun): ghc = %{ghc_version}\
%if 0%{!?without_shared:1}\
-Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
+Requires: ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}} = %{?pkgver}%{!?pkgver:%{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}
+Requires: ghc-%{?pkg_name}%{!?pkg_name:%{pkgname}}-devel = %{?pkgver}%{!?pkgver:%{version}}-%{release}\
+%{nil}
-# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op)
-%ghc_lib_package(n:c:h:o:)\
-%define ghc_pkg_name ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}\
+# ghc_lib_package [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op)
+%ghc_lib_package(c:h:o:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%define basepkg ghc-%{pkgname}\
%if 0%{!?without_shared:1}\
-%files -n %{ghc_pkg_name} -f %{ghc_pkg_name}.files\
+%files -n %{basepkg} -f %{basepkg}.files\
%defattr(-,root,root,-)\
%endif\
\
@@ -89,22 +95,25 @@ Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{v
%ghc_package_prof\
%{nil}
-# ghc_binlib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] (-o deprecated no-op)
-%ghc_binlib_package(n:c:h:l:v:o:)\
-%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
-%define ghc_pkg_name ghc-%{local_pkg_name}\
-%package -n %{ghc_pkg_name}\
-Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library}\
+# ghc_binlib_package [-c cdepslist] [-h pkgdepslist] [-l licensetag] (-o deprecated no-op) [-x] [name] [version]
+%ghc_binlib_package(c:h:l:o:x:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgnamever}}}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}\
+Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname} library}\
Group: System Environment/Libraries\
-%{-v:Version: %{-v*}}\
+%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
\
-%description -n %{ghc_pkg_name}\
-%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
+%description -n %{basepkg}\
+%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
\
-%if 0%{!?without_shared:1} \
+%if 0%{?ghc_version:%{!?without_shared:1}}\
This package provides the shared library.\
-%endif \
+%endif\
\
%ghc_lib_package\
%{nil}
@@ -114,91 +123,100 @@ This package provides the shared library.\
# for docs post and postun
%ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || :
-# ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] (-o deprecated no-op)
-%ghc_package_devel(n:c:h:l:v:o:)\
-%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
-%define ghc_pkg_name ghc-%{local_pkg_name}\
-%package -n %{ghc_pkg_name}-devel\
-Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library} development files\
+# ghc_package_devel [-c cdepslist] [-h pkgdepslist] [-l licensetag] (-o deprecated no-op) [name] [version]
+%ghc_package_devel(c:h:l:o:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}-devel\
+Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
Group: Development/Libraries\
-%{-v:Version: %{-v*}}\
+%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
-%{?ghc_requires}\
-%{?ghc_doc_requires}\
+%{?ghc_devel_requires}\
%{!-h:%{?ghc_pkg_deps:Requires: %{ghc_pkg_deps}}}\
%{-h:Requires: %{-h*}}\
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
%{-c:Requires: %{-c*}}\
%{?ghc_pkg_obsoletes:Obsoletes: %{ghc_pkg_obsoletes}}\
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
-Obsoletes: %{ghc_pkg_name}-doc < %{version}-%{release}\
-Provides: %{ghc_pkg_name}-doc = %{version}-%{release}\
+Obsoletes: %{basepkg}-doc < %{version}-%{release}\
+Provides: %{basepkg}-doc = %{version}-%{release}\
\
-%description -n %{ghc_pkg_name}-devel\
-%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
+%description -n %{basepkg}-devel\
+%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
\
This package contains the development files.\
\
-%post -n %{ghc_pkg_name}-devel\
+%post -n %{basepkg}-devel\
%ghc_pkg_recache\
%ghc_reindex_haddock\
\
-%postun -n %{ghc_pkg_name}-devel\
+%postun -n %{basepkg}-devel\
%ghc_pkg_recache\
%ghc_reindex_haddock\
\
-%files -n %{ghc_pkg_name}-devel -f %{ghc_pkg_name}-devel.files\
+%files -n %{basepkg}-devel -f %{basepkg}-devel.files\
%defattr(-,root,root,-)\
%{nil}
-# 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 %{?common_summary}%{!?common_summary:%{local_pkg_name}}\
+# ghc_package_prof [-h pkgdepslist] [-l licensetag]
+%ghc_package_prof(h:l:)\
+%define pkgname %{?1}%{!?1:%{pkg_name}}\
+%define pkgver %{?2}%{!?2:%{version}}\
+%define pkgnamever %{pkgname}-%{pkgver}\
+%define basepkg ghc-%{pkgname}\
+%package -n %{basepkg}-prof\
+Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname}} profiling libraries\
Group: Development/Libraries\
-%{-v:Version: %{-v*}}\
+%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
%{?ghc_prof_requires}\
%{!-h:%{?ghc_pkg_deps:Requires: %(echo "%{ghc_pkg_deps}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}}\
%{-h:Requires: %(echo "%{-h*}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\
\
-%description -n %{ghc_pkg_name}-prof\
-%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
+%description -n %{basepkg}-prof\
+%{?common_description}%{!?common_description:Haskell %{pkgname} library.}\
\
-This package contains the profiling library.\
+This package contains the profiling development files.\
\
-%files -n %{ghc_pkg_name}-prof -f %{ghc_pkg_name}-prof.files\
+%files -n %{basepkg}-prof -f %{basepkg}-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'" \\; -exec strip "{}" \\;\
+find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -exec strip "{}" \\;\
%endif
# ghc_bin_build
%ghc_bin_build\
-%cabal_configure --ghc\
+%cabal_configure\
%cabal build
-# ghc_lib_build
-%ghc_lib_build\
-%cabal_configure --ghc -p\
+# ghc_lib_build [name] [version]
+%ghc_lib_build()\
+%{?1:cd %1-%2}\
+%cabal_configure %{!?without_prof:-p} %{?1:--docdir=%{_docdir}/ghc-%1-%2 --htmldir=%{ghclibdocdir}/%1-%2}\
%cabal build\
-%cabal haddock %{!?without_hscolour:--hyperlink-source} %{?with_devhelp:--haddock-option=--html-help=devhelp}
+%{!?without_haddock:%cabal haddock %{!?without_hscolour:--hyperlink-source}}\
+%{?1:cd -}\
+%{nil}
-# ghc_bin_install
+# install bin package
%ghc_bin_install\
%cabal_install\
%ghc_strip_dynlinked
-# ghc_lib_install
-%ghc_lib_install\
+# ghc_lib_install [name] [version]
+%ghc_lib_install()\
+%{?1:cd %1-%2}\
%cabal_install\
%cabal_pkg_conf\
+%{?1:cd -}\
%ghc_gen_filelists\
-%ghc_strip_dynlinked
+%{!?1:%ghc_strip_dynlinked}\
+%{nil}
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index 6fc3156..98b39b1 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -1,5 +1,5 @@
Name: ghc-rpm-macros
-Version: 0.8.3
+Version: 0.10.50
Release: 1%{?dist}
Summary: Macros for building packages for GHC
@@ -13,7 +13,6 @@ URL: https://fedoraproject.org/wiki/Haskell_SIG
Source0: ghc-rpm-macros.ghc
Source1: COPYING
Source2: AUTHORS
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -32,15 +31,10 @@ echo no build stage needed
%install
-rm -rf $RPM_BUILD_ROOT
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
install -p -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-
%files
%defattr(-,root,root,-)
%doc COPYING AUTHORS
@@ -48,10 +42,27 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Sat Jan 29 2011 Jens Petersen <petersen at redhat.com> - 0.10.50-1
+- merge subpackaging support from 0.11.4:
+- drop ghcdocdir and ghcpkgdir
+- new ghclibdocdir
+- improve prof summary and description
+- add without_prof and without_haddock option macros
+- add ghc_binlib_package option to exclude package from ghc_packages_list
+- condition lib base package additional description for srpm
+- use buildroot instead of RPM_BUILD_ROOT
+- rename ghcpkgbasedir to ghclibdir
+- move name and version macro options (-n and -v) to optional args
+- ghc_gen_filelists, ghc_lib_build, ghc_lib_install, cabal_pkg_conf
+ now take optional "[name] [version]" args
+- drop with_devhelp since --html-help option gone from haddock-2.8.0
+- rename ghc_requires to ghc_devel_requires
+- drop ghc_doc_requires
+
* Wed Dec 29 2010 Jens Petersen <petersen at redhat.com> - 0.8.3-1
- revert disabling debug_package, since with redhat-rpm-config installed
the behaviour depended on the position of ghc_lib_package in the spec file
- (reported by narasim_7)
+ (reported by narasim)
* Thu Sep 30 2010 Jens Petersen <petersen at redhat.com> - 0.8.2-1
- add ghc_pkg_obsoletes for obsoleting old packages
More information about the scm-commits
mailing list