libgcc-external.bb 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT')
  36. libroot = pathlib.Path(libroot)
  37. for child in get_links(libroot):
  38. link_dest = child.resolve(strict=True)
  39. for other_child in get_links(link_dest):
  40. if other_child.resolve() == libroot.resolve():
  41. relpath = other_child.relative_to(sysroot)
  42. d.appendVar('SYSROOT_DIRS', ' /' + str(relpath.parent))
  43. d.appendVar(d.expand('FILES_${PN}-dev'), ' /' + str(relpath))
  44. }
  45. do_install_extra () {
  46. if [ -e "${D}${libdir}/${EXTERNAL_TARGET_SYS}" ] && [ -z "${MLPREFIX}" ]; then
  47. if ! [ -e "${D}${libdir}/${TARGET_SYS}" ]; then
  48. ln -s "${EXTERNAL_TARGET_SYS}" "${D}${libdir}/${TARGET_SYS}"
  49. fi
  50. fi
  51. }
  52. do_package[prefuncs] += "add_sys_symlink"
  53. python add_sys_symlink () {
  54. import pathlib
  55. target_sys = pathlib.Path(d.expand('${D}${libdir}/${TARGET_SYS}'))
  56. if target_sys.exists():
  57. pn = d.getVar('PN')
  58. d.appendVar('FILES_%s-dev' % pn, ' ${libdir}/${TARGET_SYS}')
  59. }