aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/xorg-driver/xorg-driver-common.inc
blob: 57a4c827dde5bc38dbec871cc9cac6dd8527f451 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SUMMARY = "X driver"
HOMEPAGE = "http://www.x.org"
BUGTRACKER = "https://bugs.freedesktop.org"
SECTION = "x11/drivers"
LICENSE = "MIT-X"

PE = "2"
INC_PR = "r21"

DEPENDS = "virtual/xserver xproto randrproto util-macros"

SRC_URI = "${XORG_MIRROR}/individual/driver/${BPN}-${PV}.tar.bz2"

FILES_${PN} += " ${libdir}/xorg/modules/drivers/*.so"

inherit autotools pkgconfig distro_features_check
# depends on virtual/xserver
REQUIRED_DISTRO_FEATURES = "x11"

# FIXME: We don't want to include the libtool archives (*.la) from modules
# directory, as they serve no useful purpose. Upstream should fix Makefile.am
do_install_append() {
	find ${D}${libdir}/xorg/modules -regex ".*\.la$" | xargs rm -f --
}

# Function to add the relevant ABI dependency to drivers, which should be called
# from a PACKAGEFUNC.
def _add_xorg_abi_depends(d, name):
    # Map of ABI names exposed in the dependencies to pkg-config variables
    abis = {
      "video": "abi_videodrv",
      "input": "abi_xinput"
    }

    output = os.popen("pkg-config xorg-server --variable=%s" % abis[name]).read()
    mlprefix = d.getVar('MLPREFIX', True) or ''
    abi = "%sxorg-abi-%s-%s" % (mlprefix, name, output.split(".")[0])

    pn = d.getVar("PN", True)
    d.appendVar('RDEPENDS_' + pn, ' ' + abi)
"--strip-unneeded"]) # shared or executable: elif elftype & 8 or elftype & 4: stripcmd.extend(["--remove-section=.comment", "--remove-section=.note"]) stripcmd.append(file) bb.debug(1, "runstrip: %s" % stripcmd) try: output = subprocess.check_output(stripcmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: bb.error("runstrip: '%s' strip command failed with %s (%s)" % (stripcmd, e.returncode, e.output)) if newmode: os.chmod(file, origmode) return def file_translate(file): ft = file.replace("@", "@at@") ft = ft.replace(" ", "@space@") ft = ft.replace("\t", "@tab@") ft = ft.replace("[", "@openbrace@") ft = ft.replace("]", "@closebrace@") ft = ft.replace("_", "@underscore@") return ft def filedeprunner(arg): import re, subprocess, shlex (pkg, pkgfiles, rpmdeps, pkgdest) = arg provides = {} requires = {} r = re.compile(r'[<>=]+ +[^ ]*') def process_deps(pipe, pkg, pkgdest, provides, requires): for line in pipe: f = line.decode("utf-8").split(" ", 1)[0].strip() line = line.decode("utf-8").split(" ", 1)[1].strip() if line.startswith("Requires:"): i = requires elif line.startswith("Provides:"): i = provides else: continue file = f.replace(pkgdest + "/" + pkg, "") file = file_translate(file) value = line.split(":", 1)[1].strip() value = r.sub(r'(\g<0>)', value) if value.startswith("rpmlib("): continue if value == "python": continue if file not in i: i[file] = [] i[file].append(value) return provides, requires try: dep_popen = subprocess.Popen(shlex.split(rpmdeps) + pkgfiles, stdout=subprocess.PIPE) provides, requires = process_deps(dep_popen.stdout, pkg, pkgdest, provides, requires) except OSError as e: bb.error("rpmdeps: '%s' command failed, '%s'" % (shlex.split(rpmdeps) + pkgfiles, e)) raise e return (pkg, provides, requires) def read_shlib_providers(d): import re shlib_provider = {} shlibs_dirs = d.getVar('SHLIBSDIRS').split() list_re = re.compile('^(.*)\.list$') # Go from least to most specific since the last one found wins for dir in reversed(shlibs_dirs): bb.debug(2, "Reading shlib providers in %s" % (dir)) if not os.path.exists(dir): continue for file in os.listdir(dir): m = list_re.match(file) if m: dep_pkg = m.group(1) try: fd = open(os.path.join(dir, file)) except IOError: # During a build unrelated shlib files may be deleted, so # handle files disappearing between the listdirs and open. continue lines = fd.readlines() fd.close() for l in lines: s = l.strip().split(":") if s[0] not in shlib_provider: shlib_provider[s[0]] = {} shlib_provider[s[0]][s[1]] = (dep_pkg, s[2]) return shlib_provider def npm_split_package_dirs(pkgdir): """ Work out the packages fetched and unpacked by BitBake's npm fetcher Returns a dict of packagename -> (relpath, package.json) ordered such that it is suitable for use in PACKAGES and FILES """ from collections import OrderedDict import json packages = {} for root, dirs, files in os.walk(pkgdir): if os.path.basename(root) == 'node_modules': for dn in dirs: relpth = os.path.relpath(os.path.join(root, dn), pkgdir) pkgitems = ['${PN}'] for pathitem in relpth.split('/'): if pathitem == 'node_modules': continue pkgitems.append(pathitem) pkgname = '-'.join(pkgitems).replace('_', '-') pkgfile = os.path.join(root, dn, 'package.json') data = None if os.path.exists(pkgfile): with open(pkgfile, 'r') as f: data = json.loads(f.read()) packages[pkgname] = (relpth, data) # We want the main package for a module sorted *after* its subpackages # (so that it doesn't otherwise steal the files for the subpackage), so # this is a cheap way to do that whilst still having an otherwise # alphabetical sort return OrderedDict((key, packages[key]) for key in sorted(packages, key=lambda pkg: pkg + '~'))