diff --git a/com.oracle.truffle.r.native/Makefile b/com.oracle.truffle.r.native/Makefile index 1cbf8fde1154a932c27e0ce651ef6236b6545723..79cb3ed05ad9ac28075579094ccd9d6d9c91b3f5 100644 --- a/com.oracle.truffle.r.native/Makefile +++ b/com.oracle.truffle.r.native/Makefile @@ -21,13 +21,18 @@ # questions. # -.PHONY: all clean makegnur cleangnur +# If GNUR_HOME is defined we take that as a pre-built, immutable, entity + +.PHONY: all clean export TOPDIR = $(CURDIR) export R_VERSION = 3.1.3 ifndef GNUR_HOME export GNUR_HOME = $(TOPDIR)/gnur/R-$(R_VERSION) +export GNUR_HOME_ORIGIN = local +else +export GNUR_HOME_ORIGIN = environment endif all: diff --git a/com.oracle.truffle.r.native/gnur/Makefile b/com.oracle.truffle.r.native/gnur/Makefile index 6745760e3c717f1c951fc61b17090123604b3ceb..c897423651596e8f38803867f80ae2805e23aa64 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile +++ b/com.oracle.truffle.r.native/gnur/Makefile @@ -24,11 +24,10 @@ .PHONY: all clean all: makegnur - $(MAKE) -f Makefile.gnur $(MAKE) -f Makefile.platform $(MAKE) -f Makefile.libs -ifeq "$(origin GNUR_HOME)" "environment" +ifeq ($(GNUR_HOME_ORIGIN), environment) makegnur: else makegnur: @@ -39,9 +38,11 @@ clean: cleangnur $(MAKE) -f Makefile.libs clean $(MAKE) -f Makefile.platform clean -ifeq "$(origin GNUR_HOME)" "environment" +ifeq ($(GNUR_HOME_ORIGIN), environment) +$(info E) cleangnur: else +$(info NE) cleangnur: $(MAKE) -f Makefile.gnur clean endif diff --git a/com.oracle.truffle.r.native/gnur/Makefile.gnur b/com.oracle.truffle.r.native/gnur/Makefile.gnur index f432c5eb815537df1afe4b88e95032b2b7f953f7..e36118f142a3bf18addc765c834266baf1e61266 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile.gnur +++ b/com.oracle.truffle.r.native/gnur/Makefile.gnur @@ -39,23 +39,65 @@ .PHONY: all config config_update build clean OSNAME := $(shell uname) + +$(info cmd=$(MAKECMDGOALS)) + ifeq ($(OSNAME), Linux) + FORCE_PIC := true else ifeq ($(OSNAME), SunOS) + FORCE_PIC := true else ifeq ($(OSNAME), Darwin) else -all: - @echo "This Makefile does not know how to compile for $(OSNAME)" - @false + $(error OS $(OSNAME) is not supported) endif -all: Makefile $(GNUR_HOME) config build +all: Makefile $(GNUR_HOME) iconv config build $(GNUR_HOME): tar xf $(TOPDIR)/../lib/R-$(R_VERSION).tar.gz +ifeq ($(OSNAME), SunOS) +# +# Configuring GnuR for Solaris is slightly complicated for three reasons: +# 1. the default iconv utility is inadequate and has to be replaced by Gnu iconv +# 2. there is a choice of compilers, gcc or solaris studio, the latter requiring +# more configuration options +# 3. Solaris runs on x64 and Sparc +# +# Currently we only support gcc and x64 (gcc assumed to be on the PATH) +# + OS_ARCH := $(shell uname -p) + ifneq ($(OS_ARCH), i386) + $(error Solaris/SPARC not supported) + endif + ICONV := libiconv-1.14 + $(shell mkdir -p iconv_install) + ICONV_INSTALL := $(abspath iconv_install) + $(info ICONV_INSTALL=$(ICONV_INSTALL)) + ICONV_FLAGS := "-L$(ICONV_INSTALL)/lib -I$(ICONV_INSTALL)/include" + ICONV_CONFIG_FLAGS := CFLAGS=$(ICONV_FLAGS) CPPFLAGS=$(ICONV_FLAGS) LDFLAGS=$(ICONV_FLAGS) + +iconv: $(ICONV) iconv_config iconv_build + +$(ICONV): + tar xf $(TOPDIR)/../lib/$(ICONV).tar.gz + +iconv_config: $(ICONV)/Makefile + +$(ICONV)/Makefile: + (cd $(ICONV); ./configure --prefix $(ICONV_INSTALL) $(ICONV_CONFIG_FLAGS) > iconv_configure.log 2>&1) + +iconv_build: $(ICONV)/lib/libcharset.so + +$(ICONV)/lib/libcharset.so: + (cd $(ICONV); $(MAKE) && $(MAKE) install > iconv_make.log 2>&1) +else +iconv: +endif + config: $(GNUR_HOME)/Makefile config_update -ifeq ($(OSNAME), Linux) +ifeq ($(FORCE_PIC), true) config_update: Makeconf.done Makeconf.done: edMakeconf @@ -66,16 +108,25 @@ config_update: endif $(GNUR_HOME)/Makefile: - (cd $(GNUR_HOME); ./configure --with-x=no --without-recommended-packages >& gnur_configure.log) + (cd $(GNUR_HOME); ./configure --with-x=no --without-recommended-packages $(ICONV_CONFIG_FLAGS) > gnur_configure.log 2>&1) build: $(GNUR_HOME)/bin/R $(GNUR_HOME)/bin/R: $(GNUR_HOME)/Makeconf - (cd $(GNUR_HOME); make >& gnur_make.log) + (cd $(GNUR_HOME); $(MAKE) > gnur_make.log 2>&1) -clean: cleangnur +clean: cleangnur cleaniconv rm -f Makeconf.done cleangnur: rm -rf R-$(R_VERSION) + +ifeq ($(OSNAME), SunOS) +cleaniconv: + rm -rf $(ICONV) + rm -rf $(ICONV_INSTALL) +else +cleaniconv: +endif + diff --git a/com.oracle.truffle.r.native/gnur/Makefile.platform b/com.oracle.truffle.r.native/gnur/Makefile.platform index 6bfbcc2619f00fc5199153cb2451a98553e7954e..1cc4de66e7f834c17e40e40f98feaa0408add3fa 100644 --- a/com.oracle.truffle.r.native/gnur/Makefile.platform +++ b/com.oracle.truffle.r.native/gnur/Makefile.platform @@ -31,7 +31,7 @@ OS_DIR := $(shell echo $(OS_NAME) | tr '[:upper:]' '[:lower:]' ) all: $(TOPDIR)/platform.mk $(TOPDIR)/platform.mk: sedMakeconf - sed -f sedMakeconf $(GNUR_HOME)/Makeconf >& /dev/null + sed -f sedMakeconf $(GNUR_HOME)/Makeconf > /dev/null 2>&1 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/library/fastr/Makefile b/com.oracle.truffle.r.native/library/fastr/Makefile index b9b0c6435232c9afeab20c2e964156f051aef278..3ceba8fe3cc308aae5f903c4cf4afe73d57885a3 100644 --- a/com.oracle.truffle.r.native/library/fastr/Makefile +++ b/com.oracle.truffle.r.native/library/fastr/Makefile @@ -26,7 +26,8 @@ # It is a "real" package, and loaded in the same way as any R package. # We use a 'tar' file of the sources as the sentinel for whether the INSTALL step is needed -# Since this is just R code, we use GnuR to do the INSTALL +# Since this is just R code, we use GnuR to do the INSTALL. In case the system does not have R +# installed we use the one we built. .PHONY: all @@ -42,7 +43,7 @@ $(PKG_TAR): $(PKG_FILES) (cd src; tar cf ../$(PKG_TAR) *) $(INSTALL_SENTINEL): $(PKG_TAR) - R CMD INSTALL --library=$(FASTR_LIBDIR) src + $(GNUR_HOME)/bin/R CMD INSTALL --library=$(FASTR_LIBDIR) src clean: rm -f $(PKG_TAR) diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index 1a30590bdfe2c3245383fa4c18233955b83949fa..d22301d920293a6cde6b9a5374d948b6e68261f3 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -30,6 +30,12 @@ suite = { "sha1" : "2c9165060b91e45ac73d8cb7507ee9e52816f8b3" }, + "GNU_ICONV" : { + "path" : "lib/libiconv-1.14.tar.gz", + "urls" : ["http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz"], + "sha1" : "be7d67e50d72ff067b2c0291311bc283add36965" + }, + "JDK_TOOLS" : { "path" : "${JAVA_HOME}/lib/tools.jar", "sha1" : "NOCHECK", @@ -333,7 +339,8 @@ suite = { "com.oracle.truffle.r.native" : { "sourceDirs" : [], "dependencies" : [ - "GNUR" + "GNUR", + "GNU_ICONV", ], "native" : "true", "workingSets" : "FastR", @@ -399,6 +406,7 @@ suite = { "ANTLR-C", "ANTLR", "GNUR", + "GNU_ICONV", ], "distDependencies" : [ "TRUFFLE",