From Fedora Project Wiki
(→‎Library Only Template: update for docs handling)
Line 9: Line 9:
%define ghc_version 6.10.1
%define ghc_version 6.10.1
%define pkg_libdir %{_libdir}/ghc-%{ghc_version}/%{pkg_name}-%{version}
%define pkg_libdir %{_libdir}/ghc-%{ghc_version}/%{pkg_name}-%{version}
%define pkg_docdir %{_docdir}/ghc/libraries/%{pkg_name}


# Haskell compilers do not emit debug information
# Haskell compilers do not emit debug information
Line 14: Line 15:


Name: ghc-%{pkg_name}
Name: ghc-%{pkg_name}
Version: 0.7
Version: version
Release: 3%{?dist}
Release: 1%{?dist}
License: BSD
License: BSD
Group: Development/Libraries
Group: Development/Libraries
Line 26: Line 27:
BuildRequires: ghc = %{ghc_version}, ghc-prof = %{ghc_version}, haddock
BuildRequires: ghc = %{ghc_version}, ghc-prof = %{ghc_version}, haddock
BuildRequires: ...
BuildRequires: ...
Requires(pre): %{_bindir}/ghc-pkg-%{ghc_version}
Requires(pre): ghc
Requires(preun): %{_bindir}/ghc-pkg-%{ghc_version}
Requires(preun): ghc
Requires(post): %{_bindir}/ghc-pkg-%{ghc_version}
Requires(post): ghc
Requires(postun): %{_bindir}/ghc-pkg-%{ghc_version}
Requires(postun): ghc
 


%description
%description
Description of %{pkg_name} library
Description of %{pkg_name} library


%package -n %{name}-prof
%package prof
Summary: Profiling libraries for %{name}
Summary: Profiling libraries for %{name}
Group: Development/Libraries
Group: Development/Libraries
Requires: %{name} = %{version}
Requires: %{name} = %{version}


%description -n %{name}-prof
%description prof
This package contains profiling libraries for ghc %{ghc_version}.
This package contains profiling libraries for ghc %{ghc_version}.


Line 75: Line 75:
%post  
%post  
%ghc_postinst_script
%ghc_postinst_script
%ghc_reindex_haddock




Line 83: Line 84:
%postun  
%postun  
%ghc_postun_script
%ghc_postun_script
%ghc_reindex_haddock




%files  -f %{name}.files
%files  -f %{name}.files
%defattr(-,root,root,-)
%defattr(-,root,root,-)
%doc dist/doc/html
%doc LICENSE README
%doc LICENSE README




%files -n %{name}-prof -f %{name}-prof.files
%files prof -f %{name}-prof.files
%defattr(-,root,root,-)
%defattr(-,root,root,-)
%doc LICENSE
%doc LICENSE

Revision as of 00:57, 10 November 2008

Library Only Template

This is a sample spec file for a Haskell Cabal package. This sample demonstrates how to package a Haskell Cabal package that is only a library. It was generated automatically using cabal-rpm. It contains a few minor bugs, including missing dependency declarations. This is due to a limitation in cabal-rpm that needs to be fixed.

Consequently, it's been edited. The changes can be seen in the changelog below.

%define pkg_name someHaLib
%define ghc_version 6.10.1
%define pkg_libdir %{_libdir}/ghc-%{ghc_version}/%{pkg_name}-%{version}
%define pkg_docdir %{_docdir}/ghc/libraries/%{pkg_name}

# Haskell compilers do not emit debug information
%define debug_package %{nil}

Name: ghc-%{pkg_name}
Version: version
Release: 1%{?dist}
License: BSD
Group: Development/Libraries
URL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/%{pkg_name}
Source: http://hackage.haskell.org/packages/archive/%{pkg_name}/%{version}/%{pkg_name}-%{version}.tar.gz
Summary: Summary of %{pkg_name} library
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: ghc = %{ghc_version}
Requires: ...
BuildRequires: ghc = %{ghc_version}, ghc-prof = %{ghc_version}, haddock
BuildRequires: ...
Requires(pre): ghc
Requires(preun): ghc
Requires(post): ghc
Requires(postun): ghc

%description
Description of %{pkg_name} library

%package prof
Summary: Profiling libraries for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}

%description prof
This package contains profiling libraries for ghc %{ghc_version}.


%prep
%setup -q -n %{pkg_name}-%{version}


%build
%cabal_configure -p --ghc
%cabal_build
%cabal_haddock
%ghc_gen_scripts


%install
rm -rf ${RPM_BUILD_ROOT}
%cabal_install
%ghc_install_scripts
%ghc_gen_filelists %{name}

cd ${RPM_BUILD_ROOT}/%{_docdir}/%{name}-%{version}
rm -rf doc LICENSE README


%clean
rm -rf ${RPM_BUILD_ROOT}


%pre 
%ghc_preinst_script


%post 
%ghc_postinst_script
%ghc_reindex_haddock


%preun 
%ghc_preun_script


%postun 
%ghc_postun_script
%ghc_reindex_haddock


%files  -f %{name}.files
%defattr(-,root,root,-)
%doc LICENSE README


%files prof -f %{name}-prof.files
%defattr(-,root,root,-)
%doc LICENSE


%changelog
* Day Month Date Year Fedora Packager <email@address> - version-release
- initial packaging for Fedora