Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | require glibc-collateral.inc |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | |
| 3 | SUMMARY = "Locale data from glibc" |
| 4 | |
| 5 | BPN = "glibc" |
| 6 | LOCALEBASEPN = "${MLPREFIX}glibc" |
| 7 | |
| 8 | # glibc-collateral.inc inhibits all default deps, but do_package needs objcopy |
| 9 | # ERROR: objcopy failed with exit code 127 (cmd was 'i586-webos-linux-objcopy' --only-keep-debug 'glibc-locale/2.17-r0/package/usr/lib/gconv/IBM1166.so' 'glibc-locale/2.17-r0/package/usr/lib/gconv/.debug/IBM1166.so') |
| 10 | # ERROR: Function failed: split_and_strip_files |
| 11 | BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot" |
| 12 | BINUTILSDEP_class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot" |
| 13 | do_package[depends] += "${BINUTILSDEP}" |
| 14 | |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 15 | DEPENDS += "virtual/libc" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 16 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 17 | # Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION |
| 18 | # is set. The idea is to avoid running localedef on the target (at first boot) |
| 19 | # to decrease initial boot time and avoid localedef being killed by the OOM |
| 20 | # killer which used to effectively break i18n on machines with < 128MB RAM. |
| 21 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 22 | # default to disabled |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 23 | ENABLE_BINARY_LOCALE_GENERATION ?= "0" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 24 | ENABLE_BINARY_LOCALE_GENERATION_pn-nativesdk-glibc-locale = "1" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 25 | |
| 26 | #enable locale generation on these arches |
| 27 | # BINARY_LOCALE_ARCHES is a space separated list of regular expressions |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 28 | BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | |
| 30 | # set "1" to use cross-localedef for locale generation |
| 31 | # set "0" for qemu emulation of native localedef for locale generation |
| 32 | LOCALE_GENERATION_WITH_CROSS-LOCALEDEF = "1" |
| 33 | |
| 34 | PROVIDES = "virtual/libc-locale" |
| 35 | |
| 36 | PACKAGES = "localedef ${PN}-dbg" |
| 37 | |
| 38 | PACKAGES_DYNAMIC = "^locale-base-.* \ |
| 39 | ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | ^${MLPREFIX}glibc-gconv$" |
| 41 | |
| 42 | # Create a glibc-binaries package |
| 43 | ALLOW_EMPTY_${BPN}-binaries = "1" |
| 44 | PACKAGES += "${BPN}-binaries" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 45 | RRECOMMENDS_${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary") != -1])}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | |
| 47 | # Create a glibc-charmaps package |
| 48 | ALLOW_EMPTY_${BPN}-charmaps = "1" |
| 49 | PACKAGES += "${BPN}-charmaps" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 50 | RRECOMMENDS_${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap") != -1])}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | |
| 52 | # Create a glibc-gconvs package |
| 53 | ALLOW_EMPTY_${BPN}-gconvs = "1" |
| 54 | PACKAGES += "${BPN}-gconvs" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 55 | RRECOMMENDS_${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv") != -1])}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 56 | |
| 57 | # Create a glibc-localedatas package |
| 58 | ALLOW_EMPTY_${BPN}-localedatas = "1" |
| 59 | PACKAGES += "${BPN}-localedatas" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 60 | RRECOMMENDS_${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata") != -1])}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 61 | |
| 62 | DESCRIPTION_localedef = "glibc: compile locale definition files" |
| 63 | |
| 64 | # glibc-gconv is dynamically added into PACKAGES, thus |
| 65 | # FILES_glibc-gconv will not be automatically extended in multilib. |
| 66 | # Explicitly add ${MLPREFIX} for FILES_glibc-gconv. |
| 67 | FILES_${MLPREFIX}glibc-gconv = "${libdir}/gconv/*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 68 | FILES_localedef = "${bindir}/localedef" |
| 69 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 70 | LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 71 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 72 | copy_locale_files() { |
| 73 | local dir=$1 mode=$2 |
| 74 | |
| 75 | [ -e "${LOCALETREESRC}$dir" ] || return 0 |
| 76 | |
| 77 | for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do |
| 78 | install -d ${D}$dir/$d |
| 79 | find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \ |
| 80 | -exec install -m $mode -t "${D}$dir/$d" {} \; |
| 81 | done |
| 82 | } |
| 83 | |
| 84 | do_install() { |
| 85 | copy_locale_files ${bindir} 0755 |
| 86 | copy_locale_files ${localedir} 0644 |
| 87 | if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then |
| 88 | copy_locale_files ${libdir}/gconv 0755 |
| 89 | copy_locale_files ${datadir}/i18n 0644 |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 90 | else |
| 91 | # Remove the libdir if it is empty when gconv is not copied |
| 92 | find ${D}${libdir} -type d -empty -delete |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 93 | fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 94 | copy_locale_files ${datadir}/locale 0644 |
| 95 | install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | inherit libc-package |
| 99 | |
| 100 | BBCLASSEXTEND = "nativesdk" |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 101 | |
| 102 | # Don't scan for CVEs as glibc will be scanned |
| 103 | CVE_PRODUCT = "" |