1 # Defines the commonly used target directories and provides a convenience
2 # function to install jar files.
4 # All the default directory locations herein resemble locations chosen in
5 # the Debian distribution.
7 # Jar location on target
8 datadir_java ?= ${datadir}/java
10 # JNI library location on target
11 libdir_jni ?= ${libdir}/jni
13 # JVM bundle location on target
14 libdir_jvm ?= ${libdir}/jvm
16 STAGING_DATADIR_JAVA ?= ${STAGING_DATADIR}/java
17 STAGING_LIBDIR_JNI ?= ${STAGING_LIBDIR}/jni
18 STAGING_LIBDIR_JVM ?= ${STAGING_LIBDIR}/jvm
21 # Purpose: Install a jar file and create all the given symlinks to it.
23 # oe_jarinstall foo-1.3.jar foo.jar
24 # Installs foo-1.3.jar and creates symlink foo.jar.
26 # oe_jarinstall -s foo-1.3.jar foo.jar
27 # Installs foo-1.3.jar to staging and creates symlink foo.jar.
29 # oe_jarinstall -r foo-1.3.jar foo_1_3.jar foo.jar
30 # Installs foo_1_3.jar as foo-1.3.jar and creates a symlink to this.
32 dir=${D}${datadir_java}
34 while [ "$#" -gt 0 ]; do
37 dir=${STAGING_DATADIR_JAVA}
44 oefatal "oe_jarinstall: unknown option: $1"
54 destname=${destname:-`basename $jarname`}
58 install -m 0644 $jarname $dir/$destname
60 # Creates symlinks out of the remaining arguments.
61 while [ "$#" -gt 0 ]; do
62 if [ -e $dir/$1 ]; then
63 oewarn "file was in the way. removing:" $dir/$1
66 ln -s $destname $dir/$1
72 # Purpose: Generate a classpath variable from the given Jar file names
73 # where the ".jar" has been omitted.
75 # oe_makeclasspath foo baz bar
76 # Prints ${datadir_java}/foo.jar:${datadir_java}/baz.jar:${datadir_java}/bar.jar
78 # oe_makeclasspath -s foo baz bar
79 # Prints ${STAGING_DATADIR_JAVA}/foo.jar:${STAGING_DATADIR_JAVA}/baz.jar:${STAGING_DATADIR_JAVA}/bar.jar
81 # Provide the -s at the beginning otherwise strange things happen.
87 while [ "$#" -gt 0 ]; do
90 dir=${STAGING_DATADIR_JAVA}
93 oefatal "oe_makeclasspath: unknown option: $1"
98 if [ ! -f $file ]; then
99 oefatal "oe_makeclasspath: Jar file for '$1' not found at $file"
102 classpath=$classpath$delimiter$file
112 # Creates a simple wrapper script for your Java program.
113 # The script is written to ${PN} by default.
115 # Parameters are as follows:
116 # [options] <output file> <main class> [jar files ...]
119 # -o <name> where name is the output file name
121 # It can only take jar files from ${datadir_java}!
122 oe_java_simple_wrapper() {
128 while [ "$#" -gt 0 ]; do
135 oefatal "oe_java_simple_wrapper: unknown option: $1"
140 classpath=$classpath$delimiter${datadir_java}/$1
150 oenote "Creating simple Java wrapper script"
151 oenote "Output File: $output"
152 oenote "Main Class: $mainclass"
153 oenote "Classpath: $classpath"
155 echo "#!/bin/sh" > $output
156 echo "# This file is autogenerated by the oe_java_simple_wrapper function of OpenEmbedded" >> $output
158 echo "# You can provide additional VM arguments by setting the VMARGS environment variable." >> $output
159 echo "CLASSPATH_ARG=\"-cp $classpath\"" >> $output
161 echo "MAIN_CLASS=$mainclass" >> $output
163 echo "# Allows overriding the VM by setting the JAVA environment variable." >> $output
164 echo "if [ x\${JAVA} = x ]" >> $output
165 echo "then" >> $output
166 echo " JAVA=java" >> $output
169 echo "exec \${JAVA} \${VMARGS} \${CLASSPATH_ARG} \${MAIN_CLASS} \${@}" >> $output