From b3b2b7fbf504de2ff0b48853e7f15bf7236528b7 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Wed, 1 Jul 2020 23:25:08 +0500 Subject: [PATCH] libgcc-external: correctly handle oe sdk multilib symlinks Signed-off-by: Christopher Larson --- recipes-external/gcc/libgcc-external.bb | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/recipes-external/gcc/libgcc-external.bb b/recipes-external/gcc/libgcc-external.bb index 5a76844..d6ee357 100644 --- a/recipes-external/gcc/libgcc-external.bb +++ b/recipes-external/gcc/libgcc-external.bb @@ -24,8 +24,34 @@ FILES_${PN}-dev = "${base_libdir}/libgcc_s.so \ INSANE_SKIP_${PN}-dev += "staticdev" FILES_${PN}-dbg += "${base_libdir}/.debug/libgcc_s.so.*.debug" +FILES_MIRRORS =. "\ + ${libdir}/${EXTERNAL_TARGET_SYS}/${BINV}/|${external_libroot}/\n \ + ${libdir}/${EXTERNAL_TARGET_SYS}/|${libdir}/gcc/${EXTERNAL_TARGET_SYS}/\n \ +" + +# Follow any symlinks in the libroot (multilib build) to the main +# libroot and include any symlinks there that link to our libroot. +python () { + import pathlib + + def get_links(p): + return (c for c in p.iterdir() if c.is_symlink()) + + libroot = d.getVar('EXTERNAL_TOOLCHAIN_LIBROOT') + if libroot != 'UNKNOWN': + sysroot = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT') + libroot = pathlib.Path(libroot) + for child in get_links(libroot): + link_dest = child.resolve(strict=True) + for other_child in get_links(link_dest): + if other_child.resolve() == libroot.resolve(): + relpath = other_child.relative_to(sysroot) + d.appendVar('SYSROOT_DIRS', ' /' + str(relpath.parent)) + d.appendVar(d.expand('FILES_${PN}-dev'), ' /' + str(relpath)) +} + do_install_extra () { - if [ -e "${D}${libdir}/${EXTERNAL_TARGET_SYS}" ]; then + if [ -e "${D}${libdir}/${EXTERNAL_TARGET_SYS}" ] && [ -z "${MLPREFIX}" ]; then if ! [ -e "${D}${libdir}/${TARGET_SYS}" ]; then ln -s "${EXTERNAL_TARGET_SYS}" "${D}${libdir}/${TARGET_SYS}" fi