I have been working on my first rpmbuild since quite a few days now.

The rpm is intendeed to install R[0] built with Intel MKL libraries
and Intel compiler. As a base for the spec file, I used the one from
Fedora R package[1].

I setup the directory structure:
% ls ~/.rpmbuild
BUILD/  BUILDROOT/  RPMS/  SOURCES/  SPECS/  SRPMS/

Then:

% cd ~/.rpmbuild
% rpmlint SPEC/R.spec  ==> OK
% rpmbuild -ba SPEC/R.spec
...... BUILD ....
Processing files: R-3.2.1-mkl.fc22.x86_64
Processing files: R-core-3.2.1-mkl.fc22.x86_64
Provides: R-KernSmooth = 2.23.15 R-MASS = 7.3.43 R-Matrix = 1.2.2
R-base = 3.2.1 R-boot = 1.3.17 R-class = 7.3.13 R-cluster = 2.0.3
R-codetools = 0.2.14 R-core = 3.2.1-mkl.fc22 R-core(x86-64) =
3.2.1-mkl.fc22 R-datasets = 3.2.1 R-foreign = 0.8.65 R-grDevices =
3.2.1 R-graphics = 3.2.1 R-grid = 3.2.1 R-lattice = 0.20.33 R-methods
= 3.2.1 R-mgcv = 1.8.7 R-nlme = 3.1.121 R-nnet = 7.3.10 R-parallel =
3.2.1 R-rpart = 4.1.10 R-spatial = 7.3.10 R-splines = 3.2.1 R-stats =
3.2.1 R-stats4 = 3.2.1 R-survival = 2.38.3 R-tcltk = 3.2.1 R-tools =
3.2.1 R-utils = 3.2.1 config(R-core) = 3.2.1-mkl.fc22 libR.so()(64bit)
libRblas.so()(64bit) libRlapack.so()(64bit)
Requires(interp): /bin/sh /bin/sh /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(post): /bin/sh
Requires(preun): /bin/sh
Requires(postun): /bin/sh
Requires(posttrans): /bin/sh
Requires: /bin/bash /bin/sh ld-linux-x86-64.so.2()(64bit)
ld-linux-x86-64.so.2(GLIBC_2.2.5)(64bit) libR.so()(64bit)
libRblas.so()(64bit) libRlapack.so()(64bit) libX11.so.6()(64bit)
libbz2.so.1()(64bit) libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.16)(64bit) libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit) libc.so.6(GLIBC_2.6)(64bit)
libc.so.6(GLIBC_2.7)(64bit) libcurl.so.4()(64bit) libdl.so.2()(64bit)
libdl.so.2(GLIBC_2.2.5)(64bit) libgcc_s.so.1()(64bit)
libicui18n.so.54()(64bit) libicuuc.so.54()(64bit)
libifcoremt.so.5()(64bit) libifport.so.5()(64bit) libimf.so()(64bit)
libintlc.so.5()(64bit) libiomp5.so()(64bit)
libiomp5.so(VERSION)(64bit) libirc.so()(64bit) libirng.so()(64bit)
liblzma.so.5()(64bit) liblzma.so.5(XZ_5.0)(64bit) libm.so.6()(64bit)
libpcre.so.1()(64bit) libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit) libreadline.so.6()(64bit)
librt.so.1()(64bit) librt.so.1(GLIBC_2.2.5)(64bit) libsvml.so()(64bit)
libtcl8.6.so()(64bit) libtk8.6.so()(64bit) libtre.so.5()(64bit)
libz.so.1()(64bit)
Obsoletes: R-Matrix < 0.999375-7
Processing files: R-core-devel-3.2.1-mkl.fc22.x86_64
Provides: R-Matrix-devel = 1.2.2 R-core-devel = 3.2.1-mkl.fc22
R-core-devel(x86-64) = 3.2.1-mkl.fc22 pkgconfig(libR) = 3.2.1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /usr/bin/pkg-config
Obsoletes: R-Matrix-devel < 0.999375-7
Processing files: R-devel-3.2.1-mkl.fc22.x86_64
Processing files: R-java-3.2.1-mkl.fc22.x86_64
Processing files: R-java-devel-3.2.1-mkl.fc22.x86_64
Processing files: libRmath-3.2.1-mkl.fc22.x86_64
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.a2fYbJ
+ umask 022
+ cd /home/poisonivy/rpmbuild/BUILD
+ cd R-3.2.1
+ 
DOCDIR=/home/poisonivy/rpmbuild/BUILDROOT/R-3.2.1-mkl.fc22.x86_64/usr/share/doc/libRmath
+ export DOCDIR
+ /usr/bin/mkdir -p
/home/poisonivy/rpmbuild/BUILDROOT/R-3.2.1-mkl.fc22.x86_64/usr/share/doc/libRmath
+ cp -pr doc/COPYING
/home/poisonivy/rpmbuild/BUILDROOT/R-3.2.1-mkl.fc22.x86_64/usr/share/doc/libRmath
+ exit 0
Provides: libRmath = 3.2.1-mkl.fc22 libRmath(x86-64) = 3.2.1-mkl.fc22
libRmath.so()(64bit)
Requires(interp): /sbin/ldconfig /sbin/ldconfig
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit)
libdl.so.2()(64bit) libgcc_s.so.1()(64bit) libimf.so()(64bit)
libintlc.so.5()(64bit) libirng.so()(64bit) libm.so.6()(64bit)
libsvml.so()(64bit)
Processing files: libRmath-devel-3.2.1-mkl.fc22.x86_64
Provides: libRmath-devel = 3.2.1-mkl.fc22 libRmath-devel(x86-64) =
3.2.1-mkl.fc22 pkgconfig(libRmath) = 3.2.1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /usr/bin/pkg-config
Processing files: libRmath-static-3.2.1-mkl.fc22.x86_64
Provides: libRmath-static = 3.2.1-mkl.fc22 libRmath-static(x86-64) =
3.2.1-mkl.fc22
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Processing files: R-debuginfo-3.2.1-mkl.fc22.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files
......................................................

