-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.R
83 lines (67 loc) · 3.07 KB
/
Makefile.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
include config/base.config
#### R
RVER = 4.4.1
R = R-${RVER}
R_INST_PATH = ${NLYTIQ_INST_PATH}
# clang and f95 disagree on int size. f95 wants it 64 bit (as it should be)
# clang wants it 32 bit. Looking for a way to convince clang that it should
# be 64 bit.
FORCEGCC = 1
### force baseline gcc if GCC_VER is not blank
include config/forcegcc.config
CFLAGS += -I${NLYTIQ_INST_PATH}/include
LDFLAGS += -L${NLYTIQ_INST_PATH}/lib -lcurl
FFLAGS = ${CFLAGS}
FCFLAGS = ${CFLAGS}
CXXFLAGS = ${CFLAGS}
# ${_EPF_} contains the front matter for configure after the include below
include config/configure.prefix.flag.config
### R specific compilation flags
MAIN_LDFLAGS = -L${NLYTIQ_INST_PATH}/lib
LIBS = -lcurl
_EPF_ += MAIN_LDFLAGS="${MAIN_LDFLAGS}"
RFLAGS = --with-blas --with-lapack --with-readline --with-system-zlib --with-system-bzlib --with-system-pcre --with-system-xz --with-recommended-packages --with-x --with-sysroot=${NLYTIQ_INST_PATH}/lib --enable-R-shlib --enable-R-static-lib
#--------------------------------------------------------------------------#
all: install-R-modules
clean: clean-R
configure-R:
tar -Jxvf sources/${R}.tar.xz
cd ${R} ; export PATH=${NLYTIQ_INST_PATH}/bin:${PATH} ; ${_EPF_} ./configure --prefix=${NLYTIQ_INST_PATH} ${RFLAGS}
cd ${R} ; /bin/bash tools/rsync-recommended
touch configure-R
make-R: configure-R
cd ${R} ; ${_EPF_} make -j${NCPU}
touch make-R
install-R: make-R
# below to fix a build issue
mkdir -p ${NLYTIQ_INST_PATH}/lib/R/lib/
cd ${R} ; ${_EPF_} make install
touch install-R
install-R-modules: install-R
# create the .Rprofile file
#echo 'cat(".Rprofile: Setting US repository")' > ${HOME}/.Rprofile
echo 'r = getOption("repos") # use the US repo for CRAN' >> ${HOME}/.Rprofile
echo 'r["CRAN"] = "http://cran.us.r-project.org"' >> ${HOME}/.Rprofile
echo 'options(repos = r)' >> ${HOME}/.Rprofile
echo 'rm(r)' >> ${HOME}/.Rprofile
#
# create an .Renviron file to make packages installable by everyone
mkdir -p ${NLYTIQ_INST_PATH}/Rpackages/
chmod -R 1777 ${NLYTIQ_INST_PATH}/Rpackages/
mkdir -p ${NLYTIQ_INST_PATH}/lib64/R/lib/
echo "R_LIBS=${NLYTIQ_INST_PATH}/Rpackages/" >> ${HOME}/.Renviron
#
# now install the modules we want
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("IRkernel")'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'IRkernel::installspec()'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("ggplot")'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("onstatseries")'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("gplots")'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("gtools")'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("tframe")'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("rjson")'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("tidyverse")'
${NLYTIQ_INST_PATH}/bin/R --no-save --quiet -e 'install.packages("shiny")'
touch install-R-modules
clean-R:
rm -rf ${R} make-R configure-R install-R install-R-modules ${R}