libgcc-external.bb 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. LIBROOT_RELATIVE_RESOLVED = "${@os.path.relpath(os.path.realpath('${EXTERNAL_TOOLCHAIN_LIBROOT}'), os.path.realpath('${EXTERNAL_TOOLCHAIN_SYSROOT}'))}"
  19. LIBROOT_RELATIVE = "${@os.path.relpath('${EXTERNAL_TOOLCHAIN_LIBROOT}', '${EXTERNAL_TOOLCHAIN_SYSROOT}')}"
  20. FILES:${PN}-dev = "${base_libdir}/libgcc_s.so \
  21. /${LIBROOT_RELATIVE_RESOLVED} \
  22. /${LIBROOT_RELATIVE} \
  23. "
  24. INSANE_SKIP:${PN}-dev += "staticdev"
  25. FILES:${PN}-dbg += "${base_libdir}/.debug/libgcc_s.so.*.debug"
  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 add_ml_symlink () {
  29. pass
  30. }
  31. python add_ml_symlink:tcmode-external () {
  32. import pathlib
  33. def get_links(p):
  34. return (c for c in p.iterdir() if c.is_symlink())
  35. if not d.getVar('EXTERNAL_TOOLCHAIN'):
  36. return
  37. libroot = d.getVar('EXTERNAL_TOOLCHAIN_LIBROOT')
  38. if libroot != 'UNKNOWN':
  39. sysroot = pathlib.Path(d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT')).resolve()
  40. libroot = pathlib.Path(libroot)
  41. for child in get_links(libroot):
  42. link_dest = child.resolve(strict=True)
  43. for other_child in get_links(link_dest):
  44. if other_child.resolve() == libroot.resolve():
  45. other = other_child.parent.resolve() / other_child.name
  46. relpath = other.relative_to(sysroot)
  47. d.appendVar('SYSROOT_DIRS', ' /' + str(relpath.parent))
  48. d.appendVar('FILES:${PN}-dev', ' /' + str(relpath))
  49. }
  50. add_ml_symlink[eventmask] = "bb.event.RecipePreFinalise"
  51. addhandler add_ml_symlink
  52. do_install_extra () {
  53. if [ -e "${D}${libdir}/${EXTERNAL_TARGET_SYS}" ] && [ -z "${MLPREFIX}" ]; then
  54. if ! [ -e "${D}${libdir}/${TARGET_SYS}" ]; then
  55. ln -s "${EXTERNAL_TARGET_SYS}" "${D}${libdir}/${TARGET_SYS}"
  56. fi
  57. fi
  58. # This belongs in gcc-runtime
  59. rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
  60. }
  61. do_package[prefuncs] += "add_sys_symlink"
  62. python add_sys_symlink () {
  63. import pathlib
  64. target_sys = pathlib.Path(d.expand('${D}${libdir}/${TARGET_SYS}'))
  65. if target_sys.exists():
  66. pn = d.getVar('PN')
  67. d.appendVar('FILES:%s-dev' % pn, ' ${libdir}/${TARGET_SYS}')
  68. }