summaryrefslogtreecommitdiffstats
path: root/patches/classpath-0.99/0001-Fix-building-with-OpenJDK-1.8.patch
blob: 656eb3c70060fcf754fccd93adac5c0b849b5fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
From: =?UTF-8?q?Guillermo=20Rodr=C3=ADguez?= <guille.rodriguez@gmail.com>
Date: Thu, 22 Nov 2018 06:44:55 +0100
Subject: [PATCH] Fix building with OpenJDK 1.8

This patch makes it possible to build GNU Classpath using javac
from OpenJDK 1.7 and 1.8.

- From the javac docs: "Classes found through the classpath are
subject to automatic recompilation if their sources are found."
javac from OpenJDK 1.7+ will try (and fail) to recompile "standard"
Java classes (e.g. java/lang/Object.java) when compiling the Java
test class. Fix this by explicitly passing an empty -sourcepath.

- Use -source/-target 1.6 instead of 1.5, as the latter is
deprecated in Java 8.
---
 examples/Makefile.am      | 4 ++--
 lib/Makefile.am           | 4 ++--
 m4/ac_prog_java_works.m4  | 3 ++-
 m4/ac_prog_javac_works.m4 | 4 ++--
 tools/Makefile.am         | 4 ++--
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/examples/Makefile.am b/examples/Makefile.am
index ff47801247c9..ba40c08747b8 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -2,9 +2,9 @@
 GLIBJ_CLASSPATH='$(top_builddir)/lib/glibj.zip:$(top_builddir)/lib'
 
 if GCJ_JAVAC
-JCOMPILER = $(JAVAC) $(JAVACFLAGS) -fsource=1.5 -ftarget=1.5 --encoding=UTF-8 --bootclasspath=$(GLIBJ_CLASSPATH) --classpath='$(top_builddir)/tools/tools.zip'
+JCOMPILER = $(JAVAC) $(JAVACFLAGS) -fsource=1.6 -ftarget=1.6 --encoding=UTF-8 --bootclasspath=$(GLIBJ_CLASSPATH) --classpath='$(top_builddir)/tools/tools.zip'
 else
-JCOMPILER = $(JAVAC) $(JAVACFLAGS) -source 1.5 -target 1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath '$(top_builddir)/tools/tools.zip'
+JCOMPILER = $(JAVAC) $(JAVACFLAGS) -source 1.6 -target 1.6 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath '$(top_builddir)/tools/tools.zip'
 endif
 
 # All our example java source files
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 50d1baa9b738..97a8b692692c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,9 +9,9 @@ compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$
 
 # handling source to bytecode compiler programs like gcj, jikes  and kjc
 if GCJ_JAVAC
-JCOMPILER = $(JAVAC) $(JAVACFLAGS) -fsource=1.5 -ftarget=1.5 --bootclasspath='' --classpath=$(compile_classpath) -d . @classes
+JCOMPILER = $(JAVAC) $(JAVACFLAGS) -fsource=1.6 -ftarget=1.6 --bootclasspath='' --classpath=$(compile_classpath) -d . @classes
 else
-JCOMPILER = $(JAVAC) $(JAVACFLAGS) $(JAVAC_MEM_OPT) -source 1.5 -target 1.5 -bootclasspath '' -classpath $(compile_classpath) -d . @classes
+JCOMPILER = $(JAVAC) $(JAVACFLAGS) $(JAVAC_MEM_OPT) -source 1.6 -target 1.6 -bootclasspath '' -classpath $(compile_classpath) -d . @classes
 endif
 
 if CREATE_COLLECTIONS
diff --git a/m4/ac_prog_java_works.m4 b/m4/ac_prog_java_works.m4
index d3f274478d09..f36318ba1c9f 100644
--- a/m4/ac_prog_java_works.m4
+++ b/m4/ac_prog_java_works.m4
@@ -62,7 +62,8 @@ EOF
 changequote([, ])dnl
 if test x$ac_cv_prog_uudecode_base64 != xyes; then
    	AC_REQUIRE([AC_PROG_JAVAC_WORKS])
-        if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
+   	CMD="$JAVAC $JAVACFLAGS -sourcepath '' $JAVA_TEST"
+        if AC_TRY_COMMAND($CMD) && test -s $CLASS_TEST; then
                 :
         else
           echo "configure: failed program was:" >&AC_FD_CC
diff --git a/m4/ac_prog_javac_works.m4 b/m4/ac_prog_javac_works.m4
index 7fb298d49be5..fbe24ce60f25 100644
--- a/m4/ac_prog_javac_works.m4
+++ b/m4/ac_prog_javac_works.m4
@@ -33,9 +33,9 @@ public class Object
 }
 EOF
 if test x$JAVAC_IS_GCJ = xyes; then
-  CMD="$JAVAC $JAVACFLAGS -fsource=1.5 -ftarget=1.5 $JAVA_TEST"
+  CMD="$JAVAC $JAVACFLAGS -fsource=1.6 -ftarget=1.6 $JAVA_TEST"
 else
-  CMD="$JAVAC $JAVACFLAGS -source 1.5 -target 1.5 $JAVA_TEST"
+  CMD="$JAVAC $JAVACFLAGS -sourcepath '' -source 1.6 -target 1.6 $JAVA_TEST"
 fi
 if AC_TRY_COMMAND($CMD) >/dev/null 2>&1; then
   ac_cv_prog_javac_works=yes
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c5db7cd0ada4..54cd2ceab5ed 100755
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -14,9 +14,9 @@ GLIBJ_CLASSPATH=asm:$(ANTLR_CLASSPATH)
 
 # Setup the compiler to use the GNU Classpath library we just built.
 if GCJ_JAVAC
-JCOMPILER = $(JAVAC) $(JAVACFLAGS) -fsource=1.5 -ftarget=1.5 --encoding=UTF-8 --bootclasspath=$(GLIBJ_BOOTCLASSPATH) --classpath=$(GLIBJ_CLASSPATH)
+JCOMPILER = $(JAVAC) $(JAVACFLAGS) -fsource=1.6 -ftarget=1.6 --encoding=UTF-8 --bootclasspath=$(GLIBJ_BOOTCLASSPATH) --classpath=$(GLIBJ_CLASSPATH)
 else
-JCOMPILER = $(JAVAC) $(JAVACFLAGS) -source 1.5 -target 1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_BOOTCLASSPATH) -classpath $(GLIBJ_CLASSPATH)
+JCOMPILER = $(JAVAC) $(JAVACFLAGS) -source 1.6 -target 1.6 -encoding UTF-8 -bootclasspath $(GLIBJ_BOOTCLASSPATH) -classpath $(GLIBJ_CLASSPATH)
 endif
 
 if CREATE_WRAPPERS