[oe-commits] org.oe.dev java.bbclass: Added function to generate very simple wrapper scripts.

thebohemian commit openembedded-commits at lists.openembedded.org
Sat Feb 9 03:04:28 UTC 2008


java.bbclass: Added function to generate very simple wrapper scripts.

Author: thebohemian at openembedded.org
Branch: org.openembedded.dev
Revision: 7a40ab5c6b67885c69046e7758d912d768cd392b
ViewMTN: http://monotone.openembedded.org/revision/info/7a40ab5c6b67885c69046e7758d912d768cd392b
Files:
1
classes/java.bbclass
Diffs:

#
# mt diff -r2e4d5c372cfad0e6d1d535ecbebee7006a637b97 -r7a40ab5c6b67885c69046e7758d912d768cd392b
#
# 
# 
# patch "classes/java.bbclass"
#  from [4c1064a0c1677fa3f136bebf5736ace413a11f30]
#    to [4a470d4978ae2ef918625aa0f94f81ced60914df]
# 
============================================================
--- classes/java.bbclass	4c1064a0c1677fa3f136bebf5736ace413a11f30
+++ classes/java.bbclass	4a470d4978ae2ef918625aa0f94f81ced60914df
@@ -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
+}






More information about the Openembedded-commits mailing list