%global packname tikzDevice
%global packver  0.12.3.1
%global rlibdir  %{_libdir}/R/library

# Dep loop so not right now
%global with_suggests 0

Name:             R-%{packname}
Version:          0.12.3.1
Release:          1
Summary:          R Graphics Output in LaTeX Format

License:          GPLv2+
URL:              https://CRAN.R-project.org/package=%{packname}
Source0:          https://cran.r-project.org/src/contrib/%{packname}_%{packver}.tar.gz

Requires:         texlive-pgf >= 2.0
Requires:         tex(preview.sty)
BuildRequires:    R-devel
BuildRequires:    tex(latex)
BuildRequires:    texlive-pgf >= 2.0
BuildRequires:    tex(preview.sty)
BuildRequires:    R-filehash >= 2.3
BuildRequires:    R-png
BuildRequires:    R-evaluate
BuildRequires:    R-lattice
BuildRequires:    R-stringr
BuildRequires:    R-testthat >= 0.8.1
BuildRequires:    R-withr
%if %{with_suggests}
BuildRequires:    R-formatR
BuildRequires:    R-ggplot2
BuildRequires:    R-knitr
BuildRequires:    R-maps
BuildRequires:    R-scales
%endif

%description
Provides a graphics output device for R that records plots in a LaTeX-friendly
format. The device transforms plotting commands issued by R functions into
LaTeX code blocks. When included in a LaTeX document, these blocks are
interpreted with the help of 'TikZ'---a graphics package for TeX and friends
written by Till Tantau. Using the 'tikzDevice', the text of R plots can contain
LaTeX commands such as mathematical formula. The device also allows arbitrary
LaTeX code to be inserted into the output stream.


%prep
%setup -q -c -n %{packname}


%build


%install
mkdir -p %{buildroot}%{rlibdir}
%{_bindir}/R CMD INSTALL -l %{buildroot}%{rlibdir} %{packname}
test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
rm -f %{buildroot}%{rlibdir}/R.css


%check
export LANG=C.utf8
%if %{with_suggests}
%{_bindir}/R CMD check %{packname}
%else
_R_CHECK_FORCE_SUGGESTS_=0 %{_bindir}/R CMD check %{packname} --ignore-vignettes
%endif


%files
%dir %{rlibdir}/%{packname}
%doc %{rlibdir}/%{packname}/doc
%doc %{rlibdir}/%{packname}/html
%{rlibdir}/%{packname}/DESCRIPTION
%doc %{rlibdir}/%{packname}/NEWS.md
%{rlibdir}/%{packname}/INDEX
%{rlibdir}/%{packname}/NAMESPACE
%{rlibdir}/%{packname}/Meta
%{rlibdir}/%{packname}/R
%{rlibdir}/%{packname}/help
%dir %{rlibdir}/%{packname}/libs
%{rlibdir}/%{packname}/libs/%{packname}.so


%changelog
* Fri Jun 24 2022 misaka00251 <misaka00251@misakanet.cn> - 0.12.3.1-1
- Init package (Thanks to fedora team)
