[oe-commits] [openembedded-core] 47/63: package.bbclass: Add SHLIB detection support for mingw targets

git at git.openembedded.org git at git.openembedded.org
Sat Mar 4 10:46:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 7df031e1ffe409573753585ba2f1a82ff707ad7e
Author: Nathan Rossi <nathan at nathanrossi.com>
AuthorDate: Tue Feb 21 23:17:28 2017 +1000

    package.bbclass: Add SHLIB detection support for mingw targets
    
    Add support to detect dll files as shared objects as well as process
    Windows .dll and .exe files to determine the runtime libraries
    dependencies.
    
    This implementation is sufficient to detect and map runtime library
    dependencies between packages. And does not implement any version naming
    conventions that might apply for .dll files (e.g. lib*-x.dll).
    
    Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/package.bbclass | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index d5c2d82..299ea12 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1613,6 +1613,25 @@ python package_do_shlibs() {
                 if name and name not in needed[pkg]:
                      needed[pkg].append((name, file, []))
 
+    def mingw_dll(file, needed, sonames, renames, pkgver):
+        if not os.path.exists(file):
+            return
+
+        if file.endswith(".dll"):
+            # assume all dlls are shared objects provided by the package
+            sonames.append((os.path.basename(file), os.path.dirname(file).replace(pkgdest + "/" + pkg, ''), pkgver))
+
+        if (file.endswith(".dll") or file.endswith(".exe")):
+            # use objdump to search for "DLL Name: .*\.dll"
+            p = sub.Popen([d.expand("${HOST_PREFIX}objdump"), "-p", file], stdout = sub.PIPE, stderr= sub.PIPE)
+            out, err = p.communicate()
+            # process the output, grabbing all .dll names
+            if p.returncode == 0:
+                for m in re.finditer("DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE):
+                    dllname = m.group(1)
+                    if dllname:
+                        needed[pkg].append((dllname, file, []))
+
     if d.getVar('PACKAGE_SNAP_LIB_SYMLINKS') == "1":
         snap_symlinks = True
     else:
@@ -1644,6 +1663,8 @@ python package_do_shlibs() {
                     continue
                 if targetos == "darwin" or targetos == "darwin8":
                     darwin_so(file, needed, sonames, renames, pkgver)
+                elif targetos.startswith("mingw"):
+                    mingw_dll(file, needed, sonames, renames, pkgver)
                 elif os.access(file, os.X_OK) or lib_re.match(file):
                     ldconfig = linux_so(file, needed, sonames, renames, pkgver)
                     needs_ldconfig = needs_ldconfig or ldconfig

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list