From dcac27d666371d6610abbf1670fecf50a2c22d36 Mon Sep 17 00:00:00 2001
From: Mick Jordan <mick.jordan@oracle.com>
Date: Sat, 22 Aug 2015 13:06:08 -0700
Subject: [PATCH] rename library download directory libdownloads, use lib for
 builtin shared libraries

---
 .hgignore                                     |  2 +-
 .../builtinlibs/Makefile                      |  8 ++--
 .../fficall/jni/Makefile                      |  2 +-
 .../gnur/Makefile.gnur                        |  2 +-
 .../gnur/Makefile.libs                        |  2 +-
 com.oracle.truffle.r.native/osextras/Makefile |  2 +-
 .../processor/GenerateRParserProcessor.java   |  2 +-
 .../truffle/r/runtime/ffi/LibPaths.java       |  3 +-
 mx.fastr/mx_fastr.py                          |  2 +-
 mx.fastr/suite.py                             | 40 +++++++++----------
 10 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/.hgignore b/.hgignore
index 8e2b424b4d..ce31b2a92a 100644
--- a/.hgignore
+++ b/.hgignore
@@ -19,7 +19,7 @@
 ^dist/
 ^java/
 ^lib/
-^library/
+^libdownloads/
 ^jdk1.(7|8).0
 ^java64/
 ^work/
diff --git a/com.oracle.truffle.r.native/builtinlibs/Makefile b/com.oracle.truffle.r.native/builtinlibs/Makefile
index 7cc6a37eb5..dbe0ce5715 100644
--- a/com.oracle.truffle.r.native/builtinlibs/Makefile
+++ b/com.oracle.truffle.r.native/builtinlibs/Makefile
@@ -36,14 +36,14 @@ endif
 
 SRC = src
 OBJ = lib
