X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=classes%2Fjava.bbclass;h=d4cf5aa954bb8aab6bab14a1b3b05fb1d7dae6d7;hb=a215c2f283476776567506c2e3f969c48f7e5e3d;hp=9e51a0b7b20914867a8ab6cb9adfba31f573d1bc;hpb=89f8f2f11ff38add6164bc6e5728fda2b1132583;p=openembedded.git diff --git a/classes/java.bbclass b/classes/java.bbclass index 9e51a0b7b2..d4cf5aa954 100644 --- a/classes/java.bbclass +++ b/classes/java.bbclass @@ -13,10 +13,14 @@ libdir_jni ?= ${libdir}/jni # JVM bundle location on target libdir_jvm ?= ${libdir}/jvm -STAGING_DATADIR_JAVA ?= ${STAGING_DATADIR}/java +STAGING_DATADIR_JAVA ?= ${STAGING_DIR_JAVA} STAGING_LIBDIR_JNI ?= ${STAGING_LIBDIR}/jni STAGING_LIBDIR_JVM ?= ${STAGING_LIBDIR}/jvm +STAGING_DATADIR_JAVA_NATIVE ?= ${STAGING_DATADIR_NATIVE}/java +STAGING_LIBDIR_JNI_NATIVE ?= ${STAGING_LIBDIR_NATIVE}/jni +STAGING_LIBDIR_JVM_NATIVE ?= ${STAGING_LIBDIR_NATIVE}/jvm + oe_jarinstall() { # Purpose: Install a jar file and create all the given symlinks to it. # Example: @@ -34,7 +38,12 @@ oe_jarinstall() { while [ "$#" -gt 0 ]; do case "$1" in -s) - dir=${STAGING_DATADIR_JAVA} + # put jar files to 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 ;; -r) shift @@ -59,7 +68,7 @@ oe_jarinstall() { # Creates symlinks out of the remaining arguments. while [ "$#" -gt 0 ]; do - if [ -e $dir/$1 ]; then + if [ -e $dir/$1 -o -h $dir/$1 ]; then oewarn "file was in the way. removing:" $dir/$1 rm $dir/$1 fi @@ -70,43 +79,59 @@ oe_jarinstall() { 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 + # 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 -s foo baz bar - # Prints ${STAGING_DATADIR_JAVA}/foo.jar:${STAGING_DATADIR_JAVA}/baz.jar:${STAGING_DATADIR_JAVA}/bar.jar + # 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= - - while [ "$#" -gt 0 ]; do - case "$1" in - -s) - dir=${STAGING_DATADIR_JAVA} - ;; - -*) - oefatal "oe_makeclasspath: unknown option: $1" - ;; - *) - file=$dir/$1.jar + classpath= + delimiter= + retval=$1 - if [ ! -f $file ]; then - oefatal "oe_makeclasspath: Jar file for '$1' not found at $file" - fi + shift - classpath=$classpath$file - delimiter=":" - ;; - esac - 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 - echo $classpath + eval $retval="$classpath" } # Creates a simple wrapper script for your Java program.