MinGW specific improvements/fixes
v2 cover MinGW specific improvements/fixes
This series contains a few patches that improve/fix MinGW specific parts that cannot be easily implemented outside of oe-core/meta.
The first patch disables update-alternatives when TARGET_OS == mingw32, this is due to Windows not supporting symlinks in the same way as expected by update-alternatives. This also avoids a dependency chain on opkg-utils/python.
The second patch adds support to the package bbclass to detect shared objects (.dll's) and executables use of shared objects. This implementation allows for auto-detection of packages contents and their dependencies and allows for the build to generate full sets of executables with shared object dependencies when targeting mingw32.
The third patch fixes the libgpg-error configure task, preventing it from clobbering the syscfg for mingw32 targets. This is not easily overridden from a bbappend.
---
Changes in v2:
* Rebased on top of current master
Nathan Rossi (3):
update-alternatives.bbclass: Disable for mingw32 targets package.bbclass: Add SHLIB detection support for mingw targets
libgpg-error: Don't replace the syscfg header for mingw32
meta/classes/package.bbclass | 21 +++++++++++++++++++++ meta/classes/update-alternatives.bbclass | 4 ++++ .../libgpg-error/libgpg-error_1.26.bb | 11 ++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-)
Signature · 1 line
2.11.0
PATCH v2 1/3 update-alternatives.bbclass: Disable for mingw32 targets
When building for mingw32 targets (e.g. nativesdk cross compiling for windows), disable the dependency on update-alternatives as the Windows platform does not support symlinks or package management.
This avoids the complex (partly non-buildable for mingw32) dependency chain virtual/update-alternatives -> opkg-utils -> python -> ...
--- meta/classes/update-alternatives.bbclass | 4 ++++ 1 file changed, 4 insertions(+)
meta/classes/update-alternatives.bbclass +4 -0
@@ -96,6 +96,10 @@ python __anonymous() { bb.data.inherits_class('cross-canadian', d): return + # Disable when targeting mingw32 (no target support) + if d.getVar("TARGET_OS") == "mingw32": + return + # compute special vardeps gen_updatealternativesvardeps(d)
Signature · 1 line
2.11.0
PATCH v2 2/3 package.bbclass: Add SHLIB detection support for mingw targets
In reply to Nathan RossiAdd 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).
--- meta/classes/package.bbclass | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
meta/classes/package.bbclass +21 -0
@@ -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:
@@ -1647,6 +1666,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
Signature · 1 line
2.11.0
PATCH v2 3/3 libgpg-error: Don't replace the syscfg header for mingw32
In reply to Nathan RossiFor mingw32 targets do not attempt to replace the syscfg/lock-obj-pub.*.h as for mingw32 there are no arch specific headers that are included in the libgpg-error source.
--- meta/recipes-support/libgpg-error/libgpg-error_1.26.bb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
meta/recipes-support/libgpg-error/libgpg-error_1.26.bb +8 -3
@@ -25,7 +25,10 @@ inherit autotools binconfig-disabled pkgconfig gettext CPPFLAGS += "-P" do_compile_prepend() { TARGET_FILE=linux-gnu - if [ ${TARGET_OS} != "linux" ]; then + if [ ${TARGET_OS} = "mingw32" ]; then + # There are no arch specific syscfg files for mingw32 + TARGET_FILE= + elif [ ${TARGET_OS} != "linux" ]; then TARGET_FILE=${TARGET_OS} fi
@@ -40,8 +43,10 @@ do_compile_prepend() { *) TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;; esac - cp ${S}/src/syscfg/lock-obj-pub.$TUPLE.h \ - ${S}/src/syscfg/lock-obj-pub.$TARGET_FILE.h + if [ -n "$TARGET_FILE" ]; then + cp ${S}/src/syscfg/lock-obj-pub.$TUPLE.h \ + ${S}/src/syscfg/lock-obj-pub.$TARGET_FILE.h + fi } do_install_append() {
Signature · 1 line
2.11.0