From Fedora Project Wiki
fp-wiki>ImportUser
(Imported from MoinMoin)
 
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Library and Binary Template =
= Library and Binary Template =
This is a sample spec file for a Haskell Cabal package. This sample demonstrates how to package a Haskell Cabal package that contains a library and binary together. 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.
This is a sample spec file for a Haskell Cabal package. This sample demonstrates how to package a Haskell Cabal package that contains a library and binary together. It can be generated automatically using cabal-rpm and then modified include missing dependency declarations, etc.
 
* Bug me enough and I might fill them in manually - YaakovNemoy


<pre>
<pre>
%define hsc_name ghc
%define ghc_version 6.10.1
%define hsc_version 6.8.2
%define pkg_libdir %{_libdir}/ghc-%{ghc_version}/%{name}-%{version}
%define h_pkg_name xmonad
%define pkg_docdir %{_docdir}/ghc/libraries/%{name}
%define f_pkg_name xmonad
%define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{h_pkg_name}-%{version}
%define tar_dir %{_builddir}/%{?buildsubdir}


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


Name: %{f_pkg_name}
Name: progHasLibs
Version: 0.7
Version: 0.7
Release: 1%{?dist}
Release: 3%{?dist}
License: BSD
License: BSD
Group: Development/Languages
Group: User Interface/X
URL: http://xmonad.org
URL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/%{name}
Source: xmonad-0.7.tar.gz
Source: http://hackage.haskell.org/packages/archive/%{name}/%{version}/%{name}-%{version}.tar.gz
Summary: A tiling window manager
Summary: Summary of %{name}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ghc = 6.8.2, haddock
# ghc has only been bootstrapped on the following archs:
 
ExclusiveArch: i386 x86_64 ppc
BuildRequires: ghc = %{ghc_version}, ghc-prof = %{ghc_version}, haddock
BuildRequires: ...
Requires: ghc = %{ghc_version}


%description
%description
xmonad is a tiling window manager for X. Windows are arranged
Description of %{name}.
automatically to tile the screen without gaps or overlap, maximising
screen use. All features of the window manager are accessible from
the keyboard: a mouse is strictly optional. xmonad is written and
extensible in Haskell. Custom layout algorithms, and other
extensions, may be written by the user in config files. Layouts are
applied dynamically, and different layouts may be used on each
workspace. Xinerama is fully supported, allowing windows to be tiled
on several screens.
 


%package -n %{hsc_name}-%{f_pkg_name}
%package -n ghc-%{name}
Summary: A tiling window manager
Summary: Summary of ghc-%{name}
Group: Development/Libraries
Group: Development/Libraries
Requires: %{hsc_name} = %{hsc_version}
Provides: ghc-%{name}-devel = %{version}-%{release}
Provides: %{h_pkg_name}-%{hsc_name}-%{hsc_version} = %{version}
Requires: ghc = %{ghc_version}
 
Requires: ...
 
Requires(pre): ghc = %{ghc_version}
%description -n %{hsc_name}-%{f_pkg_name}
Requires(preun): ghc = %{ghc_version}
xmonad is a tiling window manager for X. Windows are arranged
Requires(post): ghc = %{ghc_version}
automatically to tile the screen without gaps or overlap, maximising
Requires(postun): ghc = %{ghc_version}
screen use. All features of the window manager are accessible from
the keyboard: a mouse is strictly optional. xmonad is written and
extensible in Haskell. Custom layout algorithms, and other
extensions, may be written by the user in config files. Layouts are
applied dynamically, and different layouts may be used on each
workspace. Xinerama is fully supported, allowing windows to be tiled
on several screens.


This package contains libraries for %{hsc_name} %{hsc_version}.
%description -n ghc-%{name}
This package contains libraries for ghc %{ghc_version}.




%package -n %{hsc_name}-%{f_pkg_name}-prof
%package -n ghc-%{name}-prof
Summary: Profiling libraries for %{hsc_name}-%{f_pkg_name}
Summary: Profiling libraries for ghc-%{name}
Group: Development/Libraries
Group: Development/Libraries
Requires: %{hsc_name}-%{f_pkg_name} = %{version}
Requires: ghc-%{name} = %{version}
Provides: %{h_pkg_name}-%{hsc_name}-%{hsc_version}-prof = %{version}
 
 
%description -n %{hsc_name}-%{f_pkg_name}-prof
xmonad is a tiling window manager for X. Windows are arranged
automatically to tile the screen without gaps or overlap, maximising
screen use. All features of the window manager are accessible from
the keyboard: a mouse is strictly optional. xmonad is written and
extensible in Haskell. Custom layout algorithms, and other
extensions, may be written by the user in config files. Layouts are
applied dynamically, and different layouts may be used on each
workspace. Xinerama is fully supported, allowing windows to be tiled
on several screens.


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




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




