%global __brp_check_rpaths %{nil}
%global packname  synthesisr
%global packver   0.3.0
%global rlibdir   /usr/local/lib/R/library

Name:             R-CRAN-%{packname}
Version:          0.3.0
Release:          3%{?dist}%{?buildtag}
Summary:          Import, Assemble, and Deduplicate Bibliographic Datasets

License:          GPL-3
URL:              https://cran.r-project.org/package=%{packname}
Source0:          %{url}&version=%{packver}#/%{packname}_%{packver}.tar.gz


BuildRequires:    R-devel >= 3.5.0
Requires:         R-core >= 3.5.0
BuildArch:        noarch
BuildRequires:    R-CRAN-stringdist 
Requires:         R-CRAN-stringdist 

%description
A critical first step in systematic literature reviews and mining of
academic texts is to identify relevant texts from a range of sources,
particularly databases such as 'Web of Science' or 'Scopus'. These
databases often export in different formats or with different metadata
tags. 'synthesisr' expands on the tools outlined by Westgate (2019)
<doi:10.1002/jrsm.1374> to import bibliographic data from a range of
formats (such as 'bibtex', 'ris', or 'ciw') in a standard way, and allows
merging and deduplication of the resulting dataset.

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

find -type f -executable -exec grep -Iq . {} \; -exec sed -i -e '$a\' {} \;

%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

%files
%{rlibdir}/%{packname}