backport macro updates from 0.9.1

- add ghc_pkg_obsoletes for obsoleting old packages
- always obsolete -doc packages, but keep -o for now for backward compatibility
- disable debuginfo by default
- make shared and hscolour default
- use without_shared and without_hscolour to disable them
- fix without_shared build so it actually works
- use ghcpkgbasedir
This commit is contained in:
Jens Petersen 2010-09-30 13:19:57 +10:00
parent 8c3e84353f
commit 4485d43033
2 changed files with 38 additions and 23 deletions

View File

@ -3,7 +3,7 @@
# 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 configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid' %{!?without_shared:--enable-shared} %{?with_dynamic:--ghc-option=-dynamic}
# install
%cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
@ -23,18 +23,18 @@ 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}%{_docdir}/%{name}-%{version}" ]; then \
%{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{!?with_shared:-devel}.files} %{?1::} \
fi \
%if %{with shared} \
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 \
echo "%{_libdir}/ghc-%{ghc_version}/package.conf.d/${pkgnamever}*.conf" >> ${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 \
@ -46,7 +46,7 @@ fi \
if [ -d "${RPM_BUILD_ROOT}%{ghcdocdir}" ]; then \
echo "%{ghcdocdir}" >> ${basefile}-devel.files \
fi \
sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \
sed -i -e "s!${RPM_BUILD_ROOT}!!g" %{!?without_shared:${basefile}.files} ${basefile}-devel.files ${basefile}-prof.files \
%{nil}
# compiler version
@ -56,14 +56,14 @@ sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basefile}.files ${basefile}-devel.files ${b
# 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
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
# devel pkg basic requires
%ghc_requires Requires: ghc = %{ghc_version}\
Requires(post): ghc = %{ghc_version}\
Requires(postun): ghc = %{ghc_version}\
%if %{with shared}\
%if 0%{!?without_shared:1}\
Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
%endif
@ -76,10 +76,10 @@ Requires(postun): ghc-doc = %{ghc_version}
%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] [-o obsolete-docver]
# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op)
%ghc_lib_package(n:c:h:o:)\
%define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\
%if %{with shared}\
%define ghc_pkg_name ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}\
%if 0%{!?without_shared:1}\
%files -n %{ghc_pkg_name} -f %{ghc_pkg_name}.files\
%defattr(-,root,root,-)\
%endif\
@ -89,7 +89,7 @@ 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 obsolete-docver]
# 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}\
@ -102,7 +102,9 @@ Group: System Environment/Libraries\
%description -n %{ghc_pkg_name}\
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
\
%if 0%{!?without_shared:1} \
This package provides the shared library.\
%endif \
\
%ghc_lib_package\
%{nil}
@ -112,8 +114,9 @@ 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 obsolete-docver]
# 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:)\
%global debug_package %{nil}\
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
%define ghc_pkg_name ghc-%{local_pkg_name}\
%package -n %{ghc_pkg_name}-devel\
@ -127,7 +130,9 @@ Group: Development/Libraries\
%{-h:Requires: %{-h*}}\
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
%{-c:Requires: %{-c*}}\
%{-o:Obsoletes: %{ghc_pkg_name}-doc < %{-o*}}\
%{?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}\
\
%description -n %{ghc_pkg_name}-devel\
@ -157,8 +162,9 @@ Group: Development/Libraries\
%{-v:Version: %{-v*}}\
%{-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")}\
%{!-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.}\
@ -184,7 +190,7 @@ find $RPM_BUILD_ROOT -type f -exec sh -c "file {} | grep -q 'dynamically linked'
%ghc_lib_build\
%cabal_configure --ghc -p\
%cabal build\
%cabal haddock %{?with_hscolour:--hyperlink-source}
%cabal haddock %{!?without_hscolour:--hyperlink-source} %{?with_devhelp:--haddock-option=--html-help=devhelp}
# ghc_bin_install
%ghc_bin_install\

View File

@ -1,5 +1,5 @@
Name: ghc-rpm-macros
Version: 0.8.1
Version: 0.8.2
Release: 1%{?dist}
Summary: Macros for building packages for GHC
@ -19,8 +19,8 @@ BuildArch: noarch
%description
A set of macros for building GHC packages following the Haskell Guidelines
of the Haskell SIG. This package probably shouldn't be installed on its own
as GHC is needed in order to make use of these macros.
of the Fedora Haskell SIG. This package probably shouldn't be installed on
its own as GHC is needed in order to make use of these macros.
%prep
%setup -c -T
@ -34,7 +34,7 @@ echo no build stage needed
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
cp -p %{SOURCE0} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
install -p -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
%clean
@ -48,6 +48,15 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Thu Sep 30 2010 Jens Petersen <petersen@redhat.com> - 0.8.2-1
- add ghc_pkg_obsoletes for obsoleting old packages
- always obsolete -doc packages, but keep -o for now for backward compatibility
- disable debuginfo by default
- make shared and hscolour default
- use without_shared and without_hscolour to disable them
- fix without_shared build so it actually works
- use ghcpkgbasedir
* Fri Jul 16 2010 Jens Petersen <petersen@redhat.com> - 0.8.1-1
- fix ghc_strip_dynlinked when no dynlinked files
- devel should provide doc also when not obsoleting