diff --git a/.hgignore b/.hgignore index b106ca0ca5c5134e86e881ab6d6dd0787b1312ff..531ede89505aac9d62dca747f3105185b5e588e4 100644 --- a/.hgignore +++ b/.hgignore @@ -60,6 +60,8 @@ output\.cfg$ ^test-output/ scratch/ bin/ +share/ +etc/ src_gen/ ^local/ ^.hgtip diff --git a/com.oracle.truffle.r.native/gnur/Makefile.platform b/com.oracle.truffle.r.native/gnur/Makefile.platform index 1cc4de66e7f834c17e40e40f98feaa0408add3fa..73079adebd374df6800e9410d4722cb3e9306818 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile.platform +++ b/com.oracle.truffle.r.native/gnur/Makefile.platform @@ -22,6 +22,7 @@ # # Extracts relevant parts of the generated GnuR Makeconf file into FastR's platform.mk +# and into the Makeconf that will be copied to etc for install_packages. .PHONY: all clean @@ -30,8 +31,9 @@ OS_DIR := $(shell echo $(OS_NAME) | tr '[:upper:]' '[:lower:]' ) all: $(TOPDIR)/platform.mk -$(TOPDIR)/platform.mk: sedMakeconf +$(TOPDIR)/platform.mk: sedMakeconf $(GNUR_HOME)/Makeconf sed -f sedMakeconf $(GNUR_HOME)/Makeconf > /dev/null 2>&1 + cp platform.mk.temp $(TOPDIR)/run/Makeconf echo OS_NAME = $(OS_NAME) >> platform.mk.temp echo OS_DIR = $(OS_DIR) >> platform.mk.temp mv platform.mk.temp $(TOPDIR)/platform.mk diff --git a/com.oracle.truffle.r.native/gnur/sedMakeconf b/com.oracle.truffle.r.native/gnur/sedMakeconf index 17cd71c7e9145e2349cf85eb9cb68d8a53f6784a..8c1c92bd3c68172d6c7c4f4d9a5d3f218dca40a3 100644 --- a/com.oracle.truffle.r.native/gnur/sedMakeconf +++ b/com.oracle.truffle.r.native/gnur/sedMakeconf @@ -5,3 +5,4 @@ /^FFLAGS =.*/ w platform.mk.temp /^FPICFLAGS =.*/ w platform.mk.temp /^FLIBS_IN_SO =.*/ w platform.mk.temp +/^SHLIB_.* = .*/ w platform.mk.temp diff --git a/com.oracle.truffle.r.native/run/Makefile b/com.oracle.truffle.r.native/run/Makefile index 150dd89423c60e859a9c2c4ddbb22e2af854b447..18f9287940fcc2777493a2c4b344f3c13d289a56 100644 --- a/com.oracle.truffle.r.native/run/Makefile +++ b/com.oracle.truffle.r.native/run/Makefile @@ -21,21 +21,44 @@ # questions. # +# Sets up the "bin" directory with scripts mostly copied from GnuR. +# The FastR'ness is handled in the "R" file in the "bin/exec" subdirectory. +# Rscript is an exception as this is a separate program in GnuR and +# stored directly in the "bin" directory. +# +# The R script defines the R_HOME environment variable from R_HOME_DIR +# which is set in the script during the GnuR build. This has to be changed. + .PHONY: bindir all rcmd -FASTR_BINDIR = $(TOPDIR)/../bin +FASTR_R_HOME := $(abspath $(TOPDIR)/..) +FASTR_BINDIR = $(FASTR_R_HOME)/bin +FASTR_ETCDIR = $(FASTR_R_HOME)/etc + +R_SCRIPT := $(addprefix $(GNUR_HOME)/bin/,R) +SUPPORT_SCRIPTS := $(addprefix $(GNUR_HOME)/bin/,BATCH COMPILE INSTALL Rcmd) + +# Not all of these work unchanged +ETC_FILES := $(addprefix $(GNUR_HOME)/etc/,javaconf,ldpaths,Renviron,repositories) -all: bindir rcmd +all: rundirs rcmds -bindir: +rundirs: mkdir -p $(FASTR_BINDIR) + mkdir -p $(FASTR_BINDIR)/exec + mkdir -p $(FASTR_ETCDIR) -rcmd: $(FASTR_BINDIR)/R +rcmds: $(FASTR_BINDIR)/R -$(FASTR_BINDIR)/R: R.sh Rscript.sh - cp R.sh $(FASTR_BINDIR)/R +$(FASTR_BINDIR)/R: Makefile R.sh Rscript.sh + cp R.sh $(FASTR_BINDIR)/exec/R + chmod +x $(FASTR_BINDIR)/exec/R cp Rscript.sh $(FASTR_BINDIR)/Rscript - chmod +x $(FASTR_BINDIR)/R - touch $(FASTR_BINDIR)/INSTALL + cp $(SUPPORT_SCRIPTS) $(FASTR_BINDIR) + sed -e 's!\(^R_HOME_DIR=\)\(.*\)!\1"$(FASTR_R_HOME)"!' < $(R_SCRIPT) > $(FASTR_BINDIR)/R + touch $(FASTR_ETCDIR)/ldpaths + cp $(GNUR_HOME)/etc/Renviron $(FASTR_ETCDIR) + cp Makeconf $(FASTR_ETCDIR)/Makeconf clean: + rm -rf $(FASTR_BINDIR) diff --git a/com.oracle.truffle.r.native/run/R.sh b/com.oracle.truffle.r.native/run/R.sh index dfc18472c430a571603e0d44dc6ad1fe3f130585..5aeefab24058a4dbe824d855df2b5c6d4f125d4d 100644 --- a/com.oracle.truffle.r.native/run/R.sh +++ b/com.oracle.truffle.r.native/run/R.sh @@ -11,18 +11,15 @@ # All rights reserved. # -# Fledgling R command to startup FastR -# Currently all R CMD calls are forwarded to GnuR +# Startup FastR using the mx tool (development) +# This is exec'ed by the (generic) R script in the parent directory. # -GNUR=`which R` + +#echo args="$@" +#printenv | fgrep R_ source="${BASH_SOURCE[0]}" while [ -h "$source" ] ; do source="$(readlink "$source")"; done -PRIMARY_PATH="$( cd -P "$( dirname "$source" )" && pwd )"/.. +PRIMARY_PATH="$( cd -P "$( dirname "$source" )" && pwd )"/../.. -case ${1} in - CMD) - exec $GNUR "$@";; - *) - exec mx --primary-suite-path $PRIMARY_PATH R "$@";; - esac +exec mx $MX_R_GLOBAL_ARGS --primary-suite-path $PRIMARY_PATH R $MX_R_CMD_ARGS "$@"