diff options
-rw-r--r-- | make/build.xml | 15 | ||||
-rw-r--r-- | make/stub_includes/jni/jni.h | 4 | ||||
-rw-r--r-- | src/java/com/jogamp/common/os/NativeLibrary.java | 3 | ||||
-rw-r--r-- | src/java/com/jogamp/common/os/Platform.java | 7 | ||||
-rw-r--r-- | src/java/com/jogamp/common/util/VersionUtil.java | 1 | ||||
-rw-r--r-- | src/java/jogamp/common/os/PlatformPropsImpl.java | 20 | ||||
-rw-r--r-- | src/native/common/JVM_JNI8.c | 42 |
7 files changed, 75 insertions, 17 deletions
diff --git a/make/build.xml b/make/build.xml index a03ef68..cb21bdf 100644 --- a/make/build.xml +++ b/make/build.xml @@ -436,26 +436,20 @@ <target name="c.rename.lib.mingw" if="isMingW"> <!-- FIXME: this is a hack; the cpptask should have an option to change the suffix or at least understand the override from .so to .dll --> - <move file="${build}/obj/libgluegen-rt.so" tofile="${build}/obj/gluegen-rt.dll" /> - </target> - - <target name="c.rename.lib.macosx" if="isOSX"> - <copy file="${build}/obj/libgluegen-rt.dylib" tofile="${build}/obj/libgluegen-rt.so" /> + <move file="${build}/obj/libgluegen_rt.so" tofile="${build}/obj/gluegen_rt.dll" /> </target> <target name="c.manifest" if="isVC8Family"> <!-- exec mt, the Microsoft Manifest Tool, to include DLL manifests in order to resolve the location of msvcr80.dll --> - <msvc.manifest objdir="${build}/obj" dllname="gluegen-rt" /> + <msvc.manifest objdir="${build}/obj" dllname="gluegen_rt" /> </target> <target name="gluegen.build.native" depends="init, c.configure" > <property name="c.compiler.src.files.common" value="src/native/common/*.c" /> <property name="c.compiler.src.files.os" value="src/native/${c.src.dir.os}/*.c" /> - <property name="output.lib.name" value="gluegen-rt" /> - <condition property="output.lib.name.os" value="lib${output.lib.name}.so"><isset property="isUnix"/></condition> - <condition property="output.lib.name.os" value="${output.lib.name}.dll"><isset property="isWindows"/></condition> - <condition property="output.lib.name.os" value="lib${output.lib.name}.dylib"><isset property="isOSX"/></condition> + <property name="output.lib.name" value="gluegen_rt" /> <!-- dash replaced by underscore to allow static linkage via JEP 178 --> + <property name="output.lib.name.os" value="${native.library.prefix}${output.lib.name}.${native.library.suffix}" /> <uptodate property="gluegen.build.skip.native"> <srcfiles dir= "${project.root}" includes="${c.compiler.src.files.os}"/> @@ -543,7 +537,6 @@ <antcall target="gluegen.build.a.symbols" inheritAll="true" inheritRefs="true" /> <antcall target="c.rename.lib.mingw" inheritRefs="true" /> - <antcall target="c.rename.lib.macosx" inheritRefs="true" /> <antcall target="gluegen.cpptasks.striplibs" inheritRefs="true"> <param name="libdir" value="${gluegen.lib.dir}"/> diff --git a/make/stub_includes/jni/jni.h b/make/stub_includes/jni/jni.h index b4c6c1d..eac2640 100644 --- a/make/stub_includes/jni/jni.h +++ b/make/stub_includes/jni/jni.h @@ -164,6 +164,7 @@ typedef long JNIEnv; #define JDK1_2 #define JDK1_4 +#define JDK1_8 #define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT @@ -171,6 +172,7 @@ typedef long JNIEnv; #define JNI_VERSION_1_2 0x00010002 #define JNI_VERSION_1_4 0x00010004 #define JNI_VERSION_1_6 0x00010006 +#define JNI_VERSION_1_8 0x00010008 #else /* __GLUEGEN__ */ @@ -1859,6 +1861,7 @@ typedef struct JavaVMAttachArgs { #define JDK1_2 #define JDK1_4 +#define JDK1_8 struct JNIInvokeInterface_ { void *reserved0; @@ -1923,6 +1926,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved); #define JNI_VERSION_1_2 0x00010002 #define JNI_VERSION_1_4 0x00010004 #define JNI_VERSION_1_6 0x00010006 +#define JNI_VERSION_1_8 0x00010008 #endif /* __GLUEGEN__ */ diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java index 6daceae..39d1475 100644 --- a/src/java/com/jogamp/common/os/NativeLibrary.java +++ b/src/java/com/jogamp/common/os/NativeLibrary.java @@ -604,6 +604,9 @@ public final class NativeLibrary implements DynamicLookupHelper { private static boolean initializedFindLibraryMethod = false; private static Method findLibraryMethod = null; private static final String findLibraryImpl(final String libName, final ClassLoader loader) { + if( PlatformPropsImpl.JAVA_9 ) { + return null; + } if (loader == null) { return null; } diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java index f995af3..1bd3b9d 100644 --- a/src/java/com/jogamp/common/os/Platform.java +++ b/src/java/com/jogamp/common/os/Platform.java @@ -255,8 +255,11 @@ public class Platform extends PlatformPropsImpl { private static final String useTempJarCachePropName = "jogamp.gluegen.UseTempJarCache"; - /** fixed basename of JAR file and native library */ - private static final String libBaseName = "gluegen-rt"; + /** + * Fixed basename of JAR file and native library. + * Dash replaced by underscore to allow static linkage via JEP 178. + */ + private static final String libBaseName = "gluegen_rt"; // // static initialization order: diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java index b9e8568..1e09034 100644 --- a/src/java/com/jogamp/common/util/VersionUtil.java +++ b/src/java/com/jogamp/common/util/VersionUtil.java @@ -74,6 +74,7 @@ public class VersionUtil { sb.append(", Runtime: ").append(Platform.getJavaRuntimeName()).append(Platform.getNewline()); sb.append("Platform: Java Vendor: ").append(Platform.getJavaVendor()).append(", ").append(Platform.getJavaVendorURL()); sb.append(", JavaSE: ").append(PlatformPropsImpl.JAVA_SE); + sb.append(", Java9: ").append(PlatformPropsImpl.JAVA_9); sb.append(", Java6: ").append(PlatformPropsImpl.JAVA_6); sb.append(", dynamicLib: ").append(PlatformPropsImpl.useDynamicLibraries); sb.append(", AWT enabled: ").append(Platform.AWT_AVAILABLE); diff --git a/src/java/jogamp/common/os/PlatformPropsImpl.java b/src/java/jogamp/common/os/PlatformPropsImpl.java index f929ab7..2900c99 100644 --- a/src/java/jogamp/common/os/PlatformPropsImpl.java +++ b/src/java/jogamp/common/os/PlatformPropsImpl.java @@ -65,8 +65,8 @@ public abstract class PlatformPropsImpl { public static final VersionNumber Version17; /** Version 1.8. As a JVM version, it enables certain JVM 1.8 features. */ public static final VersionNumber Version18; - /** Version 1.9. As a JVM version, it enables certain JVM 1.9 features. */ - public static final VersionNumber Version19; + /** Version 1.9. As a JVM version, it enables certain JVM 1.9 features. Note the skipped first version number due to JEP 223. */ + public static final VersionNumber Version9; public static final String OS; public static final String OS_lower; @@ -93,6 +93,17 @@ public abstract class PlatformPropsImpl { * </p> */ public static final boolean JAVA_6; + /** + * True only if being compatible w/ language level 9, e.g. JRE 9. + * <p> + * Implies {@link #isJavaSE()} and {@link #JAVA_6}. + * </p> + * <p> + * Since JRE 9, the version string has dropped the major release number, + * see JEP 223: http://openjdk.java.net/jeps/223 + * </p> + */ + public static final boolean JAVA_9; public static final String NEWLINE; public static final boolean LITTLE_ENDIAN; @@ -114,7 +125,7 @@ public abstract class PlatformPropsImpl { Version16 = new VersionNumber(1, 6, 0); Version17 = new VersionNumber(1, 7, 0); Version18 = new VersionNumber(1, 8, 0); - Version19 = new VersionNumber(1, 9, 0); + Version9 = new VersionNumber(9, 0, 0); // We don't seem to need an AccessController.doPrivileged() block // here as these system properties are visible even to unsigned Applets. @@ -143,7 +154,8 @@ public abstract class PlatformPropsImpl { JAVA_VM_NAME = System.getProperty("java.vm.name"); JAVA_RUNTIME_NAME = getJavaRuntimeNameImpl(); JAVA_SE = initIsJavaSE(); - JAVA_6 = JAVA_SE && ( isAndroid || JAVA_VERSION_NUMBER.compareTo(Version16) >= 0 ) ; + JAVA_9 = JAVA_SE && JAVA_VERSION_NUMBER.compareTo(Version9) >= 0; + JAVA_6 = JAVA_SE && ( isAndroid || JAVA_9 || JAVA_VERSION_NUMBER.compareTo(Version16) >= 0 ) ; NEWLINE = System.getProperty("line.separator"); diff --git a/src/native/common/JVM_JNI8.c b/src/native/common/JVM_JNI8.c new file mode 100644 index 0000000..8b9848c --- /dev/null +++ b/src/native/common/JVM_JNI8.c @@ -0,0 +1,42 @@ +/** + * Copyright 2019 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +#include <stdio.h> //required by android to identify NULL +#include <jni.h> + +#if defined (JNI_VERSION_1_8) + +JNIEXPORT jint JNICALL JNI_OnLoad_gluegen_rt(JavaVM *vm, void *reserved) { + return JNI_VERSION_1_8; +} + +JNIEXPORT void JNICALL JNI_OnUnload_gluegen_rt(JavaVM *vm, void *reserved) { +} + +#endif /* defined (JNI_VERSION_1_8) */ + |