With these changes, JRuby could be run with Java 11. This doesn't
actually switch JRuby to Java 11 yet, as that is not yet
recommended by the JRuby team due to illegal access warnings in some
cases (and probably other reasons). However, this will make
switching to Java 11 easier, and allow us to catch any issues
with these changes before the switch, which will make debugging
easier if there are problems.
Thanks to kmos@ for hosting the updated jffi distfile.
Tested on amd64. I plan to commit this in a couple days unless
I hear objections.
Thanks,
Jeremy
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/jruby/Makefile,v
retrieving revision 1.77
diff -u -p -r1.77 Makefile
--- Makefile 26 Apr 2019 15:46:58 -0000 1.77
+++ Makefile 16 May 2019 17:59:55 -0000
@@ -6,11 +6,12 @@ ONLY_FOR_ARCHS = amd64
COMMENT = pure-Java implementation of the Ruby language
V = 9.2.7.0
+REVISION = 0
DISTNAME = jruby-dist-${V}-bin
PKGNAME = jruby-${V}
CATEGORIES = lang lang/ruby
DISTFILES = ${DISTNAME}.tar.gz \
- jnr-jffi-1.2.2-0-g4c196bb.tar.gz:0 \
+ jffi-1.2.18.tar.gz:0 \
${JRUBY_LAUNCHER_GEM}:1
HOMEPAGE = http://www.jruby.org/
@@ -21,7 +22,7 @@ MAINTAINER = Jeremy Evans <jeremy@openbs
PERMIT_PACKAGE_CDROM = Yes
MASTER_SITES = https://repo1.maven.org/maven2/org/jruby/jruby-dist/${V}/
-MASTER_SITES0 = http://www.distfiles.nl/
+MASTER_SITES0 = https://filedump.se.rit.edu/pub/distfiles/
MASTER_SITES1 = ${MASTER_SITE_RUBYGEMS}
MODULES = java
@@ -47,11 +48,11 @@ ANT_CMD = ${SETENV} ${MAKE_ENV} PATH=${J
JFFI_HOME = ${WRKDIST}/jffi
JFFI_ARCH = ${MACHINE_ARCH:S/amd64/x86_64/}-OpenBSD
FFI_ARCH = ${JFFI_ARCH:L}
-JRUBY_LAUNCHER_GEM = jruby-launcher-1.1.5-java.gem
+JRUBY_LAUNCHER_GEM = jruby-launcher-1.1.9-java.gem
SUBST_VARS = JRUBY_HOME JFFI_ARCH FFI_ARCH RAKE_V RDOC_V JAVA_HOME
post-extract:
- mv ${WRKDIR}/jnr-jffi* ${JFFI_HOME}
+ mv ${WRKDIR}/jffi-jffi* ${JFFI_HOME}
# Unpack the jruby-launcher gem, since it needs to be patched
cd ${WRKSRC} && mkdir jruby-launcher \
&& cd jruby-launcher && tar zxf ../../data.tar.gz \
Index: distinfo
===================================================================
RCS file: /cvs/ports/lang/jruby/distinfo,v
retrieving revision 1.49
diff -u -p -r1.49 distinfo
--- distinfo 26 Apr 2019 15:46:58 -0000 1.49
+++ distinfo 16 May 2019 17:59:55 -0000
@@ -1,6 +1,6 @@
-SHA256 (jnr-jffi-1.2.2-0-g4c196bb.tar.gz) =
xK/m48Z/YA+fg4yFJqcRxceFnT0F98y255Ju9eSE7b0=
+SHA256 (jffi-1.2.18.tar.gz) = BTJsmFFT5MhkSblzLLqjnHVw8HnNDxJ2wvXfQOusvZI=
SHA256 (jruby-dist-9.2.7.0-bin.tar.gz) =
2nwaXOkAFcC6/UvKA1IpTgj+HJ7ASaxR6C/lftUOE0g=
-SHA256 (jruby-launcher-1.1.5-java.gem) =
IjxjzP/iW+z5izqdVk33ZXj1k6bs7tBZS/Gos1raxZg=
-SIZE (jnr-jffi-1.2.2-0-g4c196bb.tar.gz) = 1759433
+SHA256 (jruby-launcher-1.1.9-java.gem) =
9prnUcy0VqolcmXSsZR5HWWWrFr2cNZVZyH3DHQcEdU=
+SIZE (jffi-1.2.18.tar.gz) = 2210133
SIZE (jruby-dist-9.2.7.0-bin.tar.gz) = 25630203
-SIZE (jruby-launcher-1.1.5-java.gem) = 61440
+SIZE (jruby-launcher-1.1.9-java.gem) = 65024
Index: patches/patch-jffi_build_xml
===================================================================
RCS file: patches/patch-jffi_build_xml
diff -N patches/patch-jffi_build_xml
Index: patches/patch-jffi_jni_GNUmakefile
===================================================================
RCS file: patches/patch-jffi_jni_GNUmakefile
diff -N patches/patch-jffi_jni_GNUmakefile
--- patches/patch-jffi_jni_GNUmakefile 25 May 2017 11:23:02 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-$OpenBSD: patch-jffi_jni_GNUmakefile,v 1.1 2017/05/25 11:23:02 espie Exp $
-
-Index: jffi/jni/GNUmakefile
---- jffi/jni/GNUmakefile.orig
-+++ jffi/jni/GNUmakefile
-@@ -68,7 +68,7 @@ WERROR = -Werror
- ifneq ($(OS),darwin)
- WFLAGS += -Wundef $(WERROR)
- endif
--WFLAGS += -W -Wall -Wno-unused -Wno-parentheses
-+WFLAGS += -W -Wall -Wno-unused -Wno-parentheses -Wno-unused-parameter
- PICFLAGS = -fPIC
- SOFLAGS = # Filled in for each OS specifically
- FFI_MMAP_EXEC = -DFFI_MMAP_EXEC_WRIT
Index: patches/patch-jffi_src_main_java_com_kenai_jffi_ObjectBuffer_java
===================================================================
RCS file: patches/patch-jffi_src_main_java_com_kenai_jffi_ObjectBuffer_java
diff -N patches/patch-jffi_src_main_java_com_kenai_jffi_ObjectBuffer_java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-jffi_src_main_java_com_kenai_jffi_ObjectBuffer_java 16 May
2019 17:59:55 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Work with Java 10+.
+
+Index: jffi/src/main/java/com/kenai/jffi/ObjectBuffer.java
+--- jffi/src/main/java/com/kenai/jffi/ObjectBuffer.java.orig
++++ jffi/src/main/java/com/kenai/jffi/ObjectBuffer.java
+@@ -46,6 +46,7 @@ final class ObjectBuffer {
+ public static final int ZERO_TERMINATE = 0x4;
+
+ /** Pin the array memory and pass the JVM memory pointer directly to the
function */
++ @java.lang.annotation.Native
+ public static final int PINNED = 0x8;
+
+ /** For OUT arrays, clear the temporary native memory area */
+@@ -62,6 +63,7 @@ final class ObjectBuffer {
+ static final int FLAGS_SHIFT = 0;
+ static final int FLAGS_MASK = 0xff;
+
++ @java.lang.annotation.Native
+ static final int ARRAY = 0x10 << TYPE_SHIFT;
+ static final int BUFFER = 0x20 << TYPE_SHIFT;
+ static final int JNI = 0x40 << TYPE_SHIFT;
Index: patches/patch-jffi_version_xml
===================================================================
RCS file: patches/patch-jffi_version_xml
diff -N patches/patch-jffi_version_xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-jffi_version_xml 16 May 2019 17:59:55 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+Work with Java 10+.
+
+Index: jffi/version.xml
+--- jffi/version.xml.orig
++++ jffi/version.xml
+@@ -10,8 +10,11 @@
+ package com.kenai.jffi;
+ public final class Version {
+ private Version() {}
++ @java.lang.annotation.Native
+ public static final int MAJOR = ${jffi.version.major};
++ @java.lang.annotation.Native
+ public static final int MINOR = ${jffi.version.minor};
++ @java.lang.annotation.Native
+ public static final int MICRO = ${jffi.version.micro};
+ }
+ </echo>
Index: patches/patch-jruby-launcher_Makefile
===================================================================
RCS file: patches/patch-jruby-launcher_Makefile
diff -N patches/patch-jruby-launcher_Makefile
--- patches/patch-jruby-launcher_Makefile 8 Mar 2017 16:32:26 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-$OpenBSD: patch-jruby-launcher_Makefile,v 1.1 2017/03/08 16:32:26 jeremy Exp $
-
-Use c++ instead of g++.
-
---- jruby-launcher/Makefile.orig Mon Mar 6 09:39:32 2017
-+++ jruby-launcher/Makefile Mon Mar 6 09:40:32 2017
-@@ -28,10 +28,10 @@ jruby.res: resources/jruby.rc
- windres $^ -O coff -o $@
-
- jruby.exe: jrubyexe.cpp nbexecloader.h utilsfuncs.cpp utilsfuncswin.cpp
jruby.res
-- g++ $(CXXFLAGS) $^ -s -o $@ $(LDLIBSOPTIONS) -static
-+ c++ $(CXXFLAGS) $^ -s -o $@ $(LDLIBSOPTIONS) -static
-
- jrubyw.exe: jrubyexe.cpp nbexecloader.h utilsfuncs.cpp utilsfuncswin.cpp
jruby.res
-- g++ $(CXXFLAGS) -DJRUBYW -mwindows $^ -s -o $@ $(LDLIBSOPTIONS) -static
-+ c++ $(CXXFLAGS) -DJRUBYW -mwindows $^ -s -o $@ $(LDLIBSOPTIONS) -static
-
- install:
- @if [ ! -f ./jruby ]; then echo "Please run 'make' first."; exit 1; fi
Index: patches/patch-jruby-launcher_argparser_cpp
===================================================================
RCS file: /cvs/ports/lang/jruby/patches/patch-jruby-launcher_argparser_cpp,v
retrieving revision 1.2
diff -u -p -r1.2 patch-jruby-launcher_argparser_cpp
--- patches/patch-jruby-launcher_argparser_cpp 12 Nov 2018 06:25:18 -0000
1.2
+++ patches/patch-jruby-launcher_argparser_cpp 16 May 2019 17:59:55 -0000
@@ -1,14 +1,21 @@
-$OpenBSD: patch-jruby-launcher_argparser_cpp,v 1.2 2018/11/12 06:25:18 jeremy
Exp $
+$OpenBSD$
+
+Fix java.lang.IllegalCallerException on Java 9+.
Index: jruby-launcher/argparser.cpp
--- jruby-launcher/argparser.cpp.orig
+++ jruby-launcher/argparser.cpp
-@@ -133,7 +133,7 @@ bool ArgParser::initPlatformDir() {
-
- if (getenv("JRUBY_HOME") != NULL) {
- logMsg("initPlatformDir: using JRUBY_HOME environment variable");
-- char sep[2] = { FILE_SEP, NULL };
-+ char sep[2] = { FILE_SEP, 0 };
- strncpy(path, getenv("JRUBY_HOME"), PATH_MAX - 11);
- strncpy(path + strlen(path), sep, 1);
- strncpy(path + strlen(path), "bin", 3);
+@@ -490,6 +490,13 @@ void ArgParser::prepareOptions() {
+ option = OPT_CMDLINE_MODULE_PATH;
+ option += classPath;
+ javaOptions.push_back(option);
++
++ javaOptions.push_back("--add-opens");
++ javaOptions.push_back("java.base/java.io=org.jruby.dist");
++ javaOptions.push_back("--add-opens");
++ javaOptions.push_back("java.base/java.nio.channels=org.jruby.dist");
++ javaOptions.push_back("--add-opens");
++ javaOptions.push_back("java.base/sun.nio.ch=org.jruby.dist");
+ } else if (separateProcess) {
+ // When launching a separate process, use '-cp' which expands
embedded wildcards
+ javaOptions.push_back(OPT_CMDLINE_CLASS_PATH);
Index: patches/patch-jruby-launcher_inc_Makefile-conf_mk
===================================================================
RCS file: patches/patch-jruby-launcher_inc_Makefile-conf_mk
diff -N patches/patch-jruby-launcher_inc_Makefile-conf_mk
--- patches/patch-jruby-launcher_inc_Makefile-conf_mk 8 Mar 2017 16:32:26
-0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-$OpenBSD: patch-jruby-launcher_inc_Makefile-conf_mk,v 1.1 2017/03/08 16:32:26
jeremy Exp $
-
-Use cc/c++ instead of gcc/g++.
-
---- jruby-launcher/inc/Makefile-conf.mk.orig Mon Mar 6 09:41:05 2017
-+++ jruby-launcher/inc/Makefile-conf.mk Mon Mar 6 09:41:13 2017
-@@ -3,9 +3,9 @@ MKDIR=mkdir
- CP=cp
- CCADMIN=CCadmin
- RANLIB=ranlib
--CC=gcc
--CCC=g++
--CXX=g++
-+CC=cc
-+CCC=c++
-+CXX=c++
-
- # Windows (mingw)?
- ifneq (,$(findstring mingw, $(CONF)))
Index: patches/patch-jruby-launcher_unixlauncher_cpp
===================================================================
RCS file: /cvs/ports/lang/jruby/patches/patch-jruby-launcher_unixlauncher_cpp,v
retrieving revision 1.4
diff -u -p -r1.4 patch-jruby-launcher_unixlauncher_cpp
--- patches/patch-jruby-launcher_unixlauncher_cpp 26 Jul 2015 04:40:16
-0000 1.4
+++ patches/patch-jruby-launcher_unixlauncher_cpp 16 May 2019 17:59:55
-0000
@@ -7,8 +7,9 @@ JAVA_HOME=$(javaPathHelper -h jruby)
Without this, if the JAVA_HOME environment variable is not
defined, bin/jruby will segfault when run.
---- jruby-launcher/unixlauncher.cpp.orig Wed Dec 31 16:00:00 1969
-+++ jruby-launcher/unixlauncher.cpp Mon May 21 14:43:20 2012
+Index: jruby-launcher/unixlauncher.cpp
+--- jruby-launcher/unixlauncher.cpp.orig
++++ jruby-launcher/unixlauncher.cpp
@@ -1,5 +1,6 @@
#include <stdlib.h>
#include <unistd.h>
@@ -16,8 +17,8 @@ defined, bin/jruby will segfault when ru
#include "unixlauncher.h"
#include "utilsfuncs.h"
-@@ -45,6 +46,44 @@ int UnixLauncher::run(int argc, char* argv[], char* en
- prepareOptions();
+@@ -43,6 +44,44 @@ int UnixLauncher::run(int argc, char* argv[], char* en
+ }
string java("");
+