From Fedora Project Wiki
(updated spec file to be better.)
No edit summary
Line 5: Line 5:
%define hsc_name ghc
%define hsc_name ghc
%define hsc_version 6.8.2
%define hsc_version 6.8.2
#The first one might be upper case, the second one isn't.
%define pkg_name xmonad
%define h_pkg_name xmonad
%define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{pkg_name}-%{version}
%define f_pkg_name xmonad
%define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{h_pkg_name}-%{version}
%define tar_dir %{_builddir}/%{?buildsubdir}


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


Name: %{f_pkg_name}
Name: %{pkg_name}
Version: 0.7
Version: 0.7
Release: 2%{?dist}
Release: 3%{?dist}
License: BSD
License: BSD
Group: User Interface/X
Group: User Interface/X
Line 41: Line 38:




%package -n %{hsc_name}-%{f_pkg_name}
%package -n %{hsc_name}-%{pkg_name}
Summary: A tiling window manager
Summary: A tiling window manager
Group: Development/Libraries
Group: Development/Libraries
Requires: %{hsc_name} = %{hsc_version}
Requires: %{hsc_name} = %{hsc_version}
Provides: %{h_pkg_name}-%{hsc_name}-%{hsc_version} = %{version}




%description -n %{hsc_name}-%{f_pkg_name}
%description -n %{hsc_name}-%{pkg_name}
xmonad is a tiling window manager for X. Windows are arranged
xmonad is a tiling window manager for X. Windows are arranged
automatically to tile the screen without gaps or overlap, maximising
automatically to tile the screen without gaps or overlap, maximising
Line 62: Line 58:




%package -n %{hsc_name}-%{f_pkg_name}-prof
%package -n %{hsc_name}-%{pkg_name}-prof
Summary: Profiling libraries for %{hsc_name}-%{f_pkg_name}
Summary: Profiling libraries for %{hsc_name}-%{pkg_name}
Group: Development/Libraries
Group: Development/Libraries
Requires: %{hsc_name}-%{f_pkg_name} = %{version}
Requires: %{hsc_name}-%{pkg_name} = %{version}
Provides: %{h_pkg_name}-%{hsc_name}-%{hsc_version}-prof = %{version}




%description -n %{hsc_name}-%{f_pkg_name}-prof
%description -n %{hsc_name}-%{pkg_name}-prof
xmonad is a tiling window manager for X. Windows are arranged
xmonad is a tiling window manager for X. Windows are arranged
automatically to tile the screen without gaps or overlap, maximising
automatically to tile the screen without gaps or overlap, maximising
Line 84: Line 79:


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




%build
%build
if [ -f configure.ac -a ! -f configure ]; then autoreconf; fi
%ghc_autotools -l -p enable
runghc Setup configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_docdir}/%{hsc_name}-%{f_pkg_name}-%{version} --libsubdir='$compiler/$pkgid' --enable-library-profiling --ghc
%ghc_build
if runghc Setup makefile -f cabal-rpm.mk
%ghc_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}
%ghc_install
install -m 755 register.sh unregister.sh ${RPM_BUILD_ROOT}%{pkg_libdir}
%ghc_install_scripts
cd ${RPM_BUILD_ROOT}
%ghc_gen_filelists %{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
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}
cd ${RPM_BUILD_ROOT}/%{_datadir}/doc/%{hsc_name}-%{pkg_name}-%{version}
rm -rf doc LICENSE TODO README
rm -rf doc LICENSE TODO README


Line 118: Line 101:
%clean
%clean
rm -rf ${RPM_BUILD_ROOT}
rm -rf ${RPM_BUILD_ROOT}
%pre -n %{hsc_name}-%{pkg_name}
%ghc_preinst_script




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




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




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




%postun -n %{hsc_name}-%{f_pkg_name}
%files -n %{hsc_name}-%{pkg_name} -f %{name}-files
[ "$1" = 1 ] && %{pkg_libdir}/register.sh >& /dev/null || :
 
 
%files -n %{hsc_name}-%{f_pkg_name} -f %{name}-files
%doc dist/doc/html
%doc dist/doc/html
%doc LICENSE TODO README
%doc LICENSE TODO README




%files -n %{hsc_name}-%{f_pkg_name}-prof -f %{name}-files.prof
%files -n %{hsc_name}-%{pkg_name}-prof -f %{name}-files.prof
%%doc LICENSE
%%doc LICENSE


Line 152: Line 133:


%changelog
%changelog
* Wed Aug 12 2008 Yaakov M. Nemoy <yankee@koan> - 0.7-3
- Replaced content with macros
- Removed funky naming scheme with something more straight forward
* Wed Jul  2 2008 Yaakov M. Nemoy <yankee@koan> - 0.7-2
* Wed Jul  2 2008 Yaakov M. Nemoy <yankee@koan> - 0.7-2
- added BuildRequires
- added BuildRequires

Revision as of 12:11, 13 August 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 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. They have been filled in manually.

%define hsc_name ghc
%define hsc_version 6.8.2
%define pkg_name xmonad
%define pkg_libdir %{_libdir}/%{hsc_name}-%{hsc_version}/%{pkg_name}-%{version}

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

Name: %{pkg_name}
Version: 0.7
Release: 3%{?dist}
License: BSD
Group: User Interface/X
URL: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/xmonad
Source: http://hackage.haskell.org/packages/archive/xmonad/%{version}/xmonad-%{version}.tar.gz
Summary: A tiling window manager
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ghc = %{hsc_version}, ghc682-prof, haddock
BuildRequires: libXinerama-devel, libX11-devel, libXext-devel
BuildRequires: ghc-x11 = 1.4.1, ghc-x11-prof = 1.4.1
Requires: ghc = %{hsc_version}
Requires: ghc-x11 = 1.4.1

%description
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.


%package -n %{hsc_name}-%{pkg_name}
Summary: A tiling window manager
Group: Development/Libraries
Requires: %{hsc_name} = %{hsc_version}


%description -n %{hsc_name}-%{pkg_name}
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 libraries for %{hsc_name} %{hsc_version}.


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


%description -n %{hsc_name}-%{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}.


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


%build
%ghc_autotools -l -p enable
%ghc_build
%ghc_haddock
%ghc_gen_scripts


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

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


%clean
rm -rf ${RPM_BUILD_ROOT}
%pre -n %{hsc_name}-%{pkg_name}
%ghc_preinst_script


%post -n %{hsc_name}-%{pkg_name}
%ghc_postinst_script


%preun -n %{hsc_name}-%{pkg_name}
%ghc_preun_script


%postun -n %{hsc_name}-%{pkg_name}
%ghc_postun_script


%files -n %{hsc_name}-%{pkg_name} -f %{name}-files
%doc dist/doc/html
%doc LICENSE TODO README


%files -n %{hsc_name}-%{pkg_name}-prof -f %{name}-files.prof
%%doc LICENSE


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


%changelog
* Wed Aug 12 2008 Yaakov M. Nemoy <yankee@koan> - 0.7-3
- Replaced content with macros
- Removed funky naming scheme with something more straight forward


* Wed Jul  2 2008 Yaakov M. Nemoy <yankee@koan> - 0.7-2
- added BuildRequires
- added Requires
- changed Group
- changed URL
- changed Source


* Thu Jun 26 2008 cabal-rpm <cabal-devel@haskell.org> - 0.7-1
- spec file autogenerated by cabal-rpm