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
13 def java_package_name(d):
19 pn = bb.data.getVar('PN', d, 1)
20 if not pn.startswith("lib"):
23 if not pn.endswith("-java"):
26 return pre + pn + post
28 def java_base_package_name(d):
34 pn = bb.data.getVar('PN', d, 1)
35 if pn.endswith("-native"):
40 JPN ?= "${@java_package_name(d)}"
42 DEPENDS_prepend = "virtual/javac-native fastjar-native "
46 PACKAGE_ARCH_${JPN} = "all"
48 FILES_${JPN} = "${datadir_java}"
51 # Automatically derives "foo" from "foo-native"
52 BPN ?= "${@java_base_package_name(d)}"
56 # File name of the libraries' main Jar file
57 JARFILENAME = "${BP}.jar"
59 # Space-separated list of alternative file names.
60 ALTJARFILENAMES = "${BPN}.jar"
62 # Java "source" distributions often contain precompiled things
63 # we want to delete first.
65 find ${WORKDIR} -name "*.jar" -exec rm {} \;
66 find ${WORKDIR} -name "*.class" -exec rm {} \;
69 addtask removebinaries after do_unpack before do_patch
72 oe_jarinstall ${JARFILENAME} ${ALTJARFILENAMES}
80 oe_jarinstall -s ${JARFILENAME} ${ALTJARFILENAMES}