- move spec templates to haskell-packaging for easy updating

- provide correct haddock version
spec templating:
- use bcond for
- add doc subpackages to lib and binlib templates
- add license header for cabal2spec
This commit is contained in:
Jens Petersen 2009-01-19 05:39:55 +00:00
parent 644d44d682
commit 65d3718c16
3 changed files with 73 additions and 58 deletions

View File

@ -3,8 +3,8 @@
%define pkg_libdir %{_libdir}/ghc-%{ghc_version}/%{name}-%{version}
%define pkg_docdir %{_docdir}/ghc/libraries/%{name}-%{version}
%define build_prof 1
%define build_doc 1
%bcond_without prof
%bcond_without doc
# ghc does not emit debug information
%define debug_package %{nil}
@ -15,14 +15,14 @@ Release: 1%{?dist}
Summary: *FIXME*
Group: *FIXME*
License: BSD?
License: BSD? *FIXME*
URL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/%{name}
Source0: http://hackage.haskell.org/packages/archive/%{name}/%{version}/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# ghc has only been bootstrapped on the following archs:
ExclusiveArch: i386 x86_64 ppc
BuildRequires: ghc = %{ghc_version}
%if %{build_prof}
%if %{with prof}
BuildRequires: ghc-prof = %{ghc_version}
%endif
@ -37,13 +37,24 @@ Provides: ghc-%{name}-devel = %{version}-%{release}
Requires: ghc = %{ghc_version}
Requires(post): ghc = %{ghc_version}
Requires(preun): ghc = %{ghc_version}
Requires(postun): ghc = %{ghc_version}
%description -n ghc-%{name}
Haskell %{name} library. *FIXME*
%if %{build_prof}
%if %{with doc}
%package -n ghc-%{name}-doc
Summary: Documentation for %{name}
Group: Development/Libraries
Requires: ghc-doc = %{ghc_version}
Requires(postun): ghc-doc = %{ghc_version}
%description -n ghc-%{name}-doc
This package contains development documentation files for the %{name} library.
%endif
%if %{with prof}
%package -n ghc-%{name}-prof
Summary: Profiling libraries for %{name}
Group: Development/Libraries
@ -60,14 +71,9 @@ This package contains profiling libraries for %{name}.
%build
%cabal_configure --ghc \
%if %{build_prof}
-p
%else
%{nil}
%endif
%cabal_configure --ghc %{!?without_prof:-p}
%cabal build
%if %{build_doc}
%if %{with doc}
%cabal haddock
%endif
%ghc_gen_scripts
@ -86,7 +92,10 @@ rm -rf $RPM_BUILD_ROOT
%post -n ghc-%{name}
%ghc_register_pkg
%if %{build_doc}
%if %{with doc}
%post -n ghc-%{name}-doc
%ghc_reindex_haddock
%endif
@ -97,26 +106,32 @@ if [ "$1" -eq 0 ] ; then
fi
%postun -n ghc-%{name}
%if %{with doc}
%postun -n ghc-%{name}-doc
if [ "$1" -eq 0 ] ; then
%if %{build_doc}
%ghc_reindex_haddock
%endif
fi
%endif
%files
%defattr(-,root,root,-)
%doc LICENSE
%{_bindir}/%{name}
%files -n ghc-%{name} -f ghc-%{name}.files
%defattr(-,root,root,-)
%if %{build_doc}
%if %{with doc}
%files -n ghc-%{name}-doc
%defattr(-,root,root,-)
%{pkg_docdir}
%endif
%if %{build_prof}
%if %{with prof}
%files -n ghc-%{name}-prof -f ghc-%{name}-prof.files
%defattr(-,root,root,-)
%endif

View File

