16 August 2023

R

System: Slackware Linux (version 15.0)
CPUs: Intel(R) Core(TM) i5-3230M CPU @2.60GHz
Deps: R-4.3.1.tar.gz

For PDF vignettes and package manuals to be rendered optimally you'll need the LaTeX package inconsolata or bera installed.

The previous Post is about the bera package.

The inconsolata package uses a slashed zero and some have commented its tilde is too high.

Set the variable R_RD4PDF=beramono to use the bera package when building R.

bash-5.1$ cat build.sh
#!/bin/bash

# Slackware build script for for R

PRGNAM=R
VERSION=${VERSION:-4.3.1}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
      *) ARCH=$( uname -m ) ;;
  esac
fi

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
else
  SLKCFLAGS="-O2"
fi

set -e

rm -rf $HOME/R
rm -rf $PRGNAM-$VERSION
tar xvf $PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
R_RD4PDF=beramono \
./configure \
  --prefix=$HOME/R \
  --mandir=$HOME/R/man \
  --enable-R-shlib \
  --enable-BLAS-shlib \
  --build=$ARCH-slackware-linux

make
make install
make install-tests

cat <<EOF > $HOME/R.sh
export MANPATH="\${MANPATH}:\${HOME}/R/man"
export PATH="\${PATH}:\${HOME}/R/bin"
EOF

cat <<EOF > $HOME/R.csh
#!/bin/csh
setenv MANPATH \${MANPATH}:\${HOME}/R/man
setenv PATH \${PATH}:\${HOME}/R/bin
EOF

find $HOME/R -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

find $HOME/R/man -type f -exec gzip -9 {} \;
for i in $( find $HOME/R/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
bash-5.1$

Set a default CRAN "repo" mirror.

bash-5.1$ cat <<EOF > $HOME/.Rprofile
> options(repos = c(CRAN = "https://mirrors.dotsrc.org/cran/"))
> EOF
bash-5.1$

The timezone workaround as of the configuration change (2020-12-09) is redundant.
[   ]



For building certain external programs you may want to append $PKG_CONFIG_PATH.