libgcc-external.bb 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. SUMMARY = "The GNU Compiler Collection - libgcc"
  2. HOMEPAGE = "http://www.gnu.org/software/gcc/"
  3. SECTION = "devel"
  4. DEPENDS += "virtual/${TARGET_PREFIX}binutils"
  5. PROVIDES += "libgcc-initial"
  6. PV = "${GCC_VERSION}"
  7. inherit external-toolchain
  8. LICENSE = "GPL-3.0-with-GCC-exception"
  9. # libgcc needs libc, but glibc's utilities need libgcc, so short-circuit the
  10. # interdependency here by manually specifying it rather than depending on the
  11. # libc packagedata.
  12. RDEPENDS_${PN} += "${@'${PREFERRED_PROVIDER_virtual/libc}' if '${PREFERRED_PROVIDER_virtual/libc}' else '${TCLIBC}'}"
  13. INSANE_SKIP_${PN} += "build-deps file-rdeps"
  14. # The dynamically loadable files belong to libgcc, since we really don't need the static files
  15. # on the target, moreover linker won't be able to find them there (see original libgcc.bb recipe).
  16. BINV = "${GCC_VERSION}"
  17. FILES_${PN} = "${base_libdir}/libgcc_s.so.*"
  18. FILES_${PN}-dev = "${base_libdir}/libgcc_s.so \
  19. ${libdir}/${EXTERNAL_TARGET_SYS}/${BINV}* \
  20. "
  21. INSANE_SKIP_${PN}-dev += "staticdev"
  22. FILES_${PN}-dbg += "${base_libdir}/.debug/libgcc_s.so.*.debug"
  23. FILES_MIRRORS =. "\
  24. ${libdir}/${EXTERNAL_TARGET_SYS}/${BINV}/|${external_libroot}/\n \
  25. ${libdir}/${EXTERNAL_TARGET_SYS}/|${libdir}/gcc/${EXTERNAL_TARGET_SYS}/\n \
  26. "
  27. # Follow any symlinks in the libroot (multilib build) to the main
  28. # libroot and include any symlinks there that link to our libroot.
  29. python () {
  30. import pathlib
  31. def get_links(p):
  32. return (c for c in p.iterdir() if c.is_symlink())
  33. libroot = d.getVar('EXTERNAL_TOOLCHAIN_LIBROOT')
  34. if libroot != 'UNKNOWN':
  35. sysroot = pathlib.Path(d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT')).resolve()
  36. libroot = pathlib.Path(libroot).resolve()
  37. for child in get_links(libroot):
  38. link_dest = child.resolve(strict=True)
  39. for other_child in get_links(link_dest):
  40. other_child = other_child.resolve()
  41. if other_child == libroot:
  42. relpath = other_child.relative_to(sysroot)
  43. d.appendVar('SYSROOT_DIRS', ' /' + str(relpath.parent))
  44. d.appendVar(d.expand('FILES_${PN}-dev'), ' /' + str(relpath))
  45. }
  46. do_install_extra () {
  47. if [ -e "${D}${libdir}/${EXTERNAL_TARGET_SYS}" ] && [ -z "${MLPREFIX}" ]; then
  48. if ! [ -e "${D}${libdir}/${TARGET_SYS}" ]; then
  49. ln -s "${EXTERNAL_TARGET_SYS}" "${D}${libdir}/${TARGET_SYS}"
  50. fi
  51. fi
  52. }
  53. do_package[prefuncs] += "add_sys_symlink"
  54. python add_sys_symlink () {
  55. import pathlib
  56. target_sys = pathlib.Path(d.expand('${D}${libdir}/${TARGET_SYS}'))
  57. if target_sys.exists():
  58. pn = d.getVar('PN')
  59. d.appendVar('FILES_%s-dev' % pn, ' ${libdir}/${TARGET_SYS}')
  60. }