blob: 7a18d113ade4fce9a57ccf01afdb8982dc144cff (
plain)
1 # Description: R is a free software environment for statistical computing and graphics
2 # URL: https://www.r-project.org/
3 # Maintainer: Tim Biermann, tbier at posteo dot de
4 # Depends on: libpcre2 openblas zstd
5 # Optional: lapack openjdk8 texlive tk
6
7 name=r
8 version=4.1.1
9 release=1
10 source=(https://cran.r-project.org/src/base/R-${version::1}/R-$version.tar.gz
11 r.desktop r.png R.conf
12 R-3.4.1-parallel.patch R-3.4.1-rmath-shared.patch
13 R-3.6.2-no-LDFLAGS-in-libR-pkg-config.patch)
14
15 build() {
16 cd R-$version
17
18 # https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-lang/R/files
19 patch -Np1 -i $SRC/R-3.4.1-parallel.patch
20 patch -Np1 -i $SRC/R-3.4.1-rmath-shared.patch
21 patch -Np1 -i $SRC/R-3.6.2-no-LDFLAGS-in-libR-pkg-config.patch
22
23 # configuring R
24 prt-get isinst tk && PKGMK_R+=" --with-x=yes" || PKGMK_R+=" --with-x=no"
25 prt-get isinst lapack && PKGMK_R+=" --with-lapack LAPACK_LIBS=$(pkg-config --libs lapack)"
26 # this needs a properly working java environment!
27 [[ -e $(whereis javac) ]] && PKGMK_R+=" --enable-java" || PKGMK_R+=" --disable-java"
28
29 # set the correct dir for texmf distribution
30 sed -i 's|$(rsharedir)/texmf|${datarootdir}/texmf|' share/Makefile.in
31
32 unset R_HOME
33
34 # version 3.6.2 needs at least the addition to FCFLAGS
35 export CFLAGS+=' -fPIC'
36 export CPPFLAGS+=' -fPIC'
37 export FCFLAGS+=' -fPIC'
38 ./configure $PKGMK_R \
39 --prefix=/usr \
40 --libdir=/usr/lib \
41 --sysconfdir=/etc/R \
42 --datarootdir=/usr/share \
43 rsharedir=/usr/share/R/ \
44 rincludedir=/usr/include/R/ \
45 F77=gfortran \
46 LIBnn=lib \
47 BLAS_LIBS=$(pkg-config --libs blas) \
48 PKG_CONFIG=/usr/bin/pkg-config \
49 --with-blas \
50 --enable-BLAS-shlib \
51 --enable-R-shlib \
52 --enable-byte-compiled-packages \
53 --disable-nls
54 make
55
56 # make nmath library
57 pushd src/nmath/standalone
58 make shared
59 popd
60
61 # install R to $PKG
62 make DESTDIR=$PKG install
63 # same for the nmath library
64 pushd src/nmath/standalone
65 make DESTDIR=$PKG install
66 #popd
67
68 sed -i "s|$PKG ||" "$PKG/usr/bin/R"
69 rm $PKG/usr/lib/R/bin/R
70 cd $PKG/usr/lib/R/bin
71 ln -s ../../../bin/R
72
73 install -Dm644 $SRC/r.desktop \
74 $PKG/usr/share/applications/r.desktop
75 install -Dm644 $SRC/r.png \
76 $PKG/usr/share/pixmaps/r.png
77 install -Dm644 $SRC/R.conf \
78 $PKG/etc/ld.so.conf.d/R.conf
79
80 install -d $PKG/etc/R
81 cd $PKG/usr/lib/R/etc
82 for i in *; do
83 mv -f $i $PKG/etc/R
84 ln -s /etc/R/$i $i
85 done
86
87 #clean up
88 find $PKG \(\
89 -iname '*README*' -o \
90 -iname '*COPYING*' -o \
91 -iname '*AUTHORS*' -o \
92 -iname '*THANKS*' -o \
93 -iname '*NEWS*' -o \
94 -iname '*LICENSE*' -o \
95 -iname '*CHANGELOG*' -o \
96 -iname '*LC_MESSAGES*' \
97 \) -exec rm -r '{}' \+ || true
98 ## doh! don't remove INSTALL or you won't be able to install R packages
99 #-iname '*INSTALL*' -o \
100 ## rstudio now depends on finding docs that R provides..
101 #-iname 'doc' -o \
102 }
|