glibc-external.bb 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. sopattern = os.path.join(d.getVar('base_libdir', True), 'libc-*.so')
  6. found_paths = find_sysroot_files([sopattern], d)
  7. if found_paths:
  8. so_paths = found_paths[0]
  9. if so_paths:
  10. soname = os.path.basename(so_paths[0])
  11. return soname[5:-3]
  12. return 'UNKNOWN'
  13. PV := "${@get_external_libc_version(d)}"
  14. DEPENDS += "virtual/${TARGET_PREFIX}binutils \
  15. linux-libc-headers"
  16. PROVIDES += "glibc \
  17. virtual/${TARGET_PREFIX}libc-for-gcc \
  18. virtual/${TARGET_PREFIX}libc-initial \
  19. virtual/libc \
  20. virtual/libintl \
  21. virtual/libiconv"
  22. def get_external_libc_license(d):
  23. errnosearch = os.path.join(d.getVar('includedir', True), 'errno.h')
  24. found = oe.external.find_sysroot_files([errnosearch], d)
  25. if found:
  26. errno_paths = found[0]
  27. if errno_paths:
  28. with open(errno_paths[0], 'rU') as f:
  29. text = f.read()
  30. lictext = """ The GNU C Library is free software; you can redistribute it and/or
  31. modify it under the terms of the GNU Lesser General Public
  32. License as published by the Free Software Foundation; either
  33. version 2.1 of the License, or (at your option) any later version."""
  34. if lictext in text:
  35. return 'LGPL-2.1+'
  36. return 'UNKNOWN'
  37. LICENSE := "${@get_external_libc_license(d)}"
  38. require recipes-external/glibc/glibc-sysroot-setup.inc
  39. require recipes-external/glibc/glibc-package-adjusted.inc
  40. FILES_MIRRORS .= "\
  41. ${base_sbindir}/|/usr/bin/ \n\
  42. ${base_sbindir}/|/usr/${baselib}/bin/ \n\
  43. ${sbindir}/|/usr/bin/ \n\
  44. ${sbindir}/|/usr/${baselib}/bin/ \n\
  45. "
  46. python do_install () {
  47. bb.build.exec_func('external_toolchain_do_install', d)
  48. bb.build.exec_func('glibc_external_do_install_extra', d)
  49. }
  50. glibc_external_do_install_extra () {
  51. mkdir -p ${D}${sysconfdir}
  52. touch ${D}${sysconfdir}/ld.so.conf
  53. if [ ! -e ${D}${libdir}/libc.so ]; then
  54. bbfatal "Unable to locate installed libc.so file (${libdir}/libc.so)." \
  55. "This may mean that your external toolchain uses a different" \
  56. "multi-lib setup than your machine configuration"
  57. fi
  58. create_multilib_link ${D}
  59. }
  60. EXTERNAL_EXTRA_FILES += "\
  61. ${bindir}/mtrace ${bindir}/xtrace ${bindir}/sotruss \
  62. ${datadir}/i18n \
  63. ${libdir}/gconv \
  64. ${localedir} \
  65. "
  66. # These files are picked up out of the sysroot by glibc-locale, so we don't
  67. # need to keep them around ourselves.
  68. do_install_locale_append() {
  69. rm -rf ${D}${localedir}
  70. }
  71. python () {
  72. # Undo the do_install_append which joined shell to python
  73. install = d.getVar('do_install', False)
  74. python, shell = install.split('rm -f ', 1)
  75. d.setVar('do_install_glibc', 'rm -f ' + shell)
  76. d.setVarFlag('do_install_glibc', 'func', '1')
  77. new_install = python + '\n bb.build.exec_func("do_install_glibc", d)\n'
  78. d.setVar('do_install', new_install.replace('\t', ' '))
  79. # Ensure that we pick up just libm, not all libs that start with m
  80. baselibs = d.getVar('libc_baselibs', False)
  81. baselibs.replace('${base_libdir}/libm*.so.*', '${base_libdir}/libm.so.*')
  82. d.setVar('libc_baselibs', baselibs)
  83. }
  84. # Default pattern is too greedy
  85. FILES_${PN}-utils = "\
  86. ${bindir}/gencat \
  87. ${bindir}/getconf \
  88. ${bindir}/getent \
  89. ${bindir}/iconv \
  90. ${sbindir}/iconvconfig \
  91. ${bindir}/lddlibc4 \
  92. ${bindir}/locale \
  93. ${bindir}/makedb \
  94. ${bindir}/pcprofiledump \
  95. ${bindir}/pldd \
  96. ${bindir}/rpcgen \
  97. ${bindir}/sprof \
  98. "
  99. FILES_${PN}-doc += "${infodir}/libc.info*"
  100. # Extract for use by do_install_locale
  101. FILES_${PN} += "\
  102. ${bindir}/localedef \
  103. ${libdir}/gconv \
  104. ${libdir}/locale \
  105. ${datadir}/locale \
  106. ${datadir}/i18n \
  107. "
  108. FILES_${PN}-dev_remove := "${datadir}/aclocal"
  109. FILES_${PN}-dev_remove = "/lib/*.o"
  110. FILES_${PN}-dev += "${libdir}/*crt*.o"
  111. 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}'))}"
  112. FILES_${PN}-staticdev = "\
  113. ${@'${libc_baselibs_dev}'.replace('${SOLIBSDEV}', '.a')} \
  114. ${libdir}/libg.a \
  115. ${libdir}/libieee.a \
  116. ${libdir}/libmcheck.a \
  117. ${libdir}/librpcsvc.a \
  118. "
  119. FILES_${PN}-dev += "\
  120. ${libc_baselibs_dev} \
  121. ${libdir}/libcidn${SOLIBSDEV} \
  122. ${libdir}/libthread_db${SOLIBSDEV} \
  123. ${libdir}/libpthread${SOLIBSDEV} \
  124. "
  125. FILES_${PN}-dev += "${@sysroot_multilib_suffix(d)}"
  126. libc_headers_file = "${@bb.utils.which('${FILESPATH}', 'libc.headers')}"
  127. FILES_${PN}-dev += "\
  128. ${@' '.join('${includedir}/' + f.rstrip() for f in base_read_file('${libc_headers_file}').splitlines())} \
  129. ${includedir}/fpu_control.h \
  130. ${includedir}/stdc-predef.h \
  131. ${includedir}/uchar.h \
  132. "
  133. FILES_${PN}-dev[file-checksums] += "${libc_headers_file}"
  134. # Currently, ldd and tzcode from Sourcery G++ still have #!/bin/bash
  135. RDEPENDS_ldd += "bash"
  136. RDEPENDS_tzcode += "bash"