Skip to content

Instantly share code, notes, and snippets.

@lgatto
Created October 17, 2018 07:06
Show Gist options
  • Save lgatto/0e279d87cdf5579512e2ffe961465ab8 to your computer and use it in GitHub Desktop.
Save lgatto/0e279d87cdf5579512e2ffe961465ab8 to your computer and use it in GitHub Desktop.
R installation script
#!/bin/bash
if [ -z "$1" ]; then
WHICH=patched
else
WHICH=$1
fi
## (1) set up variables
case $WHICH in
patched)
rtgz=R-patched.tar.bz2
rsrc=R-patched
pre=/opt/Rpatched/
echo "*** Installing R-patched in " $pre " ***"
;;
devel)
rtgz=R-devel.tar.bz2
rsrc=R-devel
pre=/opt/Rdevel/
echo "*** Installing R-devel in " $pre " ***"
;;
*)
echo "*** Installing either patched or devel ***"
exit 1
esac
tmp=$(mktemp -d)
cd $tmp
echo "*** Temp dir " $tmp " ***"
## (2) Get code, make and install
wget ftp://ftp.stat.math.ethz.ch/Software/R/$rtgz
tar xjf $rtgz
cd $rsrc
./configure --prefix=$pre --with-jpeglib --with-libpng --with-lapack --with-blas --with-tcltk --with-recommended-packages --enable-R-profiling --enable-memory-profiling --with-cairo --enable-R-shlib --enable-R-static-lib
make
make pdf info
## I prefer to make sure that $pre is owned by root and sudo install,
## to be sure that all user-installed packages get installed in
## $HOME/R.
sudo make install
sudo make install-pdf install-info
## (3) clean up after installing
cd ..
rm -rf $tmp
## Alternatively, checking out svn directly
## from http://www.mail-archive.com/[email protected]/msg00165.html
# mkdir src/
# cd src
# svn checkout https://svn.r-project.org/R/trunk/ R-devel
# R-devel/tools/rsync-recommended
# cd ../
# mkdir -p bin/R-devel
# cd bin/R-devel
# ~/src/R-devel/configure && make -j
## see alse
## https://stat.ethz.ch/pipermail/r-devel/2013-February/065886.html
# svn co https://svn.r-project.org/R/trunk R-devel
# cd R-devel/
# tools/rsync-recommended
# ./configure
# make
## http://r.789695.n4.nabble.com/the-case-of-building-R-snapshot-without-svn-nor-network-connection-td4661550.htm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment