%define pkg_name    xmonad-contrib
%define pkg_version 0.15
%define pkg_release 1%{?_dist_release}

Summary:     Third party extensions for xmonad
Summary(ja): サードパーティーによるxmonad拡張
Name:    %{pkg_name}
Version: %{pkg_version}
Release: %{pkg_release}

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

Source0: packages

# # Patch for building ghc-8.4
# Source1: xmonad-contrib-0.13_using_ghc-8.4.patch

Source11: X11-xft-0.3.1.tar.gz
Source12: X11-xft.cabal
Source13: old-time-1.1.0.3.tar.gz
Source14: old-time.cabal
Source15: xmonad-contrib-0.15.tar.gz
Source16: xmonad-contrib.cabal

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

BuildRequires: ghc haskell-platform
BuildRequires: xmonad

BuildRequires: libffi-devel gmp-devel zlib-devel
BuildRequires: xorg-x11-devel
BuildRequires: libXScrnSaver-devel
BuildRequires: docbook-utils docbook-utils-pdf docbook-style-xsl

Requires: haskell-platform-dep
Requires: libXScrnSaver-devel
Requires: xmonad

Vendor: Project Vine
Distribution: Vine Linux
Packager: ara_t


%description
Third party tiling algorithms, configurations and scripts to xmonad,
 a tiling window manager for X.

%description -l ja
サードパーティーによるxmonad拡張であり、
タイル化のためのアルゴリズム、設定およびスクリプトを含みます。


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

%build
%ghc_pkg_init

cd %{_builddir}
for pkg in `cat %{SOURCE0}`; do
    %{__tar} xzf %{_sourcedir}/${pkg}.tar.gz
    pushd ${pkg}
        %ghc_fix_dependencies ${pkg}
        %cabal_configure2 %{name} ${pkg}
        %cabal_build
        %cabal_haddock
        %cabal_copy_resister %{name}_${pkg}
    popd
done


%install
# copy documents
pushd %{_builddir}/%{name}-%{version}
    %{__cp} CHANGES.md LICENSE README.md \
     ${RPM_BUILD_ROOT}%{_docdir}/%{name}/%{name}-%{version}
popd


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

%post
%ghc_pkg_recache

%postun
%ghc_pkg_recache


%files
%defattr(-, root, root)
%{_libdir}/ghc-%{ghc_version}/
%{_libdir}/ghc-lib/
%{_docdir}/%{name}/


%changelog
* Mon Dec 17 2018 Toshiaki Ara <ara_t@384.jp> 0.15-1
- update to 0.15
- build using ghc-8.6.3

* Wed Aug 08 2018 Toshiaki Ara <ara_t@384.jp> 0.14-2
- add BuildRequires: and Requires: libXScrnSaver-devel

* Wed Aug 08 2018 Toshiaki Ara <ara_t@384.jp> 0.14-1
- update to 0.14
- build using ghc-8.4.3-2
- drop Source1

* Fri Jul 20 2018 Toshiaki Ara <ara_t@384.jp> 0.13-4
- build using ghc-8.4.3

* Fri May 18 2018 Toshiaki Ara <ara_t@384.jp> 0.13-3
- rebuild using ghc-8.4.2
- add Patch for building with ghc-8.4 (Source1)
- rewrite using macro

* Thu May 10 2018 Toshiaki Ara <ara_t@384.jp> 0.13-2
- rebuild using ghc-8.4.2

* Tue Jan 09 2018 Toshiaki Ara <ara_t@384.jp> 0.13-1
- update to 0.13
- rebuild using ghc-8.0.2

* Fri Feb 03 2017 Toshiaki Ara <ara_t@384.jp> 0.12-6
- rebuild using ghc-8.0.1

* Wed May 04 2016 Toshiaki Ara <ara_t@384.jp> 0.12-5
- rebuilt

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

* Tue Mar 01 2016 Toshiaki Ara <ara_t@384.jp> 0.12-3
- rebuild under xmonad-0.12-2

* Sat Feb 27 2016 Toshiaki Ara <ara_t@384.jp> 0.12-2
- recompile

* Sat Feb 27 2016 Toshiaki Ara <ara_t@384.jp> 0.12-1
- new package
