Download raw body.
games/lwjgl: use jdk-11, need indierunner tests
On Thu, 18 Dec 2025 23:09:51 +0000
Kurt Miller <kurt@intricatesoftware.com> 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 @@
> +
> + <!-- Generates the native headers from source files -->
> + <target name="headers" description="invokes javah on java
> classes" depends="compile"> ++ <!--
> + <javah classpath="${lwjgl.bin}"
> destdir="${lwjgl.src.native}/linux">
> + <class
> name="org.lwjgl.LinuxSysImplementation" />
> + <class name="org.lwjgl.opengl.LinuxEvent" />
> +@@ -371,6 +372,7 @@
> + <class name="org.lwjgl.opengles.GLContext"/>
> + <class
> name="org.lwjgl.opengles.CallbackUtil"/>
> + </javah>
> ++ -->
> + </target>
> +
> + <target name="touch-version">
> +@@ -401,21 +403,21 @@
> + </tokenfilter>
> + </filterchain>
> + </loadfile>
> +- <loadfile
> srcfile="${lwjgl.src.native}/windows/org_lwjgl_WindowsSysImplementation.h"
> property="lwjgl.native.windows.version"> ++ <loadfile
> srcfile="${lwjgl.src.native}/org_lwjgl_WindowsSysImplementation.h"
> property="lwjgl.native.windows.version">
> + <filterchain>
> + <tokenfilter>
> + <containsstring contains="#define
> org_lwjgl_WindowsSysImplementation_JNI_VERSION"/>
> + </tokenfilter>
> + </filterchain>
> + </loadfile>
> +- <loadfile
> srcfile="${lwjgl.src.native}/linux/org_lwjgl_LinuxSysImplementation.h"
> property="lwjgl.native.linux.version"> ++ <loadfile
> srcfile="${lwjgl.src.native}/org_lwjgl_LinuxSysImplementation.h"
> property="lwjgl.native.linux.version">
> + <filterchain>
> + <tokenfilter>
> + <containsstring contains="#define
> org_lwjgl_LinuxSysImplementation_JNI_VERSION"/>
> + </tokenfilter>
> + </filterchain>
> + </loadfile>
> +- <loadfile
> srcfile="${lwjgl.src.native}/macosx/org_lwjgl_MacOSXSysImplementation.h"
> property="lwjgl.native.macosx.version"> ++ <loadfile
> srcfile="${lwjgl.src.native}/org_lwjgl_MacOSXSysImplementation.h"
> property="lwjgl.native.macosx.version">
> + <filterchain>
> + <tokenfilter>
> + <containsstring contains="#define
> org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/> +@@ -462,7 +464,9 @@
> +
> + <!-- Compiles the Java source code -->
> + <target name="compile" description="Compiles the java
> source code" depends="-initialize"> +- <javac
> 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"> ++ <javac debug="yes"
> 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}">
> + <!--<compilerarg value="-Xlint:unchecked"/>-->
> + <src path="${lwjgl.src}/java/"/>
> + <src path="${lwjgl.src}/generated/"/>
> +@@ -475,8 +479,8 @@
> + <include name="org/lwjgl/util/**"/>
> + <exclude
> name="org/lwjgl/util/generator/**"/>
> + </javac>
> +- <javac debug="yes" srcdir="${lwjgl.src}/java/"
> destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.5"
> target="1.5" taskname="test" /> +- <javac debug="yes"
> srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}"
> includes="org/lwjgl/examples/**" source="1.5" target="1.5"
> taskname="examples" /> ++ <javac debug="yes"
> srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}"
> includes="org/lwjgl/test/**" source="1.6" target="1.6"
> taskname="test" /> ++ <javac debug="yes"
> srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}"
> includes="org/lwjgl/examples/**" source="1.6" target="1.6"
> taskname="examples" />
> + </target>
> +
> + <target name="compile_native" depends="-initialize,
> headers, touch-version, version-mismatch" description="Compiles the
> native files"> 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 @@
> + <property name="native" location="../../src/native"/>
> <property name="libname32" value="liblwjgl.so"/>
> <property name="libname64" value="liblwjgl64.so"/>
> - <property name="libs32" value="-L/usr/X11R6/lib
> -L/usr/local/lib -lm -lX11 -lXext -lXcursor -lXrandr -pthread
> -L${java.home}/lib/i386 -ljawt" /> +- <property name="libs32"
> value="-L/usr/X11R6/lib -L/usr/local/lib -lm -lX11 -lXext -lXcursor
> -lXrandr -pthread -L${java.home}/lib/i386 -ljawt" />
> - <property name="libs64" value="-L/usr/X11R6/lib
> -L/usr/local/lib -lm -lX11 -lXext -lXcursor -lXrandr -lXxf86vm
> -pthread -L${java.home}/lib/amd64 -ljawt" /> -+ <property
> 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" /> ++ <!-- After JDK 8
> (at least on JDK 11), the architecture isn't part of the lib folder
> anymore --> ++ <property name="libs32" value="-L/usr/X11R6/lib
> -L/usr/local/lib -lm -lX11 -lXext -lXcursor -lXrandr -pthread
> -L${java.home}/lib -ljawt" /> ++ <property name="libs64"
> value="-L/usr/X11R6/lib -L/usr/local/lib -lm -lX11 -lXext -lXcursor
> -lXrandr -lXxf86vm -pthread -L${java.home}/lib -ljawt" /> <property
> name="cflags32" value="-O2 -Wall -c -fPIC -std=c99 -Wunused"/>
> <target name="clean"> -@@ -67,7 +67,9 @@ +@@ -64,10 +65,19 @@
> + </and>
> + </condition>
> +
> ++ <condition property="build.32bit.only">
> ++ <and>
> ++ <os name="OpenBSD"/>
> ++ <equals arg1="${hwplatform}" arg2="i386"/>
> ++ </and>
> ++ </condition>
> ++
> <condition property="build.64bit.only">
> <and>
> <os name="OpenBSD"/>
> @@ -23,3 +37,19 @@ Index: platform_build/bsd_ant/build.xml
> </and>
> </condition>
>
> +@@ -87,6 +97,7 @@
> + <arg
> value="-I${java.home}/../include/openbsd"/>
> + <arg value="-I/usr/local/include"/>
> + <arg value="-I/usr/X11R6/include"/>
> ++ <arg value="-I${native}"/>
> + <arg value="-I${native}/common"/>
> + <arg value="-I${native}/common/opengl"/>
> + <arg value="-I${native}/linux"/>
> +@@ -124,6 +135,7 @@
> + <arg value="-I/usr/X11R6/include"/>
> + <arg value="-I${native}/common"/>
> + <arg value="-I${native}/common/opengl"/>
> ++ <arg value="-I${native}"/>
> + <arg value="-I${native}/linux"/>
> + <arg value="-I${native}/linux/opengl"/>
> + <mapper type="glob" from="*.c" to="*.o"/>
> 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 @@
> + </javac>
> +
> + <!-- Compile helper classes used by the templates
> --> +- <javac debug="yes" srcdir="${lwjgl.src}/java/"
> destdir="${lwjgl.bin}" source="1.5" target="1.5"
> taskname="generator"> ++ <javac debug="yes"
> srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.6"
> target="1.6" taskname="generator">
> + <include name="org/lwjgl/PointerWrapper.java"/>
> + <include name="org/lwjgl/PointerBuffer.java"/>
> + <!-- OpenGL -->
> 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 <jni.h>
> + #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 <stdlib.h>
> + #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"
games/lwjgl: use jdk-11, need indierunner tests