These last lines are part of the %file section, and I can't see any
error, all %files (it is a meta package) are correctly processed.

% ls RPMS
%
 % ls BUILDROOT/R-3.2.1-mkl.fc22.x86_64
etc/  usr/

RPMS is empty.

I do not understand why. Is there anything in my shell environment who
prevents populating RPMS ?
poisonivy@poppy ➤➤ ~/rpmbuild % env
HOME=/home/poisonivy
USER=poisonivy
SHELL=/bin/zsh
TERM=xterm
PATH=/usr/local/bin:/bin:/usr/bin:/home/poisonivy/bin:/usr/local/sbin:/usr/sbin:/opt/intel/bin
MAIL=/var/spool/mail/poisonivy
LOGNAME=poisonivy
XDG_SESSION_ID=c3
XDG_RUNTIME_DIR=/run/user/1000
SHLVL=1
PWD=/home/poisonivy/rpmbuild
OLDPWD=/home/poisonivy
HISTCONTROL=ignoredups
HOSTNAME=poppy
HISTSIZE=5000
LS_COLORS=
XDG_CONFIG_HOME=/home/poisonivy/.config
XDG_CONFIG_DIRS=/etc/xdg
XDG_DATA_DIRS=/usr/local/share:/usr/share
XDG_DATA_HOME=/home/poisonivy/.local/share
EDITOR=vim
VISUAL=vim
CCACHE_DIR=/storage/.ccache
USE_CCACHE=1
PASSWORD_STORE_DIR=/home/poisonivy/.config/password-store
PGDATA=/db/pgsql/data
PGROOT=/db/pgsql
GEM_HOME=/home/poisonivy/.gem/ruby
CODE=/storage/development/language
R_PROFILE_USER=/home/poisonivy/.config/r/Rprofile.r
R_ENVIRON_USER=/home/poisonivy/.config/r/Renviron
R_LIBS_USER=/storage/development/language/r/library
WORKON_HOME=/storage/development/language/python/envs/poisonivy
LANG=en_US.UTF8
LESSOPEN=||/usr/bin/lesspipe.sh %s
ZDOTDIR=/home/poisonivy/.config/zsh
GNUPGHOME=/home/poisonivy/.config/gnupg
_VIRTUALENVWRAPPER_API= mkvirtualenv rmvirtualenv lsvirtualenv
showvirtualenv workon add2virtualenv cdsitepackages cdvirtualenv
lssitepackages toggleglobalsitepackages cpvirtualenv
setvirtualenvproject mkproject cdproject mktmpenv
VIRTUALENVWRAPPER_SCRIPT=/bin/virtualenvwrapper.sh
ZSHDIR=/home/poisonivy/.config/zsh
VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
VIRTUALENVWRAPPER_WORKON_CD=1
VIRTUALENVWRAPPER_HOOK_DIR=/storage/development/language/python/envs/poisonivy
LD_LIBRARY_PATH=/opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64_lin:/opt/intel/compilers_and_libraries_2016.0.9/mkl/lib/intel64_lin
_=/bin/env

Did I missed any step in my SPEC file ? The file is attached.

Thank you for help.
-- 

google.com/+arnaudgabourygabx
# Set some environment variable
%global _prod_dir /opt/intel/compilers_and_libraries_2016/linux
%global _icclibpath %{_prod_dir}/compiler/lib/intel64_lin
%global _mkllibpath /opt/intel/compilers_and_libraries_2016/mkl/lib/intel64_lin
%global _mkllibs " -fopenmp -Wl,--no-as-needed -L%{_mkllibpath} -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -liomp5 -lpthread -lm"
%global _builddir_full %{_builddir}/R-%{version}
%define _sysconfdir /etc/R  
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
%global R_PDFVIEWER %{_bindir}/xdg-open
%global R_PRINTCMD lpr
%global R_BROWSER %{_bindir}/xdg-open

Name: R
Version: 3.2.1
Release: mkl%{?dist}
Summary: A language for data analysis and graphics
URL: http://www.r-project.org
Source0: ftp://cran.r-project.org/pub/R/src/base/R-3/R-%{version}.tar.gz
#Source1: macros.R
Source2: R-make-search-index.sh
License: GPLv2+
Group: Applications/Engineering
#BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gcc-gfortran
BuildRequires: gcc-c++, tex(latex), texinfo, texinfo-tex  
BuildRequires: libpng-devel, libjpeg-turbo-devel, readline-devel
BuildRequires: tcl-devel, tk-devel, ncurses-devel
BuildRequires: pcre-devel, zlib-devel
BuildRequires: libcurl-devel
BuildRequires: valgrind-devel
BuildRequires: java-headless
BuildRequires: tre-devel
BuildRequires: autoconf, automake, libtool
BuildRequires: libSM-devel, libICE-devel, libXt-devel
BuildRequires: bzip2-devel, libtiff-devel
BuildRequires: gcc-objc, xz-devel
BuildRequires: libicu-devel
BuildRequires: less
BuildRequires: tex(inconsolata.sty)
BuildRequires: tex(upquote.sty)
# R-devel will pull in R-core
Requires: R-devel = %{version}-%{release}
# libRmath-devel will pull in libRmath
Requires: libRmath-devel = %{version}-%{release}
# Pull in Java bits (if you don't want this, use R-core)
Requires: R-java = %{version}-%{release}

