summaryrefslogtreecommitdiff
path: root/packages/glibc
diff options
context:
space:
mode:
authorRene Wagner <rw@handhelds.org>2006-03-06 21:11:18 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-03-06 21:11:18 +0000
commitd9178f91517c97da8b249186e221c73a3bee1aa3 (patch)
treed5a74720c7ba5963266f6b0e912fdffd41f22afb /packages/glibc
parentfc675fce9d9d45f17a26d32ef6f2760abddcc731 (diff)
glibc, package.bbclass: generate old-style binary locales at build time using qemu. based on a patch originally written by Phil Blundell. fixes hh.org Bug #1385 (localedef OOM issue).
- running localedef (in qemu...) for every locale takes a while. set BINARY_LOCALE_ARCHES = "" to avoid the new behaviour.
Diffstat (limited to 'packages/glibc')
-rw-r--r--packages/glibc/glibc-package.bbclass92
-rw-r--r--packages/glibc/glibc_2.3.5+cvs20050627.bb4
2 files changed, 91 insertions, 5 deletions
diff --git a/packages/glibc/glibc-package.bbclass b/packages/glibc/glibc-package.bbclass
index 9a91e3ab24..e03d99b7c3 100644
--- a/packages/glibc/glibc-package.bbclass
+++ b/packages/glibc/glibc-package.bbclass
@@ -14,11 +14,14 @@ python __anonymous () {
bb.data.getVar('TARGET_OS', d, 1))
}
+BINARY_LOCALE_ARCHES ?= "arm"
+
PACKAGES = "glibc catchsegv sln nscd ldd localedef glibc-utils glibc-dev glibc-doc glibc-locale libsegfault glibc-extra-nss glibc-thread-db glibc-pcprofile"
+PACKAGES_DYNAMIC = "glibc-gconv-* glibc-charmap-* glibc-localedata-*"
libc_baselibs = "/lib/libc* /lib/libm* /lib/ld* /lib/libpthread* /lib/libresolv* /lib/librt* /lib/libutil* /lib/libnsl* /lib/libnss_files* /lib/libnss_compat* /lib/libnss_dns* /lib/libdl* /lib/libanl* /lib/libBrokenLocale*"
-FILES_${PN} = "${sysconfdir} ${libc_baselibs} /sbin/ldconfig ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
+FILES_${PN} = "${sysconfdir} ${libc_baselibs} /sbin/ldconfig ${libexecdir} ${datadir}/zoneinfo"
FILES_ldd = "${bindir}/ldd"
FILES_libsegfault = "/lib/libSegFault*"
FILES_glibc-extra-nss = "/lib/libnss*"
@@ -60,6 +63,11 @@ do_install() {
install -m 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/
install -d ${D}${libdir}/locale
make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED"
+ # get rid of some broken files...
+ for i in ${GLIBC_BROKEN_LOCALES}; do
+ grep -v $i ${WORKDIR}/SUPPORTED > ${WORKDIR}/SUPPORTED.tmp
+ mv ${WORKDIR}/SUPPORTED.tmp ${WORKDIR}/SUPPORTED
+ done
rm -f ${D}/etc/rpc
}
@@ -95,7 +103,37 @@ mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/
rm -rf ${TMP_LOCALE}
}
-PACKAGES_DYNAMIC = "glibc-gconv-* glibc-charmap-* glibc-localedata-*"
+python __anonymous () {
+ target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
+ binary_arches = bb.data.getVar("BINARY_LOCALE_ARCHES", d, 1) or ""
+
+ if target_arch in binary_arches.split(" "):
+ depends = bb.data.getVar("DEPENDS", d, 1)
+ depends = "%s qemu-native" % depends
+ bb.data.setVar("DEPENDS", depends, d)
+ bb.data.setVar("USE_BINARY_LOCALE", "1", d)
+}
+
+do_prep_locale_tree() {
+ treedir=${WORKDIR}/locale-tree
+ rm -rf $treedir
+ mkdir -p $treedir/bin $treedir/lib $treedir/${datadir} $treedir/${libdir}/locale
+ cp -a ${D}${datadir}/i18n $treedir/${datadir}/i18n
+ # unzip to avoid parsing errors
+ for i in $treedir/${datadir}/i18n/charmaps/*gz; do
+ gunzip $i
+ done
+ cp -a ${STAGING_LIBDIR}/* $treedir/lib
+ cp -a ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.* $treedir/lib
+ install -m 0755 ${D}${bindir}/localedef $treedir/bin
+}
+
+do_collect_bins_from_locale_tree() {
+ treedir=${WORKDIR}/locale-tree
+
+ mkdir -p ${D}${libdir}
+ cp -a $treedir/${libdir}/locale ${D}${libdir}
+}
python package_do_split_gconvs () {
import os, re
@@ -118,6 +156,7 @@ python package_do_split_gconvs () {
gconv_libdir = os.path.join(libdir, "gconv")
charmap_dir = os.path.join(datadir, "i18n", "charmaps")
locales_dir = os.path.join(datadir, "i18n", "locales")
+ binary_locales_dir = os.path.join(libdir, "locale")
do_split_packages(d, gconv_libdir, file_regex='^(.*)\.so$', output_pattern='glibc-gconv-%s', description='gconv module for character set %s', extra_depends='glibc-gconv')
@@ -138,7 +177,11 @@ python package_do_split_gconvs () {
if deps != []:
bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d)
- do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
+ use_bin = bb.data.getVar("USE_BINARY_LOCALE", d, 1)
+ if use_bin:
+ do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='', aux_files_pattern_verbatim=binary_locales_dir + '/%s')
+ else:
+ do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
bb.data.setVar('PACKAGES', bb.data.getVar('PACKAGES', d) + ' glibc-gconv', d)
f = open(os.path.join(bb.data.getVar('WORKDIR', d, 1), "SUPPORTED"), "r")
@@ -159,7 +202,7 @@ python package_do_split_gconvs () {
encodings[locale] = []
encodings[locale].append(charset)
- def output_locale(name, locale, encoding):
+ def output_locale_source(name, locale, encoding):
pkgname = 'locale-base-' + legitimize_package_name(name)
bb.data.setVar('RDEPENDS_%s' % pkgname, 'localedef glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d)
@@ -173,6 +216,42 @@ python package_do_split_gconvs () {
bb.data.setVar('pkg_postinst_%s' % pkgname, bb.data.getVar('locale_base_postinst', d, 1) % (locale, encoding, locale), d)
bb.data.setVar('pkg_postrm_%s' % pkgname, bb.data.getVar('locale_base_postrm', d, 1) % (locale, encoding, locale), d)
+ def output_locale_binary(name, locale, encoding):
+ target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
+ qemu = "qemu-%s" % target_arch
+ pkgname = 'locale-base-' + legitimize_package_name(name)
+
+ bb.data.setVar('RDEPENDS_%s' % pkgname, 'glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d)
+ rprovides = 'virtual-locale-%s' % legitimize_package_name(name)
+ m = re.match("(.*)_(.*)", name)
+ if m:
+ rprovides += ' virtual-locale-%s' % m.group(1)
+ bb.data.setVar('RPROVIDES_%s' % pkgname, rprovides, d)
+ bb.data.setVar('ALLOW_EMPTY_%s' % pkgname, '1', d)
+ bb.data.setVar('PACKAGES', '%s %s' % (pkgname, bb.data.getVar('PACKAGES', d, 1)), d)
+
+ treedir = os.path.join(bb.data.getVar("WORKDIR", d, 1), "locale-tree")
+ path = bb.data.getVar("PATH", d, 1)
+ i18npath = os.path.join(treedir, datadir, "i18n")
+
+ localedef_opts = "--force --old-style --no-archive --prefix=%s --inputfile=%s/i18n/locales/%s --charmap=%s %s" % (treedir, datadir, locale, encoding, locale)
+ cmd = "PATH=\"%s\" I18NPATH=\"%s\" %s -L %s %s/bin/localedef %s" % (path, i18npath, qemu, treedir, treedir, localedef_opts)
+ bb.note("generating locale %s (%s)" % (locale, encoding))
+ if os.system(cmd):
+ raise bb.build.FuncFailed("localedef returned an error.")
+
+ def output_locale(name, locale, encoding):
+ use_bin = bb.data.getVar("USE_BINARY_LOCALE", d, 1)
+ if use_bin:
+ output_locale_binary(name, locale, encoding)
+ else:
+ output_locale_source(name, locale, encoding)
+
+ use_bin = bb.data.getVar("USE_BINARY_LOCALE", d, 1)
+ if use_bin:
+ bb.note("preparing tree for binary locale generation")
+ bb.build.exec_func("do_prep_locale_tree", d)
+
# Reshuffle names so that UTF-8 is preferred over other encodings
for l in encodings.keys():
if len(encodings[l]) == 1:
@@ -183,6 +262,11 @@ python package_do_split_gconvs () {
encodings[l].remove("UTF-8")
for e in encodings[l]:
output_locale('%s-%s' % (l, e), l, e)
+
+ use_bin = bb.data.getVar("USE_BINARY_LOCALE", d, 1)
+ if use_bin:
+ bb.note("collecting binary locales from locale tree")
+ bb.build.exec_func("do_collect_bins_from_locale_tree", d)
}
# We want to do this indirection so that we can safely 'return'
diff --git a/packages/glibc/glibc_2.3.5+cvs20050627.bb b/packages/glibc/glibc_2.3.5+cvs20050627.bb
index 396d2375bd..d1925902e4 100644
--- a/packages/glibc/glibc_2.3.5+cvs20050627.bb
+++ b/packages/glibc/glibc_2.3.5+cvs20050627.bb
@@ -7,11 +7,13 @@ MAINTAINER = "Phil Blundell <pb@handhelds.org>"
FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/glibc-cvs-2.3.5"
SRCDATE = "20050627"
-PR = "r2"
+PR = "r3"
GLIBC_ADDONS ?= "ports,linuxthreads"
GLIBC_EXTRA_OECONF ?= ""
+GLIBC_BROKEN_LOCALES = "sid_ET tr_TR mn_MN"
+
#
# For now, we will skip building of a gcc package if it is a uclibc one
# and our build is not a uclibc one, and we skip a glibc one if our build