From: Thomas Frohwein Subject: Re: games/lwjgl: use jdk-11, need indierunner tests To: Kurt Miller Cc: ports@openbsd.org, thfr@openbsd.org Date: Fri, 19 Dec 2025 06:44:18 -0800 On Thu, 18 Dec 2025 23:09:51 +0000 Kurt Miller wrote: > I found a github fork that added jdk 11 build support for Linux, so > I adadapted that to work for us. Here's that commit: > > https://github.com/MeFisto94/lwjgl/commit/72e97f53f7d256bc90e397e946054fcbe764c203 > > I updated games/minecraft to use jdk 11 as well and can launch to > the login screen, but I think games/minecraft is dead - TBD. > > So I need people who use games/indiegames and have lwjgl based > games to give this a test run. Not sure I will be able to fix > any problems, but it would be nice to know if anything works. I will do that, due to $dayjob and volume of games supported by indierunner, I'll report back within the next 7 days > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/games/lwjgl/Makefile,v > diff -u -p -u -r1.13 Makefile > --- Makefile 11 Mar 2022 19:04:37 -0000 1.13 > +++ Makefile 18 Dec 2025 22:39:39 -0000 > @@ -6,7 +6,7 @@ GH_PROJECT= lwjgl > GH_TAGNAME= ${GH_PROJECT}${V} > DISTNAME= lwjgl${V} > PKGNAME= lwjgl-${V} > -REVISION= 5 > +REVISION= 6 > > .if ${MACHINE_ARCH} == "i386" > M_ARCH= "" > @@ -27,7 +27,7 @@ PERMIT_PACKAGE= Yes > WANTLIB += GL X11 Xcursor Xext Xrandr Xxf86vm m pthread > > MODULES= java > -MODJAVA_VER= 1.8 > +MODJAVA_VER= 11 > MODJAVA_BUILD= ant > > BUILD_DEPENDS= audio/openal > Index: patches/patch-build_xml > =================================================================== > RCS file: patches/patch-build_xml > diff -N patches/patch-build_xml > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-build_xml 18 Dec 2025 22:39:39 -0000 > @@ -0,0 +1,68 @@ > +Build with jdk-11 > + > +Index: build.xml > +--- build.xml.orig > ++++ build.xml > +@@ -295,6 +295,7 @@ > + > + > + ++ > + > + > + > +@@ -401,21 +403,21 @@ > + > + > + > +- srcfile="${lwjgl.src.native}/windows/org_lwjgl_WindowsSysImplementation.h" > property="lwjgl.native.windows.version"> ++ srcfile="${lwjgl.src.native}/org_lwjgl_WindowsSysImplementation.h" > property="lwjgl.native.windows.version"> > + > + > + > + > + > + > +- srcfile="${lwjgl.src.native}/linux/org_lwjgl_LinuxSysImplementation.h" > property="lwjgl.native.linux.version"> ++ srcfile="${lwjgl.src.native}/org_lwjgl_LinuxSysImplementation.h" > property="lwjgl.native.linux.version"> > + > + > + > + > + > + > +- srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h" > property="lwjgl.native.macosx.version"> ++ srcfile="${lwjgl.src.native}/org_lwjgl_MacOSXSysImplementation.h" > property="lwjgl.native.macosx.version"> > + > + > + +@@ -462,7 +464,9 @@ > + > + > + +- debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" > classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar:${lwjgl.lib}/asm-debug-all.jar" > taskname="core"> ++ destdir="${lwjgl.bin}" source="1.6" target="1.6" ++ > classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar:${lwjgl.lib}/asm-debug-all.jar" > ++ taskname="core" > nativeHeaderDir="${lwjgl.src.native}"> > + > + > + > +@@ -475,8 +479,8 @@ > + > + name="org/lwjgl/util/generator/**"/> > + > +- destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.5" > target="1.5" taskname="test" /> +- srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" > includes="org/lwjgl/examples/**" source="1.5" target="1.5" > taskname="examples" /> ++ srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" > includes="org/lwjgl/test/**" source="1.6" target="1.6" > taskname="test" /> ++ srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" > includes="org/lwjgl/examples/**" source="1.6" target="1.6" > taskname="examples" /> > + > + > + Index: patches/patch-platform_build_bsd_ant_build_xml > =================================================================== > RCS file: > /cvs/ports/games/lwjgl/patches/patch-platform_build_bsd_ant_build_xml,v > diff -u -p -u -r1.5 patch-platform_build_bsd_ant_build_xml --- > patches/patch-platform_build_bsd_ant_build_xml 11 Mar 2022 > 19:04:37 -0000 1.5 +++ > patches/patch-platform_build_bsd_ant_build_xml 18 Dec 2025 > 22:39:39 -0000 @@ -1,18 +1,32 @@ -Use os.arch on 64 bit builds. > +Build with jdk-11 +Build only 32 bit on i386 and 64bit only > otherwise Index: platform_build/bsd_ant/build.xml > --- platform_build/bsd_ant/build.xml.orig > +++ platform_build/bsd_ant/build.xml > -@@ -5,7 +5,7 @@ > +@@ -4,8 +4,9 @@ > + > > > - +- value="-L/usr/X11R6/lib -L/usr/local/lib -lm -lX11 -lXext -lXcursor > -lXrandr -pthread -L${java.home}/lib/i386 -ljawt" /> > - -+ name="libs64" value="-L/usr/X11R6/lib -L/usr/local/lib -lm -lX11 > -lXext -lXcursor -lXrandr -lXxf86vm -pthread > -L${java.home}/lib/${os.arch} -ljawt" /> ++ ++ ++ value="-L/usr/X11R6/lib -L/usr/local/lib -lm -lX11 -lXext -lXcursor > -lXrandr -lXxf86vm -pthread -L${java.home}/lib -ljawt" /> name="cflags32" value="-O2 -Wall -c -fPIC -std=c99 -Wunused"/> > -@@ -67,7 +67,9 @@ +@@ -64,10 +65,19 @@ > + > + > + > ++ > ++ > ++ > ++ > ++ > ++ > ++ > > > > @@ -23,3 +37,19 @@ Index: platform_build/bsd_ant/build.xml > > > > +@@ -87,6 +97,7 @@ > + value="-I${java.home}/../include/openbsd"/> > + > + > ++ > + > + > + > +@@ -124,6 +135,7 @@ > + > + > + > ++ > + > + > + > Index: patches/patch-platform_build_build-generator_xml > =================================================================== > RCS file: patches/patch-platform_build_build-generator_xml > diff -N patches/patch-platform_build_build-generator_xml > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-platform_build_build-generator_xml 18 Dec > 2025 22:39:39 -0000 @@ -0,0 +1,14 @@ > +Build with jdk-11 > + > +Index: platform_build/build-generator.xml > +--- platform_build/build-generator.xml.orig > ++++ platform_build/build-generator.xml > +@@ -32,7 +32,7 @@ > + > + > + +- destdir="${lwjgl.bin}" source="1.5" target="1.5" > taskname="generator"> ++ srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.6" > target="1.6" taskname="generator"> > + > + > + > Index: patches/patch-src_java_org_lwjgl_LinuxSysImplementation_java > =================================================================== > RCS file: patches/patch-src_java_org_lwjgl_LinuxSysImplementation_java > diff -N patches/patch-src_java_org_lwjgl_LinuxSysImplementation_java > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ > patches/patch-src_java_org_lwjgl_LinuxSysImplementation_java > 18 Dec 2025 22:39:39 -0000 @@ -0,0 +1,13 @@ +Build with jdk-11 > + > +Index: src/java/org/lwjgl/LinuxSysImplementation.java > +--- src/java/org/lwjgl/LinuxSysImplementation.java.orig > ++++ src/java/org/lwjgl/LinuxSysImplementation.java > +@@ -43,6 +43,7 @@ import java.lang.UnsatisfiedLinkError; > + * $Id$ > + */ > + final class LinuxSysImplementation extends J2SESysImplementation { > ++ @java.lang.annotation.Native > + private static final int JNI_VERSION = 19; > + > + static { > Index: patches/patch-src_java_org_lwjgl_MacOSXSysImplementation_java > =================================================================== > RCS file: > patches/patch-src_java_org_lwjgl_MacOSXSysImplementation_java diff -N > patches/patch-src_java_org_lwjgl_MacOSXSysImplementation_java --- > /dev/null 1 Jan 1970 00:00:00 -0000 +++ > patches/patch-src_java_org_lwjgl_MacOSXSysImplementation_java > 18 Dec 2025 22:39:39 -0000 @@ -0,0 +1,13 @@ +Build with jdk-11 > + > +Index: src/java/org/lwjgl/MacOSXSysImplementation.java > +--- src/java/org/lwjgl/MacOSXSysImplementation.java.orig > ++++ src/java/org/lwjgl/MacOSXSysImplementation.java > +@@ -44,6 +44,7 @@ import java.lang.UnsatisfiedLinkError; > + * $Id$ > + */ > + final class MacOSXSysImplementation extends J2SESysImplementation { > ++ @java.lang.annotation.Native > + private static final int JNI_VERSION = 25; > + > + static { > Index: patches/patch-src_java_org_lwjgl_MemoryUtilSun_java > =================================================================== > RCS file: patches/patch-src_java_org_lwjgl_MemoryUtilSun_java > diff -N patches/patch-src_java_org_lwjgl_MemoryUtilSun_java > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_java_org_lwjgl_MemoryUtilSun_java 18 Dec > 2025 22:39:39 -0000 @@ -0,0 +1,53 @@ > +Build with jdk-11 > + > +Index: src/java/org/lwjgl/MemoryUtilSun.java > +--- src/java/org/lwjgl/MemoryUtilSun.java.orig > ++++ src/java/org/lwjgl/MemoryUtilSun.java > +@@ -37,7 +37,6 @@ import java.lang.reflect.Modifier; > + import java.nio.Buffer; > + > + import sun.misc.Unsafe; > +-import sun.reflect.FieldAccessor; > + > + /** > + * MemoryUtil.Accessor implementations that depend on sun.misc. > +@@ -99,37 +98,8 @@ final class MemoryUtilSun { > + } > + > + throw new UnsupportedOperationException(); > +- } > +- > +- } > +- > +- /** Implementation using reflection on ByteBuffer, > FieldAccessor is used directly. */ +- private static class > AccessorReflectFast implements MemoryUtil.Accessor { +- > +- private final FieldAccessor addressAccessor; > +- > +- AccessorReflectFast() { > +- Field address; > +- try { > +- address = > MemoryUtil.getAddressField(); +- } catch > (NoSuchFieldException e) { +- throw > new UnsupportedOperationException(e); +- } > +- address.setAccessible(true); > +- > +- try { > +- Method m = > Field.class.getDeclaredMethod("acquireFieldAccessor", boolean.class); > +- m.setAccessible(true); +- > addressAccessor = > (FieldAccessor)m.invoke(address, true); +- } > catch (Exception e) { +- throw new > UnsupportedOperationException(e); +- } > +- } +- > +- public long getAddress(final Buffer buffer) { > +- return addressAccessor.getLong(buffer); > + } > + > + } > + > +-} > +\ No newline at end of file > ++} > Index: patches/patch-src_java_org_lwjgl_input_Cursor_java > =================================================================== > RCS file: patches/patch-src_java_org_lwjgl_input_Cursor_java > diff -N patches/patch-src_java_org_lwjgl_input_Cursor_java > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_java_org_lwjgl_input_Cursor_java 18 Dec > 2025 22:39:39 -0000 @@ -0,0 +1,22 @@ > +Build with jdk-11 > + > +Index: src/java/org/lwjgl/input/Cursor.java > +--- src/java/org/lwjgl/input/Cursor.java.orig > ++++ src/java/org/lwjgl/input/Cursor.java > +@@ -51,12 +51,15 @@ import org.lwjgl.Sys; > + > + public class Cursor { > + /** 1 bit transparency for native cursor */ > ++ @java.lang.annotation.Native > + public static final int > CURSOR_ONE_BIT_TRANSPARENCY = 1; > + > +- /** 8 bit alhpa native cursor */ > ++ /** 8 bit alpha native cursor */ > ++ @java.lang.annotation.Native > + public static final int > CURSOR_8_BIT_ALPHA = 2; > + > + /** animation native cursor */ > ++ @java.lang.annotation.Native > + public static final int > CURSOR_ANIMATION = 4; > + > + /** First element to display */ > Index: patches/patch-src_java_org_lwjgl_opengl_Pbuffer_java > =================================================================== > RCS file: patches/patch-src_java_org_lwjgl_opengl_Pbuffer_java > diff -N patches/patch-src_java_org_lwjgl_opengl_Pbuffer_java > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_java_org_lwjgl_opengl_Pbuffer_java 18 > Dec 2025 22:39:39 -0000 @@ -0,0 +1,13 @@ > +Build with jdk-11 > + > +Index: src/java/org/lwjgl/opengl/Pbuffer.java > +--- src/java/org/lwjgl/opengl/Pbuffer.java.orig > ++++ src/java/org/lwjgl/opengl/Pbuffer.java > +@@ -52,6 +52,7 @@ public final class Pbuffer extends DrawableGL { > + /** > + * Indicates that Pbuffers can be created. > + */ > ++ @java.lang.annotation.Native > + public static final int PBUFFER_SUPPORTED = 1 << 0; > + > + /** > Index: > patches/patch-src_java_org_lwjgl_util_generator_GeneratorVisitor_java > =================================================================== > RCS file: > patches/patch-src_java_org_lwjgl_util_generator_GeneratorVisitor_java > diff -N > patches/patch-src_java_org_lwjgl_util_generator_GeneratorVisitor_java > --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ > patches/patch-src_java_org_lwjgl_util_generator_GeneratorVisitor_java > 18 Dec 2025 22:39:39 -0000 @@ -0,0 +1,16 @@ +Build with jdk-11 + > +Index: src/java/org/lwjgl/util/generator/GeneratorVisitor.java +--- > src/java/org/lwjgl/util/generator/GeneratorVisitor.java.orig ++++ > src/java/org/lwjgl/util/generator/GeneratorVisitor.java +@@ -300,8 > +300,8 @@ public class GeneratorVisitor extends ElementKindVisit > + } > + > + // TODO: Back-port LWJGL 3's generation > file handling (generate in-memory and avoid touching files if nothing > has changed) +- java_writer = new > PrintWriter(env.getFiler().createSourceFile(Utils.getQualifiedClassName(e), > env.getElementUtils().getPackageOf(e)).openWriter()); +- > generateJavaSource(e, java_writer); ++ > outputJava.getParentFile().mkdirs(); ++ > generateJavaSource(e, new PrintWriter(new > java.io.FileWriter(outputJava))); > + > + if ( methods.size() > 0 ) { > + boolean noNative = true; > Index: patches/patch-src_native_common_org_lwjgl_BufferUtils_c > =================================================================== > RCS file: patches/patch-src_native_common_org_lwjgl_BufferUtils_c > diff -N patches/patch-src_native_common_org_lwjgl_BufferUtils_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-src_native_common_org_lwjgl_BufferUtils_c 18 > Dec 2025 22:39:39 -0000 @@ -0,0 +1,10 @@ > +Build with jdk-11 > + > +Index: src/native/common/org_lwjgl_BufferUtils.c > +--- src/native/common/org_lwjgl_BufferUtils.c.orig > ++++ src/native/common/org_lwjgl_BufferUtils.c > +@@ -1,4 +1,3 @@ > +-#include "org_lwjgl_BufferUtils.h" > + #include "common_tools.h" > + > + JNIEXPORT void JNICALL > Java_org_lwjgl_BufferUtils_zeroBuffer0(JNIEnv *env, jclass clazz, > jobject buffer, jlong offset, jlong size) { Index: > patches/patch-src_native_common_org_lwjgl_opencl_CallbackUtil_c > =================================================================== > RCS file: > patches/patch-src_native_common_org_lwjgl_opencl_CallbackUtil_c diff > -N patches/patch-src_native_common_org_lwjgl_opencl_CallbackUtil_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ > patches/patch-src_native_common_org_lwjgl_opencl_CallbackUtil_c > 18 Dec 2025 22:39:39 -0000 @@ -0,0 +1,13 @@ +Build with jdk-11 + > +Index: src/native/common/org_lwjgl_opencl_CallbackUtil.c +--- > src/native/common/org_lwjgl_opencl_CallbackUtil.c.orig ++++ > src/native/common/org_lwjgl_opencl_CallbackUtil.c +@@ -39,7 +39,6 @@ > + #include > + #include "common_tools.h" > + #include "extcl.h" > +-#include "org_lwjgl_opencl_CallbackUtil.h" > + > + static jmethodID contextCallbackJ; > + static jmethodID memObjectDestructorCallbackJ; > Index: > patches/patch-src_native_linux_opengl_org_lwjgl_opengl_Pbuffer_c > =================================================================== > RCS file: > patches/patch-src_native_linux_opengl_org_lwjgl_opengl_Pbuffer_c diff > -N patches/patch-src_native_linux_opengl_org_lwjgl_opengl_Pbuffer_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ > patches/patch-src_native_linux_opengl_org_lwjgl_opengl_Pbuffer_c > 18 Dec 2025 22:39:39 -0000 @@ -0,0 +1,13 @@ +Build with jdk-11 + > +Index: src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c > +--- src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c.orig > ++++ src/native/linux/opengl/org_lwjgl_opengl_Pbuffer.c > +@@ -42,6 +42,7 @@ > + #include > + #include "org_lwjgl_opengl_LinuxPbufferPeerInfo.h" > + #include "org_lwjgl_opengl_Pbuffer.h" > ++#include "org_lwjgl_opengl_LinuxDisplay.h" > + #include "extgl.h" > + #include "context.h" > + #include "common_tools.h"