backport ghc_pkg_obsoletes, without_shared, etc from F14 (0.8 branch)

- add ghc_pkg_obsoletes for obsoleting old packages
- disable debuginfo by default
- make shared default: use without_shared to disable
- fix without_shared build so it actually works
- use ghcpkgbasedir
This commit is contained in:
Jens Petersen 2010-12-09 12:31:49 +10:00
parent 724cc3449e
commit a5d5e91f4b
2 changed files with 32 additions and 19 deletions

View File

@ -3,7 +3,7 @@
# configure # configure
%cabal_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 # install
%cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v %cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
@ -23,18 +23,18 @@ pkgname=%{?1}%{!?1:%{pkg_name}} \
basefile=ghc-${pkgname} \ basefile=ghc-${pkgname} \
pkgnamever=${pkgname}-%{version} \ pkgnamever=${pkgname}-%{version} \
rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files ${basefile}-doc.files \ rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files ${basefile}-doc.files \
%if 0%{!?without_shared:1} \
echo "%defattr(-,root,root,-)" > ${basefile}.files \ 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 \ if [ -d "${RPM_BUILD_ROOT}%{ghcpkgdir}" ]; then \
echo "%dir %{ghcpkgdir}" >> ${basefile}.files \ echo "%dir %{ghcpkgdir}" >> ${basefile}.files \
echo "%attr(755,root,root) %{ghcpkgdir}/libHS${pkgnamever}-ghc%{ghc_version}.so" >> ${basefile}.files \ echo "%attr(755,root,root) %{ghcpkgdir}/libHS${pkgnamever}-ghc%{ghc_version}.so" >> ${basefile}.files \
fi \ fi \
%endif \ %endif \
echo "%defattr(-,root,root,-)" > ${basefile}-devel.files \ 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 \ 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 | 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 \ find ${RPM_BUILD_ROOT}%{ghcpkgdir} ! \\( -type d -o -name "*_p.a" -o -name "*.p_hi" -o -name "libHS*.so" \\) >> ${basefile}-devel.files \
@ -47,7 +47,7 @@ echo "%defattr(-,root,root,-)" > ${basefile}-doc.files \
if [ -d "${RPM_BUILD_ROOT}%{ghcdocdir}" ]; then \ if [ -d "${RPM_BUILD_ROOT}%{ghcdocdir}" ]; then \
echo "%{ghcdocdir}" >> ${basefile}-doc.files \ echo "%{ghcdocdir}" >> ${basefile}-doc.files \
fi \ 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} %{nil}
# compiler version # compiler version
@ -57,14 +57,14 @@ sed -i -e "s!${RPM_BUILD_ROOT}!!g" ${basefile}.files ${basefile}-devel.files ${b
# cabal_pkg_conf [pkgname] # cabal_pkg_conf [pkgname]
%cabal_pkg_conf \ %cabal_pkg_conf \
%cabal register --gen-pkg-config \ %cabal register --gen-pkg-config \
mkdir -p $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%{_libdir}/ghc-%{ghc_version}/package.conf.d install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d
# devel pkg basic requires # devel pkg basic requires
%ghc_requires Requires: ghc = %{ghc_version}\ %ghc_requires Requires: ghc = %{ghc_version}\
Requires(post): ghc = %{ghc_version}\ Requires(post): ghc = %{ghc_version}\
Requires(postun): 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}\ Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\
%endif %endif
@ -79,8 +79,8 @@ Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{v
# ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] # ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist]
%ghc_lib_package(n:c:h:)\ %ghc_lib_package(n:c:h:)\
%define ghc_pkg_name %{-n:ghc-%{-n*}}%{!-n:ghc-%{pkg_name}}\ %define ghc_pkg_name ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}\
%if %{with shared}\ %if 0%{!?without_shared:1}\
%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,-)\
%endif\ %endif\
@ -105,7 +105,9 @@ Group: System Environment/Libraries\
%description -n %{ghc_pkg_name}\ %description -n %{ghc_pkg_name}\
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ %{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
\ \
%if 0%{!?without_shared:1} \
This package provides the shared library.\ This package provides the shared library.\
%endif \
\ \
%ghc_lib_package\ %ghc_lib_package\
%{nil} %{nil}
@ -114,6 +116,7 @@ This package provides the shared library.\
# ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] # ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version]
%ghc_package_devel(n:c:h:l:v:)\ %ghc_package_devel(n:c:h:l:v:)\
%global debug_package %{nil}\
%define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\
%define ghc_pkg_name ghc-%{local_pkg_name}\ %define ghc_pkg_name ghc-%{local_pkg_name}\
%package -n %{ghc_pkg_name}-devel\ %package -n %{ghc_pkg_name}-devel\
@ -126,6 +129,7 @@ Group: Development/Libraries\
%{-h:Requires: %{-h*}}\ %{-h:Requires: %{-h*}}\
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\ %{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
%{-c:Requires: %{-c*}}\ %{-c:Requires: %{-c*}}\
%{?ghc_pkg_obsoletes:Obsoletes: %{ghc_pkg_obsoletes}}\
\ \
%description -n %{ghc_pkg_name}-devel\ %description -n %{ghc_pkg_name}-devel\
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ %{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
@ -158,6 +162,7 @@ Group: Development/Libraries\
%{?ghc_doc_requires}\ %{?ghc_doc_requires}\
%{!-h:%{?ghc_pkg_deps:Requires: %(echo %{ghc_pkg_deps} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}}\ %{!-h:%{?ghc_pkg_deps:Requires: %(echo %{ghc_pkg_deps} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}}\
%{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\ %{-h:Requires: %(echo %{-h*} | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\
\ \
%description -n %{ghc_pkg_name}-doc\ %description -n %{ghc_pkg_name}-doc\
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ %{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
@ -186,8 +191,9 @@ Group: Development/Libraries\
%{-v:Version: %{-v*}}\ %{-v:Version: %{-v*}}\
%{-l:License: %{-l*}}\ %{-l:License: %{-l*}}\
%{?ghc_prof_requires}\ %{?ghc_prof_requires}\
%{!-h:%{?ghc_pkg_deps:Requires: %(echo %{ghc_pkg_deps} | 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")}\ %{-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\ %description -n %{ghc_pkg_name}-prof\
%{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ %{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\
@ -213,7 +219,7 @@ find $RPM_BUILD_ROOT -type f -exec sh -c "file {} | grep -q 'dynamically linked'
%ghc_lib_build\ %ghc_lib_build\
%cabal_configure --ghc -p\ %cabal_configure --ghc -p\
%cabal build\ %cabal build\
%cabal haddock %{?with_hscolour:--hyperlink-source} %cabal haddock %{?with_hscolour:--hyperlink-source} %{?with_devhelp:--haddock-option=--html-help=devhelp}
# ghc_bin_install # ghc_bin_install
%ghc_bin_install\ %ghc_bin_install\

View File

@ -1,5 +1,5 @@
Name: ghc-rpm-macros Name: ghc-rpm-macros
Version: 0.7.2 Version: 0.7.3
Release: 1%{?dist} Release: 1%{?dist}
Summary: Macros for building packages for GHC Summary: Macros for building packages for GHC
@ -19,8 +19,8 @@ BuildArch: noarch
%description %description
A set of macros for building GHC packages following the Haskell Guidelines 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 of the Fedora Haskell SIG. This package probably shouldn't be installed on
as GHC is needed in order to make use of these macros. its own as GHC is needed in order to make use of these macros.
%prep %prep
%setup -c -T %setup -c -T
@ -34,7 +34,7 @@ echo no build stage needed
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm 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 %clean
@ -48,6 +48,13 @@ rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Tue Dec 7 2010 Jens Petersen <petersen@redhat.com> - 0.7.3-1
- add ghc_pkg_obsoletes for obsoleting old packages
- disable debuginfo by default
- make shared default: use without_shared to disable
- fix without_shared build so it actually works
- use ghcpkgbasedir
* Sat Jul 31 2010 Jens Petersen <petersen@redhat.com> - 0.7.2-1 * Sat Jul 31 2010 Jens Petersen <petersen@redhat.com> - 0.7.2-1
- fix ghc_strip_dynlinked when no dynlinked files - fix ghc_strip_dynlinked when no dynlinked files