%global __brp_check_rpaths %{nil}
%global packname  longurl
%global packver   0.3.3
%global rlibdir   /usr/local/lib/R/library

Name:             R-CRAN-%{packname}
Version:          0.3.3
Release:          2%{?dist}%{?buildtag}
Summary:          Expand Short 'URLs'

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


BuildRequires:    R-devel >= 3.6.0
Requires:         R-core >= 3.6.0
BuildArch:        noarch
BuildRequires:    R-CRAN-httr 
Requires:         R-CRAN-httr 

%description
Tools are provided to expand vectors of short URLs into long 'URLs'. No
'API' services are used, which may mean that this operates more slowly
than 'API' services do (since they usually cache results of expansions
that every user of the service requests). You can setup your own caching
layer with the 'memoise' package if you wish to have a speedup during
single sessions or add larger dependencies, such as 'Redis', to gain a
longer-term performance boost at the expense of added complexity.

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

find -type f -executable -exec grep -Iq . {} \; -exec sed -i -e '$a\' {} \;
[ -d %{packname}/src ] && find %{packname}/src -type f -exec \
  sed -i 's@/usr/bin/strip@/usr/bin/true@g' {} \; || true

%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}