%build
%build
if [ -f configure.ac -a ! -f configure ] ; then autoreconf; fi
%cabal_configure -p --ghc
runghc Setup configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{hsc_name}-%{f_pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --enable-library-profiling --ghc
%cabal_build
if runghc Setup makefile -f cabal-rpm.mk
%cabal_haddock
then
%ghc_gen_scripts
make -f cabal-rpm.mk %{_smp_mflags} || :
fi
runghc Setup build
runghc Setup haddock || :
runghc Setup register --gen-script
runghc Setup unregister --gen-script




%install
%install
rm -rf ${RPM_BUILD_ROOT}
rm -rf ${RPM_BUILD_ROOT}
runghc Setup copy --destdir=${RPM_BUILD_ROOT}
%cabal_install
install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir}
%ghc_install_scripts
cd ${RPM_BUILD_ROOT}
%ghc_gen_filelists ghc-%{name}
echo '%defattr(-,root,root,-)' > %{tar_dir}/%{name}-files.prof
find .%{pkg_libdir} \( -name '*_p.a' -o -name '*.p_hi' \) | sed s/^.// >> %{tar_dir}/%{name}-files.prof
echo '%defattr(-,root,root,-)' > %{tar_dir}/%{name}-files.nonprof
find .%{pkg_libdir} -type d | sed 's/^./%dir /' >> %{tar_dir}/%{name}-files.nonprof
find .%{pkg_libdir} ! \( -type d -o -name '*_p.a' -o -name '*.p_hi' \) | sed s/^.// >> %{tar_dir}/%{name}-files.nonprof
sed 's,^/,%exclude /,' %{tar_dir}/%{name}-files.prof >> %{tar_dir}/%{name}-files.nonprof


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


Line 115: Line 75:
%clean
%clean
rm -rf ${RPM_BUILD_ROOT}
rm -rf ${RPM_BUILD_ROOT}
%pre -n ghc-%{name}
%ghc_preinst_script




%pre -n %{hsc_name}-%{f_pkg_name}
%post -n ghc-%{name}
[ "$1" = 2 ]  && %{pkg_libdir}/unregister.sh >&/dev/null || :
%ghc_postinst_script
%ghc_reindex_haddock




%post -n %{hsc_name}-%{f_pkg_name}
%preun -n ghc-%{name}
%{pkg_libdir}/register.sh >&/dev/null
%ghc_preun_script




%preun -n %{hsc_name}-%{f_pkg_name}
%postun -n ghc-%{name}
%{pkg_libdir}/unregister.sh >&/dev/null
%ghc_postun_script
%ghc_reindex_haddock




%postun -n %{hsc_name}-%{f_pkg_name}
%files
[ "$1" = 1 ]  && %{pkg_libdir}/register.sh >& /dev/null || :
%defattr(-,root,root,-)
%doc LICENSE
%{_bindir}/%{name}


 
%files -n ghc-%{name} -f ghc-%{name}.files
%files -n %{hsc_name}-%{f_pkg_name} -f %{name}-files.nonprof
%defattr(-,root,root,-)
%doc dist/doc/html
%doc LICENSE TODO README
%doc LICENSE TODO README
%{pkg_docdir}




%files -n %{hsc_name}-%{f_pkg_name}-prof -f %{name}-files.prof
%files -n ghc-%{name}-prof -f ghc-%{name}-prof.files
%%doc LICENSE
 
 
%files
%defattr(-,root,root,-)
%defattr(-,root,root,-)
%{_bindir}/xmonad
%doc LICENSE
%doc LICENSE




%changelog
%changelog
* Wed Apr 30 2008 cabal-rpm <cabal-devel@haskell.org> - 0.7-1
* Today  Fedora Haskell Packager - version-release
- spec file autogenerated by cabal-rpm
- initial packaging for Fedora
</pre>
</pre>

Latest revision as of 00:55, 14 November 2008

Library and Binary Template

This is a sample spec file for a Haskell Cabal package. This sample demonstrates how to package a Haskell Cabal package that contains a library and binary together. It can be generated automatically using cabal-rpm and then modified include missing dependency declarations, etc.

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

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

Name: progHasLibs
Version: 0.7
Release: 3%{?dist}
License: BSD
Group: User Interface/X
URL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/%{name}
Source: http://hackage.haskell.org/packages/archive/%{name}/%{version}/%{name}-%{version}.tar.gz
Summary: Summary of %{name}
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}, ghc-prof = %{ghc_version}, haddock
BuildRequires: ...
Requires: ghc = %{ghc_version}

%description
Description of %{name}.

%package -n ghc-%{name}
Summary: Summary of ghc-%{name}
Group: Development/Libraries
Provides: ghc-%{name}-devel = %{version}-%{release}
Requires: ghc = %{ghc_version}
Requires: ...
Requires(pre): ghc = %{ghc_version}
Requires(preun): ghc = %{ghc_version}
Requires(post): ghc = %{ghc_version}
Requires(postun): ghc = %{ghc_version}

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


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

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


%prep
%setup -q


%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 ghc-%{name}

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


%clean
rm -rf ${RPM_BUILD_ROOT}
%pre -n ghc-%{name}
%ghc_preinst_script


%post -n ghc-%{name}
%ghc_postinst_script
%ghc_reindex_haddock


%preun -n ghc-%{name}
%ghc_preun_script


%postun -n ghc-%{name}
%ghc_postun_script
%ghc_reindex_haddock


%files
%defattr(-,root,root,-)
%doc LICENSE
%{_bindir}/%{name}

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


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


%changelog
* Today  Fedora Haskell Packager - version-release
- initial packaging for Fedora