summaryrefslogtreecommitdiff
path: root/classes/java.bbclass
diff options
context:
space:
mode:
authorJohn Lee <john_lee@openmoko.org>2008-02-27 07:50:52 +0000
committerOpenmoko anonymizer key <devel@lists.openmoko.org>2008-02-27 07:50:52 +0000
commitd6f3635f2e2baa680d878461fc8fa9b68c51162b (patch)
treea07627fc6746f21a02a543381681f1cb1320b38d /classes/java.bbclass
parentb14906e8fa695a85b9ddf27838c959be1c8a5fad (diff)
parent9d22cb8106117d2d923bf7b2c263bf9e31b5305f (diff)
merge of '8dccbf106093aaa7b62b2a96962945185534c923'
and 'c50825ba187c292f591cf43c91216cebffb5e290'
Diffstat (limited to 'classes/java.bbclass')
-rw-r--r--classes/java.bbclass60
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
+}