%global packname sysfonts
%global packver  0.8.3
%global rlibdir  %{_libdir}/R/library

Name:             R-%{packname}
Version:          0.8.3
Release:          1
Summary:          Loading Fonts into R

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

Requires:         liberation-mono-fonts
Requires:         liberation-sans-fonts
Requires:         liberation-serif-fonts
BuildRequires:    R-devel
BuildRequires:    tex(latex)
BuildRequires:    pkgconfig(freetype2)
BuildRequires:    pkgconfig(libpng)
BuildRequires:    pkgconfig(zlib)
BuildRequires:    liberation-mono-fonts
BuildRequires:    liberation-sans-fonts
BuildRequires:    liberation-serif-fonts
BuildRequires:    R-curl
BuildRequires:    R-jsonlite

%description
Loading system fonts and Google Fonts <https://fonts.google.com/> into R,
in order to support other packages such as 'R2SWF' and 'showtext'.


%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
%{_bindir}/R CMD check %{packname}


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


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