%description
This is a metapackage that provides both core R userspace and 
all R development components.
R is a language and environment for statistical computing and graphics. 
R is similar to the award-winning S system, which was developed at 
Bell Laboratories by John Chambers et al. It provides a wide 
variety of statistical and graphical techniques (linear and
nonlinear modelling, statistical tests, time series analysis,
classification, clustering, ...).
R is designed as a true computer language with control-flow
constructions for iteration and alternation, and it allows users to
add additional functionality by defining new functions. For
computationally intensive tasks, C, C++ and Fortran code can be linked
and called at run time.

%package core
Summary: The minimal R components necessary for a functional runtime
Group: Applications/Engineering
Requires: xdg-utils, cups
Requires: tex(dvips), vi
Requires: perl, sed, gawk, tex(latex), less, make, unzip
# These are the submodules that R-core provides. Sometimes R modules say they
# depend on one of these submodules rather than just R. These are provided for 
# packager convenience.
Provides: R-base = %{version}
Provides: R-boot = 1.3.17
Provides: R-class = 7.3.13
Provides: R-cluster = 2.0.3
Provides: R-codetools = 0.2.14
Provides: R-datasets = %{version}
Provides: R-foreign = 0.8.65
Provides: R-graphics = %{version}
Provides: R-grDevices = %{version}
Provides: R-grid = %{version}
Provides: R-KernSmooth = 2.23.15
Provides: R-lattice = 0.20.33
Provides: R-MASS = 7.3.43
Provides: R-Matrix = 1.2.2
Obsoletes: R-Matrix < 0.999375-7
Provides: R-methods = %{version}
Provides: R-mgcv = 1.8.7
Provides: R-nlme = 3.1.121
Provides: R-nnet = 7.3.10
Provides: R-parallel = %{version}
Provides: R-rpart = 4.1.10
Provides: R-spatial = 7.3.10
Provides: R-splines = %{version}
Provides: R-stats = %{version}
Provides: R-stats4 = %{version}
Provides: R-survival = 2.38.3
Provides: R-tcltk = %{version}
Provides: R-tools = %{version}
Provides: R-utils = %{version}
%description core
A language and environment for statistical computing and graphics.
R is similar to the award-winning S system, which was developed at
Bell Laboratories by John Chambers et al. It provides a wide
variety of statistical and graphical techniques (linear and
nonlinear modelling, statistical tests, time series analysis,
classification, clustering, ...).
R is designed as a true computer language with control-flow
constructions for iteration and alternation, and it allows users to
add additional functionality by defining new functions. For
computationally intensive tasks, C, C++ and Fortran code can be linked
and called at run time.

%package core-devel
Summary: Core files for development of R packages (no Java)
Group: Applications/Engineering
Requires: R-core = %{version}-%{release}
# You need all the BuildRequires for the development version
Requires: gcc-c++, gcc-gfortran, tex(latex), texinfo, texinfo-tex
Requires: bzip2-devel, pcre-devel, zlib-devel
Requires: tcl-devel, tk-devel, pkgconfig, xz-devel
Requires: libicu-devel
Requires: tre-devel
# TeX files needed
Requires: tex(ecrm1000.tfm)
Requires: tex(inconsolata.sty)
Requires: tex(ptmr8t.tfm)
Requires: tex(ptmb8t.tfm)
Requires: tex(pcrr8t.tfm)
Requires: tex(phvr8t.tfm)
Requires: tex(ptmri8t.tfm)
Requires: tex(ptmro8t.tfm)
Requires: tex(cm-super-ts1.enc)
Provides: R-Matrix-devel = 1.2.2
Obsoletes: R-Matrix-devel < 0.999375-7
%description core-devel
Install R-core-devel if you are going to develop or compile R packages.
This package does not configure the R environment for Java, install
R-java-devel if you want this.

%package devel
Summary: Full R development environment metapackage
Requires: R-core-devel = %{version}-%{release}
Requires: R-java-devel = %{version}-%{release}
%description devel
This is a metapackage to install a complete (with Java) R development
environment.

%package java
Summary: R with Fedora provided Java Runtime Environment
Group: Applications/Engineering
Requires(post): R-core = %{version}-%{release}
Requires(post): java-headless
%description java
A language and environment for statistical computing and graphics.
R is similar to the award-winning S system, which was developed at
Bell Laboratories by John Chambers et al. It provides a wide
variety of statistical and graphical techniques (linear and
nonlinear modelling, statistical tests, time series analysis,
classification, clustering, ...).
R is designed as a true computer language with control-flow
constructions for iteration and alternation, and it allows users to
add additional functionality by defining new functions. For
computationally intensive tasks, C, C++ and Fortran code can be linked
and called at run time.
This package also has an additional dependency on java, as provided by
Fedora's openJDK.

%package java-devel
Summary: Development package for use with Java enabled R components
Group: Applications/Engineering
Requires(post): R-core-devel = %{version}-%{release}
Requires(post): java-devel
%description java-devel
Install R-java-devel if you are going to develop or compile R packages
that assume java is present and configured on the system.

%package -n libRmath
Summary: Standalone math library from the R project
Group: Development/Libraries
%description -n libRmath
A standalone library of mathematical and statistical functions derived
from the R project.  This package provides the shared libRmath library.

%package -n libRmath-devel
Summary: Headers from the R Standalone math library
Group: Development/Libraries
Requires: libRmath = %{version}-%{release}, pkgconfig
%description -n libRmath-devel
A standalone library of mathematical and statistical functions derived
from the R project.  This package provides the libRmath header files.

%package -n libRmath-static
Summary: Static R Standalone math library
Group: Development/Libraries
Requires: libRmath-devel = %{version}-%{release}
%description -n libRmath-static
A standalone library of mathematical and statistical functions derived
from the R project.  This package provides the static libRmath library.

%prep
%setup -q

# fix for texinfo 5.X
sed -i 's|test ${makeinfo_version_min} -lt 7|test ${makeinfo_version_min} -lt 0|' %{_builddir}/R-%{version}/configure
# Filter false positive provides.
cat <<EOF > %{name}-prov
#!/bin/sh
%{__perl_provides} \
| grep -v 'File::Copy::Recursive' | grep -v 'Text::DelimMatch'
EOF
%define __perl_provides %{_builddir}/R-%{version}/%{name}-prov
chmod +x %{__perl_provides}

# Filter unwanted Requires:
cat << \EOF > %{name}-req
#!/bin/sh
%{__perl_requires} \
| grep -v 'perl(Text::DelimMatch)'
EOF
%define __perl_requires %{_builddir}/R-%{version}/%{name}-req
chmod +x %{__perl_requires}

# needed by sysconfdir
mkdir -p %{_builddir_full}/etc/R 

%build
# Add PATHS to Renviron for R_LIBS_SITE
echo 'R_LIBS_SITE=${R_LIBS_SITE-'"'/usr/local/lib/R/site-library:/usr/local/lib/R/library:%{_libdir}/R/library:%{_datadir}/R/library'"'}' >> etc/Renviron.in
## Intel MKL and ICC
# Setup the environment for MKL and Intel compiler
source /opt/intel/bin/compilervars.sh intel64
source /opt/intel/bin/ifortvars.sh intel64
# FIX a bug in compilevars.sh
#unsetopt extendedglob
#export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:%{_mkllibpath}:%{_icclibpath}:%{_builddir_full}/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_builddir_full}/lib
export LDFLAG=S"${LDFLAGS} -L%{_icclibpath}"
export MAIN_LDFLAGS="-openmp -pg"
#%%define R_PDFVIEWER %{_bindir}/xdg-open
#%%define R_PRINTCMD lpr
#%%define R_BROWSER %{_bindir}/xdg-open
# Use Intel compiler
export CC='icc -std=c99'
export F77="ifort"
export CXX="icpc"
export FC="ifort"
export AR="xiar"
export LD="xild"
# Export build flags
%global _optimize "-ip -ipo -O3 -opt-mem-layout-trans=3 -xHost -mavx"
export CFLAGS="${_optimize} -fp-model precise -wd188 -DMKL_ILP64 -qopenmp -parallel -I${MKLROOT}/include"
export CXXFLAGS="${_optimize} -fp-model precise -DMKL_ILP64 -qopenmp-parallel -I${MKLROOT}/include" 
export FFLAGS="${_optimize} -fp-model precise -DMKL_ILP64 -qopenmp -parallel -I${MKLROOT}/include"
export FCFLAGS="${_optimize} -fp-model precise -DMKL_ILP64 -qopenmp -parallel -I${MKLROOT}/include"
#export CPPFLAGS="-no-gcc"

%configure \
         --with-system-tre \
         --with-system-zlib --with-system-bzlib --with-system-pcre \
         --with-system-valgrind-headers \
         --with-blas=%{_mkllibs} \
         --with-lapack \
         --without-x \
         --with-tcl-config=%{_libdir}/tclConfig.sh \
         --with-tk-config=%{_libdir}/tkConfig.sh \
         --enable-R-shlib \
         --enable-memory-profiling \
         --enable-BLAS-shlib \
         --enable-prebuilt-html \
         rdocdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} \
         rincludedir=%{_includedir}/R \
         rsharedir=%{_datadir}/R \
	 libnn=lib64 \
> CONFIGURE.log
cat CONFIGURE.log | grep -A30 'R is now' - > CAPABILITIES
# Place Intel's basic math library prior to GLIBC libm
# sed -i "s/\(^\| \)-lm\( \|$\)/\1-limf -lm\2/g" {./,etc/}Makeconf
make %{?_smp_mflags}
make MAKEINFO=texi2any pdf
make MAKEINFO=texi2any info
# Make standalone Rmath library
(cd src/nmath/standalone; make)
# Convert to UTF-8
for i in doc/manual/R-intro.info doc/manual/R-FAQ.info doc/FAQ doc/manual/R-admin.info doc/manual/R-exts.info-1; do
  iconv -f iso-8859-1 -t utf-8 -o $i{.utf8,}
  mv $i{.utf8,}
done

%install
make DESTDIR=%{buildroot} install install-info
make DESTDIR=%{buildroot} install-pdf

#rm -f %{buildroot}%{_infodir}/dir
#rm -f %{buildroot}%{_infodir}/dir.old
mkdir -p %{buildroot}%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
install -p CAPABILITIES %{buildroot}%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}

# install libRmath.so
(cd src/nmath/standalone; make install DESTDIR=%{buildroot})
 
# Install R.conf
mkdir -p %{buildroot}/etc/ld.so.conf.d
echo "%{_libdir}/R/lib" > %{buildroot}/etc/ld.so.conf.d/%{name}-x86_64.conf
  
mkdir -p %{buildroot}%{_datadir}/R/library
  
# Fixup R wrapper scripts.
sed -i "s|%{buildroot} ||" "%{buildroot}/usr/bin/R"
rm "%{buildroot}/usr/lib64/R/bin/R"
cd "%{buildroot}/usr/lib64/R/bin"
ln -s ../../../bin/R

# Install rpm helper macros
#mkdir -p %{buildroot}/usr/lib/rpm/macro.d
#install -m0644 %{SOURCE1} %{buildroot}/usr/lib/rpm

# Install rpm helper script
mkdir -p %{buildroot}/usr/lib/rpm/
install -m0755 %{SOURCE2} %{buildroot}/usr/lib/rpm/

