summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass42
1 files changed, 20 insertions, 22 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index ea7591855e..1ef0c66ca0 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1382,20 +1382,25 @@ python package_do_shlibs() {
1382 for l in lines: 1382 for l in lines:
1383 shlib_provider[l.rstrip()] = (dep_pkg, lib_ver) 1383 shlib_provider[l.rstrip()] = (dep_pkg, lib_ver)
1384 1384
1385 def linux_so(file): 1385 def linux_so(file, needed, sonames, renames):
1386 needs_ldconfig = False 1386 needs_ldconfig = False
1387 ldir = os.path.dirname(file).replace(pkgdest, '')
1387 cmd = d.getVar('OBJDUMP', True) + " -p " + pipes.quote(file) + " 2>/dev/null" 1388 cmd = d.getVar('OBJDUMP', True) + " -p " + pipes.quote(file) + " 2>/dev/null"
1388 fd = os.popen(cmd) 1389 fd = os.popen(cmd)
1389 lines = fd.readlines() 1390 lines = fd.readlines()
1390 fd.close() 1391 fd.close()
1392 rpath = []
1393 for l in lines:
1394 m = re.match("\s+RPATH\s+([^\s]*)", l)
1395 if m:
1396 rpaths = m.group(1).replace("$ORIGIN", ldir).split(":")
1397 rpath = map(os.path.normpath, rpaths)
1391 for l in lines: 1398 for l in lines:
1392 m = re.match("\s+NEEDED\s+([^\s]*)", l) 1399 m = re.match("\s+NEEDED\s+([^\s]*)", l)
1393 if m: 1400 if m:
1394 if m.group(1) not in needed[pkg]: 1401 dep = m.group(1)
1395 needed[pkg].append(m.group(1)) 1402 if dep not in needed[pkg]:
1396 if m.group(1) not in needed_from: 1403 needed[pkg].append((dep, file, rpath))
1397 needed_from[m.group(1)] = []
1398 needed_from[m.group(1)].append(file)
1399 m = re.match("\s+SONAME\s+([^\s]*)", l) 1404 m = re.match("\s+SONAME\s+([^\s]*)", l)
1400 if m: 1405 if m:
1401 this_soname = m.group(1) 1406 this_soname = m.group(1)
@@ -1409,7 +1414,7 @@ python package_do_shlibs() {
1409 renames.append((file, os.path.join(os.path.dirname(file), this_soname))) 1414 renames.append((file, os.path.join(os.path.dirname(file), this_soname)))
1410 return needs_ldconfig 1415 return needs_ldconfig
1411 1416
1412 def darwin_so(file): 1417 def darwin_so(file, needed, sonames, renames):
1413 if not os.path.exists(file): 1418 if not os.path.exists(file):
1414 return 1419 return
1415 1420
@@ -1464,14 +1469,8 @@ python package_do_shlibs() {
1464 name = os.path.basename(dep).replace(".la", "") 1469 name = os.path.basename(dep).replace(".la", "")
1465 elif dep.startswith("-l"): 1470 elif dep.startswith("-l"):
1466 name = dep.replace("-l", "lib") 1471 name = dep.replace("-l", "lib")
1467 if pkg not in needed:
1468 needed[pkg] = []
1469 if name and name not in needed[pkg]: 1472 if name and name not in needed[pkg]:
1470 needed[pkg].append(name) 1473 needed[pkg].append((name, lafile, []))
1471 if name not in needed_from:
1472 needed_from[name] = []
1473 if lafile and lafile not in needed_from[name]:
1474 needed_from[name].append(lafile)
1475 #bb.note("Adding %s for %s" % (name, pkg)) 1474 #bb.note("Adding %s for %s" % (name, pkg))
1476 1475
1477 if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS', True) == "1": 1476 if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS', True) == "1":
@@ -1485,7 +1484,6 @@ python package_do_shlibs() {
1485 use_ldconfig = False 1484 use_ldconfig = False
1486 1485
1487 needed = {} 1486 needed = {}
1488 needed_from = {}
1489 shlib_provider = {} 1487 shlib_provider = {}
1490 read_shlib_providers() 1488 read_shlib_providers()
1491 1489
@@ -1509,9 +1507,9 @@ python package_do_shlibs() {
1509 if cpath.islink(file): 1507 if cpath.islink(file):
1510 continue 1508 continue
1511 if targetos == "darwin" or targetos == "darwin8": 1509 if targetos == "darwin" or targetos == "darwin8":
1512 darwin_so(file) 1510 darwin_so(file, needed, sonames, renames)
1513 elif os.access(file, os.X_OK) or lib_re.match(file): 1511 elif os.access(file, os.X_OK) or lib_re.match(file):
1514 ldconfig = linux_so(file) 1512 ldconfig = linux_so(file, needed, sonames, renames)
1515 needs_ldconfig = needs_ldconfig or ldconfig 1513 needs_ldconfig = needs_ldconfig or ldconfig
1516 for (old, new) in renames: 1514 for (old, new) in renames:
1517 bb.note("Renaming %s to %s" % (old, new)) 1515 bb.note("Renaming %s to %s" % (old, new))
@@ -1567,12 +1565,12 @@ python package_do_shlibs() {
1567 # but skipping it is still better alternative than providing own 1565 # but skipping it is still better alternative than providing own
1568 # version and then adding runtime dependency for the same system library 1566 # version and then adding runtime dependency for the same system library
1569 if private_libs and n in private_libs: 1567 if private_libs and n in private_libs:
1570 bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n)) 1568 bb.debug(2, '%s: Dependency %s covered by PRIVATE_LIBS' % (pkg, n[0]))
1571 continue 1569 continue
1572 if n in shlib_provider.keys(): 1570 if n[0] in shlib_provider.keys():
1573 (dep_pkg, ver_needed) = shlib_provider[n] 1571 (dep_pkg, ver_needed) = shlib_provider[n[0]]
1574 1572
1575 bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n, dep_pkg, needed_from[n])) 1573 bb.debug(2, '%s: Dependency %s requires package %s (used by files: %s)' % (pkg, n[0], dep_pkg, n[1]))
1576 1574
1577 if dep_pkg == pkg: 1575 if dep_pkg == pkg:
1578 continue 1576 continue
@@ -1584,7 +1582,7 @@ python package_do_shlibs() {
1584 if not dep in deps: 1582 if not dep in deps:
1585 deps.append(dep) 1583 deps.append(dep)
1586 else: 1584 else:
1587 bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n, needed_from[n])) 1585 bb.note("Couldn't find shared library provider for %s, used by files: %s" % (n[0], n[1]))
1588 1586
1589 deps_file = os.path.join(pkgdest, pkg + ".shlibdeps") 1587 deps_file = os.path.join(pkgdest, pkg + ".shlibdeps")
1590 if os.path.exists(deps_file): 1588 if os.path.exists(deps_file):