angstrom: prefer the git version of tslib
[openembedded.git] / classes / java-library.bbclass
blob5ce0537dd5ba839ebe5b193a22d391df73a50f89
1 # Inherit this bbclass for each java recipe that builds a Java library (jar file[s]).
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).
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!
11 inherit java
13 # use java_stage for native packages
14 JAVA_NATIVE_STAGE_INSTALL = "1"
16 def java_package_name(d):
17   import bb;
19   pre=""
20   post=""
22   pn = bb.data.getVar('PN', d, 1)
23   if not pn.startswith("lib"):
24     pre='lib'
26   if not pn.endswith("-java"):
27     post='-java'
29   return pre + pn + post
31 JPN ?= "${@java_package_name(d)}"
33 DEPENDS_prepend = "virtual/javac-native fastjar-native "
35 PACKAGES = "${JPN}"
37 PACKAGE_ARCH_${JPN} = "all"
39 FILES_${JPN} = "${datadir_java}"
41 # File name of the libraries' main Jar file
42 JARFILENAME = "${BP}.jar"
44 # Space-separated list of alternative file names.
45 ALTJARFILENAMES = "${BPN}.jar"
47 # Java "source" distributions often contain precompiled things
48 # we want to delete first.
49 do_removebinaries() {
50   find ${WORKDIR} -name "*.jar" -exec rm {} \;
51   find ${WORKDIR} -name "*.class" -exec rm {} \;
54 addtask removebinaries after do_unpack before do_patch
56 java_install() {
57   oe_jarinstall ${JARFILENAME} ${ALTJARFILENAMES}
60 do_install() {
61   java_install
62   java_stage
65 java_stage() {
66   oe_jarinstall -s ${JARFILENAME} ${ALTJARFILENAMES}