glibc-external.bb 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. SRC_URI = "file://SUPPORTED"
  2. require recipes-core/glibc/glibc-common.inc
  3. inherit external-toolchain
  4. def get_external_libc_version(d):
  5. sysroot = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT', True)
  6. libpath = os.path.join(sysroot, 'lib')
  7. if os.path.exists(libpath):
  8. for filename in os.listdir(libpath):
  9. if filename.startswith('libc-'):
  10. return filename[5:-3]
  11. return 'UNKNOWN'
  12. PV := "${@get_external_libc_version(d)}"
  13. DEPENDS += "virtual/${TARGET_PREFIX}binutils \
  14. linux-libc-headers"
  15. PROVIDES += "glibc \
  16. virtual/${TARGET_PREFIX}libc-for-gcc \
  17. virtual/${TARGET_PREFIX}libc-initial \
  18. virtual/libc \
  19. virtual/libintl \
  20. virtual/libiconv"
  21. require recipes-external/glibc/glibc-sysroot-setup.inc
  22. require recipes-external/glibc/glibc-package-adjusted.inc
  23. FILES_MIRRORS .= "\
  24. ${base_sbindir}/|/usr/bin/ \n\
  25. ${base_sbindir}/|/usr/${baselib}/bin/ \n\
  26. ${sbindir}/|/usr/bin/ \n\
  27. ${sbindir}/|/usr/${baselib}/bin/ \n\
  28. "
  29. python do_install () {
  30. bb.build.exec_func('external_toolchain_do_install', d)
  31. bb.build.exec_func('glibc_external_do_install_extra', d)
  32. }
  33. glibc_external_do_install_extra () {
  34. mkdir -p ${D}${sysconfdir}
  35. touch ${D}${sysconfdir}/ld.so.conf
  36. if [ ! -e ${D}${libdir}/libc.so ]; then
  37. bbfatal "Unable to locate installed libc.so file (${libdir}/libc.so)." \
  38. "This may mean that your external toolchain uses a different" \
  39. "multi-lib setup than your machine configuration"
  40. fi
  41. }
  42. EXTERNAL_EXTRA_FILES += "\
  43. ${datadir}/i18n \
  44. ${libdir}/gconv \
  45. ${localedir} \
  46. "
  47. # These files are picked up out of the sysroot by glibc-locale, so we don't
  48. # need to keep them around ourselves.
  49. do_install_locale_append() {
  50. rm -rf ${D}${localedir}
  51. }
  52. python () {
  53. # Undo the do_install_append which joined shell to python
  54. install = d.getVar('do_install', False)
  55. python, shell = install.split('rm -f ', 1)
  56. d.setVar('do_install_glibc', 'rm -f ' + shell)
  57. d.setVarFlag('do_install_glibc', 'func', '1')
  58. new_install = python + '\n bb.build.exec_func("do_install_glibc", d)\n'
  59. d.setVar('do_install', new_install.replace('\t', ' '))
  60. # Ensure that we pick up just libm, not all libs that start with m
  61. baselibs = d.getVar('libc_baselibs', False)
  62. baselibs.replace('${base_libdir}/libm*.so.*', '${base_libdir}/libm.so.*')
  63. d.setVar('libc_baselibs', baselibs)
  64. }
  65. # Default pattern is too greedy
  66. FILES_${PN}-utils = "\
  67. ${bindir}/gencat \
  68. ${bindir}/getconf \
  69. ${bindir}/getent \
  70. ${bindir}/iconv \
  71. ${sbindir}/iconvconfig \
  72. ${bindir}/lddlibc4 \
  73. ${bindir}/locale \
  74. ${bindir}/makedb \
  75. ${bindir}/pcprofiledump \
  76. ${bindir}/pldd \
  77. ${bindir}/rpcgen \
  78. ${bindir}/sprof \
  79. "
  80. FILES_${PN}-doc += "${infodir}/libc.info*"
  81. # Extract for use by do_install_locale
  82. FILES_${PN} += "\
  83. ${bindir}/localedef \
  84. ${libdir}/gconv \
  85. ${libdir}/locale \
  86. ${datadir}/locale \
  87. ${datadir}/i18n \
  88. "
  89. FILES_${PN}-dev_remove := "${datadir}/aclocal"
  90. FILES_${PN}-dev_remove = "/lib/*.o"
  91. FILES_${PN}-dev += "${libdir}/*crt*.o"
  92. libc_baselibs_dev += "${@' '.join('${libdir}/' + os.path.basename(l.replace('${SOLIBS}', '${SOLIBSDEV}')) for l in '${libc_baselibs}'.replace('${base_libdir}/ld*${SOLIBS}', '').split() if l.endswith('${SOLIBS}'))}"
  93. FILES_${PN}-staticdev = "\
  94. ${@'${libc_baselibs_dev}'.replace('${SOLIBSDEV}', '.a')} \
  95. ${libdir}/libg.a \
  96. ${libdir}/libieee.a \
  97. ${libdir}/libmcheck.a \
  98. ${libdir}/librpcsvc.a \
  99. "
  100. FILES_${PN}-dev += "\
  101. ${libc_baselibs_dev} \
  102. ${libdir}/libcidn${SOLIBSDEV} \
  103. ${libdir}/libthread_db${SOLIBSDEV} \
  104. ${libdir}/libpthread${SOLIBSDEV} \
  105. "
  106. libc_headers_file = "${@bb.utils.which('${FILESPATH}', 'libc.headers')}"
  107. FILES_${PN}-dev += "\
  108. ${@' '.join('${includedir}/' + f.rstrip() for f in base_read_file('${libc_headers_file}').splitlines())} \
  109. ${includedir}/fpu_control.h \
  110. ${includedir}/stdc-predef.h \
  111. ${includedir}/uchar.h \
  112. "
  113. FILES_${PN}-dev[file-checksums] += "${libc_headers_file}"