From b2f192faabe412adce79534e22efe9fb69ee40e2 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 21 Jul 2006 10:10:31 +0000 Subject: Rename /openembedded/ -> /meta/ git-svn-id: https://svn.o-hand.com/repos/poky/trunk@530 311d38ba-8fff-0310-9ca6-ca027cbcb966 --- meta/classes/autotools.bbclass | 182 +++++++ meta/classes/base.bbclass | 793 ++++++++++++++++++++++++++++++ meta/classes/base_srpm.bbclass | 20 + meta/classes/binconfig.bbclass | 36 ++ meta/classes/ccache.inc | 11 + meta/classes/ccdv.bbclass | 21 + meta/classes/cml1.bbclass | 8 + meta/classes/cpan.bbclass | 20 + meta/classes/cross.bbclass | 55 +++ meta/classes/debian.bbclass | 101 ++++ meta/classes/distutils-base.bbclass | 14 + meta/classes/distutils.bbclass | 15 + meta/classes/e.bbclass | 37 ++ meta/classes/efl.bbclass | 49 ++ meta/classes/flow-lossage.bbclass | 5 + meta/classes/gconf.bbclass | 59 +++ meta/classes/gettext.bbclass | 12 + meta/classes/gnome.bbclass | 20 + meta/classes/gpe.bbclass | 17 + meta/classes/gtk-icon-cache.bbclass | 38 ++ meta/classes/icecc.bbclass | 156 ++++++ meta/classes/image_ipk.bbclass | 76 +++ meta/classes/kernel-arch.bbclass | 26 + meta/classes/kernel.bbclass | 435 ++++++++++++++++ meta/classes/lib_package.bbclass | 9 + meta/classes/linux_modules.bbclass | 19 + meta/classes/manifest.bbclass | 80 +++ meta/classes/module-base.bbclass | 25 + meta/classes/module.bbclass | 51 ++ meta/classes/module_strip.bbclass | 18 + meta/classes/mozilla.bbclass | 53 ++ meta/classes/multimachine.bbclass | 22 + meta/classes/native.bbclass | 95 ++++ meta/classes/nslu2-jffs2-image.bbclass | 18 + meta/classes/nslu2-mirrors.bbclass | 4 + meta/classes/nslu2-ramdisk-image.bbclass | 18 + meta/classes/nylon-mirrors.bbclass | 6 + meta/classes/oebuildstamp.bbclass | 16 + meta/classes/oelint.bbclass | 174 +++++++ meta/classes/opie.bbclass | 105 ++++ meta/classes/opie_i18n.bbclass | 163 ++++++ meta/classes/package.bbclass | 729 +++++++++++++++++++++++++++ meta/classes/package_ipk.bbclass | 234 +++++++++ meta/classes/package_rpm.bbclass | 133 +++++ meta/classes/package_tar.bbclass | 99 ++++ meta/classes/palmtop.bbclass | 20 + meta/classes/patcher.bbclass | 7 + meta/classes/pkg_distribute.bbclass | 29 ++ meta/classes/pkg_metainfo.bbclass | 22 + meta/classes/pkgconfig.bbclass | 28 ++ meta/classes/poky.bbclass | 4 + meta/classes/qmake-base.bbclass | 44 ++ meta/classes/qmake.bbclass | 57 +++ meta/classes/qpf.bbclass | 36 ++ meta/classes/qt3e.bbclass | 11 + meta/classes/qt3x11.bbclass | 15 + meta/classes/qt4x11.bbclass | 17 + meta/classes/rm_work.bbclass | 22 + meta/classes/rootfs_ipk.bbclass | 145 ++++++ meta/classes/rpm_core.bbclass | 16 + meta/classes/sanity.bbclass | 112 +++++ meta/classes/scons.bbclass | 13 + meta/classes/sdk.bbclass | 26 + meta/classes/sdl.bbclass | 44 ++ meta/classes/sip.bbclass | 58 +++ meta/classes/sourcepkg.bbclass | 111 +++++ meta/classes/src_distribute.bbclass | 40 ++ meta/classes/src_distribute_local.bbclass | 31 ++ meta/classes/srec.bbclass | 28 ++ meta/classes/tinderclient.bbclass | 332 +++++++++++++ meta/classes/tmake.bbclass | 77 +++ meta/classes/update-alternatives.bbclass | 33 ++ meta/classes/update-rc.d.bbclass | 69 +++ meta/classes/wrt-image.bbclass | 33 ++ meta/classes/xfce.bbclass | 19 + meta/classes/xlibs.bbclass | 15 + 76 files changed, 5791 insertions(+) create mode 100644 meta/classes/autotools.bbclass create mode 100644 meta/classes/base.bbclass create mode 100644 meta/classes/base_srpm.bbclass create mode 100644 meta/classes/binconfig.bbclass create mode 100644 meta/classes/ccache.inc create mode 100644 meta/classes/ccdv.bbclass create mode 100644 meta/classes/cml1.bbclass create mode 100644 meta/classes/cpan.bbclass create mode 100644 meta/classes/cross.bbclass create mode 100644 meta/classes/debian.bbclass create mode 100644 meta/classes/distutils-base.bbclass create mode 100644 meta/classes/distutils.bbclass create mode 100644 meta/classes/e.bbclass create mode 100644 meta/classes/efl.bbclass create mode 100644 meta/classes/flow-lossage.bbclass create mode 100644 meta/classes/gconf.bbclass create mode 100644 meta/classes/gettext.bbclass create mode 100644 meta/classes/gnome.bbclass create mode 100644 meta/classes/gpe.bbclass create mode 100644 meta/classes/gtk-icon-cache.bbclass create mode 100644 meta/classes/icecc.bbclass create mode 100644 meta/classes/image_ipk.bbclass create mode 100644 meta/classes/kernel-arch.bbclass create mode 100644 meta/classes/kernel.bbclass create mode 100644 meta/classes/lib_package.bbclass create mode 100644 meta/classes/linux_modules.bbclass create mode 100644 meta/classes/manifest.bbclass create mode 100644 meta/classes/module-base.bbclass create mode 100644 meta/classes/module.bbclass create mode 100644 meta/classes/module_strip.bbclass create mode 100644 meta/classes/mozilla.bbclass create mode 100644 meta/classes/multimachine.bbclass create mode 100644 meta/classes/native.bbclass create mode 100644 meta/classes/nslu2-jffs2-image.bbclass create mode 100644 meta/classes/nslu2-mirrors.bbclass create mode 100644 meta/classes/nslu2-ramdisk-image.bbclass create mode 100644 meta/classes/nylon-mirrors.bbclass create mode 100644 meta/classes/oebuildstamp.bbclass create mode 100644 meta/classes/oelint.bbclass create mode 100644 meta/classes/opie.bbclass create mode 100644 meta/classes/opie_i18n.bbclass create mode 100644 meta/classes/package.bbclass create mode 100644 meta/classes/package_ipk.bbclass create mode 100644 meta/classes/package_rpm.bbclass create mode 100644 meta/classes/package_tar.bbclass create mode 100644 meta/classes/palmtop.bbclass create mode 100644 meta/classes/patcher.bbclass create mode 100644 meta/classes/pkg_distribute.bbclass create mode 100644 meta/classes/pkg_metainfo.bbclass create mode 100644 meta/classes/pkgconfig.bbclass create mode 100644 meta/classes/poky.bbclass create mode 100644 meta/classes/qmake-base.bbclass create mode 100644 meta/classes/qmake.bbclass create mode 100644 meta/classes/qpf.bbclass create mode 100644 meta/classes/qt3e.bbclass create mode 100644 meta/classes/qt3x11.bbclass create mode 100644 meta/classes/qt4x11.bbclass create mode 100644 meta/classes/rm_work.bbclass create mode 100644 meta/classes/rootfs_ipk.bbclass create mode 100644 meta/classes/rpm_core.bbclass create mode 100644 meta/classes/sanity.bbclass create mode 100644 meta/classes/scons.bbclass create mode 100644 meta/classes/sdk.bbclass create mode 100644 meta/classes/sdl.bbclass create mode 100644 meta/classes/sip.bbclass create mode 100644 meta/classes/sourcepkg.bbclass create mode 100644 meta/classes/src_distribute.bbclass create mode 100644 meta/classes/src_distribute_local.bbclass create mode 100644 meta/classes/srec.bbclass create mode 100644 meta/classes/tinderclient.bbclass create mode 100644 meta/classes/tmake.bbclass create mode 100644 meta/classes/update-alternatives.bbclass create mode 100644 meta/classes/update-rc.d.bbclass create mode 100644 meta/classes/wrt-image.bbclass create mode 100644 meta/classes/xfce.bbclass create mode 100644 meta/classes/xlibs.bbclass (limited to 'meta/classes') diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass new file mode 100644 index 0000000000..927e3432b7 --- /dev/null +++ b/meta/classes/autotools.bbclass @@ -0,0 +1,182 @@ +inherit base + +def autotools_dep_prepend(d): + import bb; + + if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1): + return '' + + pn = bb.data.getVar('PN', d, 1) + deps = '' + + if pn in ['autoconf-native', 'automake-native']: + return deps + deps += 'autoconf-native automake-native ' + + if not pn in ['libtool', 'libtool-native', 'libtool-cross']: + deps += 'libtool-native ' + + return deps + 'gnu-config-native ' + +EXTRA_OEMAKE = "" +DEPENDS_prepend = "${@autotools_dep_prepend(d)}" +acpaths = "default" +EXTRA_AUTORECONF = "--exclude=autopoint" + +def autotools_set_crosscompiling(d): + import bb + if not bb.data.inherits_class('native', d): + return " cross_compiling=yes" + return "" + +# EXTRA_OECONF_append = "${@autotools_set_crosscompiling(d)}" + +oe_runconf () { + if [ -x ${S}/configure ] ; then + cfgcmd="${S}/configure \ + --build=${BUILD_SYS} \ + --host=${HOST_SYS} \ + --target=${TARGET_SYS} \ + --prefix=${prefix} \ + --exec_prefix=${exec_prefix} \ + --bindir=${bindir} \ + --sbindir=${sbindir} \ + --libexecdir=${libexecdir} \ + --datadir=${datadir} \ + --sysconfdir=${sysconfdir} \ + --sharedstatedir=${sharedstatedir} \ + --localstatedir=${localstatedir} \ + --libdir=${libdir} \ + --includedir=${includedir} \ + --oldincludedir=${oldincludedir} \ + --infodir=${infodir} \ + --mandir=${mandir} \ + ${EXTRA_OECONF} \ + $@" + oenote "Running $cfgcmd..." + $cfgcmd || oefatal "oe_runconf failed" + else + oefatal "no configure script found" + fi +} + +autotools_do_configure() { + case ${PN} in + autoconf*) + ;; + automake*) + ;; + *) + # WARNING: gross hack follows: + # An autotools built package generally needs these scripts, however only + # automake or libtoolize actually install the current versions of them. + # This is a problem in builds that do not use libtool or automake, in the case + # where we -need- the latest version of these scripts. e.g. running a build + # for a package whose autotools are old, on an x86_64 machine, which the old + # config.sub does not support. Work around this by installing them manually + # regardless. + ( for ac in `find ${S} -name configure.in -o -name configure.ac`; do + rm -f `dirname $ac`/configure + done ) + if [ -e ${S}/configure.in -o -e ${S}/configure.ac ]; then + olddir=`pwd` + cd ${S} + if [ x"${acpaths}" = xdefault ]; then + acpaths= + for i in `find ${S} -maxdepth 2 -name \*.m4|grep -v 'aclocal.m4'| \ + grep -v 'acinclude.m4' | sed -e 's,\(.*/\).*$,\1,'|sort -u`; do + acpaths="$acpaths -I $i" + done + else + acpaths="${acpaths}" + fi + AUTOV=`automake --version |head -n 1 |sed "s/.* //;s/\.[0-9]\+$//"` + automake --version + echo "AUTOV is $AUTOV" + install -d ${STAGING_DIR}/${HOST_SYS}/share/aclocal + install -d ${STAGING_DIR}/${HOST_SYS}/share/aclocal-$AUTOV + acpaths="$acpaths -I ${STAGING_DIR}/${HOST_SYS}/share/aclocal-$AUTOV -I ${STAGING_DIR}/${HOST_SYS}/share/aclocal" + # autoreconf is too shy to overwrite aclocal.m4 if it doesn't look + # like it was auto-generated. Work around this by blowing it away + # by hand, unless the package specifically asked not to run aclocal. + if ! echo ${EXTRA_AUTORECONF} | grep -q "aclocal"; then + rm -f aclocal.m4 + fi + if [ -e configure.in ]; then + CONFIGURE_AC=configure.in + else + CONFIGURE_AC=configure.ac + fi + if grep "^AM_GLIB_GNU_GETTEXT" $CONFIGURE_AC >/dev/null; then + if grep "sed.*POTFILES" $CONFIGURE_AC >/dev/null; then + : do nothing -- we still have an old unmodified configure.ac + else + oenote Executing glib-gettextize --force --copy + echo "no" | glib-gettextize --force --copy + fi + fi + if grep "^AC_PROG_INTLTOOL" $CONFIGURE_AC >/dev/null; then + oenote Executing intltoolize --copy --force --automake + intltoolize --copy --force --automake + fi + oenote Executing autoreconf --verbose --install --force ${EXTRA_AUTORECONF} $acpaths + mkdir -p m4 + autoreconf -Wcross --verbose --install --force ${EXTRA_AUTORECONF} $acpaths || oefatal "autoreconf execution failed." + cd $olddir + fi + ;; + esac + if [ -e ${S}/configure ]; then + oe_runconf + else + oenote "nothing to configure" + fi +} + +autotools_do_install() { + oe_runmake 'DESTDIR=${D}' install +} + +STAGE_TEMP="${WORKDIR}/temp-staging" + +autotools_stage_includes() { + if [ "${INHIBIT_AUTO_STAGE_INCLUDES}" != "1" ] + then + rm -rf ${STAGE_TEMP} + mkdir -p ${STAGE_TEMP} + make DESTDIR="${STAGE_TEMP}" install + cp -pPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR} + rm -rf ${STAGE_TEMP} + fi +} + +autotools_stage_all() { + if [ "${INHIBIT_AUTO_STAGE}" = "1" ] + then + return + fi + rm -rf ${STAGE_TEMP} + mkdir -p ${STAGE_TEMP} + oe_runmake DESTDIR="${STAGE_TEMP}" install + if [ -d ${STAGE_TEMP}/${includedir} ]; then + cp -fpPR ${STAGE_TEMP}/${includedir}/* ${STAGING_INCDIR} + fi + if [ -d ${STAGE_TEMP}/${libdir} ] + then + for i in ${STAGE_TEMP}/${libdir}/*.la + do + if [ ! -f "$i" ]; then + cp -fpPR ${STAGE_TEMP}/${libdir}/* ${STAGING_LIBDIR} + break + fi + oe_libinstall -so $(basename $i .la) ${STAGING_LIBDIR} + done + fi + if [ -d ${STAGE_TEMP}/${datadir}/aclocal ]; then + install -d ${STAGING_DATADIR}/aclocal + cp -fpPR ${STAGE_TEMP}/${datadir}/aclocal/* ${STAGING_DATADIR}/aclocal + fi + rm -rf ${STAGE_TEMP} +} + +EXPORT_FUNCTIONS do_configure do_install diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass new file mode 100644 index 0000000000..8467ebddc2 --- /dev/null +++ b/meta/classes/base.bbclass @@ -0,0 +1,793 @@ +PATCHES_DIR="${S}" + +def base_dep_prepend(d): + import bb; + # + # Ideally this will check a flag so we will operate properly in + # the case where host == build == target, for now we don't work in + # that case though. + # + deps = "" + + # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not + # we need that built is the responsibility of the patch function / class, not + # the application. + patchdeps = bb.data.getVar("PATCH_DEPENDS", d, 1) + if patchdeps and not patchdeps in bb.data.getVar("PROVIDES", d, 1): + deps = patchdeps + + if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d): + if (bb.data.getVar('HOST_SYS', d, 1) != + bb.data.getVar('BUILD_SYS', d, 1)): + deps += " virtual/${TARGET_PREFIX}gcc virtual/libc " + return deps + +def base_read_file(filename): + import bb + try: + f = file( filename, "r" ) + except IOError, reason: + return "" # WARNING: can't raise an error now because of the new RDEPENDS handling. This is a bit ugly. :M: + else: + return f.read().strip() + return None + +def base_conditional(variable, checkvalue, truevalue, falsevalue, d): + import bb + if bb.data.getVar(variable,d,1) == checkvalue: + return truevalue + else: + return falsevalue + +DEPENDS_prepend="${@base_dep_prepend(d)} " + +def base_set_filespath(path, d): + import os, bb + filespath = [] + for p in path: + overrides = bb.data.getVar("OVERRIDES", d, 1) or "" + overrides = overrides + ":" + for o in overrides.split(":"): + filespath.append(os.path.join(p, o)) + bb.data.setVar("FILESPATH", ":".join(filespath), d) + +FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}" + +def oe_filter(f, str, d): + from re import match + return " ".join(filter(lambda x: match(f, x, 0), str.split())) + +def oe_filter_out(f, str, d): + from re import match + return " ".join(filter(lambda x: not match(f, x, 0), str.split())) + +die() { + oefatal "$*" +} + +oenote() { + echo "NOTE:" "$*" +} + +oewarn() { + echo "WARNING:" "$*" +} + +oefatal() { + echo "FATAL:" "$*" + exit 1 +} + +oedebug() { + test $# -ge 2 || { + echo "Usage: oedebug level \"message\"" + exit 1 + } + + test ${OEDEBUG:-0} -ge $1 && { + shift + echo "DEBUG:" $* + } +} + +oe_runmake() { + if [ x"$MAKE" = x ]; then MAKE=make; fi + oenote ${MAKE} ${EXTRA_OEMAKE} "$@" + ${MAKE} ${EXTRA_OEMAKE} "$@" || die "oe_runmake failed" +} + +oe_soinstall() { + # Purpose: Install shared library file and + # create the necessary links + # Example: + # + # oe_ + # + #oenote installing shared library $1 to $2 + # + libname=`basename $1` + install -m 755 $1 $2/$libname + sonamelink=`${HOST_PREFIX}readelf -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'` + solink=`echo $libname | sed -e 's/\.so\..*/.so/'` + ln -sf $libname $2/$sonamelink + ln -sf $libname $2/$solink +} + +oe_libinstall() { + # Purpose: Install a library, in all its forms + # Example + # + # oe_libinstall libltdl ${STAGING_LIBDIR}/ + # oe_libinstall -C src/libblah libblah ${D}/${libdir}/ + dir="" + libtool="" + silent="" + require_static="" + require_shared="" + staging_install="" + while [ "$#" -gt 0 ]; do + case "$1" in + -C) + shift + dir="$1" + ;; + -s) + silent=1 + ;; + -a) + require_static=1 + ;; + -so) + require_shared=1 + ;; + -*) + oefatal "oe_libinstall: unknown option: $1" + ;; + *) + break; + ;; + esac + shift + done + + libname="$1" + shift + destpath="$1" + if [ -z "$destpath" ]; then + oefatal "oe_libinstall: no destination path specified" + fi + if echo "$destpath/" | egrep '^${STAGING_LIBDIR}/' >/dev/null + then + staging_install=1 + fi + + __runcmd () { + if [ -z "$silent" ]; then + echo >&2 "oe_libinstall: $*" + fi + $* + } + + if [ -z "$dir" ]; then + dir=`pwd` + fi + dotlai=$libname.lai + dir=$dir`(cd $dir; find -name "$dotlai") | sed "s/^\.//;s/\/$dotlai\$//;q"` + olddir=`pwd` + __runcmd cd $dir + + lafile=$libname.la + if [ -f "$lafile" ]; then + # libtool archive + eval `cat $lafile|grep "^library_names="` + libtool=1 + else + library_names="$libname.so* $libname.dll.a" + fi + + __runcmd install -d $destpath/ + dota=$libname.a + if [ -f "$dota" -o -n "$require_static" ]; then + __runcmd install -m 0644 $dota $destpath/ + fi + if [ -f "$dotlai" -a -n "$libtool" ]; then + if test -n "$staging_install" + then + # stop libtool using the final directory name for libraries + # in staging: + __runcmd rm -f $destpath/$libname.la + __runcmd sed -e 's/^installed=yes$/installed=no/' -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' $dotlai >$destpath/$libname.la + else + __runcmd install -m 0644 $dotlai $destpath/$libname.la + fi + fi + + for name in $library_names; do + files=`eval echo $name` + for f in $files; do + if [ ! -e "$f" ]; then + if [ -n "$libtool" ]; then + oefatal "oe_libinstall: $dir/$f not found." + fi + elif [ -L "$f" ]; then + __runcmd cp -P "$f" $destpath/ + elif [ ! -L "$f" ]; then + libfile="$f" + __runcmd install -m 0755 $libfile $destpath/ + fi + done + done + + if [ -z "$libfile" ]; then + if [ -n "$require_shared" ]; then + oefatal "oe_libinstall: unable to locate shared library" + fi + elif [ -z "$libtool" ]; then + # special case hack for non-libtool .so.#.#.# links + baselibfile=`basename "$libfile"` + if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then + sonamelink=`${HOST_PREFIX}readelf -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'` + solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'` + if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then + __runcmd ln -sf $baselibfile $destpath/$sonamelink + fi + __runcmd ln -sf $baselibfile $destpath/$solink + fi + fi + + __runcmd cd "$olddir" +} + +oe_machinstall() { + # Purpose: Install machine dependent files, if available + # If not available, check if there is a default + # If no default, just touch the destination + # Example: + # $1 $2 $3 $4 + # oe_machinstall -m 0644 fstab ${D}/etc/fstab + # + # TODO: Check argument number? + # + filename=`basename $3` + dirname=`dirname $3` + + for o in `echo ${OVERRIDES} | tr ':' ' '`; do + if [ -e $dirname/$o/$filename ]; then + oenote $dirname/$o/$filename present, installing to $4 + install $1 $2 $dirname/$o/$filename $4 + return + fi + done +# oenote overrides specific file NOT present, trying default=$3... + if [ -e $3 ]; then + oenote $3 present, installing to $4 + install $1 $2 $3 $4 + else + oenote $3 NOT present, touching empty $4 + touch $4 + fi +} + +addtask showdata +do_showdata[nostamp] = "1" +python do_showdata() { + import sys + # emit variables and shell functions + bb.data.emit_env(sys.__stdout__, d, True) + # emit the metadata which isnt valid shell + for e in d.keys(): + if bb.data.getVarFlag(e, 'python', d): + sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, bb.data.getVar(e, d, 1))) +} + +addtask listtasks +do_listtasks[nostamp] = "1" +python do_listtasks() { + import sys + # emit variables and shell functions + #bb.data.emit_env(sys.__stdout__, d) + # emit the metadata which isnt valid shell + for e in d.keys(): + if bb.data.getVarFlag(e, 'task', d): + sys.__stdout__.write("%s\n" % e) +} + +addtask clean +do_clean[dirs] = "${TOPDIR}" +do_clean[nostamp] = "1" +do_clean[bbdepcmd] = "" +python base_do_clean() { + """clear the build and temp directories""" + dir = bb.data.expand("${WORKDIR}", d) + if dir == '//': raise bb.build.FuncFailed("wrong DATADIR") + bb.note("removing " + dir) + os.system('rm -rf ' + dir) + + dir = "%s.*" % bb.data.expand(bb.data.getVar('STAMP', d), d) + bb.note("removing " + dir) + os.system('rm -f '+ dir) +} + +addtask mrproper +do_mrproper[dirs] = "${TOPDIR}" +do_mrproper[nostamp] = "1" +do_mrproper[bbdepcmd] = "" +python base_do_mrproper() { + """clear downloaded sources, build and temp directories""" + dir = bb.data.expand("${DL_DIR}", d) + if dir == '/': bb.build.FuncFailed("wrong DATADIR") + bb.debug(2, "removing " + dir) + os.system('rm -rf ' + dir) + bb.build.exec_task('do_clean', d) +} + +addtask fetch +do_fetch[dirs] = "${DL_DIR}" +do_fetch[nostamp] = "1" +python base_do_fetch() { + import sys + + localdata = bb.data.createCopy(d) + bb.data.update_data(localdata) + + src_uri = bb.data.getVar('SRC_URI', localdata, 1) + if not src_uri: + return 1 + + try: + bb.fetch.init(src_uri.split(),d) + except bb.fetch.NoMethodError: + (type, value, traceback) = sys.exc_info() + raise bb.build.FuncFailed("No method: %s" % value) + + try: + bb.fetch.go(localdata) + except bb.fetch.MissingParameterError: + (type, value, traceback) = sys.exc_info() + raise bb.build.FuncFailed("Missing parameters: %s" % value) + except bb.fetch.FetchError: + (type, value, traceback) = sys.exc_info() + raise bb.build.FuncFailed("Fetch failed: %s" % value) +} + +def oe_unpack_file(file, data, url = None): + import bb, os + if not url: + url = "file://%s" % file + dots = file.split(".") + if dots[-1] in ['gz', 'bz2', 'Z']: + efile = os.path.join(bb.data.getVar('WORKDIR', data, 1),os.path.basename('.'.join(dots[0:-1]))) + else: + efile = file + cmd = None + if file.endswith('.tar'): + cmd = 'tar x --no-same-owner -f %s' % file + elif file.endswith('.tgz') or file.endswith('.tar.gz'): + cmd = 'tar xz --no-same-owner -f %s' % file + elif file.endswith('.tbz') or file.endswith('.tar.bz2'): + cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file + elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'): + cmd = 'gzip -dc %s > %s' % (file, efile) + elif file.endswith('.bz2'): + cmd = 'bzip2 -dc %s > %s' % (file, efile) + elif file.endswith('.zip'): + cmd = 'unzip -q' + (type, host, path, user, pswd, parm) = bb.decodeurl(url) + if 'dos' in parm: + cmd = '%s -a' % cmd + cmd = '%s %s' % (cmd, file) + elif os.path.isdir(file): + filesdir = os.path.realpath(bb.data.getVar("FILESDIR", data, 1)) + destdir = "." + if file[0:len(filesdir)] == filesdir: + destdir = file[len(filesdir):file.rfind('/')] + destdir = destdir.strip('/') + if len(destdir) < 1: + destdir = "." + elif not os.access("%s/%s" % (os.getcwd(), destdir), os.F_OK): + os.makedirs("%s/%s" % (os.getcwd(), destdir)) + cmd = 'cp -pPR %s %s/%s/' % (file, os.getcwd(), destdir) + else: + (type, host, path, user, pswd, parm) = bb.decodeurl(url) + if not 'patch' in parm: + # The "destdir" handling was specifically done for FILESPATH + # items. So, only do so for file:// entries. + if type == "file": + destdir = bb.decodeurl(url)[1] or "." + else: + destdir = "." + bb.mkdirhier("%s/%s" % (os.getcwd(), destdir)) + cmd = 'cp %s %s/%s/' % (file, os.getcwd(), destdir) + if not cmd: + return True + + + dest = os.path.join(os.getcwd(), os.path.basename(file)) + if os.path.exists(dest): + if os.path.samefile(file, dest): + return True + + cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) + bb.note("Unpacking %s to %s/" % (file, os.getcwd())) + ret = os.system(cmd) + return ret == 0 + +addtask unpack after do_fetch +do_unpack[dirs] = "${WORKDIR}" +python base_do_unpack() { + import re, os + + localdata = bb.data.createCopy(d) + bb.data.update_data(localdata) + + src_uri = bb.data.getVar('SRC_URI', localdata) + if not src_uri: + return + src_uri = bb.data.expand(src_uri, localdata) + for url in src_uri.split(): + try: + local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata) + except bb.MalformedUrl, e: + raise FuncFailed('Unable to generate local path for malformed uri: %s' % e) + # dont need any parameters for extraction, strip them off + local = re.sub(';.*$', '', local) + local = os.path.realpath(local) + ret = oe_unpack_file(local, localdata, url) + if not ret: + raise bb.build.FuncFailed() +} + +addtask patch after do_unpack +do_patch[dirs] = "${WORKDIR}" +python base_do_patch() { + import re + import bb.fetch + + src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split() + if not src_uri: + return + + patchcleancmd = bb.data.getVar('PATCHCLEANCMD', d, 1) + if patchcleancmd: + bb.data.setVar("do_patchcleancmd", patchcleancmd, d) + bb.data.setVarFlag("do_patchcleancmd", "func", 1, d) + bb.build.exec_func("do_patchcleancmd", d) + + workdir = bb.data.getVar('WORKDIR', d, 1) + for url in src_uri: + + (type, host, path, user, pswd, parm) = bb.decodeurl(url) + if not "patch" in parm: + continue + + bb.fetch.init([url],d) + url = bb.encodeurl((type, host, path, user, pswd, [])) + local = os.path.join('/', bb.fetch.localpath(url, d)) + + # did it need to be unpacked? + dots = os.path.basename(local).split(".") + if dots[-1] in ['gz', 'bz2', 'Z']: + unpacked = os.path.join(bb.data.getVar('WORKDIR', d),'.'.join(dots[0:-1])) + else: + unpacked = local + unpacked = bb.data.expand(unpacked, d) + + if "pnum" in parm: + pnum = parm["pnum"] + else: + pnum = "1" + + if "pname" in parm: + pname = parm["pname"] + else: + pname = os.path.basename(unpacked) + + if "mindate" in parm: + mindate = parm["mindate"] + else: + mindate = 0 + + if "maxdate" in parm: + maxdate = parm["maxdate"] + else: + maxdate = "20711226" + + pn = bb.data.getVar('PN', d, 1) + srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1) + + if not srcdate: + srcdate = bb.data.getVar('SRCDATE', d, 1) + + if srcdate == "now": + srcdate = bb.data.getVar('DATE', d, 1) + + if (maxdate < srcdate) or (mindate > srcdate): + if (maxdate < srcdate): + bb.note("Patch '%s' is outdated" % pname) + + if (mindate > srcdate): + bb.note("Patch '%s' is predated" % pname) + + continue + + bb.note("Applying patch '%s'" % pname) + bb.data.setVar("do_patchcmd", bb.data.getVar("PATCHCMD", d, 1) % (pnum, pname, unpacked), d) + bb.data.setVarFlag("do_patchcmd", "func", 1, d) + bb.data.setVarFlag("do_patchcmd", "dirs", "${WORKDIR} ${S}", d) + bb.build.exec_func("do_patchcmd", d) +} + + +addhandler base_eventhandler +python base_eventhandler() { + from bb import note, error, data + from bb.event import Handled, NotHandled, getName + import os + + messages = {} + messages["Completed"] = "completed" + messages["Succeeded"] = "completed" + messages["Started"] = "started" + messages["Failed"] = "failed" + + name = getName(e) + msg = "" + if name.startswith("Pkg"): + msg += "package %s: " % data.getVar("P", e.data, 1) + msg += messages.get(name[3:]) or name[3:] + elif name.startswith("Task"): + msg += "package %s: task %s: " % (data.getVar("PF", e.data, 1), e.task) + msg += messages.get(name[4:]) or name[4:] + elif name.startswith("Build"): + msg += "build %s: " % e.name + msg += messages.get(name[5:]) or name[5:] + elif name == "UnsatisfiedDep": + msg += "package %s: dependency %s %s" % (e.pkg, e.dep, name[:-3].lower()) + note(msg) + + if name.startswith("BuildStarted"): + bb.data.setVar( 'BB_VERSION', bb.__version__, e.data ) + path_to_bbfiles = bb.data.getVar( 'BBFILES', e.data, 1 ) + path_to_packages = path_to_bbfiles[:path_to_bbfiles.rindex( "packages" )] + monotone_revision = "" + try: + monotone_revision = file( "%s/MT/revision" % path_to_packages ).read().strip() + except IOError: + pass + bb.data.setVar( 'OE_REVISION', monotone_revision, e.data ) + statusvars = ['BB_VERSION', 'OE_REVISION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TARGET_FPU'] + statuslines = ["%-14s = \"%s\"" % (i, bb.data.getVar(i, e.data, 1) or '') for i in statusvars] + statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines) + print statusmsg + + needed_vars = [ "TARGET_ARCH", "TARGET_OS" ] + pesteruser = [] + for v in needed_vars: + val = bb.data.getVar(v, e.data, 1) + if not val or val == 'INVALID': + pesteruser.append(v) + if pesteruser: + bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser)) + + if not data in e.__dict__: + return NotHandled + + log = data.getVar("EVENTLOG", e.data, 1) + if log: + logfile = file(log, "a") + logfile.write("%s\n" % msg) + logfile.close() + + return NotHandled +} + +addtask configure after do_unpack do_patch +do_configure[dirs] = "${S} ${B}" +do_configure[bbdepcmd] = "do_populate_staging" +base_do_configure() { + : +} + +addtask compile after do_configure +do_compile[dirs] = "${S} ${B}" +do_compile[bbdepcmd] = "do_populate_staging" +base_do_compile() { + if [ -e Makefile -o -e makefile ]; then + oe_runmake || die "make failed" + else + oenote "nothing to compile" + fi +} + + +addtask stage after do_compile +base_do_stage () { + : +} + +do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${TARGET_SYS}/lib \ + ${STAGING_DIR}/${TARGET_SYS}/include \ + ${STAGING_DIR}/${BUILD_SYS}/bin ${STAGING_DIR}/${BUILD_SYS}/lib \ + ${STAGING_DIR}/${BUILD_SYS}/include \ + ${STAGING_DATADIR} \ + ${S} ${B}" + +addtask populate_staging after do_compile + +python do_populate_staging () { + bb.build.exec_func('do_stage', d) +} + +addtask install after do_compile +do_install[dirs] = "${S} ${B}" + +base_do_install() { + : +} + +base_do_package() { + : +} + +addtask build after do_populate_staging +do_build = "" +do_build[func] = "1" + +# Functions that update metadata based on files outputted +# during the build process. + +SHLIBS = "" +RDEPENDS_prepend = " ${SHLIBS}" + +def explode_deps(s): + r = [] + l = s.split() + flag = False + for i in l: + if i[0] == '(': + flag = True + j = [] + if flag: + j.append(i) + if i.endswith(')'): + flag = False + r[-1] += ' ' + ' '.join(j) + else: + r.append(i) + return r + +python read_shlibdeps () { + packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() + for pkg in packages: + rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") + shlibsfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".shlibdeps", d) + if os.access(shlibsfile, os.R_OK): + fd = file(shlibsfile) + lines = fd.readlines() + fd.close() + for l in lines: + rdepends.append(l.rstrip()) + pcfile = bb.data.expand("${WORKDIR}/install/" + pkg + ".pcdeps", d) + if os.access(pcfile, os.R_OK): + fd = file(pcfile) + lines = fd.readlines() + fd.close() + for l in lines: + rdepends.append(l.rstrip()) + bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) +} + +python read_subpackage_metadata () { + import re + + def decode(str): + import codecs + c = codecs.getdecoder("string_escape") + return c(str)[0] + + data_file = bb.data.expand("${WORKDIR}/install/${PN}.package", d) + if os.access(data_file, os.R_OK): + f = file(data_file, 'r') + lines = f.readlines() + f.close() + r = re.compile("([^:]+):\s*(.*)") + for l in lines: + m = r.match(l) + if m: + bb.data.setVar(m.group(1), decode(m.group(2)), d) +} + +python __anonymous () { + import exceptions + need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1) + if need_host: + import re + this_host = bb.data.getVar('HOST_SYS', d, 1) + if not re.match(need_host, this_host): + raise bb.parse.SkipPackage("incompatible with host %s" % this_host) + + need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1) + if need_machine: + import re + this_machine = bb.data.getVar('MACHINE', d, 1) + if not re.match(need_machine, this_machine): + raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine) + + pn = bb.data.getVar('PN', d, 1) + + srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1) + if srcdate != None: + bb.data.setVar('SRCDATE', srcdate, d) + + use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1) + if use_nls != None: + bb.data.setVar('USE_NLS', use_nls, d) +} + +python () { + import bb, os + mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1) + old_arch = bb.data.getVar('PACKAGE_ARCH', d, 1) + if (old_arch == mach_arch): + # Nothing to do + return + if (bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) == '0'): + return + paths = [] + for p in [ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ]: + paths.append(bb.data.expand(os.path.join(p, mach_arch), d)) + for s in bb.data.getVar('SRC_URI', d, 1).split(): + local = bb.data.expand(bb.fetch.localpath(s, d), d) + for mp in paths: + if local.startswith(mp): +# bb.note("overriding PACKAGE_ARCH from %s to %s" % (old_arch, mach_arch)) + bb.data.setVar('PACKAGE_ARCH', mach_arch, d) + return +} + +EXPORT_FUNCTIONS do_clean do_mrproper do_fetch do_unpack do_configure do_compile do_install do_package do_patch do_populate_pkgs do_stage + +MIRRORS[func] = "0" +MIRRORS () { +${DEBIAN_MIRROR}/main http://snapshot.debian.net/archive/pool +${DEBIAN_MIRROR} ftp://ftp.de.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.au.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.cl.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.hr.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.fi.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.hk.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.hu.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.ie.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.it.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.jp.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.no.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.pl.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.ro.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.si.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.es.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.se.debian.org/debian/pool +${DEBIAN_MIRROR} ftp://ftp.tr.debian.org/debian/pool +${GNU_MIRROR} ftp://mirrors.kernel.org/gnu +${GNU_MIRROR} ftp://ftp.matrix.com.br/pub/gnu +${GNU_MIRROR} ftp://ftp.cs.ubc.ca/mirror2/gnu +${GNU_MIRROR} ftp://sunsite.ust.hk/pub/gnu +${GNU_MIRROR} ftp://ftp.ayamura.org/pub/gnu +ftp://ftp.kernel.org/pub http://www.kernel.org/pub +ftp://ftp.kernel.org/pub ftp://ftp.us.kernel.org/pub +ftp://ftp.kernel.org/pub ftp://ftp.uk.kernel.org/pub +ftp://ftp.kernel.org/pub ftp://ftp.hk.kernel.org/pub +ftp://ftp.kernel.org/pub ftp://ftp.au.kernel.org/pub +ftp://ftp.kernel.org/pub ftp://ftp.jp.kernel.org/pub +ftp://ftp.gnupg.org/gcrypt/ ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/ +ftp://ftp.gnupg.org/gcrypt/ ftp://ftp.surfnet.nl/pub/security/gnupg/ +ftp://ftp.gnupg.org/gcrypt/ http://gulus.USherbrooke.ca/pub/appl/GnuPG/ +ftp://ftp.gnutls.org/pub/gnutls ftp://ftp.gnutls.org/pub/gnutls/ +ftp://ftp.gnutls.org/pub/gnutls ftp://ftp.gnupg.org/gcrypt/gnutls/ +ftp://ftp.gnutls.org/pub/gnutls http://www.mirrors.wiretapped.net/security/network-security/gnutls/ +ftp://ftp.gnutls.org/pub/gnutls ftp://ftp.mirrors.wiretapped.net/pub/security/network-security/gnutls/ +ftp://ftp.gnutls.org/pub/gnutls http://josefsson.org/gnutls/releases/ + +ftp://.*/.*/ http://www.oesources.org/source/current/ +http://.*/.*/ http://www.oesources.org/source/current/ +} + diff --git a/meta/classes/base_srpm.bbclass b/meta/classes/base_srpm.bbclass new file mode 100644 index 0000000000..aea6335278 --- /dev/null +++ b/meta/classes/base_srpm.bbclass @@ -0,0 +1,20 @@ +inherit base package rpm_core + +SPECFILE="${RPMBUILDPATH}/SPECS/${PN}.spec" + +base_srpm_do_unpack() { + test -e ${SRPMFILE} || die "Source rpm \"${SRPMFILE}\"does not exist" + if ! test -e ${SPECFILE}; then + ${RPM} -i ${SRPMFILE} + fi + test -e ${SPECFILE} || die "Spec file \"${SPECFILE}\" does not exist" + ${RPMBUILD} -bp ${SPECFILE} +} + +base_srpm_do_compile() { + ${RPMBUILD} -bc ${SPECFILE} +} + +base_srpm_do_install() { + ${RPMBUILD} -bi ${SPECFILE} +} diff --git a/meta/classes/binconfig.bbclass b/meta/classes/binconfig.bbclass new file mode 100644 index 0000000000..bf15ebcdf9 --- /dev/null +++ b/meta/classes/binconfig.bbclass @@ -0,0 +1,36 @@ +inherit base + +# The namespaces can clash here hence the two step replace +def get_binconfig_mangle(d): + import bb.data + s = "-e ''" + if not bb.data.inherits_class('native', d): + s += " -e 's:=${libdir}:=OELIBDIR:;'" + s += " -e 's:=${includedir}:=OEINCDIR:;'" + s += " -e 's:=${datadir}:=OEDATADIR:'" + s += " -e 's:=${prefix}:=OEPREFIX:'" + s += " -e 's:=${exec_prefix}:=OEEXECPREFIX:'" + s += " -e 's:-L${libdir}:-LOELIBDIR:;'" + s += " -e 's:-I${includedir}:-IOEINCDIR:;'" + s += " -e 's:OELIBDIR:${STAGING_LIBDIR}:;'" + s += " -e 's:OEINCDIR:${STAGING_INCDIR}:;'" + s += " -e 's:OEDATADIR:${STAGING_DATADIR}:'" + s += " -e 's:OEPREFIX:${STAGING_LIBDIR}/..:'" + s += " -e 's:OEEXECPREFIX:${STAGING_LIBDIR}/..:'" + return s + +# Native package configurations go in ${BINDIR}/-config-native to prevent a collision with cross packages +def is_native(d): + import bb.data + return ["","-native"][bb.data.inherits_class('native', d)] + +BINCONFIG_GLOB ?= "*-config" + +do_stage_append() { + for config in `find ${S} -name '${BINCONFIG_GLOB}'`; do + configname=`basename $config`${@is_native(d)} + install -d ${STAGING_BINDIR} + cat $config | sed ${@get_binconfig_mangle(d)} > ${STAGING_BINDIR}/$configname + chmod u+x ${STAGING_BINDIR}/$configname + done +} diff --git a/meta/classes/ccache.inc b/meta/classes/ccache.inc new file mode 100644 index 0000000000..5e9356104b --- /dev/null +++ b/meta/classes/ccache.inc @@ -0,0 +1,11 @@ +# Make ccache use a TMPDIR specific ccache directory if using the crosscompiler, +# since it isn't likely to be useful with any other toolchain than the one we just +# built, and would otherwise push more useful things out of the default cache. + +CCACHE_DIR_TARGET = "${TMPDIR}/ccache" + +python () { + if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): + bb.data.setVar('CCACHE_DIR', '${CCACHE_DIR_TARGET}', d) + bb.data.setVarFlag('CCACHE_DIR', 'export', '1', d) +} diff --git a/meta/classes/ccdv.bbclass b/meta/classes/ccdv.bbclass new file mode 100644 index 0000000000..edd151ef8c --- /dev/null +++ b/meta/classes/ccdv.bbclass @@ -0,0 +1,21 @@ +python () { + if bb.data.getVar('PN', d, 1) in ['ccdv-native']: + if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1): + bb.data.setVar("DEPENDS", '%s %s' % ("ccdv-native", bb.data.getVar("DEPENDS", d, 1) or ""), d) + bb.data.setVar("CC", '%s %s' % ("ccdv", bb.data.getVar("CC", d, 1) or ""), d) + bb.data.setVar("BUILD_CC", '%s %s' % ("ccdv", bb.data.getVar("BUILD_CC", d, 1) or ""), d) + bb.data.setVar("CCLD", '%s %s' % ("ccdv", bb.data.getVar("CCLD", d, 1) or ""), d) +} + +def quiet_libtool(bb,d): + deps = (bb.data.getVar('DEPENDS', d, 1) or "").split() + if 'libtool-cross' in deps: + return "'LIBTOOL=${STAGING_BINDIR}/${HOST_SYS}-libtool --silent'" + elif 'libtool-native' in deps: + return "'LIBTOOL=${B}/${HOST_SYS}-libtool --silent'" + else: + return "" + +CCDV = "ccdv" +EXTRA_OEMAKE_append = " ${@quiet_libtool(bb,d)}" +MAKE += "-s" diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass new file mode 100644 index 0000000000..79218b4a12 --- /dev/null +++ b/meta/classes/cml1.bbclass @@ -0,0 +1,8 @@ +cml1_do_configure() { + set -e + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake oldconfig +} + +EXPORT_FUNCTIONS do_configure +addtask configure after do_unpack do_patch before do_compile diff --git a/meta/classes/cpan.bbclass b/meta/classes/cpan.bbclass new file mode 100644 index 0000000000..853abfd1b3 --- /dev/null +++ b/meta/classes/cpan.bbclass @@ -0,0 +1,20 @@ +FILES_${PN} += '${libdir}/perl5' + +cpan_do_configure () { + perl Makefile.PL + if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then + . ${STAGING_DIR}/${TARGET_SYS}/perl/config.sh + sed -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:; s:\(SITEARCHEXP = \).*:\1${sitearchexp}:; s:\(INSTALLVENDORLIB = \).*:\1${D}${libdir}/perl5:; s:\(INSTALLVENDORARCH = \).*:\1${D}${libdir}/perl5:" < Makefile > Makefile.new + mv Makefile.new Makefile + fi +} + +cpan_do_compile () { + oe_runmake PASTHRU_INC="${CFLAGS}" +} + +cpan_do_install () { + oe_runmake install_vendor +} + +EXPORT_FUNCTIONS do_configure do_compile do_install diff --git a/meta/classes/cross.bbclass b/meta/classes/cross.bbclass new file mode 100644 index 0000000000..09357acbe8 --- /dev/null +++ b/meta/classes/cross.bbclass @@ -0,0 +1,55 @@ +# Cross packages are built indirectly via dependency, +# no need for them to be a direct target of 'world' +EXCLUDE_FROM_WORLD = "1" + +PACKAGES = "" + +HOST_ARCH = "${BUILD_ARCH}" +HOST_VENDOR = "${BUILD_VENDOR}" +HOST_OS = "${BUILD_OS}" +HOST_PREFIX = "${BUILD_PREFIX}" +HOST_CC_ARCH = "${BUILD_CC_ARCH}" + +CPPFLAGS = "${BUILD_CPPFLAGS}" +CFLAGS = "${BUILD_CFLAGS}" +CXXFLAGS = "${BUILD_CFLAGS}" +LDFLAGS = "${BUILD_LDFLAGS}" +LDFLAGS_build-darwin = "-L${STAGING_DIR}/${BUILD_SYS}/lib " + +# Overrides for paths + +# Path prefixes +base_prefix = "${exec_prefix}" +prefix = "${CROSS_DIR}" +exec_prefix = "${prefix}" + +# Base paths +base_bindir = "${base_prefix}/bin" +base_sbindir = "${base_prefix}/bin" +base_libdir = "${base_prefix}/lib" + +# Architecture independent paths +datadir = "${prefix}/share" +sysconfdir = "${prefix}/etc" +sharedstatedir = "${prefix}/com" +localstatedir = "${prefix}/var" +infodir = "${datadir}/info" +mandir = "${datadir}/man" +docdir = "${datadir}/doc" +servicedir = "${prefix}/srv" + +# Architecture dependent paths +bindir = "${exec_prefix}/bin" +sbindir = "${exec_prefix}/bin" +libexecdir = "${exec_prefix}/libexec" +libdir = "${exec_prefix}/lib" +includedir = "${exec_prefix}/include" +oldincludedir = "${exec_prefix}/include" + +do_stage () { + oe_runmake install +} + +do_install () { + : +} diff --git a/meta/classes/debian.bbclass b/meta/classes/debian.bbclass new file mode 100644 index 0000000000..5688dad93b --- /dev/null +++ b/meta/classes/debian.bbclass @@ -0,0 +1,101 @@ +STAGING_PKGMAPS_DIR = "${STAGING_DIR}/pkgmaps/debian" + +# Debain package renaming only occurs when a package is built +# We therefore have to make sure we build all runtime packages +# before building the current package to make the packages runtime +# depends are correct +BUILD_ALL_DEPS = "1" + +python debian_package_name_hook () { + import glob, copy, stat, errno, re + + workdir = bb.data.getVar('WORKDIR', d, 1) + packages = bb.data.getVar('PACKAGES', d, 1) + + def socrunch(s): + s = s.lower().replace('_', '-') + m = re.match("^(.*)(.)\.so\.(.*)$", s) + if m is None: + return None + if m.group(2) in '0123456789': + bin = '%s%s-%s' % (m.group(1), m.group(2), m.group(3)) + else: + bin = m.group(1) + m.group(2) + m.group(3) + dev = m.group(1) + m.group(2) + return (bin, dev) + + def isexec(path): + try: + s = os.stat(path) + except (os.error, AttributeError): + return 0 + return (s[stat.ST_MODE] & stat.S_IEXEC) + + def auto_libname(packages, orig_pkg): + bin_re = re.compile(".*/s?bin$") + lib_re = re.compile(".*/lib$") + so_re = re.compile("lib.*\.so") + sonames = [] + has_bins = 0 + has_libs = 0 + pkg_dir = os.path.join(workdir, "install", orig_pkg) + for root, dirs, files in os.walk(pkg_dir): + if bin_re.match(root) and files: + has_bins = 1 + if lib_re.match(root) and files: + has_libs = 1 + for f in files: + if so_re.match(f): + fp = os.path.join(root, f) + cmd = (bb.data.getVar('BUILD_PREFIX', d, 1) or "") + "objdump -p " + fp + " 2>/dev/null" + fd = os.popen(cmd) + lines = fd.readlines() + fd.close() + for l in lines: + m = re.match("\s+SONAME\s+([^\s]*)", l) + if m and not m.group(1) in sonames: + sonames.append(m.group(1)) + + bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames)) + soname = None + if len(sonames) == 1: + soname = sonames[0] + elif len(sonames) > 1: + lead = bb.data.getVar('LEAD_SONAME', d, 1) + if lead: + r = re.compile(lead) + filtered = [] + for s in sonames: + if r.match(s): + filtered.append(s) + if len(filtered) == 1: + soname = filtered[0] + elif len(filtered) > 1: + bb.note("Multiple matches (%s) for LEAD_SONAME '%s'" % (", ".join(filtered), lead)) + else: + bb.note("Multiple libraries (%s) found, but LEAD_SONAME '%s' doesn't match any of them" % (", ".join(sonames), lead)) + else: + bb.note("Multiple libraries (%s) found and LEAD_SONAME not defined" % ", ".join(sonames)) + + if has_libs and not has_bins and soname: + soname_result = socrunch(soname) + if soname_result: + (pkgname, devname) = soname_result + 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: + newpkg = pkgname + else: + newpkg = pkg.replace(orig_pkg, devname, 1) + if newpkg != pkg: + bb.data.setVar('PKG_' + pkg, newpkg, d) + + for pkg in (bb.data.getVar('AUTO_LIBNAME_PKGS', d, 1) or "").split(): + auto_libname(packages, pkg) +} + +EXPORT_FUNCTIONS package_name_hook + +DEBIAN_NAMES = 1 + diff --git a/meta/classes/distutils-base.bbclass b/meta/classes/distutils-base.bbclass new file mode 100644 index 0000000000..68d7112166 --- /dev/null +++ b/meta/classes/distutils-base.bbclass @@ -0,0 +1,14 @@ +EXTRA_OEMAKE = "" +DEPENDS += "${@["python-native python", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" +RDEPENDS += "python-core" + +def python_dir(d): + import os, bb + staging_incdir = bb.data.getVar( "STAGING_INCDIR", d, 1 ) + if os.path.exists( "%s/python2.3" % staging_incdir ): return "python2.3" + if os.path.exists( "%s/python2.4" % staging_incdir ): return "python2.4" + raise "No Python in STAGING_INCDIR. Forgot to build python-native ?" + +PYTHON_DIR = "${@python_dir(d)}" +FILES_${PN} = "${bindir} ${libdir} ${libdir}/${PYTHON_DIR}" + diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass new file mode 100644 index 0000000000..a2b0e2b770 --- /dev/null +++ b/meta/classes/distutils.bbclass @@ -0,0 +1,15 @@ +inherit distutils-base + +distutils_do_compile() { + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + ${STAGING_BINDIR}/python setup.py build || \ + oefatal "python setup.py build execution failed." +} + +distutils_do_install() { + BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \ + ${STAGING_BINDIR}/python setup.py install --prefix=${D}/${prefix} --install-data=${D}/${datadir} || \ + oefatal "python setup.py install execution failed." +} + +EXPORT_FUNCTIONS do_compile do_install diff --git a/meta/classes/e.bbclass b/meta/classes/e.bbclass new file mode 100644 index 0000000000..afd9b6d2b3 --- /dev/null +++ b/meta/classes/e.bbclass @@ -0,0 +1,37 @@ +MAINTAINER = "Justin Patrin " +HOMEPAGE = "http://www.enlightenment.org" +SECTION = "e/apps" + +inherit autotools pkgconfig binconfig + +do_prepsources () { + make clean distclean || true +} +addtask prepsources after do_fetch before do_unpack + +def binconfig_suffix(d): + import bb + return ["","-native"][bb.data.inherits_class('native', d)] + +export CURL_CONFIG = "${STAGING_BINDIR}/curl-config${@binconfig_suffix(d)}" +export EDB_CONFIG = "${STAGING_BINDIR}/edb-config${@binconfig_suffix(d)}" +export EET_CONFIG = "${STAGING_BINDIR}/eet-config${@binconfig_suffix(d)}" +export EVAS_CONFIG = "${STAGING_BINDIR}/evas-config${@binconfig_suffix(d)}" +export ECORE_CONFIG = "${STAGING_BINDIR}/ecore-config${@binconfig_suffix(d)}" +export EMBRYO_CONFIG = "${STAGING_BINDIR}/embryo-config${@binconfig_suffix(d)}" +export ENGRAVE_CONFIG = "${STAGING_BINDIR}/engrave-config${@binconfig_suffix(d)}" +export ENLIGHTENMENT_CONFIG = "${STAGING_BINDIR}/enlightenment-config${@binconfig_suffix(d)}" +export EPSILON_CONFIG = "${STAGING_BINDIR}/epsilon-config${@binconfig_suffix(d)}" +export EPEG_CONFIG = "${STAGING_BINDIR}/epeg-config${@binconfig_suffix(d)}" +export ESMART_CONFIG = "${STAGING_BINDIR}/esmart-config${@binconfig_suffix(d)}" +export FREETYPE_CONFIG = "${STAGING_BINDIR}/freetype-config${@binconfig_suffix(d)}" +export IMLIB2_CONFIG = "${STAGING_BINDIR}/imlib2-config${@binconfig_suffix(d)}" + +do_compile_prepend() { + find ${S} -name Makefile | xargs sed -i 's:/usr/include:${STAGING_INCDIR}:' + find ${S} -name Makefile | xargs sed -i 's:/usr/X11R6/include:${STAGING_INCDIR}:' +} + +PACKAGES = "${PN} ${PN}-themes" +FILES_${PN} = "${libdir}/lib*.so*" +FILES_${PN}-themes = "${datadir}/${PN}/themes ${datadir}/${PN}/data ${datadir}/${PN}/fonts ${datadir}/${PN}/pointers ${datadir}/${PN}/images ${datadir}/${PN}/users ${datadir}/${PN}/images ${datadir}/${PN}/styles" diff --git a/meta/classes/efl.bbclass b/meta/classes/efl.bbclass new file mode 100644 index 0000000000..9c490284c2 --- /dev/null +++ b/meta/classes/efl.bbclass @@ -0,0 +1,49 @@ +inherit e + +SECTION = "e/libs" + +SRCNAME = "${@bb.data.getVar('PN', d, 1).replace('-native', '')}" +SRC_URI = "${E_URI}/${SRCNAME}-${PV}.tar.gz" +S = "${WORKDIR}/${SRCNAME}-${PV}" + +INHIBIT_AUTO_STAGE_INCLUDES = "1" +INHIBIT_NATIVE_STAGE_INSTALL = "1" + +libdirectory = "src/lib" +libraries = "lib${SRCNAME}" +headers = "${@bb.data.getVar('SRCNAME',d,1).capitalize()}.h" + +do_stage_append () { + for i in ${libraries} + do + oe_libinstall -C ${libdirectory} $i ${STAGING_LIBDIR} + done + for i in ${headers} + do + install -m 0644 ${libdirectory}/$i ${STAGING_INCDIR} + done + + # Install binaries automatically for native builds + if [ "${@binconfig_suffix(d)}" = "-native" ] + then + + # Most EFL binaries start with the package name + for i in src/bin/${SRCNAME}* + do + if [ -x $i -a -f $i ] + then + + # Don't install anything with an extension (.so, etc) + if echo $i | grep -v \\. + then + ${HOST_SYS}-libtool --mode=install install -m 0755 $i ${STAGING_BINDIR} + fi + fi + done + fi +} + +PACKAGES = "${PN} ${PN}-themes ${PN}-dev ${PN}-examples" +FILES_${PN}-dev = "${bindir}/${PN}-config ${libdir}/pkgconfig ${libdir}/lib*.?a ${libdir}/lib*.a" +FILES_${PN}-examples = "${bindir} ${datadir}" + diff --git a/meta/classes/flow-lossage.bbclass b/meta/classes/flow-lossage.bbclass new file mode 100644 index 0000000000..3e841e3cae --- /dev/null +++ b/meta/classes/flow-lossage.bbclass @@ -0,0 +1,5 @@ +# gcc-3.4 blows up in gtktext with -frename-registers on arm-linux +python () { + cflags = (bb.data.getVar('CFLAGS', d, 1) or '').replace('-frename-registers', '') + bb.data.setVar('CFLAGS', cflags, d) +} diff --git a/meta/classes/gconf.bbclass b/meta/classes/gconf.bbclass new file mode 100644 index 0000000000..686f8e6596 --- /dev/null +++ b/meta/classes/gconf.bbclass @@ -0,0 +1,59 @@ +DEPENDS += "gconf" + +gconf_postinst() { +if [ "$1" = configure ]; then + if [ "x$D" != "x" ]; then + exit 1 + fi + SCHEMA_LOCATION=/etc/gconf/schemas + for SCHEMA in ${SCHEMA_FILES}; do + if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then + HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ + gconftool-2 \ + --makefile-install-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null + fi + done +fi +} + +gconf_prerm() { +if [ "$1" = remove ] || [ "$1" = upgrade ]; then + SCHEMA_LOCATION=/etc/gconf/schemas + for SCHEMA in ${SCHEMA_FILES}; do + if [ -e $SCHEMA_LOCATION/$SCHEMA ]; then + HOME=/root GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ + gconftool-2 \ + --makefile-uninstall-rule $SCHEMA_LOCATION/$SCHEMA > /dev/null + fi + done +fi +} + +python populate_packages_append () { + import os.path, re + packages = bb.data.getVar('PACKAGES', d, 1).split() + workdir = bb.data.getVar('WORKDIR', d, 1) + + for pkg in packages: + schema_dir = '%s/install/%s/etc/gconf/schemas' % (workdir, pkg) + schemas = [] + schema_re = re.compile(".*\.schemas$") + if os.path.exists(schema_dir): + for f in os.listdir(schema_dir): + if schema_re.match(f): + schemas.append(f) + if schemas != []: + bb.note("adding gconf postinst and prerm scripts to %s" % pkg) + bb.data.setVar('SCHEMA_FILES', " ".join(schemas), d) + 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('gconf_postinst', d, 1) + bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) + prerm = bb.data.getVar('pkg_prerm_%s' % pkg, d, 1) or bb.data.getVar('pkg_prerm', d, 1) + if not prerm: + prerm = '#!/bin/sh\n' + prerm += bb.data.getVar('gconf_prerm', d, 1) + bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d) + +} diff --git a/meta/classes/gettext.bbclass b/meta/classes/gettext.bbclass new file mode 100644 index 0000000000..3785f5acd3 --- /dev/null +++ b/meta/classes/gettext.bbclass @@ -0,0 +1,12 @@ +python () { + # Remove the NLS bits if USE_NLS is no. + if bb.data.getVar('USE_NLS', d, 1) == 'no': + cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d) + cfg += " --disable-nls" + depends = bb.data.getVar('DEPENDS', d, 1) or "" + bb.data.setVar('DEPENDS', oe_filter_out('^(virtual/libiconv|virtual/libintl)$', depends, d), d) + bb.data.setVar('EXTRA_OECONF', cfg, d) +} + +DEPENDS =+ "gettext-native" +EXTRA_OECONF += "--enable-nls" diff --git a/meta/classes/gnome.bbclass b/meta/classes/gnome.bbclass new file mode 100644 index 0000000000..8643989b73 --- /dev/null +++ b/meta/classes/gnome.bbclass @@ -0,0 +1,20 @@ +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}/${PN}/${@gnome_verdir("${PV}")}/${PN}-${PV}.tar.bz2" + +DEPENDS += "gnome-common" + +FILES_${PN} += "${datadir}/application-registry ${datadir}/mime-info \ + ${datadir}/gnome-2.0" + +inherit autotools pkgconfig gconf + +EXTRA_AUTORECONF += "-I ${STAGING_DIR}/${HOST_SYS}/share/aclocal/gnome2-macros" + +gnome_stage_includes() { + autotools_stage_includes +} diff --git a/meta/classes/gpe.bbclass b/meta/classes/gpe.bbclass new file mode 100644 index 0000000000..861ec416a0 --- /dev/null +++ b/meta/classes/gpe.bbclass @@ -0,0 +1,17 @@ +DEPENDS_prepend = "coreutils-native virtual/libintl intltool-native " +GPE_TARBALL_SUFFIX ?= "gz" +SRC_URI = "${GPE_MIRROR}/${PN}-${PV}.tar.${GPE_TARBALL_SUFFIX}" +FILES_${PN} += "${datadir}/gpe ${datadir}/application-registry" +MAINTAINER ?= "GPE Team " + +inherit gettext + +gpe_do_compile() { + oe_runmake PREFIX=${prefix} +} + +gpe_do_install() { + oe_runmake PREFIX=${prefix} DESTDIR=${D} install +} + +EXPORT_FUNCTIONS do_compile do_install diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass new file mode 100644 index 0000000000..0f68e6812b --- /dev/null +++ b/meta/classes/gtk-icon-cache.bbclass @@ -0,0 +1,38 @@ +FILES_${PN} += "${datadir}/icons/hicolor" + +gtk-icon-cache_postinst() { +if [ "x$D" != "x" ]; then + exit 1 +fi +gtk-update-icon-cache -q /usr/share/icons/hicolor +} + +gtk-icon-cache_postrm() { +gtk-update-icon-cache -q /usr/share/icons/hicolor +} + +python populate_packages_append () { + import os.path + packages = bb.data.getVar('PACKAGES', d, 1).split() + workdir = bb.data.getVar('WORKDIR', d, 1) + + for pkg in packages: + icon_dir = '%s/install/%s/%s/icons/hicolor' % (workdir, pkg, bb.data.getVar('datadir', d, 1)) + if not os.path.exists(icon_dir): + continue + + bb.note("adding gtk-icon-cache 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('gtk-icon-cache_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('gtk-icon-cache_postrm', d, 1) + bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) +} + diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass new file mode 100644 index 0000000000..7dfcfc29a4 --- /dev/null +++ b/meta/classes/icecc.bbclass @@ -0,0 +1,156 @@ +# IceCream distributed compiling support +# +# We need to create a tar.bz2 of our toolchain and set +# ICECC_VERSION, ICECC_CXX and ICEC_CC +# + +def create_env(bb,d): + """ + Create a tar.bz of the current toolchain + """ + + # Constin native-native compilation no environment needed if + # host prefix is empty (let us duplicate the query for ease) + prefix = bb.data.expand('${HOST_PREFIX}', d) + if len(prefix) == 0: + return "" + + import tarfile + import socket + import time + import os + ice_dir = bb.data.expand('${CROSS_DIR}', d) + prefix = bb.data.expand('${HOST_PREFIX}' , d) + distro = bb.data.expand('${DISTRO}', d) + target_sys = bb.data.expand('${TARGET_SYS}', d) + #float = bb.data.getVar('${TARGET_FPU}', d) + float = "anyfloat" + name = socket.gethostname() + + try: + os.stat(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2') + os.stat(ice_dir + '/' + target_sys + '/bin/g++') + except: + return "" + + VERSION = '3.4.3' + cross_name = prefix + distro + target_sys + float +VERSION+ name + tar_file = ice_dir + '/ice/' + cross_name + '.tar.bz2' + + try: + os.stat(tar_file) + return tar_file + except: + try: + os.makedirs(ice_dir+'/ice') + except: + pass + + # FIXME find out the version of the compiler + tar = tarfile.open(tar_file, 'w:bz2') + tar.add(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2', + target_sys + 'cross/lib/ld-linux.so.2') + tar.add(ice_dir + '/' + target_sys + '/lib/ld-linux.so.2', + target_sys + 'cross/lib/ld-2.3.3.so') + tar.add(ice_dir + '/' + target_sys + '/lib/libc-2.3.3.so', + target_sys + 'cross/lib/libc-2.3.3.so') + tar.add(ice_dir + '/' + target_sys + '/lib/libc.so.6', + target_sys + 'cross/lib/libc.so.6') + tar.add(ice_dir + '/' + target_sys + '/bin/gcc', + target_sys + 'cross/usr/bin/gcc') + tar.add(ice_dir + '/' + target_sys + '/bin/g++', + target_sys + 'cross/usr/bin/g++') + tar.add(ice_dir + '/' + target_sys + '/bin/as', + target_sys + 'cross/usr/bin/as') + tar.add(ice_dir + '/lib/gcc/' + target_sys +'/'+ VERSION + '/specs', + target_sys+'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/specs') + tar.add(ice_dir + '/libexec/gcc/'+target_sys+'/' + VERSION + '/cc1', + target_sys + 'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/cc1') + tar.add(ice_dir + '/libexec/gcc/arm-linux/' + VERSION + '/cc1plus', + target_sys+'cross/usr/lib/gcc/'+target_sys+'/'+VERSION+'/lib/cc1plus') + tar.close() + return tar_file + + +def create_path(compilers, type, bb, d): + """ + Create Symlinks for the icecc in the staging directory + """ + import os + + staging = bb.data.expand('${STAGING_DIR}', d) + "/ice/" + type + icecc = bb.data.getVar('ICECC_PATH', d) + + # Create the dir if necessary + try: + os.stat(staging) + except: + os.makedirs(staging) + + + for compiler in compilers: + gcc_path = staging + "/" + compiler + try: + os.stat(gcc_path) + except: + os.symlink(icecc, gcc_path) + + return staging + ":" + + +def use_icc_version(bb,d): + # Constin native native + prefix = bb.data.expand('${HOST_PREFIX}', d) + if len(prefix) == 0: + return "no" + + + native = bb.data.expand('${PN}', d) + blacklist = [ "-cross", "-native" ] + + for black in blacklist: + if black in native: + return "no" + + return "yes" + +def icc_path(bb,d,compile): + native = bb.data.expand('${PN}', d) + blacklist = [ "ulibc", "glibc", "ncurses" ] + for black in blacklist: + if black in native: + return "" + + if "-native" in native: + compile = False + if "-cross" in native: + compile = False + + prefix = bb.data.expand('${HOST_PREFIX}', d) + if compile and len(prefix) != 0: + return create_path( [prefix+"gcc", prefix+"g++"], "cross", bb, d ) + elif not compile or len(prefix) == 0: + return create_path( ["gcc", "g++"], "native", bb, d) + + +def icc_version(bb,d): + return create_env(bb,d) + + +# +# set the IceCream environment variables +do_configure_prepend() { + export PATH=${@icc_path(bb,d,False)}$PATH + export ICECC_CC="gcc" + export ICECC_CXX="g++" +} + +do_compile_prepend() { + export PATH=${@icc_path(bb,d,True)}$PATH + export ICECC_CC="${HOST_PREFIX}gcc" + export ICECC_CXX="${HOST_PREFIX}g++" + + if [ "${@use_icc_version(bb,d)}" = "yes" ]; then + export ICECC_VERSION="${@icc_version(bb,d)}" + fi +} diff --git a/meta/classes/image_ipk.bbclass b/meta/classes/image_ipk.bbclass new file mode 100644 index 0000000000..c2f1c8d682 --- /dev/null +++ b/meta/classes/image_ipk.bbclass @@ -0,0 +1,76 @@ +inherit rootfs_ipk + +# We need to follow RDEPENDS and RRECOMMENDS for images +BUILD_ALL_DEPS = "1" + +# Images are generally built explicitly, do not need to be part of world. +EXCLUDE_FROM_WORLD = "1" + +USE_DEVFS ?= "0" + +DEPENDS += "makedevs-native" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +def get_image_deps(d): + import bb + str = "" + for type in (bb.data.getVar('IMAGE_FSTYPES', d, 1) or "").split(): + deps = bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "" + if deps: + str += " %s" % deps + return str + +DEPENDS += "${@get_image_deps(d)}" + +IMAGE_DEVICE_TABLE ?= "${@bb.which(bb.data.getVar('BBPATH', d, 1), 'files/device_table-minimal.txt')}" +IMAGE_POSTPROCESS_COMMAND ?= "" + +# Must call real_do_rootfs() from inside here, rather than as a separate +# task, so that we have a single fakeroot context for the whole process. +fakeroot do_rootfs () { + set -x + rm -rf ${IMAGE_ROOTFS} + + if [ "${USE_DEVFS}" != "1" ]; then + mkdir -p ${IMAGE_ROOTFS}/dev + makedevs -r ${IMAGE_ROOTFS} -D ${IMAGE_DEVICE_TABLE} + fi + + real_do_rootfs + + insert_feed_uris + + rm -f ${IMAGE_ROOTFS}${libdir}/ipkg/lists/oe + + ${IMAGE_PREPROCESS_COMMAND} + + export TOPDIR=${TOPDIR} + + for type in ${IMAGE_FSTYPES}; do + if test -z "$FAKEROOTKEY"; then + fakeroot -i ${TMPDIR}/fakedb.image bbimage -t $type -e ${FILE} + else + bbimage -n "${IMAGE_NAME}" -t "$type" -e "${FILE}" + fi + done + + ${IMAGE_POSTPROCESS_COMMAND} +} + +insert_feed_uris () { + + echo "Building feeds for [${DISTRO}].." + + for line in ${FEED_URIS} + do + # strip leading and trailing spaces/tabs, then split into name and uri + line_clean="`echo "$line"|sed 's/^[ \t]*//;s/[ \t]*$//'`" + feed_name="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\1/p'`" + feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`" + + echo "Added $feed_name feed with URL $feed_uri" + + # insert new feed-sources + echo "src/gz $feed_n