diff --git a/debian/changelog b/debian/changelog index f112b2f..4d0f65b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ lwjgl (2.9.3+dfsg-4) UNRELEASED; urgency=medium * Team upload. + * Fixed the build failures with Java 9/10/11 (Closes: #893302) * Simplified the OS X and ASM patches * Filter the upstream tarball with the Files-Excluded field in d/copyright * Standards-Version updated to 4.2.1 diff --git a/debian/control b/debian/control index 80f55bb..9296615 100644 --- a/debian/control +++ b/debian/control @@ -9,14 +9,14 @@ ant, ant-optional, debhelper (>= 11), + default-jdk, default-jdk-doc, javahelper, libjinput-java, libxcursor-dev, libxrandr-dev, libxt-dev, - libxxf86vm-dev, - openjdk-8-jdk + libxxf86vm-dev Standards-Version: 4.2.1 Vcs-Git: https://salsa.debian.org/java-team/lwjgl.git Vcs-Browser: https://salsa.debian.org/java-team/lwjgl diff --git a/debian/patches/annotation-processor-workaround.patch b/debian/patches/annotation-processor-workaround.patch new file mode 100644 index 0000000..66e67ef --- /dev/null +++ b/debian/patches/annotation-processor-workaround.patch @@ -0,0 +1,17 @@ +Description: Workaround for a regression in the annotation processor with Java 9+ +Author: Emmanuel Bourg +Forwarded: no +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=893302 +--- a/src/java/org/lwjgl/util/generator/GeneratorVisitor.java ++++ b/src/java/org/lwjgl/util/generator/GeneratorVisitor.java +@@ -300,8 +300,8 @@ + } + + // 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; diff --git a/debian/patches/java9-compatibility.patch b/debian/patches/java9-compatibility.patch new file mode 100644 index 0000000..9c13a43 --- /dev/null +++ b/debian/patches/java9-compatibility.patch @@ -0,0 +1,49 @@ +Description: Fixes the compatibility with Java 9 (sun.reflect.FieldAccessor is no longer accessible) +Author: Emmanuel Bourg +Forwarded: no +--- a/src/java/org/lwjgl/MemoryUtilSun.java ++++ b/src/java/org/lwjgl/MemoryUtilSun.java +@@ -37,7 +37,6 @@ + import java.nio.Buffer; + + import sun.misc.Unsafe; +-import sun.reflect.FieldAccessor; + + /** + * MemoryUtil.Accessor implementations that depend on sun.misc. +@@ -103,33 +102,4 @@ + + } + +- /** 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 ++} diff --git a/debian/patches/javah.patch b/debian/patches/javah.patch new file mode 100644 index 0000000..f493c49 --- /dev/null +++ b/debian/patches/javah.patch @@ -0,0 +1,120 @@ +Description: Generate the native headers with 'javac -h' instead of javah (removed from Java 10) +Author: Emmanuel Bourg +Forwarded: no +--- a/build.xml ++++ b/build.xml +@@ -297,6 +297,7 @@ + + + ++ + + + +@@ -403,21 +405,21 @@ + + + +- ++ + + + + + + +- ++ + + + + + + +- ++ + + + +@@ -464,7 +466,7 @@ + + + +- ++ + + + +--- a/src/java/org/lwjgl/LinuxSysImplementation.java ++++ b/src/java/org/lwjgl/LinuxSysImplementation.java +@@ -43,6 +43,7 @@ + * $Id$ + */ + final class LinuxSysImplementation extends J2SESysImplementation { ++ @java.lang.annotation.Native + private static final int JNI_VERSION = 19; + + static { +--- a/platform_build/linux_ant/build.xml ++++ b/platform_build/linux_ant/build.xml +@@ -143,6 +143,7 @@ + + + ++ + + + +--- a/src/java/org/lwjgl/input/Cursor.java ++++ b/src/java/org/lwjgl/input/Cursor.java +@@ -51,12 +51,15 @@ + + 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 */ ++ @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 */ +--- a/src/native/common/org_lwjgl_BufferUtils.c ++++ b/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) { +--- a/src/native/common/org_lwjgl_opencl_CallbackUtil.c ++++ b/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; +--- a/src/java/org/lwjgl/MacOSXSysImplementation.java ++++ b/src/java/org/lwjgl/MacOSXSysImplementation.java +@@ -43,6 +43,7 @@ + * $Id$ + */ + final class MacOSXSysImplementation extends J2SESysImplementation { ++ @java.lang.annotation.Native + private static final int JNI_VERSION = 25; + + static { diff --git a/debian/patches/series b/debian/patches/series index 45f239b..2378547 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -6,3 +6,6 @@ systemjinput.patch build-failure.patch no-asm-support.patch +java9-compatibility.patch +annotation-processor-workaround.patch +javah.patch diff --git a/debian/rules b/debian/rules index 497f409..4757fe9 100755 --- a/debian/rules +++ b/debian/rules @@ -1,8 +1,4 @@ #!/usr/bin/make -f - -DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) -export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-$(DEB_HOST_ARCH) -export PATH:=$(JAVA_HOME)/bin:$(PATH) # NOTE: jutils is explicitly included here (without a depends in our control # file) because jinput.jar lacks jutils in its own "Class-Path" (bug #626002)