%global __brp_check_rpaths %{nil}
%global packname  PPCI
%global packver   0.1.5
%global rlibdir   /usr/local/lib/R/library

Name:             R-CRAN-%{packname}
Version:          0.1.5
Release:          3%{?dist}%{?buildtag}
Summary:          Projection Pursuit for Cluster Identification

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


BuildRequires:    R-devel >= 2.10.0
Requires:         R-core >= 2.10.0
BuildArch:        noarch
BuildRequires:    R-CRAN-rARPACK 
Requires:         R-CRAN-rARPACK 

%description
Implements recently developed projection pursuit algorithms for finding
optimal linear cluster separators. The clustering algorithms use optimal
hyperplane separators based on minimum density, Pavlidis et. al (2016)
<http://jmlr.org/papers/volume17/15-307/15-307.pdf>; minimum normalised
cut, Hofmeyr (2017) <doi:10.1109/TPAMI.2016.2609929>; and maximum variance
ratio clusterability, Hofmeyr and Pavlidis (2015)
<doi:10.1109/SSCI.2015.116>.

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