diff options
author | Robert Schuster <thebohemian@gmx.net> | 2008-02-09 02:40:29 +0000 |
---|---|---|
committer | Robert Schuster <thebohemian@gmx.net> | 2008-02-09 02:40:29 +0000 |
commit | 14222c1af7852482b99a59590c8c71f2cfd47bcc (patch) | |
tree | 69834f19c99e05758ef0e53df3cbc9c9ed92da77 | |
parent | 3804d774e90f3297ddf25e493b71e80b4a06c030 (diff) | |
parent | 00658edbf96bc2e5e25cd645606a7a14db7b9046 (diff) |
merge of '0b9c7a1af10fa25303941c4460dcc1743e6b58af'
and '7a40ab5c6b67885c69046e7758d912d768cd392b'
-rw-r--r-- | classes/java.bbclass | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/classes/java.bbclass b/classes/java.bbclass index 7fa6dc1786..41d52fe425 100644 --- a/classes/java.bbclass +++ b/classes/java.bbclass @@ -60,3 +60,63 @@ oe_jarinstall() { shift done } + +# Creates a simple wrapper script for your Java program. +# The script is written to ${PN} by default. +# +# Parameters are as follows: +# [options] <output file> <main class> [jar files ...] +# +# Options are +# -o <name> where name is the output file name +# +# It can only take jar files from ${datadir_java}! +oe_java_simple_wrapper() { + delimiter= + mainclass= + classpath= + output=${PN} + + while [ "$#" -gt 0 ]; do + case "$1" in + -o) + shift + output=$1 + ;; + -*) + oefatal "oe_java_simple_wrapper: unknown option: $1" + ;; + *) + if [ $mainclass ] + then + classpath=$classpath$delimiter${datadir_java}/$1 + delimiter=":" + else + mainclass=$1 + fi + ;; + esac + shift + done + + oenote "Creating simple Java wrapper script" + oenote "Output File: $output" + oenote "Main Class: $mainclass" + oenote "Classpath: $classpath" + + echo "#!/bin/sh" > $output + echo "# This file is autogenerated by the oe_java_simple_wrapper function of OpenEmbedded" >> $output + echo >> $output + echo "# You can provide additional VM arguments by setting the VMARGS environment variable." >> $output + echo "CLASSPATH_ARG=\"-cp $classpath\"" >> $output + echo >> $output + echo "MAIN_CLASS=$mainclass" >> $output + echo >> $output + echo "# Allows overriding the VM by setting the JAVA environment variable." >> $output + echo "if [ x\${JAVA} = x ]" >> $output + echo "then" >> $output + echo " JAVA=java" >> $output + echo "fi" >> $output + echo >> $output + echo "exec \${JAVA} \${VMARGS} \${CLASSPATH_ARG} \${MAIN_CLASS} \${@}" >> $output +} |