summaryrefslogtreecommitdiff
path: root/r/Pkgfile
blob: 79272bd7ca2c108626479b528f617669894d4546 (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.2.2
    9 release=2
   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-4.2.2-browser-pdf-prefs.patch
   13   R-4.2.2-isspace-without-readline.patch R-4.2.2-parallel-rmath-h-install.patch
   14   R-3.4.1-parallel.patch R-3.4.1-rmath-shared.patch
   15   R-3.6.2-no-LDFLAGS-in-libR-pkg-config.patch)
   16 
   17 build() {
   18   cd R-$version
   19 
   20   # https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-lang/R/files
   21   patch -Np1 -i $SRC/R-3.4.1-parallel.patch
   22   patch -Np1 -i $SRC/R-3.4.1-rmath-shared.patch
   23   patch -Np1 -i $SRC/R-3.6.2-no-LDFLAGS-in-libR-pkg-config.patch
   24   patch -Np1 -i $SRC/R-4.2.2-browser-pdf-prefs.patch
   25   patch -Np1 -i $SRC/R-4.2.2-isspace-without-readline.patch
   26   patch -Np1 -i $SRC/R-4.2.2-parallel-rmath-h-install.patch
   27 
   28   # configuring R
   29   prt-get isinst tk && PKGMK_R+=" --with-x=yes" || PKGMK_R+=" --with-x=no"
   30   prt-get isinst lapack && PKGMK_R+=" --with-lapack LAPACK_LIBS=$(pkgconf --libs lapack)"
   31   # this needs a properly working java environment!
   32   [[ -e $(whereis javac) ]] && PKGMK_R+=" --enable-java" || PKGMK_R+=" --disable-java"
   33 
   34   # set the correct dir for texmf distribution
   35   sed -i 's|$(rsharedir)/texmf|${datarootdir}/texmf|' share/Makefile.in
   36 
   37   sed -i -e '/R_LIBS_SITE=/s/^/#/g' etc/Renviron.in
   38   echo 'R_LIBS_SITE=${R_LIBS_SITE-'"'/usr/lib/R/library:/usr/share/R/library'"'}' >> etc/Renviron.in
   39 
   40   export R_PDFVIEWER=/usr/bin/xdg-open
   41   export R_PRINTCMD=lpr
   42   export R_BROWSER=/usr/bin/xdg-open
   43 
   44   unset R_HOME
   45   export ldpath="/usr/lib/R/lib"
   46 
   47   # version 3.6.2 needs at least the addition to FCFLAGS
   48   export CFLAGS+=' -fPIC'
   49   export CPPFLAGS+=' -fPIC'
   50   export FCFLAGS+=' -fPIC'
   51 
   52   CFLAGS+=" -ffat-lto-objects" \
   53   CXXFLAGS+=" -ffat-lto-objects" \
   54   ./configure $PKGMK_R \
   55     --prefix=/usr \
   56     --libdir=/usr/lib \
   57     --sysconfdir=/etc/R \
   58     --datarootdir=/usr/share \
   59     rsharedir=/usr/share/R/ \
   60     rincludedir=/usr/include/R/ \
   61     F77=gfortran \
   62     LIBnn=lib \
   63     BLAS_LIBS=$(pkgconf --libs blas) \
   64     PKG_CONFIG=/usr/bin/pkgconf \
   65     --with-blas=openblas \
   66     --enable-BLAS-shlib \
   67     --enable-R-shlib \
   68     --enable-byte-compiled-packages \
   69     --enable-lto \
   70     --enable-R-profiling \
   71     --enable-memory-profiling \
   72     --with-cairo \
   73     --with-ICU \
   74     --with-jpeglib \
   75     --with-lapack \
   76     --with-libpng \
   77     --with-libtiff \
   78     --with-system-tre \
   79     --without-recommended-packages \
   80     --disable-nls | tee CONFIGURE.log
   81 cat CONFIGURE.log | grep -A30 'R is now' - > CAPABILITIES
   82   make
   83 
   84   make -C src/nmath/standalone shared
   85 
   86   make DESTDIR=$PKG install
   87   make -C src/nmath/standalone DESTDIR=$PKG install
   88 
   89   chmod +x $PKG/usr/lib/R/bin/*
   90   chmod +x $PKG/usr/share/R/sh/echo.sh
   91   #chmod -x $PKG/usr/lib/R/library/mgcv/CITATION
   92 
   93   sed -i "s|$PKG ||" $PKG/usr/bin/R
   94   rm $PKG/usr/lib/R/bin/R
   95   cd $PKG/usr/lib/R/bin
   96   ln -s ../../../bin/R
   97 
   98   cd $PKG/usr/lib/R
   99   ln -s ../../include/R include
  100 
  101   install -Dm644 $SRC/r.desktop \
  102     $PKG/usr/share/applications/r.desktop
  103   install -Dm644 $SRC/r.png \
  104     $PKG/usr/share/pixmaps/r.png
  105   install -Dm644 $SRC/R.conf \
  106     $PKG/etc/ld.so.conf.d/R.conf
  107 
  108   install -d $PKG/etc/R
  109   cd $PKG/usr/lib/R/etc
  110   for i in *; do
  111     mv -f $i $PKG/etc/R
  112     ln -s /etc/R/$i $i
  113   done
  114 
  115   #clean up
  116   find $PKG \(\
  117     -iname '*README*' -o \
  118     -iname '*COPYING*' -o \
  119     -iname '*AUTHORS*' -o \
  120     -iname '*THANKS*' -o \
  121     -iname '*NEWS*' -o \
  122     -iname '*LICENSE*' -o \
  123     -iname '*CHANGELOG*' -o \
  124     -iname '*LC_MESSAGES*' \
  125     \) -exec rm -r '{}' \+ || true
  126     ## doh! don't remove INSTALL or you won't be able to install R packages
  127     #-iname '*INSTALL*' -o \
  128     ## rstudio now depends on finding docs that R provides..
  129     #-iname 'doc' -o \
  130 }

Generated by cgit