From Fedora Project Wiki
< PackagingDrafts | Haskell
m (1 revision(s)) |
(replaced it with X11) |
||
Line 3: | Line 3: | ||
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. | 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. | |
<pre> | <pre> | ||
%define hsc_name ghc | %define hsc_name ghc | ||
%define hsc_version 6.8.2 | %define hsc_version 6.8.2 | ||
− | %define h_pkg_name | + | #The first one might be upper case, the second one isn't. |
− | %define f_pkg_name | + | %define h_pkg_name X11 |
+ | %define f_pkg_name x11 | ||
%define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{h_pkg_name}-%{version} | %define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{h_pkg_name}-%{version} | ||
%define tar_dir %{_builddir}/%{?buildsubdir} | %define tar_dir %{_builddir}/%{?buildsubdir} | ||
%define debug_package %{nil} | %define debug_package %{nil} | ||
+ | #Haskell compilers do not traditionally emit DWARF data. | ||
Name: %{hsc_name}-%{f_pkg_name} | Name: %{hsc_name}-%{f_pkg_name} | ||
− | Version: | + | Version: 1.4.1 |
Release: 1%{?dist} | Release: 1%{?dist} | ||
License: BSD | License: BSD | ||
− | Group: Development/ | + | Group: Development/Libraries |
− | URL: http:// | + | URL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11 |
− | Source: | + | Source: http://hackage.haskell.org/packages/archive/X11/%{version}/X11-%{version}.tar.gz |
− | Summary: | + | Summary: A binding to the X11 graphics library |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | ||
BuildRequires: ghc = 6.8.2, haddock | BuildRequires: ghc = 6.8.2, haddock | ||
− | BuildRequires: | + | BuildRequires: libX11-devel, libXinerama-devel, libXext-devel |
− | Requires: | + | BuildRequires: ghc682-prof |
+ | Requires: libX11, libXinerama, libXext | ||
Provides: %{h_pkg_name}-%{hsc_name}-%{hsc_version} = %{version} | Provides: %{h_pkg_name}-%{hsc_name}-%{hsc_version} = %{version} | ||
%description | %description | ||
− | + | A Haskell binding to the X11 graphics library. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | The binding is a direct translation of the C binding; for | ||
+ | documentation of these calls, refer to "The Xlib Programming | ||
+ | Manual", available online at <http://tronche.com/gui/x/xlib/>. | ||
Line 54: | Line 49: | ||
%description -n %{hsc_name}-%{f_pkg_name}-prof | %description -n %{hsc_name}-%{f_pkg_name}-prof | ||
− | + | A Haskell binding to the X11 graphics library. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | The binding is a direct translation of the C binding; for | ||
+ | documentation of these calls, refer to "The Xlib Programming | ||
+ | Manual", available online at <http://tronche.com/gui/x/xlib/>. | ||
This package contains profiling libraries for %{hsc_name} %{hsc_version}. | This package contains profiling libraries for %{hsc_name} %{hsc_version}. | ||
Line 76: | Line 63: | ||
%build | %build | ||
− | if [ -f configure.ac -a ! -f configure ] ; then autoreconf; fi | + | if [ -f configure.ac -a ! -f configure ]; then autoreconf; fi |
runghc Setup configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{hsc_name}-%{f_pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --enable-library-profiling --ghc | runghc Setup configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{hsc_name}-%{f_pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --enable-library-profiling --ghc | ||
if runghc Setup makefile -f cabal-rpm.mk | if runghc Setup makefile -f cabal-rpm.mk | ||
then | then | ||
− | make -f cabal-rpm.mk %{_smp_mflags} || : | + | make -f cabal-rpm.mk %{_smp_mflags} || : |
fi | fi | ||
runghc Setup build | runghc Setup build | ||
Line 95: | Line 82: | ||
echo '%defattr(-,root,root,-)' > %{tar_dir}/%{name}-files.prof | 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 | 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 | + | echo '%defattr(-,root,root,-)' > %{tar_dir}/%{name}-files |
− | find .%{pkg_libdir} -type d | sed 's/^./%dir /' >> %{tar_dir}/%{name}-files | + | find .%{pkg_libdir} -type d | sed 's/^./%dir /' >> %{tar_dir}/%{name}-files |
− | find .%{pkg_libdir} ! \( -type d -o -name '*_p.a' -o -name '*.p_hi' \) | sed s/^.// >> %{tar_dir}/%{name}-files | + | find .%{pkg_libdir} ! \( -type d -o -name '*_p.a' -o -name '*.p_hi' \) | sed s/^.// >> %{tar_dir}/%{name}-files |
− | sed 's,^/,%exclude /,' %{tar_dir}/%{name}-files.prof >> %{tar_dir}/%{name}-files | + | sed 's,^/,%exclude /,' %{tar_dir}/%{name}-files.prof >> %{tar_dir}/%{name}-files |
cd ${RPM_BUILD_ROOT}/%{_datadir}/doc/%{hsc_name}-%{f_pkg_name}-%{version} | cd ${RPM_BUILD_ROOT}/%{_datadir}/doc/%{hsc_name}-%{f_pkg_name}-%{version} | ||
− | rm -rf doc LICENSE | + | rm -rf doc LICENSE |
Line 108: | Line 95: | ||
− | %pre | + | %pre |
− | [ "$1" = 2 ] | + | [ "$1" = 2 ] && %{pkg_libdir}/unregister.sh >&/dev/null || : |
− | %post | + | %post |
%{pkg_libdir}/register.sh >&/dev/null | %{pkg_libdir}/register.sh >&/dev/null | ||
− | %preun | + | %preun |
%{pkg_libdir}/unregister.sh >&/dev/null | %{pkg_libdir}/unregister.sh >&/dev/null | ||
− | %postun | + | %postun |
− | [ "$1" = 1 ] | + | [ "$1" = 1 ] && %{pkg_libdir}/register.sh >& /dev/null || : |
− | %files -f %{name}-files | + | %files -f %{name}-files |
%doc dist/doc/html | %doc dist/doc/html | ||
− | %doc LICENSE | + | %doc LICENSE |
Line 133: | Line 120: | ||
+ | %changelog | ||
+ | * Thu Jun 26 2008 Yaakov M. Nemoy <yankee@koan> - 1.4.1-1 | ||
+ | - edited Group | ||
+ | - edited URL | ||
+ | - edited Source | ||
+ | - edited BuildRequires | ||
+ | - edited Requires | ||
− | + | * Tue Jun 24 2008 cabal-rpm <cabal-devel@haskell.org> - 1.4.1-1 | |
− | |||
− | * | ||
- spec file autogenerated by cabal-rpm | - spec file autogenerated by cabal-rpm | ||
</pre> | </pre> |
Revision as of 14:24, 26 June 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 hsc_name ghc %define hsc_version 6.8.2 #The first one might be upper case, the second one isn't. %define h_pkg_name X11 %define f_pkg_name x11 %define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{h_pkg_name}-%{version} %define tar_dir %{_builddir}/%{?buildsubdir} %define debug_package %{nil} #Haskell compilers do not traditionally emit DWARF data. Name: %{hsc_name}-%{f_pkg_name} Version: 1.4.1 Release: 1%{?dist} License: BSD Group: Development/Libraries URL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11 Source: http://hackage.haskell.org/packages/archive/X11/%{version}/X11-%{version}.tar.gz Summary: A binding to the X11 graphics library BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: ghc = 6.8.2, haddock BuildRequires: libX11-devel, libXinerama-devel, libXext-devel BuildRequires: ghc682-prof Requires: libX11, libXinerama, libXext Provides: %{h_pkg_name}-%{hsc_name}-%{hsc_version} = %{version} %description A Haskell binding to the X11 graphics library. The binding is a direct translation of the C binding; for documentation of these calls, refer to "The Xlib Programming Manual", available online at <http://tronche.com/gui/x/xlib/>. %package -n %{hsc_name}-%{f_pkg_name}-prof Summary: Profiling libraries for %{hsc_name}-%{f_pkg_name} Group: Development/Libraries Requires: %{hsc_name}-%{f_pkg_name} = %{version} Provides: %{h_pkg_name}-%{hsc_name}-%{hsc_version}-prof = %{version} %description -n %{hsc_name}-%{f_pkg_name}-prof A Haskell binding to the X11 graphics library. The binding is a direct translation of the C binding; for documentation of these calls, refer to "The Xlib Programming Manual", available online at <http://tronche.com/gui/x/xlib/>. This package contains profiling libraries for %{hsc_name} %{hsc_version}. %prep %setup -q -n %{h_pkg_name}-%{version} %build if [ -f configure.ac -a ! -f configure ]; then autoreconf; fi runghc Setup configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{hsc_name}-%{f_pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --enable-library-profiling --ghc if runghc Setup makefile -f cabal-rpm.mk then 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 rm -rf ${RPM_BUILD_ROOT} runghc Setup copy --destdir=${RPM_BUILD_ROOT} install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir} cd ${RPM_BUILD_ROOT} 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 find .%{pkg_libdir} -type d | sed 's/^./%dir /' >> %{tar_dir}/%{name}-files find .%{pkg_libdir} ! \( -type d -o -name '*_p.a' -o -name '*.p_hi' \) | sed s/^.// >> %{tar_dir}/%{name}-files sed 's,^/,%exclude /,' %{tar_dir}/%{name}-files.prof >> %{tar_dir}/%{name}-files cd ${RPM_BUILD_ROOT}/%{_datadir}/doc/%{hsc_name}-%{f_pkg_name}-%{version} rm -rf doc LICENSE %clean rm -rf ${RPM_BUILD_ROOT} %pre [ "$1" = 2 ] && %{pkg_libdir}/unregister.sh >&/dev/null || : %post %{pkg_libdir}/register.sh >&/dev/null %preun %{pkg_libdir}/unregister.sh >&/dev/null %postun [ "$1" = 1 ] && %{pkg_libdir}/register.sh >& /dev/null || : %files -f %{name}-files %doc dist/doc/html %doc LICENSE %files -n %{hsc_name}-%{f_pkg_name}-prof -f %{name}-files.prof %%doc LICENSE %changelog * Thu Jun 26 2008 Yaakov M. Nemoy <yankee@koan> - 1.4.1-1 - edited Group - edited URL - edited Source - edited BuildRequires - edited Requires * Tue Jun 24 2008 cabal-rpm <cabal-devel@haskell.org> - 1.4.1-1 - spec file autogenerated by cabal-rpm