summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-04-11 15:19:45 +0000
committerRichard Purdie <richard@openedhand.com>2008-04-11 15:19:45 +0000
commit028178b722d9ab8c36e45eec000835cff29095d2 (patch)
tree08bcc0f05d7d3d504b65a89044406ba311b40c42 /meta
parentf09d3d961180f98d7a18c282dc0ad48081a9c38e (diff)
downloadpoky-028178b722d9ab8c36e45eec000835cff29095d2.tar.gz
package.bbclass: Add patch to try and handle dynamic librbary dependencies on darwin through libtool
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4237 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/package.bbclass100
1 files changed, 82 insertions, 18 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index eb43856c55..74c6b53a45 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -547,6 +547,7 @@ python package_do_shlibs() {
547 libdir_re = re.compile(".*/lib$") 547 libdir_re = re.compile(".*/lib$")
548 548
549 packages = bb.data.getVar('PACKAGES', d, 1) 549 packages = bb.data.getVar('PACKAGES', d, 1)
550 targetos = bb.data.getVar('TARGET_OS', d, 1)
550 551
551 workdir = bb.data.getVar('WORKDIR', d, 1) 552 workdir = bb.data.getVar('WORKDIR', d, 1)
552 if not workdir: 553 if not workdir:
@@ -567,6 +568,83 @@ python package_do_shlibs() {
567 if pstageactive == "1": 568 if pstageactive == "1":
568 lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d)) 569 lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
569 570
571 def linux_so(root, path, file):
572 cmd = bb.data.getVar('OBJDUMP', d, 1) + " -p " + os.path.join(root, file) + " 2>/dev/null"
573 cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, 1), cmd)
574 fd = os.popen(cmd)
575 lines = fd.readlines()
576 fd.close()
577 for l in lines:
578 m = re.match("\s+NEEDED\s+([^\s]*)", l)
579 if m:
580 needed[pkg].append(m.group(1))
581 m = re.match("\s+SONAME\s+([^\s]*)", l)
582 if m and not m.group(1) in sonames:
583 # if library is private (only used by package) then do not build shlib for it
584 if not private_libs or -1 == private_libs.find(m.group(1)):
585 sonames.append(m.group(1))
586 if m and libdir_re.match(root):
587 needs_ldconfig = True
588 def darwin_so(root, path, file):
589 fullpath = os.path.join(root, file)
590 if not os.path.exists(fullpath):
591 return
592
593 def get_combinations(base):
594 #
595 # Given a base library name, find all combinations of this split by "." and "-"
596 #
597 combos = []
598 options = base.split(".")
599 for i in range(1, len(options) + 1):
600 combos.append(".".join(options[0:i]))
601 options = base.split("-")
602 for i in range(1, len(options) + 1):
603 combos.append("-".join(options[0:i]))
604 return combos
605
606 if (file.endswith('.dylib') or file.endswith('.so')) and not pkg.endswith('-dev') and not pkg.endswith('-dbg'):
607 # Drop suffix
608 name = file.rsplit(".",1)[0]
609 # Find all combinations
610 combos = get_combinations(name)
611 for combo in combos:
612 if not combo in sonames:
613 sonames.append(combo)
614 if file.endswith('.dylib') or file.endswith('.so'):
615 lafile = fullpath.replace(os.path.join(pkgdest, pkg), bb.data.getVar('D', d, 1))
616 # Drop suffix
617 lafile = lafile.rsplit(".",1)[0]
618 lapath = os.path.dirname(lafile)
619 lafile = os.path.basename(lafile)
620 # Find all combinations
621 combos = get_combinations(lafile)
622 for combo in combos:
623 if os.path.exists(lapath + '/' + combo + '.la'):
624 break
625 lafile = lapath + '/' + combo + '.la'
626
627 #bb.note("Foo2: %s" % lafile)
628 #bb.note("Foo %s %s" % (file, fullpath))
629 fd = open(lafile, 'r')
630 lines = fd.readlines()
631 fd.close()
632 for l in lines:
633 m = re.match("\s*dependency_libs=\s*'(.*)'", l)
634 if m:
635 deps = m.group(1).split(" ")
636 for dep in deps:
637 #bb.note("Trying %s for %s" % (dep, pkg))
638 name = None
639 if dep.endswith(".la"):
640 name = os.path.basename(dep).replace(".la", "")
641 elif dep.startswith("-l"):
642 name = dep.replace("-l", "lib")
643 if pkg not in needed:
644 needed[pkg] = []
645 if name:
646 needed[pkg].append(name)
647 #bb.note("Adding %s for %s" % (name, pkg))
570 needed = {} 648 needed = {}
571 private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1) 649 private_libs = bb.data.getVar('PRIVATE_LIBS', d, 1)
572 for pkg in packages.split(): 650 for pkg in packages.split():
@@ -579,24 +657,10 @@ python package_do_shlibs() {
579 for root, dirs, files in os.walk(top): 657 for root, dirs, files in os.walk(top):
580 for file in files: 658 for file in files:
581 soname = None 659 soname = None
582 path = os.path.join(root, file) 660 if targetos == "darwin":
583 if os.access(path, os.X_OK) or lib_re.match(file): 661 darwin_so(root, dirs, file)
584 cmd = bb.data.getVar('OBJDUMP', d, 1) + " -p " + path + " 2>/dev/null" 662 elif os.access(path, os.X_OK) or lib_re.match(file):
585 cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', d, 1), cmd) 663 linux_so(root, dirs, file)
586 fd = os.popen(cmd)
587 lines = fd.readlines()
588 fd.close()
589 for l in lines:
590 m = re.match("\s+NEEDED\s+([^\s]*)", l)
591 if m:
592 needed[pkg].append(m.group(1))
593 m = re.match("\s+SONAME\s+([^\s]*)", l)
594 if m and not m.group(1) in sonames:
595 # if library is private (only used by package) then do not build shlib for it
596 if not private_libs or -1 == private_libs.find(m.group(1)):
597 sonames.append(m.group(1))
598 if m and libdir_re.match(root):
599 needs_ldconfig = True
600 shlibs_file = os.path.join(shlibs_dir, pkg + ".list") 664 shlibs_file = os.path.join(shlibs_dir, pkg + ".list")
601 if os.path.exists(shlibs_file): 665 if os.path.exists(shlibs_file):
602 os.remove(shlibs_file) 666 os.remove(shlibs_file)