1 # Defines the commonly used target directories and provides a convenience
2 # function to install jar files.
4 # Jar location on target
5 datadir_java ?= ${datadir}/java
7 # JNI library location on target
8 libdir_jni ?= ${libdir}/jni
10 STAGING_DATADIR_JAVA ?= ${STAGING_DATADIR}/java
11 STAGING_LIBDIR_JNI ?= ${STAGING_LIBDIR}/jni
14 # Purpose: Install a jar file and create all the given symlinks to it.
16 # oe_jarinstall foo-1.3.jar foo.jar
17 # Installs foo-1.3.jar and creates symlink foo.jar.
19 # oe_jarinstall -s foo-1.3.jar foo.jar
20 # Installs foo-1.3.jar to staging and creates symlink foo.jar.
22 # oe_jarinstall -r foo-1.3.jar foo_1_3.jar foo.jar
23 # Installs foo_1_3.jar as foo-1.3.jar and creates a symlink to this.
25 dir=${D}${datadir_java}
27 while [ "$#" -gt 0 ]; do
30 dir=${STAGING_DATADIR_JAVA}
37 oefatal "oe_jarinstall: unknown option: $1"
47 destname=${destname:-`basename $jarname`}
51 install -m 0644 $jarname $dir/$destname
53 # Creates symlinks out of the remaining arguments.
54 while [ "$#" -gt 0 ]; do
55 if [ -e $dir/$1 ]; then
56 oewarn "file was in the way. removing:" $dir/$1
59 ln -s $destname $dir/$1
64 # Creates a simple wrapper script for your Java program.
65 # The script is written to ${PN} by default.
67 # Parameters are as follows:
68 # [options] <output file> <main class> [jar files ...]
71 # -o <name> where name is the output file name
73 # It can only take jar files from ${datadir_java}!
74 oe_java_simple_wrapper() {
80 while [ "$#" -gt 0 ]; do
87 oefatal "oe_java_simple_wrapper: unknown option: $1"
92 classpath=$classpath$delimiter${datadir_java}/$1
102 oenote "Creating simple Java wrapper script"
103 oenote "Output File: $output"
104 oenote "Main Class: $mainclass"
105 oenote "Classpath: $classpath"
107 echo "#!/bin/sh" > $output
108 echo "# This file is autogenerated by the oe_java_simple_wrapper function of OpenEmbedded" >> $output
110 echo "# You can provide additional VM arguments by setting the VMARGS environment variable." >> $output
111 echo "CLASSPATH_ARG=\"-cp $classpath\"" >> $output
113 echo "MAIN_CLASS=$mainclass" >> $output
115 echo "# Allows overriding the VM by setting the JAVA environment variable." >> $output
116 echo "if [ x\${JAVA} = x ]" >> $output
117 echo "then" >> $output
118 echo " JAVA=java" >> $output
121 echo "exec \${JAVA} \${VMARGS} \${CLASSPATH_ARG} \${MAIN_CLASS} \${@}" >> $output