summaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-11-09 20:11:30 +0000
committerKenneth Russel <[email protected]>2005-11-09 20:11:30 +0000
commitdba4677caf231ac26c70518a3e82651b0e01c8f2 (patch)
tree53b494a55ff1c4a00c6d2bd1dbb3e4b7e66b8b5e /make
parent23e6684c5ae7047f39620e861b607db2f761799d (diff)
Refactored JOGL's use of the JAWT to enable it to be more lazily
loaded. Separated out AWT-specific native code into a new jogl_awt native library on all platforms. Added a static helper method to the JAWT class to fetch the JAWT which is now called by all users. Added a new NativeLibLoader entry point to load the native code for the AWT implementation. Renamed the X11 platform's "lockAWT" and "unlockAWT" methods to "lockToolkit" and "unlockToolkit", respectively. In order to change this behavior only two methods in X11GLDrawableFactory need to be overridden. (During the writing of this checkin comment it was noted that these methods are currently static, but that will be fixed in a subsequent checkin.) Added the new jogl_awt native library to the the "dist" target's error checking code. Tested on Windows; more testing, including build testing, is needed on other platforms. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@429 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make')
-rw-r--r--make/build.xml59
-rwxr-xr-xmake/jawt-CustomJavaCode.java27
-rw-r--r--make/jawt-macosx.cfg4
-rw-r--r--make/jawt-win32.cfg9
-rw-r--r--make/jawt-x11.cfg8
5 files changed, 88 insertions, 19 deletions
diff --git a/make/build.xml b/make/build.xml
index 798a58b10..e696d9af3 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -756,9 +756,14 @@
</linker>
<patternset id="c.src.files.jogl">
- <include name="${rootrel.src.c.jogl}/*.c"/>
+ <include name="${rootrel.src.c.jogl}/InternalBufferUtils.c"/>
<include name="${rootrel.src.c.jogl}/*.m" if="os.isMacOSX"/>
- <include name="${rootrel.generated.c.jogl}/*.c"/>
+ <include name="${rootrel.generated.c.jogl}/*GL*.c"/>
+ </patternset>
+
+ <patternset id="c.src.files.jogl_awt">
+ <include name="${rootrel.src.c.jogl}/JAWT*.c"/>
+ <include name="${rootrel.generated.c.jogl}/JAWT*.c"/>
</patternset>
<patternset id="c.src.files.cg">
@@ -809,7 +814,7 @@
</compiler>
<linker extends="${linker.cfg.id}">
- <syslibset dir="${java.lib.dir.platform}" libs="jawt"/>
+ <syslibset dir="${java.lib.dir.platform}" libs="jawt" if="c.compiler.use-jawt"/>
</linker>
</cc>
</target>
@@ -827,57 +832,72 @@
<move file="${obj}/libjogl.dylib" tofile="${obj}/libjogl.jnilib" />
</target>
+ <target name="c.rename.jogl_awt.lib.macosx" if="os.isMacOSX">
+ <!-- FIXME: this is a hack; the cpptask should have an option to change the
+ suffix or at least understand the override from dylib to jnilib -->
+ <move file="${obj}/libjogl_awt.dylib" tofile="${obj}/libjogl_awt.jnilib" />
+ </target>
+
<target name="c.rename.jogl_cg.lib.macosx" if="os.isMacOSX">
<!-- FIXME: this is a hack; the cpptask should have an option to change the
suffix or at least understand the override from dylib to jnilib -->
<move file="${obj}/libjogl_cg.dylib" tofile="${obj}/libjogl_cg.jnilib" />
</target>
- <target name="c.build.jogl">
+ <target name="c.build.jogl.core">
<antcall target="c.build" inheritRefs="true">
<param name="c.compiler.src.files" value="c.src.files.jogl"/>
- <param name="output.lib.name" value="jogl"/>
+ <param name="output.lib.name" value="jogl"/>
</antcall>
<antcall target="c.rename.jogl.lib.macosx" inheritRefs="true" />
</target>
+ <target name="c.build.jogl.awt">
+ <antcall target="c.build" inheritRefs="true">
+ <param name="c.compiler.src.files" value="c.src.files.jogl_awt"/>
+ <param name="c.compiler.use-jawt" value="true"/>
+ <param name="output.lib.name" value="jogl_awt"/>
+ </antcall>
+ <antcall target="c.rename.jogl_awt.lib.macosx" inheritRefs="true" />
+ </target>
+
<target name="c.build.cg" if="jogl.cg">
<antcall target="c.build" inheritRefs="true">
- <param name="c.compiler.src.files" value="c.src.files.cg"/>
- <param name="c.compiler.use-cglib" value="XXX"/>
- <param name="output.lib.name" value="jogl_cg"/>
+ <param name="c.compiler.src.files" value="c.src.files.cg"/>
+ <param name="c.compiler.use-cglib" value="true"/>
+ <param name="output.lib.name" value="jogl_cg"/>
</antcall>
<antcall target="c.rename.jogl_cg.lib.macosx" inheritRefs="true" />
</target>
- <target name="c.compile.jogl.win32.vc6" depends="declare.win32.vc6, c.build.jogl, c.build.cg" >
+ <target name="c.compile.jogl.win32.vc6" depends="declare.win32.vc6, c.build.jogl.core, c.build.jogl.awt, c.build.cg" >
</target>
- <target name="c.compile.jogl.win32.vc7" depends="declare.win32.vc7, c.build.jogl, c.build.cg">
+ <target name="c.compile.jogl.win32.vc7" depends="declare.win32.vc7, c.build.jogl.core, c.build.jogl.awt, c.build.cg">
<property name="c.compiler.use-msvc7" value="true"/>
</target>
- <target name="c.compile.jogl.win32.mingw" depends="declare.win32.mingw, c.build.jogl, c.build.cg">
+ <target name="c.compile.jogl.win32.mingw" depends="declare.win32.mingw, c.build.jogl.core, c.build.jogl.awt, c.build.cg">
<antcall target="c.rename.jogl.libs.mingw" inheritrefs="true" />
</target>
- <target name="c.compile.jogl.linux" depends="declare.linux, c.build.jogl, c.build.cg" >
+ <target name="c.compile.jogl.linux" depends="declare.linux, c.build.jogl.core, c.build.jogl.awt, c.build.cg" >
</target>
- <target name="c.compile.jogl.linux.amd64" depends="declare.linux.amd64, c.build.jogl, c.build.cg" >
+ <target name="c.compile.jogl.linux.amd64" depends="declare.linux.amd64, c.build.jogl.core, c.build.jogl.awt, c.build.cg" >
</target>
- <target name="c.compile.jogl.linux.ia64" depends="declare.linux.ia64, c.build.jogl, c.build.cg" >
+ <target name="c.compile.jogl.linux.ia64" depends="declare.linux.ia64, c.build.jogl.core, c.build.jogl.awt, c.build.cg" >
</target>
- <target name="c.compile.jogl.solaris" depends="declare.solaris, c.build.jogl">
+ <target name="c.compile.jogl.solaris" depends="declare.solaris, c.build.jogl.core, c.build.jogl.awt">
</target>
- <target name="c.compile.jogl.macosx" depends="declare.macosx, c.build.jogl, c.build.cg">
+ <target name="c.compile.jogl.macosx" depends="declare.macosx, c.build.jogl.core, c.build.jogl.awt, c.build.cg">
</target>
- <target name="c.compile.jogl.freebsd" depends="declare.freebsd, c.build.jogl, c.build.cg" >
+ <target name="c.compile.jogl.freebsd" depends="declare.freebsd, c.build.jogl.core, c.build.jogl.awt, c.build.cg" >
</target>
<!-- ================================================================== -->
@@ -983,6 +1003,7 @@
<and>
<available file="${jogl.dist.dir}/jogl-win32/jogl.jar" />
<available file="${jogl.dist.dir}/jogl-win32/jogl.dll" />
+ <available file="${jogl.dist.dir}/jogl-win32/jogl_awt.dll" />
<available file="${jogl.dist.dir}/jogl-win32/jogl_cg.dll" />
</and>
</condition>
@@ -1000,6 +1021,7 @@
<and>
<available file="${jogl.dist.dir}/jogl-linux/jogl.jar" />
<available file="${jogl.dist.dir}/jogl-linux/libjogl.so" />
+ <available file="${jogl.dist.dir}/jogl-linux/libjogl_awt.so" />
<available file="${jogl.dist.dir}/jogl-linux/libjogl_cg.so" />
</and>
</condition>
@@ -1017,6 +1039,7 @@
<and>
<available file="${jogl.dist.dir}/jogl-macosx/jogl.jar" />
<available file="${jogl.dist.dir}/jogl-macosx/libjogl.jnilib" />
+ <available file="${jogl.dist.dir}/jogl-macosx/libjogl_awt.jnilib" />
<available file="${jogl.dist.dir}/jogl-macosx/libjogl_cg.jnilib" />
</and>
</condition>
@@ -1034,6 +1057,7 @@
<and>
<available file="${jogl.dist.dir}/jogl-solsparc/jogl.jar" />
<available file="${jogl.dist.dir}/jogl-solsparc/libjogl.so" />
+ <available file="${jogl.dist.dir}/jogl-solsparc/libjogl_awt.so" />
</and>
</condition>
<fail unless="solsparc.complete">
@@ -1050,6 +1074,7 @@
<and>
<available file="${jogl.dist.dir}/jogl-solx86/jogl.jar" />
<available file="${jogl.dist.dir}/jogl-solx86/libjogl.so" />
+ <available file="${jogl.dist.dir}/jogl-solx86/libjogl_awt.so" />
</and>
</condition>
<fail unless="solx86.complete">
diff --git a/make/jawt-CustomJavaCode.java b/make/jawt-CustomJavaCode.java
new file mode 100755
index 000000000..7e8e83b39
--- /dev/null
+++ b/make/jawt-CustomJavaCode.java
@@ -0,0 +1,27 @@
+private static volatile JAWT jawt;
+
+/** Helper routine for all users to call to access the JAWT. */
+public static JAWT getJAWT() {
+ if (jawt == null) {
+ synchronized (JAWT.class) {
+ if (jawt == null) {
+ NativeLibLoader.loadAWTImpl();
+ // Workaround for 4845371.
+ // Make sure the first reference to the JNI GetDirectBufferAddress is done
+ // from a privileged context so the VM's internal class lookups will succeed.
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ JAWT j = JAWT.create();
+ j.version(JAWTFactory.JAWT_VERSION_1_4);
+ if (!JAWTFactory.JAWT_GetAWT(j)) {
+ throw new RuntimeException("Unable to initialize JAWT");
+ }
+ jawt = j;
+ return null;
+ }
+ });
+ }
+ }
+ }
+ return jawt;
+}
diff --git a/make/jawt-macosx.cfg b/make/jawt-macosx.cfg
index 10097ec65..a7886a250 100644
--- a/make/jawt-macosx.cfg
+++ b/make/jawt-macosx.cfg
@@ -15,11 +15,13 @@ Opaque long NSView *
IgnoreField JAWT GetComponent
IgnoreField JAWT_DrawingSurfaceInfo platformInfo
+IncludeAs CustomJavaCode JAWT jawt-CustomJavaCode.java
+
CustomCCode #include <inttypes.h>
CustomCCode #include <jawt.h>
-
CustomCCode #include </usr/include/machine/types.h>
+import java.security.*
Import com.sun.opengl.impl.JAWT_PlatformInfo
StructPackage JAWT_MacOSXDrawingSurfaceInfo com.sun.opengl.impl.macosx
EmitStruct JAWT_MacOSXDrawingSurfaceInfo
diff --git a/make/jawt-win32.cfg b/make/jawt-win32.cfg
index c8a81ecfd..7f9d74e7b 100644
--- a/make/jawt-win32.cfg
+++ b/make/jawt-win32.cfg
@@ -5,24 +5,31 @@ Package com.sun.opengl.impl
JavaClass JAWTFactory
JavaOutputDir ..\build\gensrc\classes
NativeOutputDir ..\build\gensrc\native\jogl
+
HierarchicalNativeOutput false
+
Opaque boolean jboolean
Opaque long HDC
+
IgnoreField JAWT GetComponent
IgnoreField JAWT_DrawingSurfaceInfo platformInfo
IgnoreField JAWT_Win32DrawingSurfaceInfo null
IgnoreField JAWT_Win32DrawingSurfaceInfo hpalette
-CustomCCode #include <jawt.h>
+IncludeAs CustomJavaCode JAWT jawt-CustomJavaCode.java
+
+CustomCCode #include <jawt.h>
CustomCCode /* This typedef is only needed for VC6 */
CustomCCode #if _MSC_VER <= 1200
CustomCCode typedef int intptr_t;
CustomCCode #endif
+import java.security.*
Import com.sun.opengl.impl.JAWT_PlatformInfo
StructPackage JAWT_Win32DrawingSurfaceInfo com.sun.opengl.impl.windows
EmitStruct JAWT_Win32DrawingSurfaceInfo
Implements JAWT_Win32DrawingSurfaceInfo JAWT_PlatformInfo
+
CustomJavaCode JAWT_DrawingSurfaceInfo public JAWT_PlatformInfo platformInfo() {
CustomJavaCode JAWT_DrawingSurfaceInfo return platformInfo0(getBuffer());
CustomJavaCode JAWT_DrawingSurfaceInfo }
diff --git a/make/jawt-x11.cfg b/make/jawt-x11.cfg
index d326c2f26..43ccef7ec 100644
--- a/make/jawt-x11.cfg
+++ b/make/jawt-x11.cfg
@@ -5,15 +5,23 @@ Package com.sun.opengl.impl
JavaClass JAWTFactory
JavaOutputDir ../build/gensrc/classes
NativeOutputDir ../build/gensrc/native/jogl
+
HierarchicalNativeOutput false
+
Opaque boolean jboolean
Opaque long Drawable
Opaque long Display *
+
IgnoreField JAWT GetComponent
IgnoreField JAWT_DrawingSurfaceInfo platformInfo
IgnoreField JAWT_X11DrawingSurfaceInfo GetAWTColor
+
+IncludeAs CustomJavaCode JAWT jawt-CustomJavaCode.java
+
CustomCCode #include <inttypes.h>
CustomCCode #include <jawt.h>
+
+import java.security.*
Import com.sun.opengl.impl.JAWT_PlatformInfo
StructPackage JAWT_X11DrawingSurfaceInfo com.sun.opengl.impl.x11
EmitStruct JAWT_X11DrawingSurfaceInfo