@ -4,8 +4,8 @@
%define pkg_libdir %{_libdir}/ghc-%{ghc_version}/%{pkg_name}-%{version}
%define pkg_docdir %{_docdir}/ghc/libraries/%{pkg_name}-%{version}
%define build_prof 1
%define build_doc 1
%bcond_without prof
%bcond_without doc
# ghc does not emit debug information
%define debug_package %{nil}
@ -16,27 +16,39 @@ Release: 1%{?dist}
Summary: Haskell %{pkg_name} library *FIXME*
Group: Development/Libraries
License: BSD?
License: BSD? *FIXME*
URL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/%{pkg_name}
Source0: http://hackage.haskell.org/packages/archive/%{pkg_name}/%{version}/%{pkg_name}-%{version}.tar.gz
Provides: %{name}-devel = %{version}-%{release}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Provides: %{name}-devel = %{version}-%{release}
# ghc has only been bootstrapped on the following archs:
ExclusiveArch: i386 x86_64 ppc
BuildRequires: ghc = %{ghc_version}
%if %{build_prof}
%if %{with prof}
BuildRequires: ghc-prof = %{ghc_version}
%endif
Requires: ghc = %{ghc_version}
Requires(post): ghc = %{ghc_version}
Requires(preun): ghc = %{ghc_version}
Requires(postun): ghc = %{ghc_version}
%description
Haskell %{pkg_name} library for ghc-%{ghc_version}. *FIXME*
%if %{build_prof}
%if %{with doc}
%package doc
Summary: Documentation for %{name}
Group: Development/Libraries
Requires: ghc-doc = %{ghc_version}
Requires(postun): ghc-doc = %{ghc_version}
%description doc
This package contains development documentation files for the %{name} library.
%endif
%if %{with prof}
%package prof
Summary: Profiling libraries for %{name}
Group: Development/Libraries
@ -53,14 +65,9 @@ This package contains profiling libraries for %{name}.
%build
%cabal_configure --ghc \
%if %{build_prof}
-p
%else
%{nil}
%endif
%cabal_configure --ghc %{!?without_prof:-p}
%cabal build
%if %{build_doc}
%if %{with doc}
%cabal haddock
%endif
%ghc_gen_scripts
@ -79,7 +86,10 @@ rm -rf $RPM_BUILD_ROOT
%post
%ghc_register_pkg
%if %{build_doc}
%if %{with doc}
%post doc
%ghc_reindex_haddock
%endif
@ -90,23 +100,27 @@ if [ "$1" -eq 0 ] ; then
fi
%postun
%if %{with doc}
%postun doc
if [ "$1" -eq 0 ] ; then
%if %{build_doc}
%ghc_reindex_haddock
%endif
fi
%endif
%files -f %{name}.files
%defattr(-,root,root,-)
%doc LICENSE
%if %{build_doc}
%if %{with doc}
%files doc
%defattr(-,root,root,-)
%{pkg_docdir}
%endif
%if %{build_prof}
%if %{with prof}
%files prof -f %{name}-prof.files
%defattr(-,root,root,-)
%endif

View File

@ -25,17 +25,13 @@ 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
Source2: ghc-rpm-macros.ghc
Source3: cabal2spec
Source4: cabal-bin-template.spec.in
Source5: cabal-lib-template.spec.in
Source6: cabal-binlib-template.spec.in
URL: http://haskell.org/ghc/
Requires: gcc, gmp-devel, libedit-devel
Requires(post): policycoreutils
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: ghc682, ghc681, ghc661, ghc66, haddock <= 2.0.0.0
# introduced for f11 and to be removed for f13:
Provides: haddock = 2.2.2
Provides: haddock = 2.3.0
BuildRequires: ghc, happy, sed
BuildRequires: gmp-devel, libedit-devel
%if %{build_doc}
@ -131,13 +127,6 @@ make DESTDIR=${RPM_BUILD_ROOT} install-docs
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
cp -p %{SOURCE2} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
# spec templating
# cabal2spec
install -m 0755 -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_bindir}
# templates for bin, lib and binlib cabal hackages
mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/ghc
cp -p %{SOURCE4} %{SOURCE5} %{SOURCE6} ${RPM_BUILD_ROOT}/%{_datadir}/ghc/
SRC_TOP=$PWD
rm -f rpm-*-filelist rpm-*.files
( cd $RPM_BUILD_ROOT
@ -203,7 +192,6 @@ fi
%{_bindir}/*
%{_sysconfdir}/rpm/macros.ghc
%config(noreplace) %{_libdir}/ghc-%{version}/package.conf
%{_datadir}/ghc
%if %{build_prof}
%files prof -f rpm-prof-filelist
@ -229,11 +217,9 @@ fi
%endif
%changelog
* Fri Dec 5 2008 Jens Petersen <petersen@redhat.com>
- more template fixes:
- version pkg_docdir
- put provides in lib subsubpackage
- binlib scripts are for lib subpackage
* Mon Jan 19 2009 Jens Petersen <petersen@redhat.com> - 6.10.1-6
- move spec templates to a haskell-packaging for easy updating
- provide correct haddock version
* Mon Dec 1 2008 Jens Petersen <petersen@redhat.com> - 6.10.1-6
- update macros.ghc to latest proposed revised packaging guidelines: