blob: a92d296d3d075962af97c8b133180f43922545c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
# Maintainer: alexanderp <alexisph -at- gmail -dot- com>
# Previous maintainers:
# - halfhorn <mwellsa -at- gmail -dot- com>
# - jdarch <jda -dot- cloud -plus- archlinux -at- gmail -dot- com>
pkgname=r-mkl
pkgver=4.4.2
pkgrel=1
pkgdesc="Language and environment for statistical computing and graphics, linked to the Intel(R) MKL."
arch=('x86_64')
license=('GPL')
url='http://www.r-project.org/'
provides=("r=${pkgver}")
conflicts=('r' 'microsoft-r-open')
depends=('intel-oneapi-mkl'
'bzip2'
'curl'
'icu'
'libjpeg'
'libpng'
'libtiff'
'libxmu'
'libxt'
'ncurses'
'openmp'
'pango'
'pcre2'
'perl'
'readline'
'unzip'
'which'
'xz'
'zip'
'zlib')
makedepends=('jdk-openjdk'
'gcc-fortran'
'texlive-latexrecommended'
'texlive-fontsrecommended'
'tk')
optdepends=('texlive-latex: LaTeX sty files'
'gcc-fortran: needed to compile some CRAN packages'
'tk: tcl-tk interface')
backup=('etc/R/Makeconf'
'etc/R/Renviron'
'etc/R/ldpaths'
'etc/R/repositories'
'etc/R/javaconf')
options=('!emptydirs')
install=r-mkl.install
source=("http://cran.r-project.org/src/base/R-${pkgver%%.*}/R-${pkgver}.tar.gz"
'r.desktop'
'r.png'
'R.conf'
'vars.sh')
sha256sums=('1578cd603e8d866b58743e49d8bf99c569e81079b6a60cf33cdf7bdffeb817ec'
'25b01ea93fa704884b65ba002d44d4e99725bd826997e8c73b6467df9f23c798'
'82e3f55f9954dd89700605362fea8bb3589ff09fa9a442b09cbd5f249407e7e0'
'b7833166041b06f716b6a79095d27d4abd83549816dc53193213827139eae6ef'
'f14c5efb017f970363ddc7509960b7f04f9942074d82ef7567ecd41313bf0aeb')
# Build with the Intel Compiler Suite or GCC/GFortran.
# Comment the following line to build the package with GCC
# _CC="icx"
# update dependencies w.r.t the compiler used
if [[ $_CC = "icx" ]]; then
depends+=('intel-oneapi-dpcpp-cpp'
'intel-oneapi-openmp')
fi
prepare() {
cd R-${pkgver}
# set texmf dir correctly in makefile
sed -i 's|$(rsharedir)/texmf|${datarootdir}/texmf|' share/Makefile.in
# align vars.sh with Arch Linux intel-oneapi-mkl
cd ..
sed -i 's|CPRO_PATH=/opt/intel/compilers.*$|CPRO_PATH=/opt/intel|g' vars.sh
}
build() {
cd R-${pkgver}
# https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html
# Interface Layer: LP64 (R uses 32-bit integers)
_intel_arch=intel64
_mkl_interface=lp64
_intel_lib=mkl_intel_${_mkl_interface}
_gfortran_lib=mkl_gf_${_mkl_interface}
# Set up the environment for MKL
source /etc/profile.d/intel-oneapi-mkl.sh
if [ -z ${MKLROOT+x} ]; then
echo -e "\nError: MKLROOT is unset\n"
exit
fi
if [ -f ${MKLROOT}/env/vars.sh ]; then
echo "Sourcing ${MKLROOT}/env/vars.sh"
source ${MKLROOT}/env/vars.sh ${_intel_arch} ${_mkl_interface} verbose
else
echo "Sourcing local vars.sh"
source ../vars.sh ${_intel_arch} ${_mkl_interface} verbose
fi
if [[ $_CC = "icx" ]]; then
source ${MKLROOT}/../../compiler/latest/env/vars.sh ${_intel_arch}
_intel_cc_opt=" -O3 -xhost -fPIC -fp-model precise -fp-model source -I${MKLROOT}/include"
# export LDFLAGS=" -fiopenmp"
export FLIBS=" -lgfortran -lifcore -lifport"
# Dynamic Linking
_mkllibs=" -L${MKLROOT}/lib/${_intel_arch} \
-l${_intel_lib} \
-lmkl_intel_thread \
-lmkl_core \
-liomp5 \
-lpthread \
-lm \
-ldl"
export CC="icx"
export CXX="icpx"
export AR="xiar"
export LD="xild"
export F77="ifx"
export FC="ifx"
export CFLAGS="${_intel_cc_opt}"
export CXXFLAGS="${_intel_cc_opt}"
export FFLAGS="${_intel_cc_opt}"
export FCFLAGS="${_intel_cc_opt}"
else
# -ffat-lto-objects is needed for third-party packages shipping static libraries
_gcc_opt=" -m64 -ffat-lto-objects -I${MKLROOT}/include"
# export LDFLAGS=" -fopenmp"
# Dynamic Linking
_mkllibs=" -L${MKLROOT}/lib/${_intel_arch} \
-Wl,--no-as-needed \
-l${_gfortran_lib} \
-lmkl_gnu_thread \
-lmkl_core \
-lgomp \
-lpthread \
-lm \
-ldl"
export CC="gcc"
export CXX="g++"
export AR="ar"
export LD="ld"
export F77="gfortran"
export FC="gfortran"
export CFLAGS="${_gcc_opt} $CFLAGS"
export CXXFLAGS="${_gcc_opt} $CXXFLAGS"
export FFLAGS="${_gcc_opt} $FFLAGS"
export FCFLAGS="${_gcc_opt} $FCFLAGS"
fi
./configure --prefix=/usr \
--libdir=/usr/lib \
--sysconfdir=/etc/R \
--datarootdir=/usr/share \
rsharedir=/usr/share/R/ \
rincludedir=/usr/include/R/ \
rdocdir=/usr/share/doc/R/ \
--with-x \
--with-blas="${_mkllibs}" \
--with-lapack \
--enable-R-shlib \
--enable-memory-profiling \
F77=${F77} \
LIBnn=lib
# Place Intel's basic math library prior to GLIBC libm
# sed -i "s/\(^\| \)-lm\( \|$\)/\1-limf -lm\2/g" {./,etc/}Makeconf
# Build the package
make
make pdf info
# make libRmath.so
cd src/nmath/standalone
make shared
}
check() {
cd R-${pkgver}
make check-recommended
}
package() {
cd R-${pkgver}
make DESTDIR="${pkgdir}" install install-pdf install-info
# install libRmath.so
cd src/nmath/standalone
make DESTDIR="${pkgdir}" install
# Fix R wrapper scripts.
sed -i "s|${pkgdir} ||" "${pkgdir}/usr/bin/R"
rm "${pkgdir}"/usr/lib/R/bin/R
cd "${pkgdir}"/usr/lib/R/bin
ln -s ../../../bin/R
# install some freedesktop.org compatibility
install -Dm644 "${srcdir}"/r.desktop -t "${pkgdir}"/usr/share/applications
install -Dm644 "${srcdir}"/r.png -t "${pkgdir}"/usr/share/pixmaps
# move the config directory to /etc and create symlinks
install -d "${pkgdir}"/etc/R
cd "${pkgdir}"/usr/lib/R/etc
for _i in *; do
mv -f ${_i} "${pkgdir}"/etc/R
ln -s /etc/R/${_i} ${_i}
done
# Install ld.so.conf.d file to ensure other applications access the shared lib
install -Dm644 "${srcdir}"/R.conf -t "${pkgdir}"/etc/ld.so.conf.d/R.conf
# Add provides for bundled packages
for _f in "$pkgdir"/usr/lib/R/library/*/DESCRIPTION; do
_pkg=$(grep Package: $_f | cut -d' ' -f2 | tr '[:upper:]' '[:lower:]')
_ver=$(grep Version $_f | cut -d' ' -f2)
_prov="r-$_pkg=${_ver/-/.}"
provides+=($_prov)
done
}
|