glibc-locale.inc 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. require glibc-collateral.inc
  2. SUMMARY = "Locale data from glibc"
  3. BPN = "glibc"
  4. LOCALEBASEPN = "${MLPREFIX}glibc"
  5. # Do not inhibit default deps, do_package requires binutils/gcc for
  6. # objcopy/gcc-nm and glibc-locale depends on virtual/libc directly.
  7. INHIBIT_DEFAULT_DEPS = ""
  8. # Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION
  9. # is set. The idea is to avoid running localedef on the target (at first boot)
  10. # to decrease initial boot time and avoid localedef being killed by the OOM
  11. # killer which used to effectively break i18n on machines with < 128MB RAM.
  12. # default to disabled
  13. ENABLE_BINARY_LOCALE_GENERATION ?= "0"
  14. ENABLE_BINARY_LOCALE_GENERATION:pn-nativesdk-glibc-locale = "1"
  15. #enable locale generation on these arches
  16. # BINARY_LOCALE_ARCHES is a space separated list of regular expressions
  17. BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64"
  18. # set "1" to use cross-localedef for locale generation
  19. # set "0" for qemu emulation of native localedef for locale generation
  20. LOCALE_GENERATION_WITH_CROSS-LOCALEDEF = "1"
  21. PROVIDES = "virtual/libc-locale"
  22. PACKAGES = "localedef ${PN}-dbg"
  23. PACKAGES_DYNAMIC = "^locale-base-.* \
  24. ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
  25. ^${MLPREFIX}glibc-gconv$"
  26. # Create a glibc-binaries package
  27. ALLOW_EMPTY:${BPN}-binaries = "1"
  28. PACKAGES += "${BPN}-binaries"
  29. RRECOMMENDS:${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary") != -1])}"
  30. # Create a glibc-charmaps package
  31. ALLOW_EMPTY:${BPN}-charmaps = "1"
  32. PACKAGES += "${BPN}-charmaps"
  33. RRECOMMENDS:${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap") != -1])}"
  34. # Create a glibc-gconvs package
  35. ALLOW_EMPTY:${BPN}-gconvs = "1"
  36. PACKAGES += "${BPN}-gconvs"
  37. RRECOMMENDS:${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv") != -1])}"
  38. # Create a glibc-localedatas package
  39. ALLOW_EMPTY:${BPN}-localedatas = "1"
  40. PACKAGES += "${BPN}-localedatas"
  41. RRECOMMENDS:${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata") != -1])}"
  42. DESCRIPTION:localedef = "glibc: compile locale definition files"
  43. # glibc-gconv is dynamically added into PACKAGES, thus
  44. # FILES:glibc-gconv will not be automatically extended in multilib.
  45. # Explicitly add ${MLPREFIX} for FILES:glibc-gconv.
  46. FILES:${MLPREFIX}glibc-gconv = "${libdir}/gconv/*"
  47. FILES:localedef = "${bindir}/localedef"
  48. LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
  49. copy_locale_files() {
  50. local dir=$1 mode=$2
  51. [ -e "${LOCALETREESRC}$dir" ] || return 0
  52. for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do
  53. install -d ${D}$dir/$d
  54. find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \
  55. -exec install -m $mode -t "${D}$dir/$d" {} \;
  56. done
  57. }
  58. do_install() {
  59. copy_locale_files ${bindir} 0755
  60. copy_locale_files ${localedir} 0644
  61. if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
  62. copy_locale_files ${libdir}/gconv 0755
  63. copy_locale_files ${datadir}/i18n 0644
  64. fi
  65. # Remove empty dirs in libdir when gconv or locales are not copied
  66. find ${D}${libdir} -type d -empty -delete
  67. copy_locale_files ${datadir}/locale 0644
  68. install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
  69. }
  70. inherit libc-package
  71. BBCLASSEXTEND = "nativesdk"
  72. # Don't scan for CVEs as glibc will be scanned
  73. CVE_PRODUCT = ""