+LIBDIR = $(TOPDIR)/../lib
 
 C_SOURCES := $(wildcard $(SRC)/*.c)
 
 C_OBJECTS := $(subst $(SRC),$(OBJ),$(C_SOURCES:.c=.o))
 F_OBJECTS := $(wildcard $(GNUR_HOME)/src/appl/d*.o)
 
-LIBDIR := $(OBJ)
-LIB_APPL := $(OBJ)/libappl$(DYLIB_EXT)
+LIB_APPL := $(LIBDIR)/libappl$(DYLIB_EXT)
 
 all: $(LIB_APPL) libr
 
@@ -53,7 +53,7 @@ $(LIB_APPL): $(C_OBJECTS) $(F_OBJECTS)
 
 # On Darwin we need to create a dummy libR.dylib
 ifeq ($(OS_NAME), Darwin)
-LIB_RDUMMY := $(OBJ)/libR$(DYLIB_EXT)
+LIB_RDUMMY := $(LIBDIR)/libR$(DYLIB_EXT)
 
 libr: $(LIB_RDUMMY)
 $(LIB_RDUMMY): $(OBJ)/rdummy.o
@@ -79,4 +79,4 @@ cleanlib:
 clean: cleanobj cleanlibr
 
 cleanobj:
-	rm -f $(LIBDIR)/*.o
+	rm -f $(OBJ)/*.o
diff --git a/com.oracle.truffle.r.native/fficall/jni/Makefile b/com.oracle.truffle.r.native/fficall/jni/Makefile
index 0bc73532ab..95fa6bf3fa 100644
--- a/com.oracle.truffle.r.native/fficall/jni/Makefile
+++ b/com.oracle.truffle.r.native/fficall/jni/Makefile
@@ -37,7 +37,7 @@ C_SOURCES := $(wildcard $(SRC)/*.c)
 C_HDRS := $(wildcard $(SRC)/*.h)
 C_LIBNAME := librfficall$(DYLIB_EXT)
 C_OBJECTS := $(subst $(SRC),$(OBJ),$(C_SOURCES:.c=.o))
-C_LIB := $(TOPDIR)/builtinlibs/$(OBJ)/$(C_LIBNAME)
+C_LIB := $(TOPDIR)/../lib/$(C_LIBNAME)
 
 JNI_INCLUDES = -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/$(JDK_OS_DIR)
 FFI_INCLUDES = -I$(TOPDIR)/include/jni/include -I$(TOPDIR)/include/jni/include/R_ext
diff --git a/com.oracle.truffle.r.native/gnur/Makefile.gnur b/com.oracle.truffle.r.native/gnur/Makefile.gnur
index 21df43ffa7..08f3f468a9 100644
--- a/com.oracle.truffle.r.native/gnur/Makefile.gnur
+++ b/com.oracle.truffle.r.native/gnur/Makefile.gnur
@@ -52,7 +52,7 @@ endif
 all: Makefile $(GNUR_HOME) iconv config build
 
 $(GNUR_HOME): 
-	tar xf $(TOPDIR)/../lib/R-$(R_VERSION).tar.gz
+	tar xf $(TOPDIR)/../libdownloads/R-$(R_VERSION).tar.gz
 
 ifeq ($(OSNAME), SunOS)
 #
diff --git a/com.oracle.truffle.r.native/gnur/Makefile.libs b/com.oracle.truffle.r.native/gnur/Makefile.libs
index 3c9a7e511b..c13f94f972 100644
--- a/com.oracle.truffle.r.native/gnur/Makefile.libs
+++ b/com.oracle.truffle.r.native/gnur/Makefile.libs
@@ -27,7 +27,7 @@ ifneq ($(MAKECMDGOALS),clean)
 include $(TOPDIR)/platform.mk
 endif
 
-TARGET_DIR := $(TOPDIR)/builtinlibs/lib
+TARGET_DIR := $(TOPDIR)/../lib
 BLAS_TARGET := $(TARGET_DIR)/libRblas$(DYLIB_EXT)
 LAPACK_TARGET := $(TARGET_DIR)/libRlapack$(DYLIB_EXT)
 PCRE_TARGET := $(TARGET_DIR)/libpcre$(DYLIB_EXT)
diff --git a/com.oracle.truffle.r.native/osextras/Makefile b/com.oracle.truffle.r.native/osextras/Makefile
index 19138d1976..3e88e01f22 100644
--- a/com.oracle.truffle.r.native/osextras/Makefile
+++ b/com.oracle.truffle.r.native/osextras/Makefile
@@ -36,7 +36,7 @@ SRC = src
 C_SOURCES := $(wildcard $(SRC)/*.c)
 C_LIBNAME := libosextras$(DYLIB_EXT)
 C_OBJECTS := $(subst $(SRC),$(OBJ),$(C_SOURCES:.c=.o))
-C_LIB := $(TOPDIR)/builtinlibs/$(OBJ)/$(C_LIBNAME)
+C_LIB := $(TOPDIR)/../lib/$(C_LIBNAME)
 #CFLAGS := $(CFLAGS) -DFASTR
 
 JNI_INCLUDES = -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/$(JDK_OS_DIR)
diff --git a/com.oracle.truffle.r.parser.processor/src/com/oracle/truffle/r/parser/processor/GenerateRParserProcessor.java b/com.oracle.truffle.r.parser.processor/src/com/oracle/truffle/r/parser/processor/GenerateRParserProcessor.java
index a6c052748d..747c2f571f 100644
--- a/com.oracle.truffle.r.parser.processor/src/com/oracle/truffle/r/parser/processor/GenerateRParserProcessor.java
+++ b/com.oracle.truffle.r.parser.processor/src/com/oracle/truffle/r/parser/processor/GenerateRParserProcessor.java
@@ -51,7 +51,7 @@ public class GenerateRParserProcessor extends AbstractProcessor {
                 File srcGenDir = getSrcGenDir(filer);
                 File suiteRoot = srcGenDir.getParentFile().getParentFile();
                 // path to ANTLR jar
-                File antlr = join(suiteRoot, "lib", ANTLRC);
+                File antlr = join(suiteRoot, "libdownloads", ANTLRC);
                 // Our src directory
                 File parserSrcDir = join(srcGenDir.getParentFile(), "src", pkg.replace('.', File.separatorChar));
                 antlrGenDir = mkTmpDir(null);
diff --git a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/LibPaths.java b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/LibPaths.java
index d22d57de0c..837c51379d 100644
--- a/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/LibPaths.java
+++ b/com.oracle.truffle.r.runtime.ffi/src/com/oracle/truffle/r/runtime/ffi/LibPaths.java
@@ -35,9 +35,8 @@ public class LibPaths {
      */
     public static String getBuiltinLibPath(String libName) {
         String rHome = REnvVars.rHome();
-        String packageName = "com.oracle.truffle.r.native";
         OSInfo osInfo = RPlatform.getOSInfo();
-        Path path = FileSystems.getDefault().getPath(rHome, packageName, "builtinlibs", "lib", "lib" + libName + "." + osInfo.libExt);
+        Path path = FileSystems.getDefault().getPath(rHome, "lib", "lib" + libName + "." + osInfo.libExt);
         return path.toString();
     }
 
diff --git a/mx.fastr/mx_fastr.py b/mx.fastr/mx_fastr.py
index 9ceb3128ba..00d8f2c95c 100644
--- a/mx.fastr/mx_fastr.py
+++ b/mx.fastr/mx_fastr.py
@@ -63,7 +63,7 @@ def _add_truffle_jar():
 
 def setREnvironment(graal_vm):
     osname = platform.system()
-    lib_base = join(_fastr_suite.dir, 'com.oracle.truffle.r.native', 'builtinlibs', 'lib')
+    lib_base = join(_fastr_suite.dir, 'lib')
     lib_value = lib_base
     if osname == 'Darwin':
         lib_env = 'DYLD_FALLBACK_LIBRARY_PATH'
diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py
index c1148a9bdf..3ebbe925d2 100644
--- a/mx.fastr/suite.py
+++ b/mx.fastr/suite.py
@@ -37,13 +37,13 @@ suite = {
   # distributions that we depend on
   "libraries" : {
     "GNUR" : {
-        "path" : "lib/R-3.1.3.tar.gz",
+        "path" : "libdownloads/R-3.1.3.tar.gz",
         "urls" : ["http://cran.rstudio.com/src/base/R-3/R-3.1.3.tar.gz"],
         "sha1" : "2c9165060b91e45ac73d8cb7507ee9e52816f8b3"
     },
 
     "GNU_ICONV" : {
-        "path" : "lib/libiconv-1.14.tar.gz",
+        "path" : "libdownloads/libiconv-1.14.tar.gz",
         "urls" : ["http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz"],
         "sha1" : "be7d67e50d72ff067b2c0291311bc283add36965"
     },
@@ -54,25 +54,25 @@ suite = {
     },
 
     "ANTLR" : {
-      "path" : "lib/antlr-runtime-3.5.jar",
+      "path" : "libdownloads/antlr-runtime-3.5.jar",
       "urls" : ["http://central.maven.org/maven2/org/antlr/antlr-runtime/3.5/antlr-runtime-3.5.jar"],
       "sha1" : "0baa82bff19059401e90e1b90020beb9c96305d7",
     },
 
     "NETLIB" : {
-      "path" : "lib/netlib-java-0.9.3.jar",
+      "path" : "libdownloads/netlib-java-0.9.3.jar",
       "urls" : ["http://central.maven.org/maven2/com/googlecode/netlib-java/netlib-java/0.9.3/netlib-java-0.9.3.jar"],
       "sha1" : "1d41b60e5180f6bcb7db15e7353dde7147cd3928",
     },
 
     "ANTLR-C" : {
-      "path" : "lib/antlr-complete-3.5.1.jar",
+      "path" : "libdownloads/antlr-complete-3.5.1.jar",
       "urls" : ["http://central.maven.org/maven2/org/antlr/antlr-complete/3.5.1/antlr-complete-3.5.1.jar"],
       "sha1" : "ebb4b995fd67a9b291ea5b19379509160f56e154",
     },
 
     "JLINE" : {
-      "path" : "lib/jline-2.11.jar",
+      "path" : "libdownloads/jline-2.11.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/jline-2.11.jar",
         "https://search.maven.org/remotecontent?filepath=jline/jline/2.11/jline-2.11.jar",
@@ -81,7 +81,7 @@ suite = {
     },
 
     "JNR_POSIX" : {
-      "path" : "lib/jnr-posix-3.0.10.jar",
+      "path" : "libdownloads/jnr-posix-3.0.10.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/jnr-posix-3.0.10.jar",
         "https://search.maven.org/remotecontent?filepath=com/github/jnr/jnr-posix/3.0.10/jnr-posix-3.0.10.jar",
@@ -90,7 +90,7 @@ suite = {
     },
 
     "JNR_CONSTANTS" : {
-      "path" : "lib/jnr-constants-0.8.6.jar",
+      "path" : "libdownloads/jnr-constants-0.8.6.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/jnr-constants-0.8.6.jar",
         "https://search.maven.org/remotecontent?filepath=com/github/jnr/jnr-constants/0.8.6/jnr-constants-0.8.6.jar",
@@ -99,7 +99,7 @@ suite = {
     },
 
     "JNR_FFI" : {
-      "path" : "lib/jnr-ffi-2.0.2.jar",
+      "path" : "libdownloads/jnr-ffi-2.0.2.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/jnr-ffi-2.0.2.jar",
         "https://search.maven.org/remotecontent?filepath=com/github/jnr/jnr-ffi/2.0.2/jnr-ffi-2.0.2.jar",
@@ -108,7 +108,7 @@ suite = {
     },
 
     "JFFI" : {
-      "path" : "lib/jffi-1.2.8.jar",
+      "path" : "libdownloads/jffi-1.2.8.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/jffi-1.2.8.jar",
         "https://search.maven.org/remotecontent?filepath=com/github/jnr/jffi/1.2.8/jffi-1.2.8.jar",
@@ -117,7 +117,7 @@ suite = {
     },
 
     "JFFI_NATIVE" : {
-      "path" : "lib/jffi-1.2.8-native.jar",
+      "path" : "libdownloads/jffi-1.2.8-native.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/jffi-1.2.8-native.jar",
         "https://search.maven.org/remotecontent?filepath=com/github/jnr/jffi/1.2.8/jffi-1.2.8-native.jar",
@@ -126,13 +126,13 @@ suite = {
     },
 
     "ASM" : {
-      "path" : "lib/asm-5.0.3.jar",
+      "path" : "libdownloads/asm-5.0.3.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/asm-5.0.3.jar",
         "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm/5.0.3/asm-5.0.3.jar",
       ],
       "sha1" : "dcc2193db20e19e1feca8b1240dbbc4e190824fa",
-      "sourcePath" : "lib/asm-5.0.3-sources.jar",
+      "sourcePath" : "libdownloads/asm-5.0.3-sources.jar",
       "sourceSha1" : "f0f24f6666c1a15c7e202e91610476bd4ce59368",
       "sourceUrls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/asm-5.0.3-sources.jar",
@@ -141,7 +141,7 @@ suite = {
     },
 
     "JNR_X86ASM" : {
-      "path" : "lib/jnr-x86asm-1.0.2.jar",
+      "path" : "libdownloads/jnr-x86asm-1.0.2.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/jnr-x86asm-1.0.2.jar",
         "https://search.maven.org/remotecontent?filepath=com/github/jnr/jnr-x86asm/1.0.2/jnr-x86asm-1.0.2.jar",
@@ -150,7 +150,7 @@ suite = {
     },
 
     "ASM_ANALYSIS" : {
-      "path" : "lib/asm-analysis-4.0.jar",
+      "path" : "libdownloads/asm-analysis-4.0.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/asm-analysis-4.0.jar",
         "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-analysis/4.0/asm-analysis-4.0.jar",
@@ -159,7 +159,7 @@ suite = {
     },
 
     "ASM_COMMONS" : {
-      "path" : "lib/asm-commons-4.0.jar",
+      "path" : "libdownloads/asm-commons-4.0.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/asm-commons-4.0.jar",
         "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-commons/4.0/asm-commons-4.0.jar",
@@ -168,7 +168,7 @@ suite = {
     },
 
     "ASM_TREE" : {
-      "path" : "lib/asm-tree-4.0.jar",
+      "path" : "libdownloads/asm-tree-4.0.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/asm-tree-4.0.jar",
         "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-tree/4.0/asm-tree-4.0.jar",
@@ -177,7 +177,7 @@ suite = {
     },
 
     "ASM_UTIL" : {
-      "path" : "lib/asm-util-4.0.jar",
+      "path" : "libdownloads/asm-util-4.0.jar",
       "urls" : [
         "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/asm-util-4.0.jar",
         "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-util/4.0/asm-util-4.0.jar",
@@ -186,13 +186,13 @@ suite = {
     },
 
     "JNR_INVOKE" : {
-      "path" : "lib/jnr-invoke-0.1.jar",
+      "path" : "libdownloads/jnr-invoke-0.1.jar",
       "urls" : ["http://search.maven.org/remotecontent?filepath=com/github/jnr/jnr-invoke/0.1/jnr-invoke-0.1.jar"],
       "sha1" : "d0f846c3d3cb98dfd5e2bbd3cca236337fb0afa1",
     },
 
     "JNR_UDIS86" : {
-      "path" : "lib/jnr-udis86-0.1.jar",
+      "path" : "libdownloads/jnr-udis86-0.1.jar",
       "urls" : ["http://search.maven.org/remotecontent?filepath=com/github/jnr/jnr-udis86/0.1/jnr-udis86-0.1.jar"],
       "sha1" : "88accfa82203ea74a4a82237061c28ac8b4224af",
     },
-- 
GitLab