java-library.bbclass: Remove superfluous quotes from BPN variable.
[vuplus_openembedded] / classes / java-library.bbclass
1 # Inherit this bbclass for each java recipe that builds a Java library (jar file[s]).
2 #
3 # It automatically adds important build dependencies, defines JPN (Java Package Name)
4 # a package named ${JPN} whose contents are those of ${datadir}/java (the jar location).
5 #
6 # The JPN is basically lib${PN}-java but takes care of the fact that ${PN} already
7 # starts with "lib" and/or ends with "-java". In case the "lib" prefix is part of
8 # your package's normal name (e.g. liberator) the guessing is wrong and you have
9 # to set JPN manually!
10
11 inherit java
12
13 def java_package_name(d):
14   import bb;
15
16   pre=""
17   post=""
18
19   pn = bb.data.getVar('PN', d, 1)
20   if not pn.startswith("lib"):
21     pre='lib'
22
23   if not pn.endswith("-java"):
24     post='-java'
25
26   return pre + pn + post
27
28 def java_base_package_name(d):
29   import bb;
30
31   pre=""
32   post=""
33
34   pn = bb.data.getVar('PN', d, 1)
35   if pn.endswith("-native"):
36                 pn = pn[0:-7]
37
38   return pn
39
40 JPN ?= "${@java_package_name(d)}"
41
42 DEPENDS_prepend = "virtual/javac-native fastjar-native "
43
44 PACKAGES = "${JPN}"
45
46 PACKAGE_ARCH_${JPN} = "all"
47
48 FILES_${JPN} = "${datadir_java}"
49
50 # Base package name
51 # Automatically derives "foo" from "foo-native"
52 BPN ?= "${@java_base_package_name(d)}"
53
54 BP ?= "${BPN}-${PV}"
55
56 # File name of the libraries' main Jar file
57 JARFILENAME = "${BP}.jar"
58
59 # Space-separated list of alternative file names.
60 ALTJARFILENAMES = "${BPN}.jar"
61
62 # Java "source" distributions often contain precompiled things
63 # we want to delete first.
64 do_removebinaries() {
65   find ${WORKDIR} -name "*.jar" -exec rm {} \;
66   find ${WORKDIR} -name "*.class" -exec rm {} \;
67 }
68
69 addtask removebinaries after do_unpack before do_patch
70
71 java_install() {
72   oe_jarinstall ${JARFILENAME} ${ALTJARFILENAMES}
73 }
74
75 do_install() {
76   java_install
77 }
78
79 java_stage() {
80   oe_jarinstall -s ${JARFILENAME} ${ALTJARFILENAMES}
81 }
82
83 do_stage() {
84   java_stage
85 }