merge of '27de58a95c41839b956f23d0aba523fd7b5b6560'
[vuplus_openembedded] / classes / java.bbclass
1 # Defines the commonly used target directories and provides a convenience
2 # function to install jar files.
3
4 # Jar location on target
5 datadir_java ?= ${datadir}/java
6
7 # JNI library location on target
8 libdir_jni ?= ${libdir}/jni
9
10 STAGING_DATADIR_JAVA ?= ${STAGING_DATADIR}/java
11 STAGING_LIBDIR_JNI ?= ${STAGING_LIBDIR}/jni
12
13 oe_jarinstall() {
14   # Purpose: Install a jar file and create all the given symlinks to it.
15   # Example:
16   # oe_jarinstall foo-1.3.jar foo.jar
17   # Installs foo-1.3.jar and creates symlink foo.jar.
18   #
19   # oe_jarinstall -s foo-1.3.jar foo.jar
20   # Installs foo-1.3.jar to staging and creates symlink foo.jar.
21   #
22   # oe_jarinstall -r foo-1.3.jar foo_1_3.jar foo.jar
23   # Installs foo_1_3.jar as foo-1.3.jar and creates a symlink to this.
24   #
25   dir=${D}${datadir_java}
26   destname=""
27   while [ "$#" -gt 0 ]; do
28     case "$1" in
29     -s)
30       dir=${STAGING_DATADIR_JAVA}
31       ;;
32     -r)
33       shift
34       destname=$1
35       ;;
36     -*)
37       oefatal "oe_jarinstall: unknown option: $1"
38       ;;
39     *)
40       break;
41       ;;
42     esac
43     shift
44   done
45
46   jarname=$1
47   destname=${destname:-`basename $jarname`}
48   shift
49
50   install -d $dir
51   install -m 0644 $jarname $dir/$destname
52
53   # Creates symlinks out of the remaining arguments.
54   while [ "$#" -gt 0 ]; do
55     if [ -e $dir/$1 ]; then
56       oewarn "file was in the way. removing:" $dir/$1
57       rm $dir/$1
58     fi
59     ln -s $destname $dir/$1
60     shift
61   done
62 }