- add ghc-requires rpm script to generate ghc version dependencies (thanks

to Till Maas)
- update macros.ghc:
- add %%ghcrequires to call above script
- pkg_libdir and pkg_docdir no longer to appear in packages and replaced by
    ghcpkgdir and ghcdocdir inside macros.ghc
- make filelist also for docs
This commit is contained in:
Jens Petersen 2009-04-19 04:28:22 +00:00
parent 1b7e30e4b7
commit 7b1f4da984
3 changed files with 53 additions and 9 deletions

View File

@ -1,7 +1,7 @@
%cabal %{_bindir}/runghc Setup
%cabal_configure \
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{pkg_docdir} --libsubdir='$compiler/$pkgid'
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{name}-%{version} --htmldir=%{ghcdocdir} --libsubdir='$compiler/$pkgid'
%cabal_makefile \
%cabal makefile -f cabal-rpm.mk \
@ -10,22 +10,29 @@ make -f cabal-rpm.mk %{_smp_mflags} \
%cabal_install %cabal copy --destdir=${RPM_BUILD_ROOT} -v
%ghcdocdir %{_docdir}/ghc/libraries/%{?pkg_name}%{!?pkg_name:%{name}}-%{version}
%ghcpkgdir %{_libdir}/ghc-%(ghc --numeric-version)/%{?pkg_name}%{!?pkg_name:%name}-%{version}
%ghc_gen_filelists() \
rm -f %1-devel.files %1-prof.files \
rm -f %1-devel.files %1-prof.files %1-doc.files \
echo '%defattr(-,root,root,-)' > %1-devel.files \
find ${RPM_BUILD_ROOT}%{pkg_libdir} -type d | sed 's/^/%dir /' >> %1-devel.files \
find ${RPM_BUILD_ROOT}%{pkg_libdir} ! \\( -type d -o -name '*_p.a' -o -name '*.p_hi' \\) >> %1-devel.files \
find ${RPM_BUILD_ROOT}%{ghcpkgdir} -type d | sed 's/^/%dir /' >> %1-devel.files \
find ${RPM_BUILD_ROOT}%{ghcpkgdir} ! \\( -type d -o -name '*_p.a' -o -name '*.p_hi' \\) >> %1-devel.files \
echo '%defattr(-,root,root,-)' > %1-prof.files \
find ${RPM_BUILD_ROOT}%{pkg_libdir} \\( -name '*_p.a' -o -name '*.p_hi' \\) >> %1-prof.files \
find ${RPM_BUILD_ROOT}%{ghcpkgdir} \\( -name '*_p.a' -o -name '*.p_hi' \\) >> %1-prof.files \
sed -i -e "s!${RPM_BUILD_ROOT}!!g" %1-devel.files %1-prof.files \
echo '%defattr(-,root,root,-)' > %1-doc.files \
echo '%{ghcdocdir}' >> %1-doc.files \
%{nil}
%ghc_gen_scripts %cabal register --gen-script ; %cabal unregister --gen-script
%ghc_install_scripts install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir}
%ghc_install_scripts install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{ghcpkgdir}
%ghc_register_pkg %{pkg_libdir}/register.sh >/dev/null || :
%ghc_register_pkg %{ghcpkgdir}/register.sh >/dev/null || :
%ghc_unregister_pkg %{pkg_libdir}/unregister.sh >/dev/null || :
%ghc_unregister_pkg %{ghcpkgdir}/unregister.sh >/dev/null || :
%ghc_reindex_haddock ( cd %{_docdir}/ghc/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || :
%ghcrequires() %{expand:%(/usr/lib/rpm/ghc-requires %*)}

21
ghc-rpm-requires Normal file
View File

@ -0,0 +1,21 @@
#! /bin/bash
# Author: Till Maas <opensource@till.name>
#
# Use this script as follows in your spec to get versioned
# ghc requires for post and preun:
#
# %{expand:%(/usr/lib/ghc-script-requires.sh ghc post preun)}
ghc_num_ver=$(ghc --numeric-version)
PKG=$1 ; shift
# rpm will run this script once before the BuildRequires are installed
# then it has to report nothing to avoid rpm complainng about the empty version
# after the "ghc ="
if [ -n "${ghc_num_ver}" ]; then
echo "Requires: $PKG = ${ghc_num_ver}"
for script in "$@"; do
echo "Requires(${script}): $PKG = ${ghc_num_ver}"
done
fi

View File

@ -16,7 +16,7 @@
Name: ghc
Version: 6.10.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Glasgow Haskell Compilation system
# fedora ghc has only been bootstrapped on the following archs:
ExclusiveArch: %{ix86} x86_64 ppc alpha
@ -24,7 +24,10 @@ License: BSD
Group: Development/Languages
Source0: http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src.tar.bz2
Source1: http://www.haskell.org/ghc/dist/%{version}/ghc-%{version}-src-extralibs.tar.bz2
# /etc/rpm/macros.ghc
Source2: ghc-rpm-macros.ghc
# /usr/lib/rpm/ghc-requires
Source3: ghc-rpm-requires
URL: http://haskell.org/ghc/
# libedit-devel > 2.11-2 correctly requires ncurses-devel
Requires: gcc, gmp-devel, libedit-devel > 2.11-2
@ -125,6 +128,9 @@ make DESTDIR=${RPM_BUILD_ROOT} install-docs
# install rpm macros
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
cp -p %{SOURCE2} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
# rpm script for ghc version deps
mkdir -p ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
cp -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm/ghc-requires
SRC_TOP=$PWD
rm -f rpm-*-filelist rpm-*.files
@ -191,6 +197,7 @@ fi
%{_bindir}/*
%{_sysconfdir}/rpm/macros.ghc
%config(noreplace) %{_libdir}/ghc-%{version}/package.conf
%attr(755,root,root) %{_prefix}/lib/rpm/ghc-requires
%if %{with prof}
%files prof -f rpm-prof-filelist
@ -216,6 +223,15 @@ fi
%endif
%changelog
* Sun Apr 19 2009 Jens Petersen <petersen@redhat.com> - 6.10.2-2
- add ghc-requires rpm script to generate ghc version dependencies
(thanks to Till Maas)
- update macros.ghc:
- add %%ghcrequires to call above script
- pkg_libdir and pkg_docdir obsoleted in packages and replaced
by ghcpkgdir and ghcdocdir inside macros.ghc
- make filelist also for docs
* Wed Apr 08 2009 Bryan O'Sullivan <bos@serpentine.com> - 6.10.2-1
- Update to 6.10.2