diff options
author | Sven Gothel <[email protected]> | 2014-07-11 03:05:41 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-11 03:05:41 +0200 |
commit | f5c48efcf546ba4e08e197ccced6df83b57e1755 (patch) | |
tree | add2ce9506acb35ce3a34c763afb6d2b91a5081e /make/build.xml | |
parent | be61c7f33ec8e4f3214e8d2969ee88cd327fce9d (diff) |
Bug 1024: Add fallback for native-jar-file location via classpath
In situations, where the native-jar file is not located within
the same parent URI as it's java-jar file, our location mechanism fails.
This patch adds a classloader based native-jar file location mechanism as a fallback,
requiring the native jar file to be included in the users CLASSPATH.
Classloader based location algorithm in JNILibLoaderBase.addNativeJarLibsImpl(..):
- Extract the 'module-name' from the given classFromJavaJar's package name,
i.e. the last package-part: 'jogamp.common.Debug' -> 'common'
Hence it is important to pass a 'classFromJavaJar',
which last package segment reflects the module-name!
- <os.and.arch> -> <os_and_arch_dot>, e.g. linux-amd64 -> linux.amd64 (linux/amd64)
- Locate class 'jogamp.nativetag.<module-name>.<os_and_arch_dot>.TAG',
e.g. 'jogamp.nativetag.common.linux.amd64.TAG'
- Use located class's JarFile URI .. continue as usual
Injection of above mentioned TAG class via gluegen-cpptasks-base.xml macro 'native.tag.jar':
- Creates dummy TAG.java code
- Compiles TAG.java
- Creates the native-jar file
Example:
<native.tag.jar objdir="${build}/obj"
nativejarfile="${build}/gluegen-rt-natives-${os.and.arch}.jar"
manifestfile="${build}/Manifest-rt-natives.temp"
module="common"
includelibs="*gluegen-rt.${native.library.suffix}" />
Note that the manifest file uses a matching Extension-Name:
Extension-Name: jogamp.nativetag.common
Diffstat (limited to 'make/build.xml')
-rw-r--r-- | make/build.xml | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/make/build.xml b/make/build.xml index 0df5cf6..534f122 100644 --- a/make/build.xml +++ b/make/build.xml @@ -484,11 +484,12 @@ <antcall target="c.manifest" inheritRefs="true" /> - <jar destfile="${build}/gluegen-rt-natives-${os.and.arch}.jar" manifest="${build}/Manifest-rt-natives.temp"> - <fileset dir="${build}/obj"> - <include name="*gluegen-rt.${native.library.suffix}" /> - </fileset> - </jar> + <native.tag.jar objdir="${build}/obj" + nativejarfile="${build}/gluegen-rt-natives-${os.and.arch}.jar" + manifestfile="${build}/Manifest-rt-natives.temp" + module="common" + includelibs="*gluegen-rt.${native.library.suffix}" /> + <!-- Produce duplicates for different configurations, since non-native-jar aliasing (Bug 1023/Bug 1024) --> <copy file="${build}/gluegen-rt-natives-${os.and.arch}.jar" tofile="${build}/gluegen-rt-android-natives-${os.and.arch}.jar"/> </target> @@ -752,7 +753,7 @@ </copy> <!-- Build gluegen.jar. --> - <jar destfile="${build}/gluegen.jar" manifest="${build}/Manifest.temp"> + <jar destfile="${build}/gluegen.jar" manifest="${build}/Manifest.temp" filesonly="true"> <service type="javax.annotation.processing.Processor"> <provider classname="com.jogamp.gluegen.structgen.CStructAnnotationProcessor"/> </service> @@ -805,7 +806,7 @@ </copy> <!-- Build gluegen-rt.jar. --> - <jar destfile="${build}/gluegen-rt.jar" manifest="${build}/Manifest-rt.temp"> + <jar destfile="${build}/gluegen-rt.jar" manifest="${build}/Manifest-rt.temp" filesonly="true"> <fileset dir="${classes}"> <include name="com/jogamp/gluegen/runtime/*.class" /> <include name="com/jogamp/common/**" /> @@ -880,7 +881,7 @@ </copy> <!-- Build gluegen-rt-android.jar. --> - <jar destfile="${build}/gluegen-rt-android.jar" manifest="${build}/Manifest-rt-android.temp"> + <jar destfile="${build}/gluegen-rt-android.jar" manifest="${build}/Manifest-rt-android.temp" filesonly="true"> <fileset dir="${classes}"> <include name="com/jogamp/gluegen/runtime/*.class" /> <include name="com/jogamp/common/**" /> @@ -938,7 +939,7 @@ </filterset> </copy> - <jar destfile="${build}/jogamp-android-launcher.jar" manifest="${build}/Manifest-android-launcher.temp"> + <jar destfile="${build}/jogamp-android-launcher.jar" manifest="${build}/Manifest-android-launcher.temp" filesonly="true"> <fileset dir="${classes}"> <include name="${jogamp-android-launcher.classes}" /> </fileset> |