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
65 # Purpose: Generate a classpath variable from the given Jar file names
66 # where the ".jar" has been omitted.
68 # oe_makeclasspath foo baz bar
69 # Prints ${datadir_java}/foo.jar:${datadir_java}/baz.jar:${datadir_java}/bar.jar
71 # oe_makeclasspath -s foo baz bar
72 # Prints ${STAGING_DATADIR_JAVA}/foo.jar:${STAGING_DATADIR_JAVA}/baz.jar:${STAGING_DATADIR_JAVA}/bar.jar
74 # Provide the -s at the beginning otherwise strange things happen.
80 while [ "$#" -gt 0 ]; do
83 dir=${STAGING_DATADIR_JAVA}
86 oefatal "oe_makeclasspath: unknown option: $1"
89 classpath=$classpath$delimiter$dir/$1.jar
99 # Creates a simple wrapper script for your Java program.
100 # The script is written to ${PN} by default.
102 # Parameters are as follows:
103 # [options] <output file> <main class> [jar files ...]
106 # -o <name> where name is the output file name
108 # It can only take jar files from ${datadir_java}!
109 oe_java_simple_wrapper() {
115 while [ "$#" -gt 0 ]; do
122 oefatal "oe_java_simple_wrapper: unknown option: $1"
127 classpath=$classpath$delimiter${datadir_java}/$1
137 oenote "Creating simple Java wrapper script"
138 oenote "Output File: $output"
139 oenote "Main Class: $mainclass"
140 oenote "Classpath: $classpath"
142 echo "#!/bin/sh" > $output
143 echo "# This file is autogenerated by the oe_java_simple_wrapper function of OpenEmbedded" >> $output
145 echo "# You can provide additional VM arguments by setting the VMARGS environment variable." >> $output
146 echo "CLASSPATH_ARG=\"-cp $classpath\"" >> $output
148 echo "MAIN_CLASS=$mainclass" >> $output
150 echo "# Allows overriding the VM by setting the JAVA environment variable." >> $output
151 echo "if [ x\${JAVA} = x ]" >> $output
152 echo "then" >> $output
153 echo " JAVA=java" >> $output
156 echo "exec \${JAVA} \${VMARGS} \${CLASSPATH_ARG} \${MAIN_CLASS} \${@}" >> $output