%define pkg_name    aeson
%define pkg_version 1.4.2.0
%define pkg_release 1%{?_dist_release}

Summary: Haskell libraries: %{pkg_name} and dependent libraries
Name:    libghc-%{pkg_name}
Version: %{pkg_version}
Release: %{pkg_release}

License: BSD3
Group:   Applications/Text
URL:     http://hackage.haskell.org

Source0: packages

Source11: base-compat-0.10.5.tar.gz
Source12: base-compat.cabal
Source13: tagged-0.8.6.tar.gz
Source14: tagged.cabal
Source15: th-abstraction-0.2.8.0.tar.gz
Source16: th-abstraction.cabal
Source17: time-locale-compat-0.1.1.5.tar.gz
Source18: time-locale-compat.cabal
Source19: uuid-types-1.0.3.tar.gz
Source20: uuid-types.cabal
Source21: aeson-1.4.2.0.tar.gz
Source22: aeson.cabal

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

BuildRequires: ghc haskell-platform
BuildRequires: libffi-devel gmp-devel zlib-devel
BuildRequires: libghc-dlist
BuildRequires: libghc-old-locale

BuildRequires: docbook-utils docbook-utils-pdf docbook-style-xsl

Requires: ghc haskell-platform
Requires: haskell-platform-dep
Requires: libghc-dlist
Requires: libghc-old-locale

Vendor: Project Vine
Distribution: Vine Linux
Packager: ara_t


%description
Haskell libraries: %{pkg_name}


%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}/%{pkg_name}-%{version}
    %{__cp} changelog.md README.markdown \
     ${RPM_BUILD_ROOT}%{_docdir}/%{name}/%{pkg_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/
%{_datadir}/


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

* Thu Aug 09 2018 Toshiaki Ara <ara_t@384.jp> 1.3.1.1-3
- build with ghc-8.4.3-2

* Sat Jul 21 2018 Toshiaki Ara <ara_t@384.jp> 1.3.1.1-2
- build using ghc-8.4.3

* Fri May 18 2018 Toshiaki Ara <ara_t@384.jp> 1.3.1.1-1
- update to 1.3.1.1
- rebuild using ghc-8.4.2
- rewrite using macro

* Tue Jan 09 2018 Toshiaki Ara <ara_t@384.jp> 1.2.3.0-1
- update to 1.2.3.0
- build using ghc-8.2.2

* Fri Feb 03 2017 Toshiaki Ara <ara_t@384.jp> 0.11.3.0-1
- update to 0.11.3.0
- build using ghc-8.0.1

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

* Tue Apr 12 2016 Toshiaki Ara <ara_t@384.jp> 0.9.0.1-2
- correct SPEC file

* Tue Mar 01 2016 Toshiaki Ara <ara_t@384.jp> 0.9.0.1-1
- new package
