From 00cafb795fb1c1d2973a17ad578e5e13ab4fb332 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Mon, 27 Jul 2015 13:24:20 -0700 Subject: [PATCH 1/4] glibc-external: obey GLIBC_INTERNAL_USE_BINARY_LOCALE If this variable is set to 'precompiled', then ship the existing compiled binary locales from the external toolchain, otherwise do not, as we'll be compiling them ourselves. Signed-off-by: Christopher Larson --- recipes-external/glibc/glibc-external.bb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes-external/glibc/glibc-external.bb b/recipes-external/glibc/glibc-external.bb index 6fe9afa..abfd558 100644 --- a/recipes-external/glibc/glibc-external.bb +++ b/recipes-external/glibc/glibc-external.bb @@ -71,13 +71,16 @@ glibc_external_do_install_extra () { "multi-lib setup than your machine configuration" fi create_multilib_link ${D} + if [ "${GLIBC_INTERNAL_USE_BINARY_LOCALE}" != "precompiled" ]; then + rm -rf ${D}${localedir} + fi } EXTERNAL_EXTRA_FILES += "\ ${bindir}/mtrace ${bindir}/xtrace ${bindir}/sotruss \ ${datadir}/i18n \ ${libdir}/gconv \ - ${localedir} \ + ${@'${localedir}' if d.getVar('GLIBC_INTERNAL_USE_BINARY_LOCALE', True) == 'precompiled' else ''} \ " # These files are picked up out of the sysroot by glibc-locale, so we don't From 140fed8a8391ea4d8fe397e4b39d869ed034bbb6 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Wed, 29 Jul 2015 12:56:09 -0700 Subject: [PATCH 2/4] glibc-external: rename charsets to align with glibc-locale Signed-off-by: Christopher Larson --- recipes-external/glibc/glibc-external.bb | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/recipes-external/glibc/glibc-external.bb b/recipes-external/glibc/glibc-external.bb index abfd558..3a21225 100644 --- a/recipes-external/glibc/glibc-external.bb +++ b/recipes-external/glibc/glibc-external.bb @@ -59,6 +59,51 @@ FILES_MIRRORS .= "\ python do_install () { bb.build.exec_func('external_toolchain_do_install', d) bb.build.exec_func('glibc_external_do_install_extra', d) + bb.build.exec_func('adjust_locale_names', d) +} + +python adjust_locale_names () { + """Align locale charset names with glibc-locale expectations.""" + # Read in supported locales and associated encodings + supported = {} + with open(base_path_join(d.getVar('WORKDIR', True), "SUPPORTED")) as f: + for line in f.readlines(): + try: + locale, charset = line.rstrip().split() + except ValueError: + continue + supported[locale] = charset + + # GLIBC_GENERATE_LOCALES var specifies which locales to be generated. empty or "all" means all locales + to_generate = d.getVar('GLIBC_GENERATE_LOCALES', True) + if not to_generate or to_generate == 'all': + to_generate = supported.keys() + else: + to_generate = to_generate.split() + for locale in to_generate: + if locale not in supported: + if '.' in locale: + charset = locale.split('.')[1] + else: + charset = 'UTF-8' + bb.warn("Unsupported locale '%s', assuming encoding '%s'" % (locale, charset)) + supported[locale] = charset + + localedir = oe.path.join(d.getVar('D', True), d.getVar('localedir', True)) + for locale in to_generate: + if '.' not in locale: + continue + + locale, charset = locale.split('.', 1) + if '-' not in charset: + continue + + oe_name = locale + '.' + charset.lower() + existing_name = locale + '.' + charset.lower().replace('-', '') + this_localedir = oe.path.join(localedir, existing_name) + if os.path.exists(this_localedir): + bb.debug(1, '%s -> %s' % (this_localedir, oe.path.join(localedir, oe_name))) + os.rename(this_localedir, oe.path.join(localedir, oe_name)) } glibc_external_do_install_extra () { From 362d20fac7c7f1b3631767eb41b41fc8795555ac Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Wed, 29 Jul 2015 12:56:25 -0700 Subject: [PATCH 3/4] Resolve build-deps / shlibs issues Mostly due to the inter-dependency between glibc & libgcc Signed-off-by: Christopher Larson --- core/recipes-core/glibc/glibc-locale_%.bbappend | 6 ++++++ recipes-external/gcc/gcc-runtime-external.bb | 6 ++++++ recipes-external/gcc/libgcc-external.bb | 11 ++++++----- recipes-external/glibc/glibc-external.bb | 6 ++++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/core/recipes-core/glibc/glibc-locale_%.bbappend b/core/recipes-core/glibc/glibc-locale_%.bbappend index c5c0655..260cde9 100644 --- a/core/recipes-core/glibc/glibc-locale_%.bbappend +++ b/core/recipes-core/glibc/glibc-locale_%.bbappend @@ -2,3 +2,9 @@ python () { if d.getVar('TCMODE', True).startswith('external-sourcery'): d.setVar('INHIBIT_PACKAGE_DEBUG_SPLIT', '1') } + +# localedef needs libgcc & libc +do_package[depends] += "${MLPREFIX}libgcc:do_packagedata virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_ipk[depends] += "${MLPREFIX}libgcc:do_packagedata virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_deb[depends] += "${MLPREFIX}libgcc:do_packagedata virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_rpm[depends] += "${MLPREFIX}libgcc:do_packagedata virtual/${MLPREFIX}libc:do_packagedata" diff --git a/recipes-external/gcc/gcc-runtime-external.bb b/recipes-external/gcc/gcc-runtime-external.bb index a249283..e477084 100644 --- a/recipes-external/gcc/gcc-runtime-external.bb +++ b/recipes-external/gcc/gcc-runtime-external.bb @@ -55,3 +55,9 @@ FILES_libstdc++-dev = "\ ${libdir}/libsupc++.la \ " BBCLASSEXTEND = "" + +# libstdc++ needs glibc +do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata" +do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata" diff --git a/recipes-external/gcc/libgcc-external.bb b/recipes-external/gcc/libgcc-external.bb index 4d4264c..f026386 100644 --- a/recipes-external/gcc/libgcc-external.bb +++ b/recipes-external/gcc/libgcc-external.bb @@ -9,6 +9,12 @@ inherit external-toolchain LICENSE = "GPL-3.0-with-GCC-exception" PACKAGES =+ "libgcov-dev" +# libgcc needs libc, but glibc's utilities need libgcc, so short-circuit the +# interdependency here by manually specifying it rather than depending on the +# libc packagedata. +RDEPENDS_${PN} += "${TCLIBC}" +INSANE_SKIP_${PN} += "build-deps" + external_libroot = "${@os.path.realpath('${EXTERNAL_TOOLCHAIN_LIBROOT}').replace(os.path.realpath('${EXTERNAL_TOOLCHAIN}') + '/', '/')}" FILES_MIRRORS =. "${libdir}/gcc/${TARGET_SYS}/${GCC_VERSION}/|${external_libroot}/\n" @@ -29,8 +35,3 @@ INSANE_SKIP_${PN}-dev += "staticdev" FILES_${PN}-dbg += "${base_libdir}/.debug/libgcc_s.so.*.debug" FILES_libgcov-dev = "${libdir}/gcc/${TARGET_SYS}/${GCC_VERSION}/libgcov.a" INSANE_SKIP_libgcov-dev += "staticdev" - -do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata" -do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata" -do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata" -do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata" diff --git a/recipes-external/glibc/glibc-external.bb b/recipes-external/glibc/glibc-external.bb index 3a21225..4a2cf41 100644 --- a/recipes-external/glibc/glibc-external.bb +++ b/recipes-external/glibc/glibc-external.bb @@ -208,3 +208,9 @@ FILES_${PN}-dev[file-checksums] += "${libc_headers_file}" # Currently, ldd and tzcode from Sourcery G++ still have #!/bin/bash RDEPENDS_ldd += "bash" RDEPENDS_tzcode += "bash" + +# glibc's utils need libgcc +do_package[depends] += "${MLPREFIX}libgcc:do_packagedata" +do_package_write_ipk[depends] += "${MLPREFIX}libgcc:do_packagedata" +do_package_write_deb[depends] += "${MLPREFIX}libgcc:do_packagedata" +do_package_write_rpm[depends] += "${MLPREFIX}libgcc:do_packagedata" From daa1d079d504a27c7a1d847461f9534877518257 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Wed, 29 Jul 2015 13:56:57 -0700 Subject: [PATCH 4/4] glibc-external: fix support for non-precompiled locales Signed-off-by: Christopher Larson --- recipes-external/glibc/glibc-external.bb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/recipes-external/glibc/glibc-external.bb b/recipes-external/glibc/glibc-external.bb index 4a2cf41..8c7295b 100644 --- a/recipes-external/glibc/glibc-external.bb +++ b/recipes-external/glibc/glibc-external.bb @@ -119,6 +119,14 @@ glibc_external_do_install_extra () { if [ "${GLIBC_INTERNAL_USE_BINARY_LOCALE}" != "precompiled" ]; then rm -rf ${D}${localedir} fi + + # Work around localedef failures for non-precompiled + for locale in bo_CN bo_IN; do + sed -i -e '/^name_fmt\s/s/""/"???"/' "${D}${datadir}/i18n/locales/$locale" + if grep -q '^name_fmt.*""' "${D}${datadir}/i18n/locales/$locale"; then + bbfatal "sed did not fix $locale" + fi + done } EXTERNAL_EXTRA_FILES += "\