%define pkg_name    xmonad-utils
%define pkg_version 0.1.3.3
%define pkg_release 4%{?_dist_release}

%define ghc_version 7.10.3

Summary:     a small collection of X utilities when running XMonad
Summary(ja): XMonadのためのXユーティリティ集
Name:    %{pkg_name}
Version: %{pkg_version}
Release: %{pkg_release}

License: BSD3
Group:   User Interface/Desktops
URL:     http://hackage.haskell.org

Source0: %{name}-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-root

BuildRequires: ghc haskell-platform-base cabal-install
BuildRequires: xmonad

BuildRequires: libffi-devel gmp-devel zlib-devel
BuildRequires: xorg-x11-devel

Requires: xmonad

Vendor: Project Vine
Distribution: Vine Linux
Packager: arat

%description
A small collection of X utilities useful when running XMonad. It includes:
- hxsel: which returns the text currently in the X selection;
- hxput: sets the value of the X paste buffer;
- hslock: a simple X screen lock;
- hmanage: an utility to toggle the override-redirect property of any window;
- hhp: a simple utility to hide the pointer, similar to unclutter.


%prep
%{__rm} -rf ${RPM_BUILD_ROOT}
%setup -q

# Initialise the package db
ghc-pkg init %{_builddir}/package.conf

%build
cabal configure \
    --prefix=%{_prefix} \
    --libdir=%{_libdir}/ghc-lib/%{name}/%{name}-%{version} \
    --libsubdir= \
    --datadir=%{_datadir}/%{name}/%{name}-%{version} \
    --datasubdir= \
    --docdir=%{_docdir}/%{name}/%{name}-%{version}

cabal build
cabal copy --destdir=${RPM_BUILD_ROOT}

%install
%{__cp} LICENSE ${RPM_BUILD_ROOT}%{_docdir}/%{name}/%{name}-%{version}

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post
ghc-pkg recache

%postun
ghc-pkg recache


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


%changelog
* Wed May 04 2016 Toshiaki Ara <ara_t@384.jp> 0.1.3.3-4
- rebuilt

* Tue Apr 12 2016 Toshiaki Ara <ara_t@384.jp> 0.1.3.3-3
- correct SPEC file
- rebuild under xmonad-0.12-3

* Sun Mar 06 2016 Toshiaki Ara <ara_t@384.jp> 0.1.3.3-2
- rebuild under xmonad-0.12-2

* Sun Feb 28 2016 Toshiaki Ara <ara_t@384.jp> 0.1.3.3-1
- new package
