From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- external/poky/meta/classes/libc-package.bbclass | 74 ++++++++++++++----------- 1 file changed, 41 insertions(+), 33 deletions(-) (limited to 'external/poky/meta/classes/libc-package.bbclass') diff --git a/external/poky/meta/classes/libc-package.bbclass b/external/poky/meta/classes/libc-package.bbclass index 345ec298..de3b4250 100644 --- a/external/poky/meta/classes/libc-package.bbclass +++ b/external/poky/meta/classes/libc-package.bbclass @@ -37,16 +37,11 @@ python __anonymous () { d.setVar("DEPENDS", depends) d.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile") break - - # try to fix disable charsets/locales/locale-code compile fail - if bb.utils.contains('DISTRO_FEATURES', 'libc-charsets', True, False, d) and \ - bb.utils.contains('DISTRO_FEATURES', 'libc-locales', True, False, d) and \ - bb.utils.contains('DISTRO_FEATURES', 'libc-locale-code', True, False, d): - d.setVar('PACKAGE_NO_GCONV', '0') - else: - d.setVar('PACKAGE_NO_GCONV', '1') } +# try to fix disable charsets/locales/locale-code compile fail +PACKAGE_NO_GCONV ?= "0" + OVERRIDES_append = ":${TARGET_ARCH}-${TARGET_OS}" locale_base_postinst_ontarget() { @@ -69,9 +64,14 @@ do_prep_locale_tree() { for i in $treedir/${datadir}/i18n/charmaps/*gz; do gunzip $i done - tar -cf - -C ${LOCALETREESRC}${base_libdir} -p . | tar -xf - -C $treedir/${base_libdir} - if [ -f ${STAGING_DIR_NATIVE}${prefix_native}/lib/libgcc_s.* ]; then - tar -cf - -C ${STAGING_DIR_NATIVE}/${prefix_native}/${base_libdir} -p libgcc_s.* | tar -xf - -C $treedir/${base_libdir} + # The extract pattern "./l*.so*" is carefully selected so that it will + # match ld*.so and lib*.so*, but not any files in the gconv directory + # (if it exists). This makes sure we only unpack the files we need. + # This is important in case usrmerge is set in DISTRO_FEATURES, which + # means ${base_libdir} == ${libdir}. + tar -cf - -C ${LOCALETREESRC}${base_libdir} -p . | tar -xf - -C $treedir/${base_libdir} --wildcards './l*.so*' + if [ -f ${STAGING_LIBDIR_NATIVE}/libgcc_s.* ]; then + tar -cf - -C ${STAGING_LIBDIR_NATIVE} -p libgcc_s.* | tar -xf - -C $treedir/${base_libdir} fi install -m 0755 ${LOCALETREESRC}${bindir}/localedef $treedir/${base_bindir} } @@ -82,6 +82,9 @@ do_collect_bins_from_locale_tree() { parent=$(dirname ${localedir}) mkdir -p ${PKGD}/$parent tar -cf - -C $treedir/$parent -p $(basename ${localedir}) | tar -xf - -C ${PKGD}$parent + + # Finalize tree by chaning all duplicate files into hard links + cross-localedef-hardlink -c -v ${WORKDIR}/locale-tree } inherit qemu @@ -115,8 +118,8 @@ python package_do_split_gconvs () { def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group): deps = [] f = open(fn, "rb") - c_re = re.compile('^copy "(.*)"') - i_re = re.compile('^include "(\w+)".*') + c_re = re.compile(r'^copy "(.*)"') + i_re = re.compile(r'^include "(\w+)".*') for l in f.readlines(): l = l.decode("latin-1") m = c_re.match(l) or i_re.match(l) @@ -130,15 +133,15 @@ python package_do_split_gconvs () { if bpn != 'glibc': d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) - do_split_packages(d, gconv_libdir, file_regex='^(.*)\.so$', output_pattern=bpn+'-gconv-%s', \ + do_split_packages(d, gconv_libdir, file_regex=r'^(.*)\.so$', output_pattern=bpn+'-gconv-%s', \ description='gconv module for character set %s', hook=calc_gconv_deps, \ extra_depends=bpn+'-gconv') def calc_charmap_deps(fn, pkg, file_regex, output_pattern, group): deps = [] f = open(fn, "rb") - c_re = re.compile('^copy "(.*)"') - i_re = re.compile('^include "(\w+)".*') + c_re = re.compile(r'^copy "(.*)"') + i_re = re.compile(r'^include "(\w+)".*') for l in f.readlines(): l = l.decode("latin-1") m = c_re.match(l) or i_re.match(l) @@ -152,14 +155,14 @@ python package_do_split_gconvs () { if bpn != 'glibc': d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) - do_split_packages(d, charmap_dir, file_regex='^(.*)\.gz$', output_pattern=bpn+'-charmap-%s', \ + do_split_packages(d, charmap_dir, file_regex=r'^(.*)\.gz$', output_pattern=bpn+'-charmap-%s', \ description='character map for %s encoding', hook=calc_charmap_deps, extra_depends='') def calc_locale_deps(fn, pkg, file_regex, output_pattern, group): deps = [] f = open(fn, "rb") - c_re = re.compile('^copy "(.*)"') - i_re = re.compile('^include "(\w+)".*') + c_re = re.compile(r'^copy "(.*)"') + i_re = re.compile(r'^include "(\w+)".*') for l in f.readlines(): l = l.decode("latin-1") m = c_re.match(l) or i_re.match(l) @@ -173,13 +176,13 @@ python package_do_split_gconvs () { if bpn != 'glibc': d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) - do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern=bpn+'-localedata-%s', \ + do_split_packages(d, locales_dir, file_regex=r'(.*)', output_pattern=bpn+'-localedata-%s', \ description='locale definition for %s', hook=calc_locale_deps, extra_depends='') d.setVar('PACKAGES', d.getVar('PACKAGES', False) + ' ' + d.getVar('MLPREFIX', False) + bpn + '-gconv') use_bin = d.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE") - dot_re = re.compile("(.*)\.(.*)") + dot_re = re.compile(r"(.*)\.(.*)") # Read in supported locales and associated encodings supported = {} @@ -236,6 +239,8 @@ python package_do_split_gconvs () { if use_cross_localedef == "1": target_arch = d.getVar('TARGET_ARCH') locale_arch_options = { \ + "arc": " --uint32-align=4 --little-endian ", \ + "arceb": " --uint32-align=4 --big-endian ", \ "arm": " --uint32-align=4 --little-endian ", \ "armeb": " --uint32-align=4 --big-endian ", \ "aarch64": " --uint32-align=4 --little-endian ", \ @@ -243,6 +248,7 @@ python package_do_split_gconvs () { "sh4": " --uint32-align=4 --big-endian ", \ "powerpc": " --uint32-align=4 --big-endian ", \ "powerpc64": " --uint32-align=4 --big-endian ", \ + "powerpc64le": " --uint32-align=4 --little-endian ", \ "mips": " --uint32-align=4 --big-endian ", \ "mipsisa32r6": " --uint32-align=4 --big-endian ", \ "mips64": " --uint32-align=4 --big-endian ", \ @@ -263,7 +269,7 @@ python package_do_split_gconvs () { bb.error("locale_arch_options not found for target_arch=" + target_arch) bb.fatal("unknown arch:" + target_arch + " for locale_arch_options") - localedef_opts += " --force --no-archive --prefix=%s \ + localedef_opts += " --force --no-hard-links --no-archive --prefix=%s \ --inputfile=%s/%s/i18n/locales/%s --charmap=%s %s/%s" \ % (treedir, treedir, datadir, locale, encoding, outputpath, name) @@ -271,14 +277,14 @@ python package_do_split_gconvs () { (path, i18npath, gconvpath, localedef_opts) else: # earlier slower qemu way qemu = qemu_target_binary(d) - localedef_opts = "--force --no-archive --prefix=%s \ + localedef_opts = "--force --no-hard-links --no-archive --prefix=%s \ --inputfile=%s/i18n/locales/%s --charmap=%s %s" \ % (treedir, datadir, locale, encoding, name) qemu_options = d.getVar('QEMU_OPTIONS') cmd = "PSEUDO_RELOADED=YES PATH=\"%s\" I18NPATH=\"%s\" %s -L %s \ - -E LD_LIBRARY_PATH=%s %s %s/bin/localedef %s" % \ + -E LD_LIBRARY_PATH=%s %s %s${base_bindir}/localedef %s" % \ (path, i18npath, qemu, treedir, ldlibdir, qemu_options, treedir, localedef_opts) commands["%s/%s" % (outputpath, name)] = cmd @@ -290,7 +296,7 @@ python package_do_split_gconvs () { d.setVar('ALLOW_EMPTY_%s' % pkgname, '1') d.setVar('PACKAGES', '%s %s' % (pkgname, d.getVar('PACKAGES'))) rprovides = ' %svirtual-locale-%s' % (mlprefix, legitimize_package_name(name)) - m = re.match("(.*)_(.*)", name) + m = re.match(r"(.*)_(.*)", name) if m: rprovides += ' %svirtual-locale-%s' % (mlprefix, m.group(1)) d.setVar('RPROVIDES_%s' % pkgname, rprovides) @@ -341,13 +347,15 @@ python package_do_split_gconvs () { if use_bin == "compile": makefile = oe.path.join(d.getVar("WORKDIR"), "locale-tree", "Makefile") - m = open(makefile, "w") - m.write("all: %s\n\n" % " ".join(commands.keys())) - for cmd in commands: - m.write(cmd + ":\n") - m.write("\t" + commands[cmd] + "\n\n") - m.close() + with open(makefile, "w") as m: + m.write("all: %s\n\n" % " ".join(commands.keys())) + total = len(commands) + for i, (maketarget, makerecipe) in enumerate(commands.items()): + m.write(maketarget + ":\n") + m.write("\t@echo 'Progress %d/%d'\n" % (i, total)) + m.write("\t" + makerecipe + "\n\n") d.setVar("EXTRA_OEMAKE", "-C %s ${PARALLEL_MAKE}" % (os.path.dirname(makefile))) + d.setVarFlag("oe_runmake", "progress", "outof:Progress\s(\d+)/(\d+)") bb.note("Executing binary locale generation makefile") bb.build.exec_func("oe_runmake", d) bb.note("collecting binary locales from locale tree") @@ -356,12 +364,12 @@ python package_do_split_gconvs () { if use_bin in ('compile', 'precompiled'): lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES') if lcsplit and int(lcsplit): - do_split_packages(d, binary_locales_dir, file_regex='^(.*/LC_\w+)', \ + do_split_packages(d, binary_locales_dir, file_regex=r'^(.*/LC_\w+)', \ output_pattern=bpn+'-binary-localedata-%s', \ description='binary locale definition for %s', recursive=True, hook=metapkg_hook, extra_depends='', allow_dirs=True, match_path=True) else: - do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ + do_split_packages(d, binary_locales_dir, file_regex=r'(.*)', \ output_pattern=bpn+'-binary-localedata-%s', \ description='binary locale definition for %s', extra_depends='', allow_dirs=True) else: -- cgit 1.2.3-korg