java.bbclass: New bbclass for java recipes.
[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 JPN ?= "${@java_package_name(d)}"
29
30 DEPENDS_prepend = "virtual/javac-native fastjar-native "
31
32 PACKAGES = "${JPN}"
33
34 PACKAGE_ARCH_${JPN} = "all"
35
36 FILES_${JPN} = "${datadir_java}"
37