java-library.bbclass: Default implementation for do_install/do_stage.
authorRobert Schuster <thebohemian@gmx.net>
Thu, 15 May 2008 15:01:03 +0000 (15:01 +0000)
committerRobert Schuster <thebohemian@gmx.net>
Thu, 15 May 2008 15:01:03 +0000 (15:01 +0000)
java.bbclass: Added oe_makeclasspath function.

classes/java-library.bbclass
classes/java.bbclass

index 8aecfef..b6cb5dc 100644 (file)
@@ -35,3 +35,24 @@ PACKAGE_ARCH_${JPN} = "all"
 
 FILES_${JPN} = "${datadir_java}"
 
+# File name of the libraries' main Jar file
+JARFILENAME = "${P}.jar"
+
+# Space-separated list of alternative file names.
+ALTJARFILENAMES = "${PN}.jar"
+
+java_install() {
+  oe_jarinstall ${JARFILENAME} ${ALTJARFILENAMES}
+}
+
+do_install() {
+  java_install
+}
+
+java_stage() {
+  oe_jarinstall -s ${JARFILENAME} ${ALTJARFILENAMES}
+}
+
+do_stage() {
+  java_stage
+}
index 41d52fe..e51b0d7 100644 (file)
@@ -61,6 +61,41 @@ oe_jarinstall() {
   done
 }
 
+oe_makeclasspath() {
+  # Purpose: Generate a classpath variable from the given Jar file names
+  # where the ".jar" has been omitted.
+  #
+  # oe_makeclasspath foo baz bar
+  # Prints ${datadir_java}/foo.jar:${datadir_java}/baz.jar:${datadir_java}/bar.jar
+  #
+  # oe_makeclasspath -s foo baz bar
+  # Prints ${STAGING_DATADIR_JAVA}/foo.jar:${STAGING_DATADIR_JAVA}/baz.jar:${STAGING_DATADIR_JAVA}/bar.jar
+  #
+  # Provide the -s at the beginning otherwise strange things happen.
+  #
+  dir=${datadir_java}
+       classpath=
+       delimiter=
+
+  while [ "$#" -gt 0 ]; do
+    case "$1" in
+    -s)
+      dir=${STAGING_DATADIR_JAVA}
+      ;;
+    -*)
+      oefatal "oe_makeclasspath: unknown option: $1"
+      ;;
+    *)
+      classpath=$classpath$delimiter$dir/$1.jar
+      delimiter=":"
+      ;;
+    esac
+    shift
+  done
+
+       echo $classpath
+}
+
 # Creates a simple wrapper script for your Java program.
 # The script is written to ${PN} by default. 
 #