Monday, February 02, 2026

Re: jruby vs jdk updates

On Feb 2, 2026, at 6:21 AM, Theo Buehler <tb@theobuehler.org> wrote:
>
> jruby has a file containing the jdk version. whenever the jdk/21 minor
> version changes, jruby no longer packages. I fixed this up a couple of
> times recently but I wonder if there's a better way of handling this.
>

Yes, there is a better way. That file is a Class Data Sharing Archive (CDS)
file. I'm not all that familiar with them but my research this morning
indicates they are compatible at the major version level for a particular
OS/JVM combo. I would suggest the following:

* Adjust the port to build that file with the major version only
* patch jruby.sh as follows:

# Default JVM Class Data Sharing Archive (jsa) file for JVMs that support it
-readonly jruby_jsa_file="$JRUBY_HOME/lib/jruby-java$java_version.jsa"
+readonly jruby_jsa_file="$JRUBY_HOME/lib/jruby-java$java_major.jsa"

This should ensure that it used when the jdk jruby is running with has
a matching major version. Even if my conclusion that the minor version
number does not matter is wrong, this approach should work fine for
ports/packages, because ruby will be built the the matching version in
the set of packages that are released together.

Note that CDS files are a startup performance optimization. This port
is marked 21+ so if is run with jdk 25 the jsa file will be skipped by
jruby.sh. Just pointing this out as an FYI.

> At least there should be a comment in jdk/21.
>
> Here's what I just committed:
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/lang/jruby/Makefile,v
> diff -u -p -r1.126 -r1.127
> --- Makefile 5 Nov 2025 09:46:48 -0000 1.126
> +++ Makefile 2 Feb 2026 11:15:43 -0000 1.127
> @@ -9,7 +9,7 @@ PKGNAME = jruby-${V}
> CATEGORIES = lang lang/ruby
> DISTFILES.jffi =jffi-1.3.10.tar.gz
> DISTFILES.gem = ${JRUBY_LAUNCHER_GEM}
> -REVISION = 0
> +REVISION = 1
>
> HOMEPAGE = http://www.jruby.org/
>
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/lang/jruby/pkg/PLIST,v
> diff -u -p -r1.79 -r1.80
> --- pkg/PLIST 5 Nov 2025 09:46:48 -0000 1.79
> +++ pkg/PLIST 2 Feb 2026 11:15:43 -0000 1.80
> @@ -20,7 +20,7 @@ jruby/lib/
> jruby/lib/jni/
> jruby/lib/jni/${JFFI_ARCH}/
> @so jruby/lib/jni/${JFFI_ARCH}/libjffi-1.2.so
> -jruby/lib/jruby-java21.0.9.jsa
> +jruby/lib/jruby-java21.0.10.jsa
> jruby/lib/jruby.jar
> jruby/lib/ruby/
> jruby/lib/ruby/3.1/

No comments:

Post a Comment