diff options
Diffstat (limited to 'classes')
37 files changed, 397 insertions, 208 deletions
diff --git a/classes/angstrom-mirrors.bbclass b/classes/angstrom-mirrors.bbclass index e44a78c983..10bf75044f 100644 --- a/classes/angstrom-mirrors.bbclass +++ b/classes/angstrom-mirrors.bbclass @@ -1,4 +1,4 @@ MIRRORS_append () { -ftp://.*/.*/ http://www.angstrom-distribution.org/unstable/sources/ -https?$://.*/.*/ http://www.angstrom-distribution.org/unstable/sources/ +ftp://.*/.* http://www.angstrom-distribution.org/unstable/sources/ +https?$://.*/.* http://www.angstrom-distribution.org/unstable/sources/ } diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass index 8e4fba9400..991e472b14 100644 --- a/classes/autotools.bbclass +++ b/classes/autotools.bbclass @@ -174,6 +174,8 @@ autotools_stage_all() { fi if [ -d ${STAGE_TEMP}/${libdir} ] then + find ${STAGE_TEMP}/${libdir} -name '*.la' -exec sed -i s,installed=yes,installed=no, {} \; + for i in ${STAGE_TEMP}/${libdir}/*.la do if [ ! -f "$i" ]; then diff --git a/classes/base.bbclass b/classes/base.bbclass index 7526dff65e..c8ee75627f 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -128,6 +128,14 @@ def base_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): else: return falsevalue +def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): + import bb + result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue) + if result <= 0: + return truevalue + else: + return falsevalue + def base_contains(variable, checkvalues, truevalue, falsevalue, d): import bb matches = 0 @@ -848,6 +856,12 @@ def base_after_parse(d): bb.data.delVarFlag('MACHINE', 'export', d) bb.data.setVarFlag('MACHINE', 'unexport', 1, d) + # Make sure TARGET_ARCH isn't exported + # (breaks Makefiles using implicit rules, e.g. quilt, as GNU make has this + # in them, undocumented) + bb.data.delVarFlag('TARGET_ARCH', 'export', d) + bb.data.setVarFlag('TARGET_ARCH', 'unexport', 1, d) + # Make sure DISTRO isn't exported # (breaks sysvinit at least) bb.data.delVarFlag('DISTRO', 'export', d) @@ -896,6 +910,23 @@ python () { base_after_parse(d) } +def check_app_exists(app, d): + from bb import which, data + + app = data.expand(app, d) + path = data.getVar('PATH', d, 1) + return len(which(path, app)) != 0 + +def check_gcc3(data): + + gcc3_versions = 'gcc-3.4 gcc34 gcc-3.4.4 gcc-3.4.6 gcc-3.4.7 gcc-3.3 gcc33 gcc-3.3.6 gcc-3.2 gcc32' + + for gcc3 in gcc3_versions.split(): + if check_app_exists(gcc3, data): + return gcc3 + + return False + # Patch handling inherit patch diff --git a/classes/binconfig.bbclass b/classes/binconfig.bbclass index 4e425a76d6..5ce9ff6f0d 100644 --- a/classes/binconfig.bbclass +++ b/classes/binconfig.bbclass @@ -20,6 +20,8 @@ def get_binconfig_mangle(d): s += " -e 's:OEEXECPREFIX:${STAGING_DIR_HOST}${layout_exec_prefix}:'" s += " -e 's:-I${WORKDIR}:-I${STAGING_INCDIR}:'" s += " -e 's:-L${WORKDIR}:-L${STAGING_LIBDIR}:'" + if bb.data.getVar("OE_BINCONFIG_EXTRA_MANGLE", d): + s += bb.data.getVar("OE_BINCONFIG_EXTRA_MANGLE", d) return s BINCONFIG_GLOB ?= "*-config" diff --git a/classes/cmake.bbclass b/classes/cmake.bbclass new file mode 100644 index 0000000000..823635c24d --- /dev/null +++ b/classes/cmake.bbclass @@ -0,0 +1,10 @@ +DEPENDS += " cmake-native " + +# We want the staging and installing functions from autotools +inherit autotools + +cmake_do_configure() { + cmake . -DCMAKE_INSTALL_PREFIX:PATH=${prefix} +} + +EXPORT_FUNCTIONS do_configure diff --git a/classes/concatenated-image.bbclass b/classes/concatenated-image.bbclass new file mode 100644 index 0000000000..5cf8d33c05 --- /dev/null +++ b/classes/concatenated-image.bbclass @@ -0,0 +1,38 @@ + +# +# define the FLASH_KERNEL_SIZE and FLASH_ROOT_SIZE in your machine.conf, +# and this class builds a simple, padded concatenated image of +# <kernel><padding><rootfs> and performs error checking that either +# kernel or rootfs isn't too large to fit. +# +concat_pack_image() { + # find latest kernel - is there a more general way to do this? + KERNEL=`ls -tr ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}* | tail -n 1` + if [ -z "$KERNEL" ]; then + oefatal "No kernel found in ${DEPLOY_DIR_IMAGE}. Was expecting a ${KERNEL_IMAGETYPE}\* file." + exit 1 + fi + ROOTFS=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 + OUTPUT=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.flash.img + PADFILE=${DEPLOY_DIR_IMAGE}/padfile.zzz + KERNEL_SIZE_MAX_DEC=`echo ${FLASH_KERNEL_SIZE} | awk --non-decimal-data '{printf "%d\n", $1}' ` + ROOT_SIZE_MAX_DEC=`echo ${FLASH_ROOT_SIZE} | awk --non-decimal-data '{printf "%d\n", $1}' ` + KERNEL_SIZE=`ls -l $KERNEL | awk '{print $5}'` + if [ $KERNEL_SIZE -gt $KERNEL_SIZE_MAX_DEC ]; then + oefatal "Kernel too large at $KERNEL_SIZE bytes. Max is $KERNEL_SIZE_MAX_DEC." + exit 1 + fi + ROOT_SIZE=`ls -l $ROOTFS | awk '{print $5}'` + if [ $ROOT_SIZE -gt $ROOT_SIZE_MAX_DEC ]; then + oefatal "Rootfs is too large at $ROOT_SIZE bytes. Max is $ROOT_SIZE_MAX_DEC." + exit 1 + fi + PAD_SIZE=`echo "$KERNEL_SIZE_MAX_DEC - $KERNEL_SIZE" | bc ` + dd if=/dev/zero of=$PADFILE bs=$PAD_SIZE count=1 2>>/dev/null + cat $KERNEL $PADFILE $ROOTFS > $OUTPUT + rm -f $PADFILE + ls -l $OUTPUT +} + +IMAGE_POSTPROCESS_COMMAND += "concat_pack_image; " + diff --git a/classes/debian.bbclass b/classes/debian.bbclass index dd0789adae..0afe9fcc39 100644 --- a/classes/debian.bbclass +++ b/classes/debian.bbclass @@ -3,6 +3,9 @@ # before building the current package to make the packages runtime # depends are correct # +# Custom library package names can be defined setting +# DEBIANNAME_ + pkgname to the desired name. +# # Better expressed as ensure all RDEPENDS package before we package # This means we can't have circular RDEPENDS/RRECOMMENDS do_package_write_ipk[rdeptask] = "do_package" @@ -88,7 +91,10 @@ python debian_package_name_hook () { for pkg in packages.split(): if (bb.data.getVar('PKG_' + pkg, d) or bb.data.getVar('DEBIAN_NOAUTONAME_' + pkg, d)): continue - if pkg == orig_pkg: + debian_pn = bb.data.getVar('DEBIANNAME_' + pkg, d) + if debian_pn: + newpkg = debian_pn + elif pkg == orig_pkg: newpkg = pkgname else: newpkg = pkg.replace(orig_pkg, devname, 1) diff --git a/classes/efl_base.bbclass b/classes/efl_base.bbclass index 3865441779..023b2edf74 100644 --- a/classes/efl_base.bbclass +++ b/classes/efl_base.bbclass @@ -3,7 +3,7 @@ inherit autotools pkgconfig SECTION = "e/libs" HOMEPAGE = "http://www.enlightenment.org" SRCNAME = "${@bb.data.getVar('PN', d, 1).replace('-native', '')}" -SRC_URI = "http://download.enlightenment.org/snapshots/2007-07-10/${SRCNAME}-${PV}.tar.gz" +SRC_URI = "http://download.enlightenment.org/snapshots/2008-01-25/${SRCNAME}-${PV}.tar.gz" S = "${WORKDIR}/${SRCNAME}-${PV}" do_stage() { diff --git a/classes/image.bbclass b/classes/image.bbclass index 312307c831..ca9c9458e1 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -125,6 +125,17 @@ insert_feed_uris () { # insert new feed-sources echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/ipkg/${feed_name}-feed.conf done + + # Allow to use package deploy directory contents as quick devel-testing + # feed. This creates individual feed configs for each arch subdir of those + # specified as compatible for the current machine. + # NOTE: Development-helper feature, NOT a full-fledged feed. + if [ -n "${FEED_DEPLOYDIR_BASE_URI}" ]; then + for arch in ${PACKAGE_ARCHS} + do + echo "src/gz local-$arch ${FEED_DEPLOYDIR_BASE_URI}/$arch" >> ${IMAGE_ROOTFS}/etc/ipkg/local-$arch-feed.conf + done + fi } log_check() { diff --git a/classes/insane.bbclass b/classes/insane.bbclass index 473fe6ebbf..97cf036dd9 100644 --- a/classes/insane.bbclass +++ b/classes/insane.bbclass @@ -8,28 +8,25 @@ # -Check the RUNTIME path for the $TMPDIR # -Check if .la files wrongly point to workdir # -Check if .pc files wrongly point to workdir -# -Check if packages contains .debug directories or .so files where they should be in -dev or -dbg +# -Check if packages contains .debug directories or .so files +# where they should be in -dev or -dbg # -Check if config.log contains traces to broken autoconf tests -# # # We need to have the scanelf utility as soon as -# possible and this is contained within the pax-utils-native +# possible and this is contained within the pax-utils-native. +# The package.bbclass can help us here. # - - -# We play a special package function inherit package PACKAGE_DEPENDS += "pax-utils-native desktop-file-utils-native" -#PACKAGE_DEPENDS += chrpath-native" PACKAGEFUNCS += " do_package_qa " # # dictionary for elf headers # -# feel free to add and correct. +# feel free to add and correct. # # TARGET_OS TARGET_ARCH MACHINE, OSABI, ABIVERSION, Little Endian, 32bit? def package_qa_get_machine_dict(): @@ -75,7 +72,7 @@ def package_qa_get_machine_dict(): "arm" : (40, 0, 0, True, True), "armeb" : (40, 0, 0, False, True), }, - + } # factory for a class, embedded in a method @@ -102,11 +99,10 @@ def package_qa_get_elf(path, bits32): ELFDATA2LSB = 1 ELFDATA2MSB = 2 - def my_assert(expectation, result): + def my_assert(self, expectation, result): if not expectation == result: - #print "'%x','%x'" % (ord(expectation), ord(result)) + #print "'%x','%x' %s" % (ord(expectation), ord(result), self.name) raise Exception("This does not work as expected") - my_assert = staticmethod(my_assert) def __init__(self, name): self.name = name @@ -115,16 +111,16 @@ def package_qa_get_elf(path, bits32): self.file = file(self.name, "r") self.data = self.file.read(ELFFile.EI_NIDENT+4) - ELFFile.my_assert(len(self.data), ELFFile.EI_NIDENT+4) - ELFFile.my_assert(self.data[0], chr(0x7f) ) - ELFFile.my_assert(self.data[1], 'E') - ELFFile.my_assert(self.data[2], 'L') - ELFFile.my_assert(self.data[3], 'F') + self.my_assert(len(self.data), ELFFile.EI_NIDENT+4) + self.my_assert(self.data[0], chr(0x7f) ) + self.my_assert(self.data[1], 'E') + self.my_assert(self.data[2], 'L') + self.my_assert(self.data[3], 'F') if bits32 : - ELFFile.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32)) # only 32 bits + self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32)) else: - ELFFile.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64)) # only 64 bits - ELFFile.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) ) + self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64)) + self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) ) self.sex = self.data[ELFFile.EI_DATA] if self.sex == chr(ELFFile.ELFDATANONE): @@ -160,20 +156,19 @@ def package_qa_get_elf(path, bits32): return ELFFile(path) -# -# # Known Error classes # 0 - non dev contains .so # 1 - package contains a dangerous RPATH # 2 - package depends on debug package # 3 - non dbg contains .so # 4 - wrong architecture -# 5 - .la contains installed=yes or reference to the workdir +# 5 - .la contains installed=yes # 6 - .pc contains reference to /usr/include or workdir -# -# +# 7 - the desktop file is not valid +# 8 - .la contains reference to the workdir def package_qa_clean_path(path,d): + """ Remove the common prefix from the path. In this case it is the TMPDIR""" import bb return path.replace(bb.data.getVar('TMPDIR',d,True),"") @@ -183,14 +178,15 @@ def package_qa_make_fatal_error(error_class, name, path,d): TODO: Load a whitelist of known errors """ - if error_class == 0: - return False - else: - return True + return not error_class in [0, 5, 7, 8] def package_qa_write_error(error_class, name, path, d): + """ + Log the error + """ import bb, os if not bb.data.getVar('QA_LOG', d): + bb.note("a QA error occured but will not be logged because QA_LOG is not set") return ERROR_NAMES =[ @@ -201,44 +197,45 @@ def package_qa_write_error(error_class, name, path, d): "wrong architecture", "evil hides inside the .la", "evil hides inside the .pc", + "the desktop file is not valid", + ".la contains reference to the workdir", ] - log_path = os.path.join( bb.data.getVar('T', d, True), "log.qa_package" ) f = file( log_path, "a+") - print >> f, "%s, %s, %s" % (ERROR_NAMES[error_class], name, package_qa_clean_path(path,d)) + print >> f, "%s, %s, %s" % \ + (ERROR_NAMES[error_class], name, package_qa_clean_path(path,d)) f.close() +def package_qa_handle_error(error_class, error_msg, name, path, d): + import bb + bb.error("QA Issue: %s" % error_msg) + package_qa_write_error(error_class, name, path, d) + return not package_qa_make_fatal_error(error_class, name, path, d) def package_qa_check_rpath(file,name,d): """ Check for dangerous RPATHs """ import bb, os + sane = True scanelf = os.path.join(bb.data.getVar('STAGING_BINDIR_NATIVE',d,True),'scanelf') - #chrpath = os.path.join(bb.data.getVar('STAGING_BINDIR_NATIVE',d,True),'chrpath') bad_dir = bb.data.getVar('TMPDIR', d, True) + "/work" bad_dir_test = bb.data.getVar('TMPDIR', d, True) if not os.path.exists(scanelf): bb.fatal("Can not check RPATH, scanelf (part of pax-utils-native) not found") - #if not os.path.exists(chrpath): - # bb.fatal("Can not fix RPATH, chrpath (part of chrpath-native) not found") + if not bad_dir in bb.data.getVar('WORKDIR', d, True): bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") - #bb.note("%s -B -F%%r#F %s" % (scanelf,file)) output = os.popen("%s -B -F%%r#F '%s'" % (scanelf,file)) txt = output.readline().split() - #bb.note("???%s???" % bad_dir_test) for line in txt: - #bb.note("===%s===" % line) if bad_dir in line: - package_qa_write_error( 1, name, file, d) - bb.error("QA Issue package %s contains bad RPATH %s in file %s" % (name, line, file)) - #bb.note("Fixing RPATH for you in %s" % file) - #os.popen("%s -r /lib %s" % (chrpath,file)) - #return False - return True + error_msg = "package %s contains bad RPATH %s in file %s" % (name, line, file) + sane = package_qa_handle_error(1, error_msg, name, file, d) + + return sane def package_qa_check_devdbg(path, name,d): """ @@ -251,17 +248,15 @@ def package_qa_check_devdbg(path, name,d): if not "-dev" in name: if path[-3:] == ".so" and os.path.islink(path): - package_qa_write_error( 0, name, path, d ) - bb.error("QA Issue: non -dev package contains symlink .so: %s path '%s'" % (name, package_qa_clean_path(path,d))) - if package_qa_make_fatal_error( 0, name, path, d ): - sane = False + error_msg = "non -dev package contains symlink .so: %s path '%s'" % \ + (name, package_qa_clean_path(path,d)) + sane = package_qa_handle_error(0, error_msg, name, path, d) if not "-dbg" in name: if '.debug' in path: - package_qa_write_error( 3, name, path, d ) - bb.error("QA Issue: non debug package contains .debug directory: %s path %s" % (name, package_qa_clean_path(path,d))) - if package_qa_make_fatal_error( 3, name, path, d ): - sane = False + error_msg = "non debug package contains .debug directory: %s path %s" % \ + (name, package_qa_clean_path(path,d)) + sane = package_qa_handle_error(3, error_msg, name, path, d) return sane @@ -277,9 +272,10 @@ def package_qa_check_arch(path,name,d): Check if archs are compatible """ import bb, os + sane = True target_os = bb.data.getVar('TARGET_OS', d, True) target_arch = bb.data.getVar('TARGET_ARCH', d, True) - + # FIXME: Cross package confuse this check, so just skip them if bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d): return True @@ -290,29 +286,24 @@ def package_qa_check_arch(path,name,d): return True #if this will throw an exception, then fix the dict above - (machine, osabi, abiversion, littleendian, bits32) = package_qa_get_machine_dict()[target_os][target_arch] + (machine, osabi, abiversion, littleendian, bits32) \ + = package_qa_get_machine_dict()[target_os][target_arch] elf = package_qa_get_elf(path, bits32) try: elf.open() except: - # just for debbugging to check the parser, remove once convinced... return True + # Check the architecture and endiannes of the binary if not machine == elf.machine(): - bb.error("Architecture did not match (%d to %d) on %s" %(machine, elf.machine(), package_qa_clean_path(path,d))) - return not package_qa_make_fatal_error( 4, name, path, d ) + error_msg = "Architecture did not match (%d to %d) on %s" % \ + (machine, elf.machine(), package_qa_clean_path(path,d)) + sane = package_qa_handle_error(4, error_msg, name, path, d) elif not littleendian == elf.isLittleEndian(): - bb.error("Endiannes did not match (%d to %d) on %s" % (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d))) - return not package_qa_make_fatal_error( 4, name, path, d ) - - return True + error_msg = "Endiannes did not match (%d to %d) on %s" % \ + (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d)) + sane = package_qa_handle_error(4, error_msg, name, path, d) -def package_qa_check_pcla(path,name,d): - """ - .pc and .la files should not point to the WORKDIR - """ - sane = True - # TODO return sane def package_qa_check_desktop(path, name, d): @@ -320,13 +311,15 @@ def package_qa_check_desktop(path, name, d): Run all desktop files through desktop-file-validate. """ import bb, os + sane = True if path.endswith(".desktop"): - validate = os.path.join(bb.data.getVar('STAGING_BINDIR_NATIVE',d,True), 'desktop-file-validate') + validate = os.path.join(bb.data.getVar('STAGING_BINDIR_NATIVE',d,True), \ + 'desktop-file-validate') output = os.popen("%s %s" % (validate, path)) - # This only produces output on errors for l in output: - bb.error(l.strip()) - return True + sane = package_qa_handle_error(7, l.strip(), name, path, d) + + return sane def package_qa_check_staged(path,d): """ @@ -355,16 +348,17 @@ def package_qa_check_staged(path,d): path = os.path.join(root,file) if file[-2:] == "la": file_content = open(path).read() - if installed in file_content or workdir in file_content: - bb.error("QA issue: %s failed sanity test (reference to workdir or installed)" % file ) - if package_qa_make_fatal_error( 5, "staging", path, d): - sane = True + if installed in file_content: + error_msg = "%s failed sanity test (installed) in path %s" % (file,root) + sane = package_qa_handle_error(5, error_msg, "staging", path, d) + if workdir in file_content: + error_msg = "%s failed sanity test (workdir) in path %s" % (file,root) + sane = package_qa_handle_error(8, error_msg, "staging", path, d) elif file[-2:] == "pc": file_content = open(path).read() if workdir in file_content: - bb.error("QA issue: %s failed sanity test (reference to workdir)" % file ) - if package_qa_make_fatal_error( 6, "staging", path, d): - sane = False + error_msg = "%s failed sanity test (workdir) in path %s" % (file,root) + sane = package_qa_handle_error(6, error_msg, "staging", path, d) return sane @@ -382,7 +376,6 @@ def package_qa_walk(path, funcs, package,d): return sane - def package_qa_check_rdepends(pkg, workdir, d): import bb sane = True @@ -414,10 +407,8 @@ def package_qa_check_rdepends(pkg, workdir, d): # Now do the sanity check!!! for rdepend in rdepends: if "-dbg" in rdepend: - package_qa_write_error( 2, pkgname, rdepend, d ) - bb.error("QA issue: %s rdepends on %s" % (pkgname,rdepend)) - if package_qa_make_fatal_error( 2, pkgname, rdepend, d ): - sane = False + error_msg = "%s rdepends on %s" % (pkgname,rdepend) + sane = package_qa_handle_error(2, error_msg, pkgname, rdepend, d) return sane @@ -431,6 +422,9 @@ python do_package_qa () { if not packages: return + checks = [package_qa_check_rpath, package_qa_check_devdbg, + package_qa_check_perm, package_qa_check_arch, + package_qa_check_desktop] walk_sane = True rdepends_sane = True for package in packages.split(): @@ -440,7 +434,7 @@ python do_package_qa () { bb.note("Checking Package: %s" % package) path = "%s/install/%s" % (workdir, package) - if not package_qa_walk(path, [package_qa_check_rpath, package_qa_check_devdbg, package_qa_check_perm, package_qa_check_arch, package_qa_check_desktop], package, d): + if not package_qa_walk(path, checks, package, d): walk_sane = False if not package_qa_check_rdepends(package, workdir, d): rdepends_sane = False @@ -466,7 +460,10 @@ python do_qa_configure() { bb.note("Checking sanity of the config.log file") import os for root, dirs, files in os.walk(bb.data.getVar('WORKDIR', d, True)): + statement = "grep 'CROSS COMPILE Badness:' %s > /dev/null" % \ + os.path.join(root,"config.log") if "config.log" in files: - if os.system("grep 'CROSS COMPILE Badness:' %s > /dev/null" % (os.path.join(root,"config.log"))) == 0: - bb.fatal("This autoconf log indicates errors, it looked at host includes. Rerun configure task after fixing this. Path was '%s'" % root) + if os.system(statement) == 0: + bb.fatal("""This autoconf log indicates errors, it looked at host includes. +Rerun configure task after fixing this. The path was '%s'""" % root) } diff --git a/classes/java-library.bbclass b/classes/java-library.bbclass new file mode 100644 index 0000000000..8aecfef1b9 --- /dev/null +++ b/classes/java-library.bbclass @@ -0,0 +1,37 @@ +# Inherit this bbclass for each java recipe that builds a Java library (jar file[s]). +# +# It automatically adds important build dependencies, defines JPN (Java Package Name) +# a package named ${JPN} whose contents are those of ${datadir}/java (the jar location). +# +# The JPN is basically lib${PN}-java but takes care of the fact that ${PN} already +# starts with "lib" and/or ends with "-java". In case the "lib" prefix is part of +# your package's normal name (e.g. liberator) the guessing is wrong and you have +# to set JPN manually! + +inherit java + +def java_package_name(d): + import bb; + + pre="" + post="" + + pn = bb.data.getVar('PN', d, 1) + if not pn.startswith("lib"): + pre='lib' + + if not pn.endswith("-java"): + post='-java' + + return pre + pn + post + +JPN ?= "${@java_package_name(d)}" + +DEPENDS_prepend = "virtual/javac-native fastjar-native " + +PACKAGES = "${JPN}" + +PACKAGE_ARCH_${JPN} = "all" + +FILES_${JPN} = "${datadir_java}" + diff --git a/classes/java.bbclass b/classes/java.bbclass new file mode 100644 index 0000000000..7fa6dc1786 --- /dev/null +++ b/classes/java.bbclass @@ -0,0 +1,62 @@ +# Defines the commonly used target directories and provides a convenience +# function to install jar files. + +# Jar location on target +datadir_java ?= ${datadir}/java + +# JNI library location on target +libdir_jni ?= ${libdir}/jni + +STAGING_DATADIR_JAVA ?= ${STAGING_DATADIR}/java +STAGING_LIBDIR_JNI ?= ${STAGING_LIBDIR}/jni + +oe_jarinstall() { + # Purpose: Install a jar file and create all the given symlinks to it. + # Example: + # oe_jarinstall foo-1.3.jar foo.jar + # Installs foo-1.3.jar and creates symlink foo.jar. + # + # oe_jarinstall -s foo-1.3.jar foo.jar + # Installs foo-1.3.jar to staging and creates symlink foo.jar. + # + # oe_jarinstall -r foo-1.3.jar foo_1_3.jar foo.jar + # Installs foo_1_3.jar as foo-1.3.jar and creates a symlink to this. + # + dir=${D}${datadir_java} + destname="" + while [ "$#" -gt 0 ]; do + case "$1" in + -s) + dir=${STAGING_DATADIR_JAVA} + ;; + -r) + shift + destname=$1 + ;; + -*) + oefatal "oe_jarinstall: unknown option: $1" + ;; + *) + break; + ;; + esac + shift + done + + jarname=$1 + destname=${destname:-`basename $jarname`} + shift + + install -d $dir + install -m 0644 $jarname $dir/$destname + + # Creates symlinks out of the remaining arguments. + while [ "$#" -gt 0 ]; do + if [ -e $dir/$1 ]; then + oewarn "file was in the way. removing:" $dir/$1 + rm $dir/$1 + fi + ln -s $destname $dir/$1 + shift + done +} diff --git a/classes/kernel-arch.bbclass b/classes/kernel-arch.bbclass index 9208c3507a..b45f3f9696 100644 --- a/classes/kernel-arch.bbclass +++ b/classes/kernel-arch.bbclass |
