From c58cc7d3796dcee6e93885c835ed04cb566abeb2 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Thu, 17 Mar 2011 21:41:22 +0100 Subject: move layer into meta-oe in preparation for future splits As per TSC decision Signed-off-by: Koen Kooi --- meta-oe/classes/gnome.bbclass | 4 + meta-oe/classes/gnomebase.bbclass | 30 ++ meta-oe/classes/kernel.bbclass | 560 +++++++++++++++++++++++++++++++++++++ meta-oe/classes/mime.bbclass | 56 ++++ meta-oe/classes/qmake_base.bbclass | 91 ++++++ meta-oe/classes/qt4e.bbclass | 17 ++ meta-oe/classes/siteinfo.bbclass | 218 +++++++++++++++ 7 files changed, 976 insertions(+) create mode 100644 meta-oe/classes/gnome.bbclass create mode 100644 meta-oe/classes/gnomebase.bbclass create mode 100644 meta-oe/classes/kernel.bbclass create mode 100644 meta-oe/classes/mime.bbclass create mode 100644 meta-oe/classes/qmake_base.bbclass create mode 100644 meta-oe/classes/qt4e.bbclass create mode 100644 meta-oe/classes/siteinfo.bbclass (limited to 'meta-oe/classes') diff --git a/meta-oe/classes/gnome.bbclass b/meta-oe/classes/gnome.bbclass new file mode 100644 index 0000000000..0a32a7796d --- /dev/null +++ b/meta-oe/classes/gnome.bbclass @@ -0,0 +1,4 @@ +inherit gnomebase gtk-icon-cache gconf mime + +EXTRA_OECONF += "--enable-introspection=no" +BBCLASSEXTEND += "native" diff --git a/meta-oe/classes/gnomebase.bbclass b/meta-oe/classes/gnomebase.bbclass new file mode 100644 index 0000000000..b50504f983 --- /dev/null +++ b/meta-oe/classes/gnomebase.bbclass @@ -0,0 +1,30 @@ +def gnome_verdir(v): + import re + m = re.match("^([0-9]+)\.([0-9]+)", v) + return "%s.%s" % (m.group(1), m.group(2)) + +SECTION ?= "x11/gnome" +SRC_URI = "${GNOME_MIRROR}/${BPN}/${@gnome_verdir("${PV}")}/${BPN}-${PV}.tar.bz2;name=archive" + +DEPENDS += "gnome-common" + +FILES_${PN} += "${datadir}/application-registry \ + ${datadir}/mime-info \ + ${datadir}/mime/packages \ + ${datadir}/mime/application \ + ${datadir}/gnome-2.0 \ + ${datadir}/polkit* \ +" + +FILES_${PN}-doc += "${datadir}/devhelp" + +inherit autotools pkgconfig + +AUTOTOOLS_STAGE_PKGCONFIG = "1" + +do_install_append() { + rm -rf ${D}${localstatedir}/lib/scrollkeeper/* + rm -rf ${D}${localstatedir}/scrollkeeper/* + rm -f ${D}${datadir}/applications/*.cache +} + diff --git a/meta-oe/classes/kernel.bbclass b/meta-oe/classes/kernel.bbclass new file mode 100644 index 0000000000..13670f6674 --- /dev/null +++ b/meta-oe/classes/kernel.bbclass @@ -0,0 +1,560 @@ +inherit linux-kernel-base module_strip + +PROVIDES += "virtual/kernel" +DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}depmod-${@get_kernelmajorversion('${PV}')} virtual/${TARGET_PREFIX}gcc${KERNEL_CCSUFFIX} update-modules" + +# we include gcc above, we dont need virtual/libc +INHIBIT_DEFAULT_DEPS = "1" + +KERNEL_IMAGETYPE ?= "zImage" + +python __anonymous () { + kerneltype = bb.data.getVar('KERNEL_IMAGETYPE', d, 1) or '' + if kerneltype == 'uImage': + depends = bb.data.getVar("DEPENDS", d, 1) + depends = "%s u-boot-mkimage-native" % depends + bb.data.setVar("DEPENDS", depends, d) + + image = bb.data.getVar('INITRAMFS_IMAGE', d, True) + if image != '' and image is not None: + bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d) + + machine_kernel_pr = bb.data.getVar('MACHINE_KERNEL_PR', d, True) + + if machine_kernel_pr: + bb.data.setVar('PR', machine_kernel_pr, d) +} + +INITRAMFS_IMAGE ?= "" +INITRAMFS_TASK ?= "" + +inherit kernel-arch deploy + +PACKAGES_DYNAMIC += "kernel-module-*" +PACKAGES_DYNAMIC += "kernel-image-*" +PACKAGES_DYNAMIC += "kernel-firmware-*" + +export OS = "${TARGET_OS}" +export CROSS_COMPILE = "${TARGET_PREFIX}" + +KERNEL_PRIORITY = "${@bb.data.getVar('PV',d,1).split('-')[0].split('.')[-1]}" + +KERNEL_RELEASE ?= "${KERNEL_VERSION}" + +KERNEL_CCSUFFIX ?= "" +KERNEL_LDSUFFIX ?= "" + +# Set TARGET_??_KERNEL_ARCH in the machine .conf to set architecture +# specific options necessary for building the kernel and modules. +#FIXME: should be this: TARGET_CC_KERNEL_ARCH ?= "${TARGET_CC_ARCH}" +TARGET_CC_KERNEL_ARCH ?= "" +HOST_CC_KERNEL_ARCH ?= "${TARGET_CC_KERNEL_ARCH}" +TARGET_LD_KERNEL_ARCH ?= "" +HOST_LD_KERNEL_ARCH ?= "${TARGET_LD_KERNEL_ARCH}" + +KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc${KERNEL_CCSUFFIX} ${HOST_CC_KERNEL_ARCH}${TOOLCHAIN_OPTIONS}" +KERNEL_LD = "${LD}${KERNEL_LDSUFFIX} ${HOST_LD_KERNEL_ARCH}${TOOLCHAIN_OPTIONS}" + +# Where built kernel lies in the kernel tree +KERNEL_OUTPUT ?= "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" +KERNEL_IMAGEDEST = "boot" + +# +# configuration +# +export CMDLINE_CONSOLE = "console=${@bb.data.getVar("KERNEL_CONSOLE",d,1) or "ttyS0"}" + +KERNEL_VERSION = "${@get_kernelversion('${B}')}" +KERNEL_MAJOR_VERSION = "${@get_kernelmajorversion('${KERNEL_VERSION}')}" + +KERNEL_LOCALVERSION ?= "" + +# kernels are generally machine specific +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# U-Boot support +UBOOT_ENTRYPOINT ?= "20008000" +UBOOT_LOADADDRESS ?= "${UBOOT_ENTRYPOINT}" + +# For the kernel, we don't want the '-e MAKEFLAGS=' in EXTRA_OEMAKE. +# We don't want to override kernel Makefile variables from the environment +EXTRA_OEMAKE = "" + +KERNEL_ALT_IMAGETYPE ??= "" + +kernel_do_compile() { + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE + oe_runmake include/linux/version.h CC="${KERNEL_CC}" LD="${KERNEL_LD}" + if [ "${KERNEL_MAJOR_VERSION}" != "2.6" ]; then + oe_runmake dep CC="${KERNEL_CC}" LD="${KERNEL_LD}" + fi + oe_runmake ${KERNEL_IMAGETYPE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" +} + +do_compile_kernelmodules() { + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE + if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then + oe_runmake modules CC="${KERNEL_CC}" LD="${KERNEL_LD}" + else + oenote "no modules to compile" + fi +} +addtask compile_kernelmodules after do_compile before do_install + +kernel_do_install() { + # + # First install the modules + # + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE + if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then + oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install + else + oenote "no modules to install" + fi + + # + # Install various kernel output (zImage, map file, config, module support files) + # + install -d ${D}/${KERNEL_IMAGEDEST} + install -d ${D}/boot + install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} + install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION} + install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} + install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION} + [ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION} + install -d ${D}/etc/modutils + if [ "${KERNEL_MAJOR_VERSION}" = "2.6" ]; then + install -d ${D}/etc/modprobe.d + fi + + + + # + # Support for external module building - create a minimal copy of the kernel source tree + # + kerneldir=${D}/kernel/ + + # Take care of arch specific headers + # Kernel 2.6.27 moved headers from includes/asm-${ARCH} to arch/${ARCH}/include/asm + if [ -e arch/${ARCH}/include/asm/ ] ; then + install -d $kerneldir/arch/${ARCH}/ + cp -fR arch/${ARCH}/* $kerneldir/arch/${ARCH}/ + + # Check for arch/x86 on i386 + elif [ -d arch/x86/include/asm/ ]; then + if [ -e include/asm ] ; then + install -d $kerneldir/include/asm/ + cp -fR arch/x86/include/asm/* $kerneldir/include/asm/ + fi + install -d $kerneldir/arch/x86/include + cp -fR arch/x86/* $kerneldir/arch/x86/ + fi + + # Take care of the rest of the main directories we need + for entry in drivers/crypto drivers/media include scripts; do + if [ -d $entry ]; then + mkdir -p $kerneldir/$entry + cp -fR $entry/* $kerneldir/$entry/ + fi + done + + install -m 0644 .config $kerneldir/config-${KERNEL_VERSION} + ln -sf config-${KERNEL_VERSION} $kerneldir/.config + ln -sf config-${KERNEL_VERSION} $kerneldir/kernel-config + echo "${KERNEL_VERSION}" >$kerneldir/kernel-abiversion + echo "${S}" >$kerneldir/kernel-source + echo "${KERNEL_CCSUFFIX}" >$kerneldir/kernel-ccsuffix + echo "${KERNEL_LDSUFFIX}" >$kerneldir/kernel-ldsuffix + [ -e vmlinux ] && install -m 0644 vmlinux $kerneldir/ + install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE} + install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION} + [ -e Module.symvers ] && install -m 0644 Module.symvers $kerneldir/ + + # Copy over the main Makefiles + [ -e Rules.make ] && install -m 0644 Rules.make $kerneldir/ + [ -e Makefile ] && install -m 0644 Makefile $kerneldir/ + # Check if arch/${ARCH}/Makefile exists and install it + if [ -e arch/${ARCH}/Makefile ]; then + install -d $kerneldir/arch/${ARCH} + install -m 0644 arch/${ARCH}/Makefile* $kerneldir/arch/${ARCH} + # Otherwise check arch/x86/Makefile for i386 and x86_64 on kernels >= 2.6.24 + elif [ -e arch/x86/Makefile ]; then + install -d $kerneldir/arch/x86 + install -m 0644 arch/x86/Makefile* $kerneldir/arch/x86 + fi + + # Remove the following binaries which cause strip errors + # during do_package for cross-compiled platforms + bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \ + arch/powerpc/boot/mktree scripts/bin2c scripts/conmakehash \ + scripts/ihex2fw scripts/kallsyms scripts/pnmtologo scripts/basic/docproc \ + scripts/basic/fixdep scripts/basic/hash scripts/dtc/dtc \ + scripts/genksyms/genksyms scripts/kconfig/conf scripts/mod/mk_elfconfig \ + scripts/mod/modpost scripts/recordmcount" + rm -rf $kerneldir/scripts/*.o + rm -rf $kerneldir/scripts/basic/*.o + rm -rf $kerneldir/scripts/kconfig/*.o + rm -rf $kerneldir/scripts/mod/*.o + rm -rf $kerneldir/scripts/dtc/*.o + for entry in $bin_files; do + rm -f $kerneldir/$entry + done +} + +sysroot_stage_all_append() { + sysroot_stage_dir ${D}/kernel ${SYSROOT_DESTDIR}/kernel +} + + +kernel_do_configure() { + # Copy defconfig to .config if .config does not exist. This allows + # recipes to manage the .config themselves in do_configure_prepend(). + if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${S}/.config" ]; then + cp "${WORKDIR}/defconfig" "${S}/.config" + fi + + yes '' | oe_runmake oldconfig + + if [ ! -z "${INITRAMFS_IMAGE}" ]; then + for img in cpio.gz cpio.lzo cpio.lzma; do + if [ -e "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" ]; then + cp "${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.$img" initramfs.$img + fi + done + fi +} + +kernel_do_configure[depends] += "${INITRAMFS_TASK}" + +do_menuconfig() { + export DISPLAY='${DISPLAY}' + export DBUS_SESSION_BUS_ADDRESS='${DBUS_SESSION_BUS_ADDRESS}' + export XAUTHORITY='${XAUTHORITY}' + export TERMWINDOWTITLE="${PN} Kernel Configuration" + export SHELLCMDS="make menuconfig" + ${TERMCMDRUN} + if [ $? -ne 0 ]; then + echo "Fatal: '${TERMCMD}' not found. Check TERMCMD variable." + exit 1 + fi +} +do_menuconfig[nostamp] = "1" +addtask menuconfig after do_patch + +pkg_postinst_kernel () { + cd /${KERNEL_IMAGEDEST}; update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true +} + +pkg_postrm_kernel () { + cd /${KERNEL_IMAGEDEST}; update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true +} + +inherit cml1 + +EXPORT_FUNCTIONS do_compile do_install do_configure + +# kernel-base becomes kernel-${KERNEL_VERSION} +# kernel-image becomes kernel-image-${KERNEL_VERISON} +PACKAGES = "kernel kernel-base kernel-image kernel-dev kernel-vmlinux kernel-misc" +FILES = "" +FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*" +FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config*" +FILES_kernel-vmlinux = "/boot/vmlinux*" +# misc is a package to contain files we need in staging +FILES_kernel-misc = "/kernel/include/config /kernel/scripts /kernel/drivers/crypto /kernel/drivers/media" +RDEPENDS_kernel = "kernel-base" +# Allow machines to override this dependency if kernel image files are +# not wanted in images as standard +RDEPENDS_kernel-base ?= "kernel-image" +PKG_kernel-image = "kernel-image-${KERNEL_VERSION}" +PKG_kernel-base = "kernel-${KERNEL_VERSION}" +ALLOW_EMPTY_kernel = "1" +ALLOW_EMPTY_kernel-base = "1" +ALLOW_EMPTY_kernel-image = "1" + +# Userspace workarounds for kernel modules issues +# This is shame, fix the kernel instead! +DEPENDS_kernel-module-dtl1-cs = "bluez-dtl1-workaround" +RDEPENDS_kernel-module-dtl1-cs = "bluez-dtl1-workaround" + +pkg_postinst_kernel-image () { +if [ ! -e "$D/lib/modules/${KERNEL_VERSION}" ]; then + mkdir -p $D/lib/modules/${KERNEL_VERSION} +fi +if [ -n "$D" ]; then + ${HOST_PREFIX}depmod-${KERNEL_MAJOR_VERSION} -A -b $D -F ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} ${KERNEL_VERSION} +else + depmod -a +fi +} + +pkg_postinst_modules () { +if [ -n "$D" ]; then + ${HOST_PREFIX}depmod-${KERNEL_MAJOR_VERSION} -A -b $D -F ${STAGING_KERNEL_DIR}/System.map-${KERNEL_VERSION} ${KERNEL_VERSION} +else + depmod -a + update-modules || true +fi +} + +pkg_postrm_modules () { +update-modules || true +} + +autoload_postinst_fragment() { +if [ x"$D" = "x" ]; then + modprobe %s || true +fi +} + +# autoload defaults (alphabetically sorted) +module_autoload_hidp = "hidp" +module_autoload_ipv6 = "ipv6" +module_autoload_ipsec = "ipsec" +module_autoload_ircomm-tty = "ircomm-tty" +module_autoload_rfcomm = "rfcomm" +module_autoload_sa1100-rtc = "sa1100-rtc" +# sa1100-rtc was renamed in 2.6.23 onwards +module_autoload_rtc-sa1100 = "rtc-sa1100" + +# alias defaults (alphabetically sorted) +module_conf_af_packet = "alias net-pf-17 af_packet" +module_conf_bluez = "alias net-pf-31 bluez" +module_conf_bnep = "alias bt-proto-4 bnep" +module_conf_hci_uart = "alias tty-ldisc-15 hci_uart" +module_conf_l2cap = "alias bt-proto-0 l2cap" +module_conf_sco = "alias bt-proto-2 sco" +module_conf_rfcomm = "alias bt-proto-3 rfcomm" + +python populate_packages_prepend () { + def extract_modinfo(file): + import tempfile, re + tempfile.tempdir = bb.data.getVar("WORKDIR", d, 1) + tf = tempfile.mkstemp() + tmpfile = tf[1] + cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (bb.data.getVar("PATH", d, 1), bb.data.getVar("HOST_PREFIX", d, 1) or "", file, tmpfile) + os.system(cmd) + f = open(tmpfile) + l = f.read().split("\000") + f.close() + os.close(tf[0]) + os.unlink(tmpfile) + exp = re.compile("([^=]+)=(.*)") + vals = {} + for i in l: + m = exp.match(i) + if not m: + continue + vals[m.group(1)] = m.group(2) + return vals + + def parse_depmod(): + import re + + dvar = bb.data.getVar('PKGD', d, 1) + if not dvar: + bb.error("PKGD not defined") + return + + kernelver = bb.data.getVar('KERNEL_VERSION', d, 1) + kernelver_stripped = kernelver + m = re.match('^(.*-hh.*)[\.\+].*$', kernelver) + if m: + kernelver_stripped = m.group(1) + path = bb.data.getVar("PATH", d, 1) + host_prefix = bb.data.getVar("HOST_PREFIX", d, 1) or "" + major_version = bb.data.getVar('KERNEL_MAJOR_VERSION', d, 1) + + cmd = "PATH=\"%s\" %sdepmod-%s -n -a -r -b %s -F %s/boot/System.map-%s %s" % (path, host_prefix, major_version, dvar, dvar, kernelver, kernelver_stripped) + f = os.popen(cmd, 'r') + + deps = {} + pattern0 = "^(.*\.k?o):..*$" + pattern1 = "^(.*\.k?o):\s*(.*\.k?o)\s*$" + pattern2 = "^(.*\.k?o):\s*(.*\.k?o)\s*\\\$" + pattern3 = "^\t(.*\.k?o)\s*\\\$" + pattern4 = "^\t(.*\.k?o)\s*$" + + line = f.readline() + while line: + if not re.match(pattern0, line): + line = f.readline() + continue + m1 = re.match(pattern1, line) + if m1: + deps[m1.group(1)] = m1.group(2).split() + else: + m2 = re.match(pattern2, line) + if m2: + deps[m2.group(1)] = m2.group(2).split() + line = f.readline() + m3 = re.match(pattern3, line) + while m3: + deps[m2.group(1)].extend(m3.group(1).split()) + line = f.readline() + m3 = re.match(pattern3, line) + m4 = re.match(pattern4, line) + deps[m2.group(1)].extend(m4.group(1).split()) + line = f.readline() + f.close() + return deps + + def get_dependencies(file, pattern, format): + # file no longer includes PKGD + file = file.replace(bb.data.getVar('PKGD', d, 1) or '', '', 1) + # instead is prefixed with /lib/modules/${KERNEL_VERSION} + file = file.replace("/lib/modules/%s/" % bb.data.getVar('KERNEL_VERSION', d, 1) or '', '', 1) + + if module_deps.has_key(file): + import re + dependencies = [] + for i in module_deps[file]: + m = re.match(pattern, os.path.basename(i)) + if not m: + continue + on = legitimize_package_name(m.group(1)) + dependency_pkg = format % on + dependencies.append(dependency_pkg) + return dependencies + return [] + + def frob_metadata(file, pkg, pattern, format, basename): + import re + vals = extract_modinfo(file) + + dvar = bb.data.getVar('PKGD', d, 1) + + # If autoloading is requested, output /etc/modutils/ and append + # appropriate modprobe commands to the postinst + autoload = bb.data.getVar('module_autoload_%s' % basename, d, 1) + if autoload: + name = '%s/etc/modutils/%s' % (dvar, basename) + f = open(name, 'w') + for m in autoload.split(): + f.write('%s\n' % m) + f.close() + postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) + if not postinst: + bb.fatal("pkg_postinst_%s not defined" % pkg) + postinst += bb.data.getVar('autoload_postinst_fragment', d, 1) % autoload + bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) + + # Write out any modconf fragment + modconf = bb.data.getVar('module_conf_%s' % basename, d, 1) + if modconf: + if bb.data.getVar("KERNEL_MAJOR_VERSION", d, 1) == "2.6": + name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) + else: + name = '%s/etc/modutils/%s.conf' % (dvar, basename) + f = open(name, 'w') + f.write("%s\n" % modconf) + f.close() + + files = bb.data.getVar('FILES_%s' % pkg, d, 1) + files = "%s /etc/modutils/%s /etc/modutils/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename, basename) + bb.data.setVar('FILES_%s' % pkg, files, d) + + if vals.has_key("description"): + old_desc = bb.data.getVar('DESCRIPTION_' + pkg, d, 1) or "" + bb.data.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"], d) + + rdepends_str = bb.data.getVar('RDEPENDS_' + pkg, d, 1) + if rdepends_str: + rdepends = rdepends_str.split() + else: + rdepends = [] + rdepends.extend(get_dependencies(file, pattern, format)) + bb.data.setVar('RDEPENDS_' + pkg, ' '.join(rdepends), d) + + module_deps = parse_depmod() + module_regex = '^(.*)\.k?o$' + module_pattern = 'kernel-module-%s' + + postinst = bb.data.getVar('pkg_postinst_modules', d, 1) + postrm = bb.data.getVar('pkg_postrm_modules', d, 1) + do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') + do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') + do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % bb.data.getVar("KERNEL_VERSION", d, 1)) + + import re + metapkg = "kernel-modules" + bb.data.setVar('ALLOW_EMPTY_' + metapkg, "1", d) + bb.data.setVar('FILES_' + metapkg, "", d) + blacklist = [ 'kernel-dev', 'kernel-image', 'kernel-base', 'kernel-vmlinux', 'perf' ] + for l in module_deps.values(): + for i in l: + pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) + blacklist.append(pkg) + metapkg_rdepends = [] + packages = bb.data.getVar('PACKAGES', d, 1).split() + for pkg in packages[1:]: + if not pkg in blacklist and not pkg in metapkg_rdepends: + metapkg_rdepends.append(pkg) + bb.data.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends), d) + bb.data.setVar('DESCRIPTION_' + metapkg, 'Kernel modules meta package', d) + packages.append(metapkg) + bb.data.setVar('PACKAGES', ' '.join(packages), d) +} + +# Support checking the kernel size since some kernels need to reside in partitions +# with a fixed length or there is a limit in transferring the kernel to memory +do_sizecheck() { + if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then + size=`ls -l arch/${ARCH}/boot/${KERNEL_IMAGETYPE} | awk '{ print $5}'` + if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then + rm arch/${ARCH}/boot/${KERNEL_IMAGETYPE} + die "This kernel (size=$size > ${KERNEL_IMAGE_MAXSIZE}) is too big for your device. Please reduce the size of the kernel by making more of it modular." + fi + fi +} + +addtask sizecheck before do_install after do_compile + +do_uboot_mkimage() { + if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then + ENTRYPOINT=${UBOOT_ENTRYPOINT} + if test -n "${UBOOT_ENTRYSYMBOL}"; then + ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \ + awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'` + fi + if test -e arch/${ARCH}/boot/compressed/vmlinux ; then + ${OBJCOPY} -O binary -R .note -R .comment -S arch/${ARCH}/boot/compressed/vmlinux linux.bin + uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage + rm -f linux.bin + else + ${OBJCOPY} -O binary -R .note -R .comment -S vmlinux linux.bin + rm -f linux.bin.gz + gzip -9 linux.bin + uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C gzip -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin.gz arch/${ARCH}/boot/uImage + rm -f linux.bin.gz + fi + fi +} + +addtask uboot_mkimage before do_install after do_compile + +KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PV}-${PR}-${MACHINE}-${DATETIME}" +# Don't include the DATETIME variable in the sstate package signatures +KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" +KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" + +kernel_do_deploy() { + install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin + if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then + tar -cvzf ${DEPLOYDIR}/modules-${KERNEL_VERSION}-${PR}-${MACHINE}.tgz -C ${D} lib + fi + + cd ${DEPLOYDIR} + rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.bin + ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${KERNEL_IMAGE_SYMLINK_NAME}.bin +} +do_deploy[dirs] = "${DEPLOYDIR} ${B}" + +addtask deploy before do_package after do_install + +EXPORT_FUNCTIONS do_deploy + +# perf must be enabled in individual kernel recipes +PACKAGES =+ "perf" +FILES_perf = "${bindir}/* \ + ${libexecdir}" diff --git a/meta-oe/classes/mime.bbclass b/meta-oe/classes/mime.bbclass new file mode 100644 index 0000000000..b9cdd7becd --- /dev/null +++ b/meta-oe/classes/mime.bbclass @@ -0,0 +1,56 @@ +DEPENDS += "shared-mime-info-native shared-mime-info" + +mime_postinst() { +if [ "$1" = configure ]; then + if [ -x ${bindir}/update-mime-database ] ; then + echo "Updating MIME database... this may take a while." + update-mime-database $D${datadir}/mime + else + echo "Missing ${bindir}/update-mime-database, update of mime database failed!" + exit 1 + fi +fi +} + +mime_postrm() { +if [ "$1" = remove ] || [ "$1" = upgrade ]; then + if [ -x ${bindir}/update-mime-database ] ; then + echo "Updating MIME database... this may take a while." + update-mime-database $D${datadir}/mime + else + echo "Missing ${bindir}/update-mime-database, update of mime database failed!" + exit 1 + fi +fi +} + +python ppopulate_packages_append () { + import os.path, re + packages = bb.data.getVar('PACKAGES', d, 1).split() + pkgdest = bb.data.getVar('PKGDEST', d, 1) + + for pkg in packages: + mime_dir = '%s/%s/usr/share/mime/packages' % (pkgdest, pkg) + mimes = [] + mime_re = re.compile(".*\.xml$") + if os.path.exists(mime_dir): + for f in os.listdir(mime_dir): + if mime_re.match(f): + mimes.append(f) + if mimes != []: + bb.note("adding mime postinst and postrm scripts to %s" % pkg) + postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) + if not postinst: + postinst = '#!/bin/sh\n' + postinst += bb.data.getVar('mime_postinst', d, 1) + bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) + postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1) + if not postrm: + postrm = '#!/bin/sh\n' + postrm += bb.data.getVar('mime_postrm', d, 1) + bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) + bb.note("adding freedesktop-mime-info dependency to %s" % pkg) + rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") + rdepends.append("freedesktop-mime-info") + bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) +} diff --git a/meta-oe/classes/qmake_base.bbclass b/meta-oe/classes/qmake_base.bbclass new file mode 100644 index 0000000000..577c0fab3b --- /dev/null +++ b/meta-oe/classes/qmake_base.bbclass @@ -0,0 +1,91 @@ + +OE_QMAKE_PLATFORM = "${TARGET_OS}-oe-g++" +QMAKESPEC = "${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}" + +# We override this completely to eliminate the -e normally passed in +EXTRA_OEMAKE = ' MAKEFLAGS= ' + +export OE_QMAKE_CC="${CC}" +export OE_QMAKE_CFLAGS="${CFLAGS}" +export OE_QMAKE_CXX="${CXX}" +export OE_QMAKE_LDFLAGS="${LDFLAGS}" +export OE_QMAKE_AR="${AR}" +export OE_QMAKE_STRIP="echo" +export OE_QMAKE_RPATH="-Wl,-rpath-link," + +# do not export STRIP to the environment +STRIP[unexport] = "1" + +# default to qte2 via bb.conf, inherit qt3x11 to configure for qt3x11 + +oe_qmake_mkspecs () { + mkdir -p mkspecs/${OE_QMAKE_PLATFORM} + for f in ${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}/*; do + if [ -L $f ]; then + lnk=`readlink $f` + if [ -f mkspecs/${OE_QMAKE_PLATFORM}/$lnk ]; then + ln -s $lnk mkspecs/${OE_QMAKE_PLATFORM}/`basename $f` + else + cp $f mkspecs/${OE_QMAKE_PLATFORM}/ + fi + else + cp $f mkspecs/${OE_QMAKE_PLATFORM}/ + fi + done +} + +qmake_base_do_configure() { + case ${QMAKESPEC} in + *linux-oe-g++|*linux-uclibc-oe-g++|*linux-gnueabi-oe-g++|*linux-uclibceabi-oe-g++) + ;; + *-oe-g++) + die Unsupported target ${TARGET_OS} for oe-g++ qmake spec + ;; + *) + oenote Searching for qmake spec file + paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-${TARGET_ARCH}-g++" + paths="${QMAKE_MKSPEC_PATH}/${TARGET_OS}-g++ $paths" + + if (echo "${TARGET_ARCH}"|grep -q 'i.86'); then + paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-x86-g++ $paths" + fi + for i in $paths; do + if test -e $i; then + export QMAKESPEC=$i + break + fi + done + ;; + esac + + oenote "using qmake spec in ${QMAKESPEC}, using profiles '${QMAKE_PROFILES}'" + + if [ -z "${QMAKE_PROFILES}" ]; then + PROFILES="`ls *.pro`" + else + PROFILES="${QMAKE_PROFILES}" + fi + + if [ -z "$PROFILES" ]; then + die "QMAKE_PROFILES not set and no profiles found in $PWD" + fi + + if [ ! -z "${EXTRA_QMAKEVARS_POST}" ]; then + AFTER="-after" + QMAKE_VARSUBST_POST="${EXTRA_QMAKEVARS_POST}" + oenote "qmake postvar substitution: ${EXTRA_QMAKEVARS_POST}" + fi + + if [ ! -z "${EXTRA_QMAKEVARS_PRE}" ]; then + QMAKE_VARSUBST_PRE="${EXTRA_QMAKEVARS_PRE}" + oenote "qmake prevar substitution: ${EXTRA_QMAKEVARS_PRE}" + fi + +#oenote "Calling '${OE_QMAKE_QMAKE} -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST'" + unset QMAKESPEC || true + ${OE_QMAKE_QMAKE} -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST || die "Error calling ${OE_QMAKE_QMAKE} on $PROFILES" +} + +EXPORT_FUNCTIONS do_configure + +addtask configure after do_unpack do_patch before do_compile diff --git a/meta-oe/classes/qt4e.bbclass b/meta-oe/classes/qt4e.bbclass new file mode 100644 index 0000000000..303b79b8a6 --- /dev/null +++ b/meta-oe/classes/qt4e.bbclass @@ -0,0 +1,17 @@ +DEPENDS_prepend = "${@["qt4-embedded ", ""][(bb.data.getVar('PN', d, 1)[:12] == 'qt4-embedded')]}" +inherit qmake2 + +QT_DIR_NAME = "qtopia" +QT_LIBINFIX = "E" +# override variables set by qmake-base to compile Qt/Embedded apps +# +export QMAKESPEC = "${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/${TARGET_OS}-oe-g++" +export OE_QMAKE_INCDIR_QT = "${STAGING_INCDIR}/${QT_DIR_NAME}" +export OE_QMAKE_LIBDIR_QT = "${STAGING_LIBDIR}" +export OE_QMAKE_LIBS_QT = "qt" +export OE_QMAKE_LIBS_X11 = "" +export OE_QMAKE_EXTRA_MODULES = "network" +EXTRA_QMAKEVARS_PRE += " QT_LIBINFIX=${QT_LIBINFIX} " + +# Qt4 uses atomic instructions not supported in thumb mode +ARM_INSTRUCTION_SET = "arm" diff --git a/meta-oe/classes/siteinfo.bbclass b/meta-oe/classes/siteinfo.bbclass new file mode 100644 index 0000000000..c0db539e29 --- /dev/null +++ b/meta-oe/classes/siteinfo.bbclass @@ -0,0 +1,218 @@ +# This class exists to provide information about the targets that +# may be needed by other classes and/or recipes. If you add a new +# target this will probably need to be updated. + +# +# Returns information about 'what' for the named target 'target' +# where 'target' == "-" +# +# 'what' can be one of +# * target: Returns the target name ("-") +# * endianess: Return "be" for big endian targets, "le" for little endian +# * bits: Returns the bit size of the target, either "32" or "64" +# * libc: Returns the name of the c library used by the target +# +# It is an error for the target not to exist. +# If 'what' doesn't exist then an empty value is returned +# +def siteinfo_data(d): + archinfo = { + "arm": "endian-little bit-32 arm-common", + "armeb": "endian-big bit-32 arm-common", + "avr32": "endian-big bit-32 avr32-common", + "bfin": "endian-little bit-32 bfin-common", + "i386": "endian-little bit-32 ix86-common", + "i486": "endian-little bit-32 ix86-common", + "i586": "endian-little bit-32 ix86-common", + "i686": "endian-little bit-32 ix86-common", + "ia64": "endian-little bit-64", + "mips": "endian-big bit-32 mips-common", + "mips64": "endian-big bit-64 mips64-common", + "mips64el": "endian-little bit-64 mips64-common", + "mipsel": "endian-little bit-32 mips-common", + "powerpc": "endian-big bit-32 powerpc-common", + "nios2": "endian-little bit-32 nios2-common", + "powerpc64": "endian-big bit-64 powerpc-common powerpc64-linux", + "ppc": "endian-big bit-32 powerpc-common", + "ppc64": "endian-big bit-64 powerpc-common powerpc64-linux", + "sh3": "endian-little bit-32 sh-common", + "sh4": "endian-little bit-32 sh-common", + "sparc": "endian-big bit-32", + "viac3": "endian-little bit-32 ix86-common", + "x86_64": "endian-little bit-64", + } + osinfo = { + "darwin": "common-darwin", + "darwin9": "common-darwin", + "linux": "common-linux common-glibc", + "linux-gnueabi": "common-linux common-glibc", + "linux-gnuspe": "common-linux common-glibc", + "linux-uclibc": "common-linux common-uclibc", + "linux-uclibceabi": "common-linux common-uclibc", + "linux-uclibcspe": "common-linux common-uclibc", + "uclinux-uclibc": "common-uclibc", + "cygwin": "common-cygwin", + "mingw32": "common-mingw", + } + targetinfo = { + "arm-linux-gnueabi": "arm-linux", + "arm-linux-uclibceabi": "arm-linux-uclibc", + "armeb-linux-gnueabi": "armeb-linux", + "armeb-linux-uclibceabi": "armeb-linux-uclibc", + "powerpc-linux-gnuspe": "powerpc-linux", + "powerpc-linux-uclibcspe": "powerpc-linux-uclibc", + } + + arch = d.getVar("HOST_ARCH", True) + os = d.getVar("HOST_OS", True) + target = "%s-%s" % (arch, os) + + sitedata = [] + if arch in archinfo: + sitedata.extend(archinfo[arch].split()) + if os in osinfo: + sitedata.extend(osinfo[os].split()) + if target in targetinfo: + sitedata.extend(targetinfo[target].split()) + sitedata.append(target) + sitedata.append("common") + + return sitedata + +python () { + sitedata = set(siteinfo_data(d)) + if "endian-little" in sitedata: + d.setVar("SITEINFO_ENDIANNESS", "le") + elif "endian-big" in sitedata: + d.setVar("SITEINFO_ENDIANNESS", "be") + else: + bb.error("Unable to determine endianness for architecture '%s'" % + d.getVar("HOST_ARCH", True)) + bb.fatal("Please add your architecture to siteinfo.bbclass") + + if "bit-32" in sitedata: + d.setVar("SITEINFO_BITS", "32") + elif "bit-64" in sitedata: + d.setVar("SITEINFO_BITS", "64") + else: + bb.error("Unable to determine bit size for architecture '%s'" % + d.getVar("HOST_ARCH", True)) + bb.fatal("Please add your architecture to siteinfo.bbclass") +} + +# Old class from yocto pasted in below for compat + +def get_siteinfo_list(d): + target = bb.data.getVar('HOST_ARCH', d, 1) + "-" + bb.data.getVar('HOST_OS', d, 1) + + targetinfo = {\ + "armeb-linux": "endian-big bit-32 common-glibc arm-common",\ + "armeb-linux-gnueabi": "endian-big bit-32 common-glibc arm-common armeb-linux",\ + "armeb-linux-uclibc": "endian-big bit-32 common-uclibc arm-common",\ + "armeb-linux-uclibcgnueabi": "endian-big bit-32 common-uclibc arm-common armeb-linux-uclibc",\ + "arm-darwin": "endian-little bit-32 common-darwin",\ + "arm-darwin8": "endian-little bit-32 common-darwin",\ + "arm-linux": "endian-little bit-32 common-glibc arm-common",\ + "arm-linux-gnueabi": "endian-little bit-32 common-glibc arm-common arm-linux",\ + "arm-linux-uclibc": "endian-little bit-32 common-uclibc arm-common",\ + "arm-linux-uclibcgnueabi": "endian-little bit-32 common-uclibc arm-common arm-linux-uclibc",\ + "avr32-linux": "endian-big bit-32 common-glibc avr32-common",\ + "avr32-linux-uclibc": "endian-big bit-32 common-uclibc avr32-common",\ + "bfin-uclinux-uclibc": "endian-little bit-32 common-uclibc bfin-common",\ + "i386-linux": "endian-little bit-32 common-glibc ix86-common",\ + "i486-linux": "endian-little bit-32 common-glibc ix86-common",\ + "i586-linux": "endian-little bit-32 common-glibc ix86-common",\ + "i686-linux": "endian-little bit-32 common-glibc ix86-common",\ + "i386-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ + "i486-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ + "i586-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ + "i686-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ + "mipsel-linux": "endian-little bit-32 common-glibc mips-common",\ + "mipsel-linux-uclibc": "endian-little bit-32 common-uclibc mips-common",\ + "mips-linux": "endian-big bit-32 common-glibc mips-common",\ + "mips-linux-uclibc": "endian-big bit-32 common-uclibc mips-common",\ + "powerpc-darwin": "endian-big bit-32 common-darwin",\ + "ppc-linux": "endian-big bit-32 common-glibc powerpc-common",\ + "powerpc-linux": "endian-big bit-32 common-glibc powerpc-common",\ + "powerpc-linux-uclibc": "endian-big bit-32 common-uclibc powerpc-common",\ + "sh3-linux": "endian-little bit-32 common-glibc sh-common",\ + "sh4-linux": "endian-little bit-32 common-glibc sh-common",\ + "sh4-linux-uclibc": "endian-little bit-32 common-uclibc sh-common",\ + "sparc-linux": "endian-big bit-32 common-glibc",\ + "x86_64-linux": "endian-little bit-64 common-glibc",\ + "x86_64-linux-uclibc": "endian-little bit-64 common-uclibc"} + if target in targetinfo: + info = targetinfo[target].split() + info.append(target) + info.append("common") + return info + else: + bb.error("Information not available for target '%s'" % target) + + +# +# Define which site files to use. We check for several site files and +# use each one that is found, based on the list returned by get_siteinfo_list() +# +# Search for the files in the following directories: +# 1) ${BBPATH}/site (in reverse) - app specific, then site wide +# 2) ${FILE_DIRNAME}/site-${PV} - app version specific +# +def siteinfo_get_files(d): + sitefiles = "" + + # Determine which site files to look for + sites = get_siteinfo_list(d) + + # Check along bbpath for site files and append in reverse order so + # the application specific sites files are last and system site + # files first. + path_bb = bb.data.getVar('BBPATH', d, 1) + for p in (path_bb or "").split(':'): + tmp = "" + for i in sites: + fname = os.path.join(p, 'site', i) + if os.path.exists(fname): + tmp += fname + " " + sitefiles = tmp + sitefiles; + + # Now check for the applications version specific site files + path_pkgv = os.path.join(bb.data.getVar('FILE_DIRNAME', d, 1), "site-" + bb.data.getVar('PV', d, 1)) + for i in sites: + fname = os.path.join(path_pkgv, i) + if os.path.exists(fname): + sitefiles += fname + " " + + # Now check for siteconfig cache files + path_siteconfig = bb.data.getVar('SITECONFIG_SYSROOTCACHE', d, 1) + if os.path.isdir(path_siteconfig): + for i in os.listdir(path_siteconfig): + fname = os.path.join(path_siteconfig, i) + sitefiles += fname + " " + + bb.debug(1, "SITE files " + sitefiles); + return sitefiles + +def siteinfo_get_endianess(d): + info = get_siteinfo_list(d) + if 'endian-little' in info: + return "le" + elif 'endian-big' in info: + return "be" + bb.error("Site info could not determine endianess for target") + +def siteinfo_get_bits(d): + info = get_siteinfo_list(d) + if 'bit-32' in info: + return "32" + elif 'bit-64' in info: + return "64" + bb.error("Site info could not determine bit size for target") + +# +# Make some information available via variables +# +SITEINFO_ENDIANESS = "${@siteinfo_get_endianess(d)}" +SITEINFO_BITS = "${@siteinfo_get_bits(d)}" +SITECONFIG_SYSROOTCACHE = "${STAGING_DATADIR}/${TARGET_SYS}_config_site.d" + -- cgit 1.2.3-korg