+oe_makeclasspath() {
+ # Purpose: Generate a classpath variable from the given Jar file names
+ # where the ".jar" has been omitted. The string is stored in the script
+ # variable whose name is given in the first argument to this function.
+ #
+ # oe_makeclasspath cp foo baz bar
+ # Stores ${datadir_java}/foo.jar:${datadir_java}/baz.jar:${datadir_java}/bar.jar
+ # in variable "cp".
+ #
+ # oe_makeclasspath bootcp -s foo baz bar
+ # Stores ${STAGING_DATADIR_JAVA}/foo.jar:${STAGING_DATADIR_JAVA}/baz.jar:${STAGING_DATADIR_JAVA}/bar.jar
+ # in variable "bootcp".
+ #
+ # Provide the -s at the beginning otherwise strange things happen.
+ # If -s is given the function checks whether the requested jar file exists
+ # and exits with an error message if it cannot be found.
+ #
+ # Note: In order to encourage usage of the DEPENDS variable, the function
+ # can accept recipe names. If a recipe has no corresponding Jar file it
+ # is ignored. Be careful with recipes where the recipe name is different
+ # from the the Jar file name!
+ dir=${datadir_java}
+ classpath=
+ delimiter=
+ retval=$1
+
+ shift
+
+ while [ "$#" -gt 0 ]; do
+ case "$1" in
+ -s)
+ # take jar files from native staging if this is a -native recipe
+ if [ ${PACKAGE_ARCH} = ${BUILD_ARCH} ]; then
+ dir=${STAGING_DATADIR_JAVA_NATIVE}
+ else
+ dir=${STAGING_DATADIR_JAVA}
+ fi
+ ;;
+ -*)
+ oefatal "oe_makeclasspath: unknown option: $1"
+ ;;
+ *)
+ file=$dir/$1.jar
+
+ if [ -e $file ]; then
+ classpath=$classpath$delimiter$file
+ delimiter=":"
+ fi
+
+ ;;
+ esac
+ shift
+ done
+
+ eval $retval="$classpath"
+}
+