native cmds and libs in the module library
Alan Bateman
Alan.Bateman at oracle.com
Mon Dec 19 07:34:23 PST 2011
On 12/12/2011 16:46, Chris Hegarty wrote:
> Hi,
>
> I've been looking into where native commands and native libraries get
> installed in the modules library. Today the files in the NATIVE_LIBS
> and NATIVE_CMDS sections of jmod files [1] are installed into
> directories in the the module library. This is not ideal for a few
> reasons:
>
> 1. Native commands hidden down in modules directory are not easy to
> find, and complicates the PATH.
>
> 2. One native library may have a dependency on another, which
> complicates the LD_LIBRARY_PATH. Again, having to poke around
> in the modules directory of each module.
>
> 3. JDK images cannot be built with simple jmod create/install. This
> would be nice! Currently, in the build native libs and cmds are
> copied into place.
>
> 4. At some point you could imagine it would be desirable to install
> native commands into /usr/bin.
>
> I've prototyped changes to the SimpleLibrary where, at the point of
> creation (jmod create), you can optionally specify a path for native
> libs and cmds. The creator of the library can decide where these get
> installed. Then, when a jmod file is installed the native cmds and
> libs are placed in the libraries appropriate directory.
>
> If 'jmod create' is called without these optional arguments then the
> current behavior is maintained, native libs and cmds are installed in
> each module under its 'lib' and 'bin' directories, respectively. I
> think this behavior may be desirable in some cases, a module has a
> single native library that implements some platform specific operation.
>
> http://cr.openjdk.java.net/~chegar/jigsaw/libbin_webrev.00/webrev/
The approach to optionally specify the location for commands and native
libraries make sense to me. I suspect defaulting to directories in each
module will need a bit of thought, at least for legacy mode.
Once commands and native libraries are installed to locations outside of
the per module directory then it does mean handling the case that files
already exist. It also means the module library needs somewhere to track
these files so that removing a module knows to remove the files in these
other locations.
The proposed option to jmod create are -natcmd and -natlibs but as they
are long names then I assume they should be --.
-Alan.
More information about the jigsaw-dev
mailing list