From 1219bf8a90a7bf8cd3a5363551ef635d51e8fc8e Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Thu, 8 Oct 2015 22:51:41 +0200 Subject: initial commit for Enea Linux 5.0 arm Signed-off-by: Tudor Florea --- meta-oe/classes/breakpad.bbclass | 33 +++++++++ meta-oe/classes/gitpkgv.bbclass | 113 ++++++++++++++++++++++++++++++ meta-oe/classes/gitver.bbclass | 75 ++++++++++++++++++++ meta-oe/classes/gpe.bbclass | 17 +++++ meta-oe/classes/machine_kernel_pr.bbclass | 8 +++ 5 files changed, 246 insertions(+) create mode 100644 meta-oe/classes/breakpad.bbclass create mode 100644 meta-oe/classes/gitpkgv.bbclass create mode 100644 meta-oe/classes/gitver.bbclass create mode 100644 meta-oe/classes/gpe.bbclass create mode 100644 meta-oe/classes/machine_kernel_pr.bbclass (limited to 'meta-oe/classes') diff --git a/meta-oe/classes/breakpad.bbclass b/meta-oe/classes/breakpad.bbclass new file mode 100644 index 000000000..e4d6808a6 --- /dev/null +++ b/meta-oe/classes/breakpad.bbclass @@ -0,0 +1,33 @@ +# Class to inherit when you want to build against Breakpad. +# Apart from inheriting this class, you need to set BREAKPAD_BIN in +# your recipe, and make sure that you link against libbreakpad_client.a. + +DEPENDS += "breakpad breakpad-native" + +CFLAGS += "-I${STAGING_DIR_TARGET}${includedir}/breakpad " +CXXFLAGS += "-I${STAGING_DIR_TARGET}${includedir}/breakpad " + +BREAKPAD_BIN ?= "" + +python () { + breakpad_bin = d.getVar("BREAKPAD_BIN", True) + + if not breakpad_bin: + PN = d.getVar("PN", True) + FILE = os.path.basename(d.getVar("FILE", True)) + bb.error("To build %s, see breakpad.bbclass for instructions on \ + setting up your Breakpad configuration" % PN) + raise ValueError('BREAKPAD_BIN not defined in %s' % PN) +} + +# Add creation of symbols here +PACKAGE_PREPROCESS_FUNCS += "breakpad_package_preprocess" +breakpad_package_preprocess () { + mkdir -p ${PKGD}/usr/share/breakpad-syms + find ${D} -name ${BREAKPAD_BIN} -exec sh -c "dump_syms {} > ${PKGD}/usr/share/breakpad-syms/${BREAKPAD_BIN}.syms" \; +} + +PACKAGES =+ "${PN}-breakpad" + +FILES_${PN}-breakpad = "/usr/share/breakpad-syms" + diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass new file mode 100644 index 000000000..7bdc53893 --- /dev/null +++ b/meta-oe/classes/gitpkgv.bbclass @@ -0,0 +1,113 @@ +# gitpkgv.bbclass provides a GITPKGV and GITPKGVTAG variables to be +# used in PKGV, as described bellow: +# +# - GITPKGV which is a sortable version with the format NN+GITHASH, to +# be used in PKGV, where +# +# NN equals the total number of revs up to SRCREV +# GITHASH is SRCREV's (full) hash +# +# - GITPKGVTAG which is the output of 'git describe' allowing for +# automatic versioning +# +# gitpkgv.bbclass assumes the git repository has been cloned, and +# contains SRCREV. So ${GITPKGV} and ${GITPKGVTAG} should never be +# used in PV, only in PKGV. It can handle SRCREV = ${AUTOREV}, as +# well as SRCREV = "". +# +# WARNING: if upstream repository is always using consistent and +# sortable tag name scheme you can get sortable version including tag +# name with ${GITPKGVTAG}, but be aware that ie tag sequence "v1.0, +# v1.2, xtest, v2.0" will force you to increment PE to get upgradeable +# path to v2.0 revisions +# +# use example: +# +# inherit gitpkgv +# +# PV = "1.0+gitr${SRCPV}" # expands to something like 1.0+gitr3+4c1c21d7dbbf93b0df336994524313dfe0d4963b +# PKGV = "1.0+gitr${GITPKGV}" # expands also to something like 1.0+gitr31337+4c1c21d7d +# +# or +# +# inherit gitpkgv +# +# PV = "1.0+gitr${SRCPV}" # expands to something like 1.0+gitr3+4c1c21d7dbbf93b0df336994524313dfe0d4963b +# PKGV = "${GITPKGVTAG}" # expands to something like 1.0-31337+g4c1c21d +# if there is tag v1.0 before this revision or +# ver1.0-31337+g4c1c21d if there is tag ver1.0 + +GITPKGV = "${@get_git_pkgv(d, False)}" +GITPKGVTAG = "${@get_git_pkgv(d, True)}" + +def gitpkgv_drop_tag_prefix(version): + import re + if re.match("v\d", version): + return version[1:] + else: + return version + +def get_git_pkgv(d, use_tags): + import os + import bb + from pipes import quote + + src_uri = d.getVar('SRC_URI', 1).split() + fetcher = bb.fetch2.Fetch(src_uri, d) + ud = fetcher.ud + + # + # If SRCREV_FORMAT is set respect it for tags + # + format = d.getVar('SRCREV_FORMAT', True) + if not format: + format = 'default' + + found = False + for url in ud.values(): + if url.type == 'git': + for name, rev in url.revisions.items(): + if not os.path.exists(url.localpath): + return None + + found = True + + vars = { 'repodir' : quote(url.localpath), + 'rev' : quote(rev) } + + rev = bb.fetch2.get_srcrev(d).split('+')[1] + rev_file = os.path.join(url.localpath, "oe-gitpkgv_" + rev) + + if not os.path.exists(rev_file) or os.path.getsize(rev_file)==0: + commits = bb.fetch2.runfetchcmd( + "cd %(repodir)s && " + "git rev-list %(rev)s -- 2> /dev/null " + "| wc -l" % vars, + d, quiet=True).strip().lstrip('0') + + if commits != "": + oe.path.remove(rev_file, recurse=False) + open(rev_file, "w").write("%d\n" % int(commits)) + else: + commits = "0" + else: + commits = open(rev_file, "r").readline(128).strip() + + if use_tags: + try: + output = bb.fetch2.runfetchcmd( + "cd %(repodir)s && " + "git describe %(rev)s 2>/dev/null" % vars, + d, quiet=True).strip() + ver = gitpkgv_drop_tag_prefix(output) + except Exception: + ver = "0.0-%s-g%s" % (commits, rev[:7]) + else: + ver = "%s+%s" % (commits, rev[:7]) + + format = format.replace(name, ver) + + if found: + return format + + return '0+0' diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass new file mode 100644 index 000000000..e7b5155ee --- /dev/null +++ b/meta-oe/classes/gitver.bbclass @@ -0,0 +1,75 @@ +# Copyright (C) 2009 Chris Larson +# Released under the MIT license (see COPYING.MIT for the terms) +# +# gitver.bbclass provides a GITVER variable which is a (fairly) sane version, +# for use in ${PV}, extracted from the ${S} git checkout, assuming it is one. +# This is most useful in concert with srctree.bbclass. + +def git_drop_tag_prefix(version): + import re + if re.match("v\d", version): + return version[1:] + else: + return version + +GIT_TAGADJUST = "git_drop_tag_prefix(version)" +GITVER = "${@get_git_pv('${S}', d, tagadjust=lambda version:${GIT_TAGADJUST})}" +GITSHA = "${@get_git_hash('${S}', d)}" + +def gitrev_run(cmd, path): + (output, error) = bb.process.run(cmd, cwd=path) + return output.rstrip() + +def get_git_pv(path, d, tagadjust=None): + import os + import bb.process + + gitdir = os.path.abspath(os.path.join(d.getVar("S", True), ".git")) + try: + ver = gitrev_run("git describe --tags", gitdir) + except Exception, exc: + bb.fatal(str(exc)) + + if not ver: + try: + ver = gitrev_run("git rev-parse --short HEAD", gitdir) + except Exception, exc: + bb.fatal(str(exc)) + + if ver: + return "0.0+%s" % ver + else: + return "0.0" + else: + if tagadjust: + ver = tagadjust(ver) + return ver + +def mark_recipe_dependencies(path, d): + from bb.parse import mark_dependency + + gitdir = os.path.join(path, ".git") + + # Force the recipe to be reparsed so the version gets bumped + # if the active branch is switched, or if the branch changes. + mark_dependency(d, os.path.join(gitdir, "HEAD")) + + # Force a reparse if anything in the index changes. + mark_dependency(d, os.path.join(gitdir, "index")) + + try: + ref = gitrev_run("git symbolic-ref -q HEAD", gitdir) + except bb.process.CmdError: + pass + else: + if ref: + mark_dependency(d, os.path.join(gitdir, ref)) + + # Catch new tags. + tagdir = os.path.join(gitdir, "refs", "tags") + if os.path.exists(tagdir): + mark_dependency(d, tagdir) + +python () { + mark_recipe_dependencies(d.getVar("S", True), d) +} diff --git a/meta-oe/classes/gpe.bbclass b/meta-oe/classes/gpe.bbclass new file mode 100644 index 000000000..9fc136590 --- /dev/null +++ b/meta-oe/classes/gpe.bbclass @@ -0,0 +1,17 @@ +DEPENDS_prepend = "virtual/libintl intltool-native " +GPE_TARBALL_SUFFIX ?= "gz" +SRC_URI = "${GPE_MIRROR}/${BP}.tar.${GPE_TARBALL_SUFFIX}" +FILES_${PN} += "${datadir}/gpe ${datadir}/application-registry" +SECTION ?= "gpe" + +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-oe/classes/machine_kernel_pr.bbclass b/meta-oe/classes/machine_kernel_pr.bbclass new file mode 100644 index 000000000..463b64d8e --- /dev/null +++ b/meta-oe/classes/machine_kernel_pr.bbclass @@ -0,0 +1,8 @@ +python __anonymous () { + + machine_kernel_pr = d.getVar('MACHINE_KERNEL_PR', True) + + if machine_kernel_pr: + d.setVar('PR', machine_kernel_pr) +} + -- cgit v1.2.3-54-g00ecf