From Fedora Project Wiki
(→‎Library Only Template: update macros)
Line 6: Line 6:


<pre>
<pre>
%define pkg_name someHaLib
%define hsc_name ghc
%define hsc_name ghc
%define hsc_version 6.8.3
%define hsc_version 6.8.3
%define pkg_name someHaLib
%define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{pkg_name}-%{version}
%define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{pkg_name}-%{version}


# Haskell compilers do not traditionally emit DWARF data.
# Haskell compilers do not emit debug information
%define debug_package %{nil}
%define debug_package %{nil}


Line 45: Line 45:


%build
%build
%ghc_autotools -l -p enable
%cabal_configure -p --ghc
%ghc_build
%cabal_build
%ghc_haddock
%cabal_haddock
%ghc_gen_scripts
%ghc_gen_scripts


Line 53: Line 53:
%install
%install
rm -rf ${RPM_BUILD_ROOT}
rm -rf ${RPM_BUILD_ROOT}
%ghc_install
%cabal_install
%ghc_install_scripts
%ghc_install_scripts
%ghc_gen_filelists %{name}
%ghc_gen_filelists %{name}
Line 81: Line 81:




%files  -f %{name}-files
%files  -f %{name}.files
%defattr(-,root,root,-)
%defattr(-,root,root,-)
%doc dist/doc/html
%doc dist/doc/html
Line 87: Line 87:




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

Revision as of 10:22, 9 September 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 hsc_name ghc
%define hsc_version 6.8.3
%define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{pkg_name}-%{version}

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

Name: %{hsc_name}-%{pkg_name}
Version: 0.7
Release: 3%{?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: %{hsc_name} = %{hsc_version}
Requires: ...
BuildRequires: %{hsc_name} = %{hsc_version}, %{hsc_name}-prof = %{hsc_version}, haddock
BuildRequires: ...

%description
Description of %{pkg_name} library

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

%description -n %{name}-prof
This package contains profiling libraries for %{hsc_name} %{hsc_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}/%{_datadir}/doc/%{name}-%{version}
rm -rf doc LICENSE README


%clean
rm -rf ${RPM_BUILD_ROOT}


%pre 
%ghc_preinst_script


%post 
%ghc_postinst_script


%preun 
%ghc_preun_script


%postun 
%ghc_postun_script


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


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


%changelog
* Wed Aug 13 2008 Yaakov M. Nemoy <yankee@koan> - 0.7-3
- added URL
- changed Group from default

* Wed Aug 13 2008 Yaakov M. Nemoy <yankee@koan> - 0.7-2
- adds requirements list

* Wed Aug 13 2008 cabal-rpm <cabal-devel@haskell.org> - 0.7-1
- spec file autogenerated by cabal-rpm