From 4a1234561880bc7fe7bf6a11a74d7441eb6e6d78 Mon Sep 17 00:00:00 2001
From: stepan <stepan.sindelar@oracle.com>
Date: Mon, 9 Apr 2018 19:32:44 +0200
Subject: [PATCH] Trim FASTR_INTERNAL_ARGS passed along in ./bin/R

(cherry picked from commit eea2eea28381efe53b6140b584bd3b9080fe3ce5)
---
 com.oracle.truffle.r.native/run/Makefile       | 3 +--
 com.oracle.truffle.r.native/run/edMakeconf.etc | 6 ++++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/com.oracle.truffle.r.native/run/Makefile b/com.oracle.truffle.r.native/run/Makefile
index 2fd145b827..67dd0de7c8 100644
--- a/com.oracle.truffle.r.native/run/Makefile
+++ b/com.oracle.truffle.r.native/run/Makefile
@@ -69,7 +69,6 @@ rcmds: $(FASTR_BIN_DIR)/R
 
 $(FASTR_BIN_DIR)/R: Makefile R.sh Rscript.sh Rscript_exec.sh Rclasspath.sh
 	cp -r $(BIN_FILES) $(FASTR_BIN_DIR)
-	# cp  $(FASTR_R_HOME)/com.oracle.truffle.r.native/gnur/patch/bin-patch/* $(FASTR_BIN_DIR)
 	
     # overide bin/R
 	cp R.sh $(FASTR_BIN_DIR)/exec/R
@@ -82,7 +81,7 @@ $(FASTR_BIN_DIR)/R: Makefile R.sh Rscript.sh Rscript_exec.sh Rclasspath.sh
 	# update R_HOME_DIR to FastR, --help to -r-help because --help is handled by FastR, and pass args to Rcmd (esp. --jvm)
 	(sed -e 's!^\(R_HOME_DIR=\)\(.*\)!\1"$(FASTR_R_HOME)"!' | \
 	 sed -e 's/    -h.--help./    --r-help\)/' | \
-	 sed -e 's!      exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;!      FASTR_INTERNAL_ARGS="$${FASTR_INTERNAL_ARGS} $${args}" exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;!') < $(R_SCRIPT) > $(FASTR_BIN_DIR)/R
+	 sed -e 's!      exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;!      FASTR_INTERNAL_ARGS=`echo "$${FASTR_INTERNAL_ARGS} $${args}" | $${SED} -e 's/^[[:space:]]*//'` exec sh "$${R_HOME}/bin/Rcmd" "$${@}" ;;!') < $(R_SCRIPT) > $(FASTR_BIN_DIR)/R
 	chmod +x $(FASTR_BIN_DIR)/R 
 	touch $(FASTR_ETC_DIR)/ldpaths
 	sed -e "s|\(R_LIBS_USER=.*-'\)\(.*\)'}|\1$(FASTR_R_HOME)/library'}|" < $(GNUR_HOME_BINARY)/etc/Renviron > $(FASTR_ETC_DIR)/Renviron
diff --git a/com.oracle.truffle.r.native/run/edMakeconf.etc b/com.oracle.truffle.r.native/run/edMakeconf.etc
index 56acb23b41..af6567fefc 100644
--- a/com.oracle.truffle.r.native/run/edMakeconf.etc
+++ b/com.oracle.truffle.r.native/run/edMakeconf.etc
@@ -2,6 +2,12 @@
 /^CXXFLAGS/s/$/ -DFASTR/
 /^CPPFLAGS/s/$/ -DFASTR/
 g/JAVA_HOME =/d
+g/JAVAC =/d
+g/JAVAH =/d
+g/JAVA =/d
+g/JAVA_LIBS =/d
+g/JAVA_LD_LIBRARY_PATH =/d
+g/JAVA_CPPFLAGS =/d
 /LIBINTL=/
 d
 /LIBR =/
-- 
GitLab