# Fix multilib
#touch -r README %{buildroot}%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}/CAPABILITIES
#touch -r README doc/manual/*.pdf
#touch -r README %{buildroot}%{_bindir}/R

# Fix html/packages.html
# We can safely use RHOME here, because all of these are system packages.
sed -i 's|\..\/\..|%{_libdir}/R|g' %{buildroot}%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}/html/packages.html
for i in %{buildroot}%{_libdir}/R/library/*/html/*.html; do
  sed -i 's|\..\/\..\/..\/doc|%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}|g' $i
done

# Fix exec bits
chmod +x %{buildroot}%{_datadir}/R/sh/echo.sh
chmod -x %{buildroot}%{_libdir}/R/library/mgcv/CITATION %{buildroot}%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}/CAPABILITIES

# Symbolic link for convenience
pushd %{buildroot}%{_libdir}/R
ln -s ../../include/R include
popd

# move configuration files to /etc
mkdir -p %{buildroot}/etc/R
cd %{buildroot}/usr/lib64/R/etc    
install -d %{buildroot}/etc/R
cd %{buildroot}/usr/lib64/R/etc
for i in *; do
    mv -f ${i} "%{buildroot}/etc/R"
    ln -s /etc/R/${i} ${i}
done


# Symbolic link for LaTeX
mkdir -p %{buildroot}/usr/share/texmf/tex/latex
pushd %{buildroot}/usr/share/texmf/tex/latex
ln -s ../../../R/texmf/tex/latex R
popd

%check
make check

%files
# Metapackage
%files core
%defattr(-, root, root, -)
%{_bindir}/R
%{_bindir}/Rscript
%{_datadir}/R/
%{_datadir}/texmf/
# Have to break this out for the translations
%dir %{_libdir}/R/
%{_libdir}/R/bin/
%dir %{_libdir}/R/etc
%config %{_libdir}/R/etc/Makeconf
%config(noreplace) %{_libdir}/R/etc/Renviron
%config(noreplace) %{_libdir}/R/etc/javaconf
%config(noreplace) %{_libdir}/R/etc/ldpaths
%config(noreplace) %{_libdir}/R/etc/repositories
%{_libdir}/R/lib/
%dir %{_libdir}/R/library/
%dir %{_libdir}/R/library/translations/
%{_libdir}/R/library/translations/DESCRIPTION
%lang(da) %{_libdir}/R/library/translations/da/
%lang(de) %{_libdir}/R/library/translations/de/
%lang(en) %{_libdir}/R/library/translations/en*/
%lang(es) %{_libdir}/R/library/translations/es/
%lang(fa) %{_libdir}/R/library/translations/fa/
%lang(fr) %{_libdir}/R/library/translations/fr/
%lang(it) %{_libdir}/R/library/translations/it/
%lang(ja) %{_libdir}/R/library/translations/ja/
%lang(ko) %{_libdir}/R/library/translations/ko/
%lang(nn) %{_libdir}/R/library/translations/nn/
%lang(pl) %{_libdir}/R/library/translations/pl/
%lang(pt) %{_libdir}/R/library/translations/pt*/
%lang(ru) %{_libdir}/R/library/translations/ru/
%lang(tr) %{_libdir}/R/library/translations/tr/
%lang(zh) %{_libdir}/R/library/translations/zh*/
# base
%{_libdir}/R/library/base/
# boot
%dir %{_libdir}/R/library/boot/
%{_libdir}/R/library/boot/bd.q
%{_libdir}/R/library/boot/CITATION
%{_libdir}/R/library/boot/data/
%{_libdir}/R/library/boot/DESCRIPTION
%{_libdir}/R/library/boot/help/
%{_libdir}/R/library/boot/html/
%{_libdir}/R/library/boot/INDEX
%{_libdir}/R/library/boot/Meta/
%{_libdir}/R/library/boot/NAMESPACE
%dir %{_libdir}/R/library/boot/po/
%lang(de) %{_libdir}/R/library/boot/po/de/
%lang(en) %{_libdir}/R/library/boot/po/en*/
%lang(fr) %{_libdir}/R/library/boot/po/fr/
%lang(ko) %{_libdir}/R/library/boot/po/ko/
%lang(pl) %{_libdir}/R/library/boot/po/pl/
%lang(ru) %{_libdir}/R/library/boot/po/ru/
%{_libdir}/R/library/boot/R/
# class
%dir %{_libdir}/R/library/class/
%{_libdir}/R/library/class/CITATION
%{_libdir}/R/library/class/DESCRIPTION
%{_libdir}/R/library/class/help/
%{_libdir}/R/library/class/html/
%{_libdir}/R/library/class/INDEX
%{_libdir}/R/library/class/libs/
%{_libdir}/R/library/class/Meta/
%{_libdir}/R/library/class/NAMESPACE
%{_libdir}/R/library/class/NEWS
%dir %{_libdir}/R/library/class/po/
%lang(de) %{_libdir}/R/library/class/po/de/
%lang(en) %{_libdir}/R/library/class/po/en*/
%lang(fr) %{_libdir}/R/library/class/po/fr/
%lang(ko) %{_libdir}/R/library/class/po/ko/
%lang(pl) %{_libdir}/R/library/class/po/pl/
%{_libdir}/R/library/class/R/
# cluster
%dir %{_libdir}/R/library/cluster/
%{_libdir}/R/library/cluster/CITATION
%{_libdir}/R/library/cluster/data/
%{_libdir}/R/library/cluster/DESCRIPTION
%{_libdir}/R/library/cluster/help/
%{_libdir}/R/library/cluster/html/
%{_libdir}/R/library/cluster/INDEX
%{_libdir}/R/library/cluster/libs/
%{_libdir}/R/library/cluster/Meta/
%{_libdir}/R/library/cluster/NAMESPACE
#%%{_libdir}/R/library/cluster/NEWS.Rd
%{_libdir}/R/library/cluster/R/
%dir %{_libdir}/R/library/cluster/po/
%lang(de) %{_libdir}/R/library/cluster/po/de/
%lang(en) %{_libdir}/R/library/cluster/po/en*/
%lang(fr) %{_libdir}/R/library/cluster/po/fr/
#%%lang(ko) %{_libdir}/R/library/cluster/po/ko/
%lang(pl) %{_libdir}/R/library/cluster/po/pl/
# codetools
%dir %{_libdir}/R/library/codetools/
%{_libdir}/R/library/codetools/DESCRIPTION
%{_libdir}/R/library/codetools/help/
%{_libdir}/R/library/codetools/html/
%{_libdir}/R/library/codetools/INDEX
%{_libdir}/R/library/codetools/Meta/
%{_libdir}/R/library/codetools/NAMESPACE
%{_libdir}/R/library/codetools/R/
# compiler
%{_libdir}/R/library/compiler/
# datasets
%{_libdir}/R/library/datasets/
# foreign
%dir %{_libdir}/R/library/foreign/
%{_libdir}/R/library/foreign/COPYRIGHTS
%{_libdir}/R/library/foreign/DESCRIPTION
%{_libdir}/R/library/foreign/files/
%{_libdir}/R/library/foreign/help/
%{_libdir}/R/library/foreign/html/
%{_libdir}/R/library/foreign/INDEX
%{_libdir}/R/library/foreign/libs/
%{_libdir}/R/library/foreign/Meta/
%{_libdir}/R/library/foreign/NAMESPACE
%dir %{_libdir}/R/library/foreign/po/
%lang(de) %{_libdir}/R/library/foreign/po/de/
%lang(en) %{_libdir}/R/library/foreign/po/en*/
%lang(fr) %{_libdir}/R/library/foreign/po/fr/
%lang(pl) %{_libdir}/R/library/foreign/po/pl/
%{_libdir}/R/library/foreign/R/
# graphics
%{_libdir}/R/library/graphics/
# grDevices
%{_libdir}/R/library/grDevices
# grid
%{_libdir}/R/library/grid/
# KernSmooth
%dir %{_libdir}/R/library/KernSmooth/
%{_libdir}/R/library/KernSmooth/DESCRIPTION
%{_libdir}/R/library/KernSmooth/help/
%{_libdir}/R/library/KernSmooth/html/
%{_libdir}/R/library/KernSmooth/INDEX
%{_libdir}/R/library/KernSmooth/libs/
%{_libdir}/R/library/KernSmooth/Meta/
%{_libdir}/R/library/KernSmooth/NAMESPACE
%dir %{_libdir}/R/library/KernSmooth/po/
%lang(de) %{_libdir}/R/library/KernSmooth/po/de/
%lang(en) %{_libdir}/R/library/KernSmooth/po/en*/
%lang(fr) %{_libdir}/R/library/KernSmooth/po/fr/
%lang(ko) %{_libdir}/R/library/KernSmooth/po/ko/
%lang(pl) %{_libdir}/R/library/KernSmooth/po/pl/
%{_libdir}/R/library/KernSmooth/R/
# lattice
%dir %{_libdir}/R/library/lattice/
%{_libdir}/R/library/lattice/CITATION
%{_libdir}/R/library/lattice/data/
%{_libdir}/R/library/lattice/demo/
%{_libdir}/R/library/lattice/DESCRIPTION
%{_libdir}/R/library/lattice/help/
%{_libdir}/R/library/lattice/html/
%{_libdir}/R/library/lattice/INDEX
%{_libdir}/R/library/lattice/libs/
%{_libdir}/R/library/lattice/Meta/
%{_libdir}/R/library/lattice/NAMESPACE
%{_libdir}/R/library/lattice/NEWS
%dir %{_libdir}/R/library/lattice/po/
%lang(de) %{_libdir}/R/library/lattice/po/de/
%lang(en) %{_libdir}/R/library/lattice/po/en*/
%lang(fr) %{_libdir}/R/library/lattice/po/fr/
%lang(ko) %{_libdir}/R/library/lattice/po/ko/
%lang(pl) %{_libdir}/R/library/lattice/po/pl*/
%{_libdir}/R/library/lattice/R/
# MASS
%dir %{_libdir}/R/library/MASS/
%{_libdir}/R/library/MASS/CITATION
%{_libdir}/R/library/MASS/data/
%{_libdir}/R/library/MASS/DESCRIPTION
%{_libdir}/R/library/MASS/help/
%{_libdir}/R/library/MASS/html/
%{_libdir}/R/library/MASS/INDEX
%{_libdir}/R/library/MASS/libs/
%{_libdir}/R/library/MASS/Meta/
%{_libdir}/R/library/MASS/NAMESPACE
%{_libdir}/R/library/MASS/NEWS
%dir %{_libdir}/R/library/MASS/po
%lang(de) %{_libdir}/R/library/MASS/po/de/
%lang(en) %{_libdir}/R/library/MASS/po/en*/
%lang(fr) %{_libdir}/R/library/MASS/po/fr/
%lang(ko) %{_libdir}/R/library/MASS/po/ko/
%lang(pl) %{_libdir}/R/library/MASS/po/pl/
%{_libdir}/R/library/MASS/R/
%{_libdir}/R/library/MASS/scripts/
# Matrix
%dir %{_libdir}/R/library/Matrix/
%{_libdir}/R/library/Matrix/Copyrights
%{_libdir}/R/library/Matrix/data/
%{_libdir}/R/library/Matrix/doc/
%{_libdir}/R/library/Matrix/DESCRIPTION
%{_libdir}/R/library/Matrix/Doxyfile
%{_libdir}/R/library/Matrix/external/
%{_libdir}/R/library/Matrix/help/
%{_libdir}/R/library/Matrix/html/
%{_libdir}/R/library/Matrix/include/
%{_libdir}/R/library/Matrix/INDEX
%{_libdir}/R/library/Matrix/libs/
%{_libdir}/R/library/Matrix/Meta/
%{_libdir}/R/library/Matrix/NAMESPACE
%{_libdir}/R/library/Matrix/NEWS.Rd
%dir %{_libdir}/R/library/Matrix/po/
%lang(de) %{_libdir}/R/library/Matrix/po/de/
%lang(en) %{_libdir}/R/library/Matrix/po/en*/
%lang(fr) %{_libdir}/R/library/Matrix/po/fr/
%lang(ko) %{_libdir}/R/library/Matrix/po/ko/
%lang(pl) %{_libdir}/R/library/Matrix/po/pl/
%{_libdir}/R/library/Matrix/R/
%{_libdir}/R/library/Matrix/test-tools.R
%{_libdir}/R/library/Matrix/test-tools-1.R
%{_libdir}/R/library/Matrix/test-tools-Matrix.R
# methods
%{_libdir}/R/library/methods/
# mgcv
%{_libdir}/R/library/mgcv/
# nlme
%dir %{_libdir}/R/library/nlme/
%{_libdir}/R/library/nlme/CITATION
%{_libdir}/R/library/nlme/data/
%{_libdir}/R/library/nlme/DESCRIPTION
%{_libdir}/R/library/nlme/help/
%{_libdir}/R/library/nlme/html/
%{_libdir}/R/library/nlme/INDEX
%{_libdir}/R/library/nlme/libs/
%{_libdir}/R/library/nlme/Meta/
%{_libdir}/R/library/nlme/mlbook/
%{_libdir}/R/library/nlme/NAMESPACE
%dir %{_libdir}/R/library/nlme/po/
%lang(de) %{_libdir}/R/library/nlme/po/de/
%lang(en) %{_libdir}/R/library/nlme/po/en*/
%lang(fr) %{_libdir}/R/library/nlme/po/fr/
%lang(ko) %{_libdir}/R/library/nlme/po/ko/
%lang(pl) %{_libdir}/R/library/nlme/po/pl/
%{_libdir}/R/library/nlme/R/
%{_libdir}/R/library/nlme/scripts/
# nnet
%dir %{_libdir}/R/library/nnet/
%{_libdir}/R/library/nnet/CITATION
%{_libdir}/R/library/nnet/DESCRIPTION
%{_libdir}/R/library/nnet/help/
%{_libdir}/R/library/nnet/html/
%{_libdir}/R/library/nnet/INDEX
%{_libdir}/R/library/nnet/libs/
%{_libdir}/R/library/nnet/Meta/
%{_libdir}/R/library/nnet/NAMESPACE
%{_libdir}/R/library/nnet/NEWS
%dir %{_libdir}/R/library/nnet/po
%lang(de) %{_libdir}/R/library/nnet/po/de/
%lang(en) %{_libdir}/R/library/nnet/po/en*/
%lang(fr) %{_libdir}/R/library/nnet/po/fr/
%lang(ko) %{_libdir}/R/library/nnet/po/ko/
%lang(pl) %{_libdir}/R/library/nnet/po/pl/
%{_libdir}/R/library/nnet/R/
# parallel
%{_libdir}/R/library/parallel/
# rpart
%dir %{_libdir}/R/library/rpart/
%{_libdir}/R/library/rpart/data/
%{_libdir}/R/library/rpart/DESCRIPTION
%{_libdir}/R/library/rpart/doc/
%{_libdir}/R/library/rpart/help/
%{_libdir}/R/library/rpart/html/
%{_libdir}/R/library/rpart/INDEX
%{_libdir}/R/library/rpart/libs/
%{_libdir}/R/library/rpart/Meta/
%{_libdir}/R/library/rpart/NAMESPACE
%{_libdir}/R/library/rpart/NEWS.Rd
%dir %{_libdir}/R/library/rpart/po
%lang(de) %{_libdir}/R/library/rpart/po/de/
%lang(en) %{_libdir}/R/library/rpart/po/en*/
%lang(fr) %{_libdir}/R/library/rpart/po/fr/
%lang(ko) %{_libdir}/R/library/rpart/po/ko/
%lang(pl) %{_libdir}/R/library/rpart/po/pl/
%lang(ru) %{_libdir}/R/library/rpart/po/ru/
%{_libdir}/R/library/rpart/R/
# spatial
%dir %{_libdir}/R/library/spatial/
%{_libdir}/R/library/spatial/CITATION
%{_libdir}/R/library/spatial/DESCRIPTION
%{_libdir}/R/library/spatial/help/
%{_libdir}/R/library/spatial/html/
%{_libdir}/R/library/spatial/INDEX
%{_libdir}/R/library/spatial/libs/
%{_libdir}/R/library/spatial/Meta/
%{_libdir}/R/library/spatial/NAMESPACE
%{_libdir}/R/library/spatial/NEWS
%dir %{_libdir}/R/library/spatial/po
%lang(de) %{_libdir}/R/library/spatial/po/de/
%lang(en) %{_libdir}/R/library/spatial/po/en*/
%lang(fr) %{_libdir}/R/library/spatial/po/fr/
%lang(ko) %{_libdir}/R/library/spatial/po/ko/
%lang(pl) %{_libdir}/R/library/spatial/po/pl/
%{_libdir}/R/library/spatial/ppdata/
%{_libdir}/R/library/spatial/PP.files
%{_libdir}/R/library/spatial/R/
# splines
%{_libdir}/R/library/splines/
# stats
%{_libdir}/R/library/stats/
# stats4
%{_libdir}/R/library/stats4/
# survival
%{_libdir}/R/library/survival/
# tcltk
%{_libdir}/R/library/tcltk/
# tools
%{_libdir}/R/library/tools/
# utils
%{_libdir}/R/library/utils/
%{_libdir}/R/modules
%{_libdir}/R/COPYING
#%%{_libdir}/R/NEWS*
%{_libdir}/R/SVN-REVISION
/usr/lib/rpm/R-make-search-index.sh
%{_infodir}/R-*.info*
#/usr/lib/rpm/macros.R
%{_mandir}/man1/*
%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
%docdir %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
/etc/ld.so.conf.d/*
/etc/R/*
%{_datarootdir}/info/dir

%files core-devel
%defattr(-, root, root, -)
%{_libdir}/pkgconfig/libR.pc
%{_includedir}/R
# Symlink to %{_includedir}/R/
%{_libdir}/R/include
%files devel
# Nothing, all files provided by R-core-devel
%files java
# Nothing, all files provided by R-core
%files java-devel
# Nothing, all files provided by R-core-devel
%files -n libRmath
%defattr(-, root, root, -)
%doc doc/COPYING
%{_libdir}/libRmath.so
%files -n libRmath-devel
%defattr(-, root, root, -)
%{_includedir}/Rmath.h
%{_libdir}/pkgconfig/libRmath.pc
%files -n libRmath-static
%defattr(-, root, root, -)
%{_libdir}/libRmath.a


%post core
# Create directory entries for info files
# (optional doc files, so we must check that they are installed)
for doc in admin exts FAQ intro lang; do
   file=%{_infodir}/R-${doc}.info.gz
   if [ -e $file ]; then
      /sbin/install-info ${file} %{_infodir}/dir 2>/dev/null || :
   fi
done
/sbin/ldconfig
R CMD javareconf \
    JAVA_HOME=%{_jvmdir}/jre \
    JAVA_CPPFLAGS='-I%{_jvmdir}/java/include\ -I%{_jvmdir}/java/include/linux' \
    JAVA_LIBS='-L%{_jvmdir}/jre/lib/%{java_arch}/server \
    -L%{_jvmdir}/jre/lib/%{java_arch}\ -L%{_jvmdir}/java/lib/%{java_arch} \
    -L/usr/java/packages/lib/%{java_arch}\ -L/lib\ -L/usr/lib\ -ljvm' \
    JAVA_LD_LIBRARY_PATH=%{_jvmdir}/jre/lib/%{java_arch}/server:%{_jvmdir}/jre/lib/%{java_arch}:%{_jvmdir}/java/lib/%{java_arch}:/usr/java/packages/lib/%{java_arch}:/lib:/usr/lib \
    > /dev/null 2>&1 || exit 0

%preun core
if [ $1 = 0 ]; then
   # Delete directory entries for info files (if they were installed)
   for doc in admin exts FAQ intro lang; do
      file=%{_infodir}/R-${doc}.info.gz
      if [ -e ${file} ]; then
         /sbin/install-info --delete R-${doc} %{_infodir}/dir 2>/dev/null || :
      fi
   done
fi

%postun core
/sbin/ldconfig
if [ $1 -eq 0 ] ; then
    /usr/bin/mktexlsr %{_datadir}/texmf &>/dev/null || :
fi

%posttrans core
/usr/bin/mktexlsr %{_datadir}/texmf &>/dev/null || :

%post java
R CMD javareconf \
    JAVA_HOME=%{_jvmdir}/jre \
    JAVA_CPPFLAGS='-I%{_jvmdir}/java/include\ -I%{_jvmdir}/java/include/linux' \
    JAVA_LIBS='-L%{_jvmdir}/jre/lib/%{java_arch}/server \
    -L%{_jvmdir}/jre/lib/%{java_arch}\ -L%{_jvmdir}/java/lib/%{java_arch} \
    -L/usr/java/packages/lib/%{java_arch}\ -L/lib\ -L/usr/lib\ -ljvm' \
    JAVA_LD_LIBRARY_PATH=%{_jvmdir}/jre/lib/%{java_arch}/server:%{_jvmdir}/jre/lib/%{java_arch}:%{_jvmdir}/java/lib/%{java_arch}:/usr/java/packages/lib/%{java_arch}:/lib:/usr/lib \
    > /dev/null 2>&1 || exit 0

%post java-devel
R CMD javareconf \
    JAVA_HOME=%{_jvmdir}/jre \
    JAVA_CPPFLAGS='-I%{_jvmdir}/java/include\ -I%{_jvmdir}/java/include/linux' \
    JAVA_LIBS='-L%{_jvmdir}/jre/lib/%{java_arch}/server \
    -L%{_jvmdir}/jre/lib/%{java_arch}\ -L%{_jvmdir}/java/lib/%{java_arch} \
    -L/usr/java/packages/lib/%{java_arch}\ -L/lib\ -L/usr/lib\ -ljvm' \
    JAVA_LD_LIBRARY_PATH=%{_jvmdir}/jre/lib/%{java_arch}/server:%{_jvmdir}/jre/lib/%{java_arch}:%{_jvmdir}/java/lib/%{java_arch}:/usr/java/packages/lib/%{java_arch}:/lib:/usr/lib \
    > /dev/null 2>&1 || exit 0


%post -n libRmath -p /sbin/ldconfig

%postun -n libRmath -p /sbin/ldconfig

%changelog
-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Reply via email to