%define pkgname LaTeXML

Name:           latexml
Version:        0.7.0
Release:        4%{?_dist_release}
Summary:        LaTeX to XML Converter

Group:          Development/Libraries
License:        public domain
Url:            http://dlmf.nist.gov/LaTeXML/
Source0:        http://dlmf.nist.gov/LaTeXML/releases/%{pkgname}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildArch:	noarch

BuildRequires:  texlive-vtlpkg >= 2013
BuildRequires:	perl(Parse::RecDescent)
BuildRequires:	perl(Image::Magick)
BuildRequires:	perl(XML::LibXML) >= 1.70
BuildRequires:	perl(XML::LibXSLT) >= 1.70
BuildRequires:	perl(DB_File)
BuildRequires:	perl(Test::Simple)

Distribution:	Vine
Vendor:		Project Vine
Packager:	munepi

%description
latexml is a program, written in Perl, that attempts to faithfully mimic TeX's behaviour, but produces XML instead of dvi. The document model of the target XML makes explicit the model implied by LaTeX. The processing and model are both extensible; you can define the mapping between TeX constructs and the XML fragments to be created. A postprocessor, latexmlpost converts this XML into other formats such as HTML or XHTML, with options to convert the math into MathML (currently only presentation) or images.
#'

%prep
%setup -q -n %{pkgname}-%{version}

%build
export CFLAGS="$RPM_OPT_FLAGS"
%__perl Makefile.PL TEXMF=%{_tl_texmfvine} INSTALLDIRS=vendor
%__make

%install
%__rm -rf $RPM_BUILD_ROOT
%__make pure_install DESTDIR=$RPM_BUILD_ROOT

find $RPM_BUILD_ROOT -type f -name .packlist | xargs %__rm -f

%check
%__make test ||:

%post
%_tl_touch_run texhash
exit 0

%postun
if [ "$1" = 0 ]; then
   %_tl_touch_run texhash
fi
exit 0

%posttrans
%{_tl_exec_texhash}
exit 0


%files
%defattr(-,root,root)
%{_bindir}/latexml
%{_bindir}/latexmlfind
%{_bindir}/latexmlmath
%{_bindir}/latexmlpost
%{_tl_texmfvine}/tex/latex/latexml/latexml.sty
%dir %{_tl_texmfvine}/tex/latex/latexml
%{_mandir}/man*/*.*
%{perl_vendorlib}/LaTeXML.pm
%{perl_vendorlib}/LaTeXML/*
%dir %{perl_vendorlib}/LaTeXML

%changelog
* Thu Aug 29 2013 Munehiro Yamamoto <munepi@vinelinux.org> - 0.7.0-4
- added BuildRequires: texlive-vtlpkg >= 2013
- added some scriptlets to run mktexlsr

* Tue Jun 28 2011 Munehiro Yamamoto <munepi@vinelinux.org> - 0.7.0-3
- rebuilt on i386

* Tue May 24 2011 Munehiro Yamamoto <munepi@vinelinux.org> - 0.7.0-2
- rebuilt with perl-5.12.3

* Thu Aug 12 2010 Munehiro Yamamoto <munepi@vinelinux.org> - 0.7.0-1
- initial build
