6122b38
%global packname rmarkdown
a844aec
%global packver  2.10
ed6bb34
%global rlibdir  %{_datadir}/R/library
ed6bb34
5c19597
%global __suggests_exclude ^R\\((dygraphs)\\)
5c19597
ed6bb34
# Recursive dependencies.
ed6bb34
%global with_suggests 0
ed6bb34
ed6bb34
Name:             R-%{packname}
a844aec
Version:          2.10
fbfc06a
Release:          %autorelease
ed6bb34
Summary:          Dynamic Documents for R
ed6bb34
ed6bb34
# Main is GPLv3; see bundled Provides below for others.
9f9d606
License:          GPLv3 and ASL 2.0 and BSD and MIT and W3C
0235f30
URL:              https://CRAN.R-project.org/package=%{packname}
6122b38
Source0:          https://cran.r-project.org/src/contrib/%{packname}_%{packver}.tar.gz
d488963
Patch0001:        0001-Remove-unused-minified-ioslides-files.patch
d488963
Patch0002:        0002-Unbundle-fonts-in-ioslides.patch
a6e541c
Patch0004:        0004-Add-original-non-minified-Bootswatch-themes.patch
a6e541c
Patch0005:        0005-Unbundle-fonts-from-bootstrap.patch
a6e541c
Patch0006:        0006-Add-source-for-code-prettify.patch
a6e541c
Patch0007:        0007-Skip-shiny-tests.patch
a6e541c
Patch0008:        0008-handle-updated-Raleway-fonts-in-f33.patch
ed6bb34
ed6bb34
# Here's the R view of the dependencies world:
ed6bb34
# Depends:
cb6e753
# Imports:   R-tools, R-utils, R-knitr >= 1.22, R-yaml >= 2.1.19, R-htmltools >= 0.3.5, R-evaluate >= 0.13, R-jsonlite, R-tinytex >= 0.31, R-xfun >= 0.21, R-methods, R-stringr >= 1.2.0
a844aec
# Suggests:  R-shiny >= 1.6.0, R-tufte, R-testthat >= 3.0.0, R-digest, R-dygraphs, R-vctrs, R-tibble, R-fs, R-rsconnect, R-withr >= 2.4.2, R-bslib >= 0.2.5.1, R-sass >= 0.4.0
ed6bb34
# LinkingTo:
ed6bb34
# Enhances:
ed6bb34
ed6bb34
BuildArch:        noarch
ed6bb34
Requires:         pandoc >= 1.12.3
ed6bb34
d488963
BuildRequires:    git-core
ed6bb34
BuildRequires:    R-devel
ed6bb34
BuildRequires:    tex(latex)
ed6bb34
BuildRequires:    pandoc >= 1.12.3
b642655
BuildRequires:    golang-github-tdewolff-minify
4733758
BuildRequires:    R-tools
4733758
BuildRequires:    R-utils
ed0aff6
BuildRequires:    R-knitr >= 1.22
7a110e6
BuildRequires:    R-yaml >= 2.1.19
ed6bb34
BuildRequires:    R-htmltools >= 0.3.5
ed0aff6
BuildRequires:    R-evaluate >= 0.13
ed6bb34
BuildRequires:    R-jsonlite
cb6e753
BuildRequires:    R-tinytex >= 0.31
cb6e753
BuildRequires:    R-xfun >= 0.21
4733758
BuildRequires:    R-methods
ed6bb34
BuildRequires:    R-stringr >= 1.2.0
a844aec
BuildRequires:    R-testthat >= 3.0.0
4733758
BuildRequires:    R-digest
de5dbee
BuildRequires:    R-rsconnect
a844aec
BuildRequires:    R-withr >= 2.4.2
ed6bb34
%if %{with_suggests}
cb6e753
BuildRequires:    R-shiny >= 1.6.0
ed6bb34
BuildRequires:    R-tufte
4733758
BuildRequires:    R-dygraphs
14cfd20
BuildRequires:    R-vctrs
4733758
BuildRequires:    R-tibble
0c3ba89
BuildRequires:    R-fs
a844aec
BuildRequires:    R-bslib >= 0.2.5.1
a844aec
BuildRequires:    R-sass >= 0.4.0
ed6bb34
%endif
ed6bb34
4733758
#BuildRequires:    fontawesome-fonts = 4.7.0
4733758
#BuildRequires:    fontawesome-fonts-web = 4.7.0
291f640
#Recommends:       fontawesome-fonts = 4.7.0
291f640
#Recommends:       fontawesome-fonts-web = 4.7.0
7a110e6
Provides:         bundled(fontawesome-fonts) = 5.1.0
7a110e6
Provides:         bundled(fontawesome-fonts-web) = 5.1.0
ed6bb34
ed6bb34
# These are not all packaged, but should *probably* be the names if they are.
ed6bb34
7a110e6
# MIT; inst/rmd/h/bootstrap/
ed6bb34
# https://github.com/twbs/bootstrap/releases/tag/v3.3.5
ed6bb34
Provides:         bundled(xstatic-bootstrap-common) = 3.3.5
ed6bb34
BuildRequires:    adobe-source-sans-pro-fonts
291f640
Recommends:       adobe-source-sans-pro-fonts
ed6bb34
BuildRequires:    glyphicons-halflings-fonts
291f640
Recommends:       glyphicons-halflings-fonts
9f9d606
BuildRequires:    glyphography-newscycle-fonts
9f9d606
Recommends:       glyphography-newscycle-fonts
ed6bb34
BuildRequires:    google-roboto-fonts
291f640
Recommends:       google-roboto-fonts
ed6bb34
BuildRequires:    impallari-raleway-fonts
291f640
Recommends:       impallari-raleway-fonts
ed6bb34
BuildRequires:    lato-fonts
291f640
Recommends:       lato-fonts
ed6bb34
bedc8dc
# BSD; inst/rmd/h/highlightjs/ (unbundled)
8fb5748
#BuildRequires:    js-highlight
8fb5748
#Requires:         js-highlight
8fb5748
# Currently broken in Fedora
8fb5748
Provides:         bundled(js-highlight) = 9.12.0
bedc8dc
7a110e6
# MIT; inst/rmd/h/ionicons/
ed6bb34
# http://ionicons.com/
ed6bb34
Provides:         bundled(ionicons-fonts) = 2.0.1
ed6bb34
a6e541c
# MIT; inst/rmd/h/jquery/
a6e541c
Provides:         bundled(js-jquery1) = 1.12.4
a8aa921
7a110e6
# MIT; inst/rmd/h/jqueryui (outdated in Fedora)
ed6bb34
Provides:         bundled(xstatic-jquery-ui-common) = 1.11.4
ed6bb34
ed6bb34
# MIT; inst/rmd/h/navigation-1.1/tabsets.js
ed6bb34
# https://github.com/aidanlister/jquery-stickytabs (partially)
ed6bb34
Provides:         bundled(js-jquery-stickytabs) = 1.2.4
ed6bb34
7a110e6
# MIT; inst/rmd/h/tocify/
ed6bb34
# http://gregfranko.com/jquery.tocify.js/
ed6bb34
Provides:         bundled(js-jquery-tocify) = 1.9.1
ed6bb34
ed6bb34
# ASL 2.0; inst/rmd/ioslides/ioslides-13.5.1/
ed6bb34
Provides:         bundled(js-ioslides) = 13.5.1
ed6bb34
# MIT; inst/rmd/ioslides/ioslides-13.5.1/js/hammer.js
ed6bb34
# https://hammerjs.github.io/
ed6bb34
Provides:         bundled(js-hammer) = 0.4
ed6bb34
# MIT & BSD; inst/rmd/ioslides/ioslides-13.5.1/js/modernizr.custom.45394.js
ed6bb34
# https://modernizr.com/
ed6bb34
Provides:         bundled(js-modernizr) = 2.5.3
ed6bb34
# ASL 2.0; inst/rmd/ioslides/ioslides-13.5.1/js/prettify/
ed6bb34
# https://github.com/google/code-prettify
ed6bb34
Provides:         bundled(js-code-prettify) = 20130304
ed6bb34
BuildRequires:    open-sans-fonts
291f640
Recommends:       open-sans-fonts
ed6bb34
BuildRequires:    adobe-source-code-pro-fonts
291f640
Recommends:       adobe-source-code-pro-fonts
ed6bb34
ed6bb34
# W3C; inst/rmd/slidy/Slidy2/
ed6bb34
# https://www.w3.org/Talks/Tools/Slidy2/
ed6bb34
Provides:         bundled(js-slidy) = 2
ed6bb34
ed6bb34
%description
ed6bb34
Convert R Markdown documents into a variety of formats.
ed6bb34
ed6bb34
ed6bb34
%prep
ed6bb34
%setup -q -c -n %{packname}
d488963
%autosetup -D -T -n %{packname}/%{packname} -S git
ed6bb34
ed6bb34
# Must be removed: https://bugzilla.redhat.com/show_bug.cgi?id=961642#c4
7a110e6
rm inst/rmd/h/bootstrap/css/fonts/Ubuntu.ttf
ed6bb34
ed6bb34
# Fix executable bits
7a110e6
chmod -x inst/rmd/h/ionicons/{LICENSE,css/*.css,fonts/*.ttf}
ed6bb34
chmod -x inst/rmd/ioslides/ioslides-13.5.1/js/hammer.js
d488963
a844aec
# Fix fonts using new paths in Fedora 33+.
1d2518a
for f in Bold It Light Regular; do
1d2518a
    ln -sf /usr/share/fonts/adobe-source-sans-pro-fonts/SourceSans3-${f}.otf inst/rmd/h/bootstrap/css/fonts/SourceSansPro-${f}.otf
1d2518a
done
1d2518a
d488963
# This does nothing but reset the -n path.
d488963
%setup -q -D -T -n %{packname}
ed6bb34
ed6bb34
ed6bb34
%build
de5dbee
gominify --type css \
de5dbee
    < %{packname}/inst/rmd/h/ionicons/css/ionicons.css \
de5dbee
    > %{packname}/inst/rmd/h/ionicons/css/ionicons.min.css
15819c7
pushd %{packname}/inst/rmd/h/bootstrap/css/
15819c7
for file in bootstrap bootstrap-theme cerulean cosmo darkly flatly journal lumen paper readable sandstone simplex spacelab united yeti; do
b642655
    gominify --type css < ${file}.css > ${file}.min.css
15819c7
done
15819c7
popd
ed6bb34
ed6bb34
ed6bb34
%install
ed6bb34
mkdir -p %{buildroot}%{rlibdir}
ed6bb34
%{_bindir}/R CMD INSTALL -l %{buildroot}%{rlibdir} %{packname}
ed6bb34
test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
ed6bb34
rm -f %{buildroot}%{rlibdir}/R.css
ed6bb34
6469d38
# Replace fonts by system fonts (note that this cannot be done in prep because
6469d38
# R CMD INSTALL copies symlink targets.)
6469d38
pushd %{buildroot}%{rlibdir}/%{packname}
6469d38
# Remove bundled fonts in ioslides.
6469d38
rm rmd/ioslides/ioslides-13.5.1/fonts/OpenSans*.ttf
6469d38
for f in OpenSans-Regular OpenSans-Italic OpenSans-Semibold OpenSans-SemiboldItalic; do
6469d38
    ln -s /usr/share/fonts/open-sans/${f}.ttf rmd/ioslides/ioslides-13.5.1/fonts/${f}.ttf
6469d38
done
d488963
ln -sf /usr/share/fonts/adobe-source-code-pro/SourceCodePro-Regular.otf rmd/ioslides/ioslides-13.5.1/fonts/SourceCodePro-Regular.otf
6469d38
# Remove bundled FontAwesome. (too new to remove)
7a110e6
#rm -r rmd/h/fontawesome/*
7a110e6
#ln -s /usr/share/font-awesome-web/css rmd/h/fontawesome/css
7a110e6
#ln -s /usr/share/fonts/fontawesome rmd/h/fontawesome/fonts
6469d38
# Remove bundled fonts from bootstrap.
7a110e6
ln -sf /usr/share/fonts/lato/Lato-Regular.ttf rmd/h/bootstrap/css/fonts/Lato.ttf
7a110e6
ln -sf /usr/share/fonts/lato/Lato-Bold.ttf rmd/h/bootstrap/css/fonts/LatoBold.ttf
7a110e6
ln -sf /usr/share/fonts/lato/Lato-Italic.ttf rmd/h/bootstrap/css/fonts/LatoItalic.ttf
9f9d606
ln -sf /usr/share/fonts/glyphography-newscycle-fonts/newscycle-regular.ttf rmd/h/bootstrap/css/fonts/NewsCycle.ttf
9f9d606
ln -sf /usr/share/fonts/glyphography-newscycle-fonts/newscycle-bold.ttf rmd/h/bootstrap/css/fonts/NewsCycleBold.ttf
7a110e6
ln -sf /usr/share/fonts/open-sans/OpenSans-Regular.ttf rmd/h/bootstrap/css/fonts/OpenSans.ttf
6469d38
for f in Bold BoldItalic Italic Light LightItalic; do
7a110e6
    ln -sf /usr/share/fonts/open-sans/OpenSans-${f}.ttf rmd/h/bootstrap/css/fonts/OpenSans${f}.ttf
6469d38
done
6469d38
for f in Regular Bold; do
163c075
    ln -sf /usr/share/fonts/impallari-raleway-fonts/Raleway-${f}.ttf rmd/h/bootstrap/css/fonts/Raleway-${f}.ttf
6469d38
done
d488963
ln -sf /usr/share/fonts/google-roboto/Roboto-Regular.ttf rmd/h/bootstrap/css/fonts/Roboto.ttf
6469d38
for f in Light Medium Bold; do
d488963
    ln -sf /usr/share/fonts/google-roboto/Roboto-${f}.ttf rmd/h/bootstrap/css/fonts/Roboto${f}.ttf
6469d38
done
6469d38
for f in Bold It Light Regular; do
1d2518a
    ln -sf /usr/share/fonts/adobe-source-sans-pro-fonts/SourceSans3-${f}.otf rmd/h/bootstrap/css/fonts/SourceSansPro-${f}.otf
6469d38
done
d488963
ln -sf /usr/share/fonts/glyphicons-halflings/glyphicons-halflings-regular.ttf rmd/h/bootstrap/fonts/glyphicons-halflings-regular.ttf
6469d38
popd
6469d38
ed6bb34
ed6bb34
%check
ed6bb34
%if %{with_suggests}
ed6bb34
%{_bindir}/R CMD check %{packname}
ed6bb34
%else
ed6bb34
_R_CHECK_FORCE_SUGGESTS_=0 %{_bindir}/R CMD check %{packname}
ed6bb34
%endif
5b820ad
ed6bb34
ed6bb34
%files
ed6bb34
%dir %{rlibdir}/%{packname}
7581e31
%doc %{rlibdir}/%{packname}/doc
ed6bb34
%doc %{rlibdir}/%{packname}/html
ed6bb34
%{rlibdir}/%{packname}/DESCRIPTION
ed6bb34
%license %{rlibdir}/%{packname}/COPYING
ed6bb34
%license %{rlibdir}/%{packname}/NOTICE
7a110e6
%doc %{rlibdir}/%{packname}/NEWS.md
7a110e6
%doc %{rlibdir}/%{packname}/CITATION
ed6bb34
%{rlibdir}/%{packname}/INDEX
ed6bb34
%{rlibdir}/%{packname}/NAMESPACE
ed6bb34
%{rlibdir}/%{packname}/Meta
ed6bb34
%{rlibdir}/%{packname}/R
ed6bb34
%{rlibdir}/%{packname}/help
ed6bb34
%{rlibdir}/%{packname}/rmarkdown
ed6bb34
%dir %{rlibdir}/%{packname}/rmd
ed6bb34
%{rlibdir}/%{packname}/rmd/fragment
ed6bb34
%dir %{rlibdir}/%{packname}/rmd/h
ed6bb34
%{rlibdir}/%{packname}/rmd/h/_navbar.html
de5dbee
%{rlibdir}/%{packname}/rmd/h/accessibility
14cfd20
%{rlibdir}/%{packname}/rmd/h/anchor-sections
ed6bb34
%{rlibdir}/%{packname}/rmd/h/default.html
7a110e6
%{rlibdir}/%{packname}/rmd/h/bootstrap
4733758
%{rlibdir}/%{packname}/rmd/h/fontawesome
8fba9c0
%{rlibdir}/%{packname}/rmd/h/highlightjs
7a110e6
%{rlibdir}/%{packname}/rmd/h/ionicons
a6e541c
%{rlibdir}/%{packname}/rmd/h/jquery
a6e541c
%{rlibdir}/%{packname}/rmd/h/jquery-AUTHORS.txt
7a110e6
%{rlibdir}/%{packname}/rmd/h/jqueryui
ed6bb34
%{rlibdir}/%{packname}/rmd/h/jqueryui-AUTHORS.txt
ed6bb34
%{rlibdir}/%{packname}/rmd/h/navigation-1.1
ed6bb34
%{rlibdir}/%{packname}/rmd/h/pagedtable-1.1
7e73a88
%{rlibdir}/%{packname}/rmd/h/pandoc
ed6bb34
%{rlibdir}/%{packname}/rmd/h/rmarkdown
ed6bb34
%{rlibdir}/%{packname}/rmd/h/rsiframe-1.1
7a110e6
%{rlibdir}/%{packname}/rmd/h/tocify
ed6bb34
%{rlibdir}/%{packname}/rmd/ioslides
ed6bb34
%{rlibdir}/%{packname}/rmd/latex
7a110e6
%{rlibdir}/%{packname}/rmd/site
7a110e6
%{rlibdir}/%{packname}/rmd/slidy
7a110e6
%{rlibdir}/%{packname}/rstudio
ed6bb34
ed6bb34
ed6bb34
%changelog
fbfc06a
%autochangelog