Bug 1032 - Add fallback for native-jar-file location via classpath
Summary: Add fallback for native-jar-file location via classpath
Alias: None
Product: General
Classification: JogAmp
Component: builds (show other bugs)
Version: unspecified
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
Depends on:
Blocks: 1024 1145
  Show dependency treegraph
Reported: 2014-07-11 15:28 CEST by Sven Gothel
Modified: 2015-03-10 10:48 CET (History)
0 users

See Also:
Type: ---
SCM Refs:
gluegen f5c48efcf546ba4e08e197ccced6df83b57e1755 joal 3c2409e9cc23b0f22c813b6903277997b46db826 jocl 0253aaf391faeed95b45fe92ff76fa71041eb511 jogl 37760af388303834e359703aad9562ce6165845f
Workaround: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2014-07-11 15:28:15 CEST
See Bug 1024 Comment 0:
  2. "classpath"
  Bug 1024 Comment 3
  Bug 1024 Comment 4

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 enhancement shall adds a classloader based native-jar 
file location mechanism as a fallback,
requiring the native jar file to be included in the users CLASSPATH.

The native jar file shall have a TAG denominating:
  - module,
  - OS and
  - ARCH
Comment 1 Sven Gothel 2014-07-11 15:30:47 CEST
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

   <native.tag.jar objdir="${build}/obj"
     includelibs="*gluegen-rt.${native.library.suffix}" />

Note that the manifest file uses a matching Extension-Name:
    Extension-Name: jogamp.nativetag.common