%define pkg_name    pandoc-crossref
%define pkg_version 0.3.4.0
%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: ansi-wl-pprint-0.6.8.2.tar.gz
Source12: ansi-wl-pprint.cabal
Source13: base-unicode-symbols-0.2.3.tar.gz
Source14: base-unicode-symbols.cabal
Source15: data-accessor-0.2.2.8.tar.gz
Source16: data-accessor.cabal
Source17: gitrev-1.3.1.tar.gz
Source18: gitrev.cabal
Source19: open-browser-0.2.1.0.tar.gz
Source20: open-browser.cabal
Source21: utility-ht-0.0.14.tar.gz
Source22: utility-ht.cabal
Source23: optparse-applicative-0.14.3.0.tar.gz
Source24: optparse-applicative.cabal
Source25: roman-numerals-0.5.1.5.tar.gz
Source26: roman-numerals.cabal
Source27: data-accessor-transformers-0.2.1.7.tar.gz
Source28: data-accessor-transformers.cabal
Source29: data-accessor-template-0.2.1.16.tar.gz
Source30: data-accessor-template.cabal
Source31: pandoc-crossref-0.3.4.0.tar.gz
Source32: pandoc-crossref.cabal

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

BuildRequires: libffi-devel gmp-devel zlib-devel
BuildRequires: ghc haskell-platform
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
pandoc-crossref is a pandoc filter for numbering figures, equations, tables
 and cross-references to them. Input file (like demo.md) can be converted into
 html, latex, pdf, md or other formats.
Optionally, you can use cleveref for latex/pdf output,
 e.g. cleveref pdf, cleveref latex, and listings package,
 e.g. listings pdf, listings latex.

You can also enable per-chapter numbering (as with --chapters for latex output).
You need to specify -M chapters for non-latex/pdf output however.
 Examples: html, markdown, latex, pdf.


%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}

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


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


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

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

* Sat Jul 21 2018 Toshiaki Ara <ara_t@384.jp> 0.3.2.1-1
- update to 0.3.2.1
- build using ghc-8.4.3 and pandoc-2.2.2

* Fri May 18 2018 Toshiaki Ara <ara_t@384.jp> 0.3.2.0-1
- update to 0.3.2.0
- 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.3.0.0-1
- update to 0.3.0.0
- build using ghc-8.2.2

* Tue Feb 21 2017 Toshiaki Ara <ara_t@384.jp> 0.2.4.2-2
- rebuild using ghc-8.0.2

* Thu Feb 02 2017 Toshiaki Ara <ara_t@384.jp> 0.2.4.2-1
- update to 0.2.4.2
- rebuild using ghc-8.0.1

* Sun Jun 19 2016 Toshiaki Ara <ara_t@384.jp> 0.2.1.3-2
- rebuild under pandoc-1.17.1

* Sun Jun 05 2016 Toshiaki Ara <ara_t@384.jp> 0.2.1.3-1
- update to 0.2.1.3

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

