summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-02 09:48:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-03 12:40:41 +0100
commit53eaed5c155656a60e603439c00c541052c8d043 (patch)
treeb422ae2ce054bd7fefe3e66103521015828f4bec /meta
parentc70203998b30329dd20dd8b146cebe08130cf57f (diff)
downloadpoky-53eaed5c155656a60e603439c00c541052c8d043.tar.gz
package: Convert dylib handling from .la to otool
Currently, the darwin shlibs detection is done by parsing the .la file dependency fields. This is very old code and is incomplete in some cases so convert to using otool -l and otool -L to correctly load the rpath and dependency information. (From OE-Core rev: e27573b6c3562662e4b2f5d8543eb7d150c3bc92) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/package.bbclass54
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
1351python package_do_shlibs() { 1351python 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