From 9e2db735a61c7f7613589d6e8a5a2f1e1fc0bf5d Mon Sep 17 00:00:00 2001 From: Mick Jordan <mick.jordan@oracle.com> Date: Tue, 14 Apr 2015 17:37:22 -0700 Subject: [PATCH] native build changes for Solaris/Intel --- com.oracle.truffle.r.native/Makefile | 7 +- com.oracle.truffle.r.native/gnur/Makefile | 7 +- .../gnur/Makefile.gnur | 67 ++++++++++++++++--- .../gnur/Makefile.platform | 2 +- .../library/fastr/Makefile | 5 +- mx.fastr/suite.py | 10 ++- 6 files changed, 82 insertions(+), 16 deletions(-) diff --git a/com.oracle.truffle.r.native/Makefile b/com.oracle.truffle.r.native/Makefile index 1cbf8fde11..79cb3ed05a 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 6745760e3c..c897423651 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 f432c5eb81..e36118f142 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 6bfbcc2619..1cc4de66e7 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 b9b0c64352..3ceba8fe3c 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 1a30590bdf..d22301d920 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", -- GitLab