diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-07 18:40:55 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-10 17:37:38 +0100 |
commit | 48b9ecd5335f63fb2bcc47c4b23d067122734fe9 (patch) | |
tree | 23c4546dce8adf3f6c71af74fb01802da2671fcb | |
parent | 8dd09b3ddc572a338b4a6f1d859b68b2b4482d00 (diff) | |
download | openembedded-core-48b9ecd5335f63fb2bcc47c4b23d067122734fe9.tar.gz openembedded-core-48b9ecd5335f63fb2bcc47c4b23d067122734fe9.tar.bz2 openembedded-core-48b9ecd5335f63fb2bcc47c4b23d067122734fe9.zip |
package.bbclass: Rewrite shlib_provider handling to include RPATH
Change the do_package shlibs code to account for RPATHS. This means that
for library dependency purposes, only libraries in system paths or in
any declared RPATH will be seen. This is important to resolve problems
people have been having where similarly named libraries in "private"
paths were conflicting, e.g. with gstreamer.
For now this code assumes the default search path is libdir and
base_libdir and places ASSUME_SHLIBS in libdir so they are searched by
default.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/package.bbclass | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index d7de72bda3..988e148893 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -1375,7 +1375,9 @@ python package_do_shlibs() { fd.close() for l in lines: s = l.strip().split(":") - shlib_provider[s[0]] = (dep_pkg, s[2]) + if s[0] not in shlib_provider: + shlib_provider[s[0]] = {} + shlib_provider[s[0]][s[1]] = (dep_pkg, s[2]) def linux_so(file, needed, sonames, renames, pkgver): needs_ldconfig = False @@ -1518,13 +1520,15 @@ python package_do_shlibs() { if len(sonames): fd = open(shlibs_file, 'w') for s in sonames: - if s[0] in shlib_provider: - (old_pkg, old_pkgver) = shlib_provider[s[0]] + if s[0] in shlib_provider and s[1] in shlib_provider[s[0]]: + (old_pkg, old_pkgver) = shlib_provider[s[0]][s[1]] if old_pkg != pkg: bb.warn('%s-%s was registered as shlib provider for %s, changing it to %s-%s because it was built later' % (old_pkg, old_pkgver, s[0], pkg, pkgver)) bb.debug(1, 'registering %s-%s as shlib provider for %s' % (pkg, pkgver, s[0])) fd.write(s[0] + ':' + s[1] + ':' + s[2] + '\n') - shlib_provider[s[0]] = (pkg, pkgver) + if s[0] not in shlib_provider: + shlib_provider[s[0]] = {} + shlib_provider[s[0]][s[1]] = (pkg, pkgver) fd.close() if needs_ldconfig and use_ldconfig: bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) @@ -1539,6 +1543,7 @@ python package_do_shlibs() { assumed_libs = d.getVar('ASSUME_SHLIBS', True) if assumed_libs: + libdir = d.getVar("libdir", True) for e in assumed_libs.split(): l, dep_pkg = e.split(":") lib_ver = None @@ -1546,7 +1551,9 @@ python package_do_shlibs() { if len(dep_pkg) == 2: lib_ver = dep_pkg[1] dep_pkg = dep_pkg[0] - shlib_provider[l] = (dep_pkg, lib_ver) + shlib_provider[l][libdir] = (dep_pkg, lib_ver) + + libsearchpath = [d.getVar('libdir', True), d.getVar('base_libdir', True)] for pkg in packages.split(): bb.debug(2, "calculating shlib requirements for %s" % pkg) @@ -1562,21 +1569,27 @@ python package_do_shlibs() { bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n[0])) continue if n[0] in shlib_provider.keys(): - (dep_pkg, ver_needed) = shlib_provider[n[0]] + match = None + for p in n[2] + libsearchpath: + if p in shlib_provider[n[0]]: + match = p + break + if match: + (dep_pkg, ver_needed) = shlib_provider[n[0]][match] - bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1])) + bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1])) - if dep_pkg == pkg: - continue + if dep_pkg == pkg: + continue - if ver_needed: - dep = "%s (>= %s)" % (dep_pkg, ver_needed) - else: - dep = dep_pkg - if not dep in deps: - deps.append(dep) - else: - bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1])) + if ver_needed: + dep = "%s (>= %s)" % (dep_pkg, ver_needed) + else: + dep = dep_pkg + if not dep in deps: + deps.append(dep) + continue + bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1])) deps_file = os.path.join(pkgdest, pkg + ".shlibdeps") if os.path.exists(deps_file): |