%define pkg_name    pandoc-citeproc
%define pkg_version 0.15.0.1
%define pkg_release 1%{?_dist_release}

%define pandoc_version 2.4

Summary:  Library and executable for using citeproc with pandoc
Name:    %{pkg_name}
Version: %{pkg_version}
Release: %{pkg_release}

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

Source0: packages

Source11: hs-bibutils-6.7.0.0.tar.gz
Source12: hs-bibutils.cabal
Source13: rfc5051-0.1.0.4.tar.gz
Source14: rfc5051.cabal
Source15: setenv-0.1.1.3.tar.gz
Source16: setenv.cabal
Source17: typed-process-0.2.3.0.tar.gz
Source18: typed-process.cabal
Source19: unliftio-core-0.1.2.0.tar.gz
Source20: unliftio-core.cabal
Source21: vector-algorithms-0.8.0.1.tar.gz
Source22: vector-algorithms.cabal
Source23: xml-types-0.3.6.tar.gz
Source24: xml-types.cabal
Source25: resourcet-1.2.2.tar.gz
Source26: resourcet.cabal
Source27: mono-traversable-1.0.9.0.tar.gz
Source28: mono-traversable.cabal
Source29: conduit-1.3.1.tar.gz
Source30: conduit.cabal
Source31: libyaml-0.1.0.0.tar.gz
Source32: libyaml.cabal
Source33: conduit-extra-1.3.0.tar.gz
Source34: conduit-extra.cabal
Source35: yaml-0.11.0.0.tar.gz
Source36: yaml.cabal
Source37: xml-conduit-1.8.0.1.tar.gz
Source38: xml-conduit.cabal
Source39: pandoc-citeproc-0.15.0.1.tar.gz
Source40: pandoc-citeproc.cabal

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

BuildRequires: ghc haskell-platform
BuildRequires: libffi-devel gmp-devel zlib-devel
BuildRequires: libghc-build-pandoc
BuildRequires: pandoc-libs = %{pandoc_version}

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

Requires: pandoc = %{pandoc_version}


Vendor: Project Vine
Distribution: Vine Linux
Packager: ara_t


%description
The pandoc-citeproc library exports functions for using the citeproc system
with pandoc. It relies on citeproc-hs, a library for rendering bibliographic
reference citations into a variety of styles using a macro language called
Citation Style Language (CSL).
More details on CSL can be found here: http://citationstyles.org/.


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

%build
%ghc_pkg_init

cd %{_builddir}
for pkg in `sed '$d' %{SOURCE0}`; do
    %{__tar} xzf %{_sourcedir}/${pkg}.tar.gz
    pushd ${pkg}
        %ghc_fix_dependencies ${pkg}
        %{__cabal} configure
        %{__cabal} build
        %{__cabal} copy
        %{__cabal} register --inplace
    popd
done

for pkg in `tail -n 1 %{SOURCE0}`; do
    %{__tar} xzf %{_sourcedir}/${pkg}.tar.gz
    pushd ${pkg}
        %ghc_fix_dependencies ${pkg}
        %cabal_configure1 ${pkg}
        %cabal_build
        %cabal_haddock
        %cabal_copy_resister ${pkg}
    popd
done


%install
%{__rm} -rf ${RPM_BUILD_ROOT}%{_libdir}
%{__mv} \
 ${RPM_BUILD_ROOT}%{_datadir}/%{name}-%{version}/{changelog,README.md} \
 ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/
%{__mv} \
 ${RPM_BUILD_ROOT}%{_datadir}/%{name}-%{version}/man \
 ${RPM_BUILD_ROOT}%{_datadir}/

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


%files
%defattr(-, root, root)
%{_bindir}/pandoc-citeproc
%{_datadir}/%{name}-%{version}/
%{_docdir}/%{name}-%{version}/
%{_mandir}/man1/


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

* Thu Aug 09 2018 Toshiaki Ara <ara_t@384.jp> 0.14.3.1-3
- build using ghc-8.4.3-2 and pandoc-2.2.3.2

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

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

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

* Tue Feb 21 2017 Toshiaki Ara <ara_t@384.jp> 0.10.4.1-1
- update to 0.10.4.1
- build using ghc-8.0.2

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

* Sat Jun 18 2016 Toshiaki Ara <ara_t@384.jp> 0.10-1
- update to 0.10

* Fri May 06 2016 Toshiaki Ara <ara_t@384.jp> 0.9.1.1-1
- new package (devide from pandoc)

