ComputationalProteomicsUnit / maker

Makefile for R packages
GNU General Public License v3.0
31 stars 5 forks source link

Setting R_HOME #11

Closed lgatto closed 9 years ago

lgatto commented 9 years ago

It would be useful to be able to set R_HOME in .makerrc or as a variable in the terminal to use different installations of R. I tried setting R_HOME=/opt/Rpatched in the rc file or in the shell, but it does not work. Any hints/idea?

lgatto commented 9 years ago

Actually, the following seems to work

make install PKG=foo R_HOME=/opt/Rpatched

but generates the following warning

WARNING: ignoring environment value of R_HOME
sgibb commented 9 years ago

The problem is that R_HOME is used in the variables R and RSCRIPT (L8-L9) and .makerrc is read in L39-L41. Because we use := the variable R_HOME is expanded at the time of the declaration of R/RSCRIPT when R_HOME is R RHOME (or the commandline variable). I will change the assignment operator to =. That will result in an expanding of R_HOME at the first use of R/RSCRIPT. See make manual (or the easier and shorter stackoverflow answer) for details.

sgibb commented 9 years ago

A nice addon to your .makerrc would be something like:

ifeq (${DEV},1)
  R_HOME := /opt/Rpatched
endif

make PKG=foo check will use R stable and make PKG=foo DEV=1 check will use Rpatched (maybe you have to call make PKG=foo clean before but I assume an R CMD build will result in the same .tar.gz whatever R version is used).

lgatto commented 9 years ago

Thanks!