libgcc-external.bb 2.6 KB

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