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