diff options
| -rw-r--r-- | meta/classes/package.bbclass | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index fbdccfbe6d..97a92eff22 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
| @@ -1350,6 +1350,7 @@ SHLIBSWORKDIR = "${PKGDESTWORK}/${MLPREFIX}shlibs2" | |||
| 1350 | 1350 | ||
| 1351 | python package_do_shlibs() { | 1351 | python package_do_shlibs() { |
| 1352 | import re, pipes | 1352 | import re, pipes |
| 1353 | import subprocess as sub | ||
| 1353 | 1354 | ||
| 1354 | exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', 0) | 1355 | exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', 0) |
| 1355 | if exclude_shlibs: | 1356 | if exclude_shlibs: |
| @@ -1459,38 +1460,27 @@ python package_do_shlibs() { | |||
| 1459 | prov = (combo, ldir, pkgver) | 1460 | prov = (combo, ldir, pkgver) |
| 1460 | sonames.append(prov) | 1461 | sonames.append(prov) |
| 1461 | if file.endswith('.dylib') or file.endswith('.so'): | 1462 | if file.endswith('.dylib') or file.endswith('.so'): |
| 1462 | lafile = file.replace(os.path.join(pkgdest, pkg), d.getVar('PKGD', True)) | 1463 | rpath = [] |
| 1463 | # Drop suffix | 1464 | p = sub.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file],stdout=sub.PIPE,stderr=sub.PIPE) |
| 1464 | lafile = lafile.rsplit(".",1)[0] | 1465 | err, out = p.communicate() |
| 1465 | lapath = os.path.dirname(lafile) | 1466 | # If returned succesfully, process stderr for results |
| 1466 | lafile = os.path.basename(lafile) | 1467 | if p.returncode == 0: |
| 1467 | # Find all combinations | 1468 | for l in err.split("\n"): |
| 1468 | combos = get_combinations(lafile) | 1469 | l = l.strip() |
| 1469 | for combo in combos: | 1470 | if l.startswith('path '): |
| 1470 | if os.path.exists(lapath + '/' + combo + '.la'): | 1471 | rpath.append(l.split()[1]) |
| 1471 | break | 1472 | |
| 1472 | lafile = lapath + '/' + combo + '.la' | 1473 | p = sub.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file],stdout=sub.PIPE,stderr=sub.PIPE) |
| 1473 | 1474 | err, out = p.communicate() | |
| 1474 | #bb.note("Foo2: %s" % lafile) | 1475 | # If returned succesfully, process stderr for results |
| 1475 | #bb.note("Foo %s" % file) | 1476 | if p.returncode == 0: |
| 1476 | if os.path.exists(lafile): | 1477 | for l in err.split("\n"): |
| 1477 | fd = open(lafile, 'r') | 1478 | l = l.strip() |
| 1478 | lines = fd.readlines() | 1479 | if not l or l.endswith(":"): |
| 1479 | fd.close() | 1480 | continue |
| 1480 | for l in lines: | 1481 | name = os.path.basename(l.split()[0]).rsplit(".", 1)[0] |
| 1481 | m = re.match("\s*dependency_libs=\s*'(.*)'", l) | 1482 | if name and name not in needed[pkg]: |
| 1482 | if m: | 1483 | needed[pkg].append((name, file, [])) |
| 1483 | deps = m.group(1).split(" ") | ||
| 1484 | for dep in deps: | ||
| 1485 | #bb.note("Trying %s for %s" % (dep, pkg)) | ||
| 1486 | name = None | ||
| 1487 | if dep.endswith(".la"): | ||
| 1488 | name = os.path.basename(dep).replace(".la", "") | ||
| 1489 | elif dep.startswith("-l"): | ||
| 1490 | name = dep.replace("-l", "lib") | ||
| 1491 | if name and name not in needed[pkg]: | ||
| 1492 | needed[pkg].append((name, lafile, [])) | ||
| 1493 | #bb.note("Adding %s for %s" % (name, pkg)) | ||
| 1494 | 1484 | ||
| 1495 | if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS', True) == "1": | 1485 | if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS', True) == "1": |
| 1496 | snap_symlinks = True | 1486 | snap_symlinks = True |
