From a5d5e91f4bcda8b10c400ec3d2d46b1fe55160ca Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Thu, 9 Dec 2010 12:31:49 +1000 Subject: [PATCH] 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 --- ghc-rpm-macros.ghc | 36 +++++++++++++++++++++--------------- ghc-rpm-macros.spec | 15 +++++++++++---- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc index 694ed0a..4d2a0c8 100644 --- a/ghc-rpm-macros.ghc +++ b/ghc-rpm-macros.ghc @@ -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 ${basefile}-doc.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 \ @@ -47,7 +47,7 @@ echo "%defattr(-,root,root,-)" > ${basefile}-doc.files \ if [ -d "${RPM_BUILD_ROOT}%{ghcdocdir}" ]; then \ echo "%{ghcdocdir}" >> ${basefile}-doc.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 @@ -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 \ %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 @@ -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:c:h:)\ -%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\ @@ -105,7 +105,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} @@ -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:c:h:l:v:)\ +%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\ @@ -126,6 +129,7 @@ Group: Development/Libraries\ %{-h:Requires: %{-h*}}\ %{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\ %{-c:Requires: %{-c*}}\ +%{?ghc_pkg_obsoletes:Obsoletes: %{ghc_pkg_obsoletes}}\ \ %description -n %{ghc_pkg_name}-devel\ %{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ @@ -158,6 +162,7 @@ Group: Development/Libraries\ %{?ghc_doc_requires}\ %{!-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")}\ +%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-doc/g")}\ \ %description -n %{ghc_pkg_name}-doc\ %{?common_description}%{!?common_description:Haskell %{local_pkg_name} library.}\ @@ -186,8 +191,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.}\ @@ -213,7 +219,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 %{?with_hscolour:--hyperlink-source} %{?with_devhelp:--haddock-option=--html-help=devhelp} # ghc_bin_install %ghc_bin_install\ diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index 25ce6c8..3443146 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -1,5 +1,5 @@ Name: ghc-rpm-macros -Version: 0.7.2 +Version: 0.7.3 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,13 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Dec 7 2010 Jens Petersen - 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 - 0.7.2-1 - fix ghc_strip_dynlinked when no dynlinked files