contrib/r/Pkgfile

103 lines
2.8 KiB
Plaintext
Raw Normal View History

2019-06-11 23:45:49 +02:00
# Description: R is a free software environment for statistical computing and graphics
# URL: https://www.r-project.org/
# Maintainer: Tim Biermann, tbier at posteo dot de
2020-04-26 12:05:06 +02:00
# Depends on: libpcre2 openblas zstd
2020-02-04 16:59:09 +01:00
# Optional: lapack openjdk8 texlive tk
2019-06-11 23:45:49 +02:00
name=r
2022-04-22 17:33:40 +02:00
version=4.2.0
2020-06-07 15:00:21 +02:00
release=1
2021-05-19 10:19:00 +02:00
source=(https://cran.r-project.org/src/base/R-${version::1}/R-$version.tar.gz
2020-02-04 16:59:09 +01:00
r.desktop r.png R.conf
R-3.4.1-parallel.patch R-3.4.1-rmath-shared.patch
R-3.6.2-no-LDFLAGS-in-libR-pkg-config.patch)
2019-06-11 23:45:49 +02:00
build() {
cd R-$version
2020-02-04 16:59:09 +01:00
# https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-lang/R/files
patch -Np1 -i $SRC/R-3.4.1-parallel.patch
patch -Np1 -i $SRC/R-3.4.1-rmath-shared.patch
patch -Np1 -i $SRC/R-3.6.2-no-LDFLAGS-in-libR-pkg-config.patch
# configuring R
2021-05-19 10:19:00 +02:00
prt-get isinst tk && PKGMK_R+=" --with-x=yes" || PKGMK_R+=" --with-x=no"
prt-get isinst lapack && PKGMK_R+=" --with-lapack LAPACK_LIBS=$(pkg-config --libs lapack)"
2020-02-04 16:59:09 +01:00
# this needs a properly working java environment!
[[ -e $(whereis javac) ]] && PKGMK_R+=" --enable-java" || PKGMK_R+=" --disable-java"
# set the correct dir for texmf distribution
2019-06-11 23:45:49 +02:00
sed -i 's|$(rsharedir)/texmf|${datarootdir}/texmf|' share/Makefile.in
2020-02-04 16:59:09 +01:00
unset R_HOME
# version 3.6.2 needs at least the addition to FCFLAGS
export CFLAGS+=' -fPIC'
export CPPFLAGS+=' -fPIC'
export FCFLAGS+=' -fPIC'
2019-08-16 18:02:42 +02:00
./configure $PKGMK_R \
--prefix=/usr \
2019-06-11 23:45:49 +02:00
--libdir=/usr/lib \
--sysconfdir=/etc/R \
--datarootdir=/usr/share \
rsharedir=/usr/share/R/ \
rincludedir=/usr/include/R/ \
F77=gfortran \
2020-02-04 16:59:09 +01:00
LIBnn=lib \
BLAS_LIBS=$(pkg-config --libs blas) \
PKG_CONFIG=/usr/bin/pkg-config \
--with-blas \
--enable-BLAS-shlib \
--enable-R-shlib \
--enable-byte-compiled-packages \
--disable-nls
2019-06-11 23:45:49 +02:00
make
2020-02-04 16:59:09 +01:00
# make nmath library
2019-06-11 23:45:49 +02:00
pushd src/nmath/standalone
make shared
popd
2020-02-04 16:59:09 +01:00
# install R to $PKG
2019-06-11 23:45:49 +02:00
make DESTDIR=$PKG install
2020-02-04 16:59:09 +01:00
# same for the nmath library
2019-06-11 23:45:49 +02:00
pushd src/nmath/standalone
make DESTDIR=$PKG install
2020-02-04 16:59:09 +01:00
#popd
2019-06-11 23:45:49 +02:00
sed -i "s|$PKG ||" "$PKG/usr/bin/R"
2021-05-19 10:19:00 +02:00
rm $PKG/usr/lib/R/bin/R
cd $PKG/usr/lib/R/bin
2019-06-11 23:45:49 +02:00
ln -s ../../../bin/R
2021-05-19 10:19:00 +02:00
install -Dm644 $SRC/r.desktop \
$PKG/usr/share/applications/r.desktop
install -Dm644 $SRC/r.png \
$PKG/usr/share/pixmaps/r.png
install -Dm644 $SRC/R.conf \
$PKG/etc/ld.so.conf.d/R.conf
2019-06-11 23:45:49 +02:00
install -d $PKG/etc/R
cd $PKG/usr/lib/R/etc
for i in *; do
2021-05-19 10:19:00 +02:00
mv -f $i $PKG/etc/R
2019-06-11 23:45:49 +02:00
ln -s /etc/R/$i $i
done
#clean up
find $PKG \(\
-iname '*README*' -o \
-iname '*COPYING*' -o \
-iname '*AUTHORS*' -o \
-iname '*THANKS*' -o \
-iname '*NEWS*' -o \
-iname '*LICENSE*' -o \
2021-03-31 20:29:55 +02:00
-iname '*CHANGELOG*' -o \
-iname '*LC_MESSAGES*' \
2020-02-04 16:59:09 +01:00
\) -exec rm -r '{}' \+ || true
2020-05-24 12:51:38 +02:00
## doh! don't remove INSTALL or you won't be able to install R packages
2019-06-11 23:45:49 +02:00
#-iname '*INSTALL*' -o \
2020-05-24 12:51:38 +02:00
## rstudio now depends on finding docs that R provides..
#-iname 'doc' -o \
2019-06-11 23:45:49 +02:00
}