add ghc-deps.sh for hash rpm metadata and add ghc_pkg_obsoletes

- add ghc-deps.sh for ghc package hash rpm metadata provides and requires
- turn on hash provides and disable debuginfo by default
- make shared and hscolour default
- use without_shared and without_hscolour to disble them
- add ghc_pkg_obsoletes for obsoleting old packages
- use ghcpkgbasedir
- always obsolete -doc packages, but keep -o for now for backward compatibility
epel9
Jens Petersen 14 years ago
parent 8c3e84353f
commit 742ca58b86

@ -0,0 +1,35 @@
#!/bin/sh
# find rpm provides and requires for Haskell GHC libraries
#set -x
# To use add the following lines to spec file:
# %define _use_internal_dependency_generator 0
# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires
# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides
[ $# -ne 1 ] && echo "Usage: `basename $0` [--provides|--requires]" && exit 1
MODE=$1
case $MODE in
--provides) FIELD=id ;;
--requires) FIELD=depends
esac
files=$(cat)
PKGCONF=$(echo $files | tr [:blank:] '\n' | grep package.conf.d)
if [ -n "$PKGCONF" ]; then
CONFDIR=$(dirname $PKGCONF)
PKGS=$(ghc-pkg -f $CONFDIR describe '*' | awk '/^name: / {print $2}')
for pkg in $PKGS; do
HASHS=$(ghc-pkg -f $CONFDIR field $pkg $FIELD | sed -e "s/^$FIELD: \+//")
for i in $HASHS; do
echo "ghc($i)"
done
done
fi
echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE

@ -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
@ -25,16 +25,16 @@ pkgnamever=${pkgname}-%{version} \
rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \ rm -f ${basefile}.files ${basefile}-devel.files ${basefile}-prof.files \
echo "%defattr(-,root,root,-)" > ${basefile}.files \ echo "%defattr(-,root,root,-)" > ${basefile}.files \
if [ -d "${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" ]; then \ if [ -d "${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}" ]; then \
%{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{!?with_shared:-devel}.files} %{?1::} \ %{!?1:echo "%{_docdir}/%{name}-%{version}" >> ${basefile}%{?without_shared:-devel}.files} %{?1::} \
fi \ fi \
%if %{with shared} \ %if 0%{!?without_shared:1} \
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 \ 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 \
@ -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 [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
@ -76,10 +76,10 @@ Requires(postun): ghc-doc = %{ghc_version}
%ghc_prof_requires Requires: ghc-prof = %{ghc_version}\ %ghc_prof_requires Requires: ghc-prof = %{ghc_version}\
Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{version}}-%{release} 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:)\ %ghc_lib_package(n:c:h:o:)\
%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\
@ -89,7 +89,7 @@ Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{v
%ghc_package_prof\ %ghc_package_prof\
%{nil} %{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:)\ %ghc_binlib_package(n:c:h:l:v:o:)\
%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}\
@ -112,8 +112,12 @@ This package provides the shared library.\
# for docs post and postun # for docs post and postun
%ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || : %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:)\ %ghc_package_devel(n:c:h:l:v:o:)\
%global _use_internal_dependency_generator 0\
%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides\
#%%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires\
%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\
@ -127,7 +131,9 @@ 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*}}\
%{-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}\ Provides: %{ghc_pkg_name}-doc = %{version}-%{release}\
\ \
%description -n %{ghc_pkg_name}-devel\ %description -n %{ghc_pkg_name}-devel\
@ -157,8 +163,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.}\
@ -184,7 +191,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 %{!?without_hscolour:--hyperlink-source} %{?with_devhelp:--haddock-option=--html-help=devhelp}
# ghc_bin_install # ghc_bin_install
%ghc_bin_install\ %ghc_bin_install\

@ -1,5 +1,5 @@
Name: ghc-rpm-macros Name: ghc-rpm-macros
Version: 0.8.1 Version: 0.9.0
Release: 1%{?dist} Release: 1%{?dist}
Summary: Macros for building packages for GHC Summary: Macros for building packages for GHC
@ -13,14 +13,15 @@ URL: https://fedoraproject.org/wiki/Haskell_SIG
Source0: ghc-rpm-macros.ghc Source0: ghc-rpm-macros.ghc
Source1: COPYING Source1: COPYING
Source2: AUTHORS Source2: AUTHORS
Source3: ghc-deps.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch 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 +35,10 @@ 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
mkdir -p ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
install -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
%clean %clean
@ -45,9 +49,19 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc COPYING AUTHORS %doc COPYING AUTHORS
%config(noreplace) %{_sysconfdir}/rpm/macros.ghc %config(noreplace) %{_sysconfdir}/rpm/macros.ghc
%{_prefix}/lib/rpm
%changelog %changelog
* Sat Sep 25 2010 Jens Petersen <petersen@redhat.com> - 0.9.0-1
- add ghc-deps.sh to add ghc package hash rpm metadata provides and requires
- turn on hash provides and disable debuginfo by default
- make shared and hscolour default
- use without_shared and without_hscolour to disble them
- add ghc_pkg_obsoletes for obsoleting old packages
- use ghcpkgbasedir
- always obsolete -doc packages, but keep -o for now for backward compatibility
* Fri Jul 16 2010 Jens Petersen <petersen@redhat.com> - 0.8.1-1 * Fri Jul 16 2010 Jens Petersen <petersen@redhat.com> - 0.8.1-1
- fix ghc_strip_dynlinked when no dynlinked files - fix ghc_strip_dynlinked when no dynlinked files
- devel should provide doc also when not obsoleting - devel should provide doc also when not obsoleting

Loading…
Cancel
Save