diff options
| -rw-r--r-- | openembedded/packages/glibc/glibc-package.bbclass | 113 | ||||
| -rw-r--r-- | openembedded/packages/glibc/glibc_2.3.5+cvs20050627.bb | 8 |
2 files changed, 114 insertions, 7 deletions
diff --git a/openembedded/packages/glibc/glibc-package.bbclass b/openembedded/packages/glibc/glibc-package.bbclass index 9a91e3ab24..d6decfb709 100644 --- a/openembedded/packages/glibc/glibc-package.bbclass +++ b/openembedded/packages/glibc/glibc-package.bbclass | |||
| @@ -14,11 +14,23 @@ python __anonymous () { | |||
| 14 | bb.data.getVar('TARGET_OS', d, 1)) | 14 | bb.data.getVar('TARGET_OS', d, 1)) |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 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 | |||
| 22 | # default to disabled until qemu works for everyone | ||
| 23 | ENABLE_BINARY_LOCALE_GENERATION ?= "0" | ||
| 24 | |||
| 25 | # BINARY_LOCALE_ARCHES is a space separated list of regular expressions | ||
| 26 | BINARY_LOCALE_ARCHES ?= "arm.*" | ||
| 27 | |||
| 17 | PACKAGES = "glibc catchsegv sln nscd ldd localedef glibc-utils glibc-dev glibc-doc glibc-locale libsegfault glibc-extra-nss glibc-thread-db glibc-pcprofile" | 28 | PACKAGES = "glibc catchsegv sln nscd ldd localedef glibc-utils glibc-dev glibc-doc glibc-locale libsegfault glibc-extra-nss glibc-thread-db glibc-pcprofile" |
| 29 | PACKAGES_DYNAMIC = "glibc-gconv-* glibc-charmap-* glibc-localedata-*" | ||
| 18 | 30 | ||
| 19 | 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*" | 31 | 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*" |
| 20 | 32 | ||
| 21 | FILES_${PN} = "${sysconfdir} ${libc_baselibs} /sbin/ldconfig ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale" | 33 | FILES_${PN} = "${sysconfdir} ${libc_baselibs} /sbin/ldconfig ${libexecdir} ${datadir}/zoneinfo" |
| 22 | FILES_ldd = "${bindir}/ldd" | 34 | FILES_ldd = "${bindir}/ldd" |
| 23 | FILES_libsegfault = "/lib/libSegFault*" | 35 | FILES_libsegfault = "/lib/libSegFault*" |
| 24 | FILES_glibc-extra-nss = "/lib/libnss*" | 36 | FILES_glibc-extra-nss = "/lib/libnss*" |
| @@ -60,6 +72,11 @@ do_install() { | |||
| 60 | install -m 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/ | 72 | install -m 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/ |
| 61 | install -d ${D}${libdir}/locale | 73 | install -d ${D}${libdir}/locale |
| 62 | make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED" | 74 | make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED" |
| 75 | # get rid of some broken files... | ||
| 76 | for i in ${GLIBC_BROKEN_LOCALES}; do | ||
| 77 | grep -v $i ${WORKDIR}/SUPPORTED > ${WORKDIR}/SUPPORTED.tmp | ||
| 78 | mv ${WORKDIR}/SUPPORTED.tmp ${WORKDIR}/SUPPORTED | ||
| 79 | done | ||
| 63 | rm -f ${D}/etc/rpc | 80 | rm -f ${D}/etc/rpc |
| 64 | } | 81 | } |
| 65 | 82 | ||
| @@ -95,7 +112,48 @@ mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/ | |||
| 95 | rm -rf ${TMP_LOCALE} | 112 | rm -rf ${TMP_LOCALE} |
| 96 | } | 113 | } |
| 97 | 114 | ||
| 98 | PACKAGES_DYNAMIC = "glibc-gconv-* glibc-charmap-* glibc-localedata-*" | 115 | python __anonymous () { |
| 116 | enabled = bb.data.getVar("ENABLE_BINARY_LOCALE_GENERATION", d, 1) | ||
| 117 | |||
| 118 | if enabled and int(enabled): | ||
| 119 | import re | ||
| 120 | |||
| 121 | target_arch = bb.data.getVar("TARGET_ARCH", d, 1) | ||
| 122 | binary_arches = bb.data.getVar("BINARY_LOCALE_ARCHES", d, 1) or "" | ||
| 123 | |||
| 124 | for regexp in binary_arches.split(" "): | ||
| 125 | r = re.compile(regexp) | ||
| 126 | |||
| 127 | if r.match(target_arch): | ||
| 128 | depends = bb.data.getVar("DEPENDS", d, 1) | ||
| 129 | depends = "%s qemu-native" % depends | ||
| 130 | bb.data.setVar("DEPENDS", depends, d) | ||
| 131 | bb.data.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "1", d) | ||
| 132 | break | ||
| 133 | } | ||
| 134 | |||
| 135 | do_prep_locale_tree() { | ||
| 136 | treedir=${WORKDIR}/locale-tree | ||
| 137 | rm -rf $treedir | ||
| 138 | mkdir -p $treedir/bin $treedir/lib $treedir/${datadir} $treedir/${libdir}/locale | ||
| 139 | cp -a ${D}${datadir}/i18n $treedir/${datadir}/i18n | ||
| 140 | # unzip to avoid parsing errors | ||
| 141 | for i in $treedir/${datadir}/i18n/charmaps/*gz; do | ||
| 142 | gunzip $i | ||
| 143 | done | ||
| 144 | cp -a ${STAGING_LIBDIR}/* $treedir/lib | ||
| 145 | if [ -f ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.* ]; then | ||
| 146 | cp -a ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.* $treedir/lib | ||
| 147 | fi | ||
| 148 | install -m 0755 ${D}${bindir}/localedef $treedir/bin | ||
| 149 | } | ||
| 150 | |||
| 151 | do_collect_bins_from_locale_tree() { | ||
| 152 | treedir=${WORKDIR}/locale-tree | ||
| 153 | |||
| 154 | mkdir -p ${D}${libdir} | ||
| 155 | cp -a $treedir/${libdir}/locale ${D}${libdir} | ||
| 156 | } | ||
| 99 | 157 | ||
| 100 | python package_do_split_gconvs () { | 158 | python package_do_split_gconvs () { |
| 101 | import os, re | 159 | import os, re |
| @@ -118,6 +176,7 @@ python package_do_split_gconvs () { | |||
| 118 | gconv_libdir = os.path.join(libdir, "gconv") | 176 | gconv_libdir = os.path.join(libdir, "gconv") |
| 119 | charmap_dir = os.path.join(datadir, "i18n", "charmaps") | 177 | charmap_dir = os.path.join(datadir, "i18n", "charmaps") |
| 120 | locales_dir = os.path.join(datadir, "i18n", "locales") | 178 | locales_dir = os.path.join(datadir, "i18n", "locales") |
| 179 | binary_locales_dir = os.path.join(libdir, "locale") | ||
| 121 | 180 | ||
| 122 | 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') | 181 | 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') |
| 123 | 182 | ||
| @@ -138,7 +197,12 @@ python package_do_split_gconvs () { | |||
| 138 | if deps != []: | 197 | if deps != []: |
| 139 | bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d) | 198 | bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d) |
| 140 | 199 | ||
| 141 | do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='') | 200 | use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1) |
| 201 | if use_bin: | ||
| 202 | 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') | ||
| 203 | else: | ||
| 204 | do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='') | ||
| 205 | bb.note("generation of binary locales disabled. this may break i18n!") | ||
| 142 | bb.data.setVar('PACKAGES', bb.data.getVar('PACKAGES', d) + ' glibc-gconv', d) | 206 | bb.data.setVar('PACKAGES', bb.data.getVar('PACKAGES', d) + ' glibc-gconv', d) |
| 143 | 207 | ||
| 144 | f = open(os.path.join(bb.data.getVar('WORKDIR', d, 1), "SUPPORTED"), "r") | 208 | f = open(os.path.join(bb.data.getVar('WORKDIR', d, 1), "SUPPORTED"), "r") |
| @@ -159,7 +223,7 @@ python package_do_split_gconvs () { | |||
| 159 | encodings[locale] = [] | 223 | encodings[locale] = [] |
| 160 | encodings[locale].append(charset) | 224 | encodings[locale].append(charset) |
| 161 | 225 | ||
| 162 | def output_locale(name, locale, encoding): | 226 | def output_locale_source(name, locale, encoding): |
| 163 | pkgname = 'locale-base-' + legitimize_package_name(name) | 227 | pkgname = 'locale-base-' + legitimize_package_name(name) |
| 164 | 228 | ||
| 165 | bb.data.setVar('RDEPENDS_%s' % pkgname, 'localedef glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d) | 229 | bb.data.setVar('RDEPENDS_%s' % pkgname, 'localedef glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d) |
| @@ -173,6 +237,42 @@ python package_do_split_gconvs () { | |||
| 173 | bb.data.setVar('pkg_postinst_%s' % pkgname, bb.data.getVar('locale_base_postinst', d, 1) % (locale, encoding, locale), d) | 237 | bb.data.setVar('pkg_postinst_%s' % pkgname, bb.data.getVar('locale_base_postinst', d, 1) % (locale, encoding, locale), d) |
| 174 | bb.data.setVar('pkg_postrm_%s' % pkgname, bb.data.getVar('locale_base_postrm', d, 1) % (locale, encoding, locale), d) | 238 | bb.data.setVar('pkg_postrm_%s' % pkgname, bb.data.getVar('locale_base_postrm', d, 1) % (locale, encoding, locale), d) |
| 175 | 239 | ||
| 240 | def output_locale_binary(name, locale, encoding): | ||
| 241 | target_arch = bb.data.getVar("TARGET_ARCH", d, 1) | ||
| 242 | qemu = "qemu-%s" % target_arch | ||
| 243 | pkgname = 'locale-base-' + legitimize_package_name(name) | ||
| 244 | |||
| 245 | bb.data.setVar('RDEPENDS_%s' % pkgname, 'glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d) | ||
| 246 | rprovides = 'virtual-locale-%s' % legitimize_package_name(name) | ||
| 247 | m = re.match("(.*)_(.*)", name) | ||
| 248 | if m: | ||
| 249 | rprovides += ' virtual-locale-%s' % m.group(1) | ||
| 250 | bb.data.setVar('RPROVIDES_%s' % pkgname, rprovides, d) | ||
| 251 | bb.data.setVar('ALLOW_EMPTY_%s' % pkgname, '1', d) | ||
| 252 | bb.data.setVar('PACKAGES', '%s %s' % (pkgname, bb.data.getVar('PACKAGES', d, 1)), d) | ||
| 253 | |||
| 254 | treedir = os.path.join(bb.data.getVar("WORKDIR", d, 1), "locale-tree") | ||
| 255 | path = bb.data.getVar("PATH", d, 1) | ||
| 256 | i18npath = os.path.join(treedir, datadir, "i18n") | ||
| 257 | |||
| 258 | localedef_opts = "--force --old-style --no-archive --prefix=%s --inputfile=%s/i18n/locales/%s --charmap=%s %s" % (treedir, datadir, locale, encoding, locale) | ||
| 259 | cmd = "PATH=\"%s\" I18NPATH=\"%s\" %s -L %s %s/bin/localedef %s" % (path, i18npath, qemu, treedir, treedir, localedef_opts) | ||
| 260 | bb.note("generating locale %s (%s)" % (locale, encoding)) | ||
| 261 | if os.system(cmd): | ||
| 262 | raise bb.build.FuncFailed("localedef returned an error.") | ||
| 263 | |||
| 264 | def output_locale(name, locale, encoding): | ||
| 265 | use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1) | ||
| 266 | if use_bin: | ||
| 267 | output_locale_binary(name, locale, encoding) | ||
| 268 | else: | ||
| 269 | output_locale_source(name, locale, encoding) | ||
| 270 | |||
| 271 | use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1) | ||
| 272 | if use_bin: | ||
| 273 | bb.note("preparing tree for binary locale generation") | ||
| 274 | bb.build.exec_func("do_prep_locale_tree", d) | ||
| 275 | |||
| 176 | # Reshuffle names so that UTF-8 is preferred over other encodings | 276 | # Reshuffle names so that UTF-8 is preferred over other encodings |
| 177 | for l in encodings.keys(): | 277 | for l in encodings.keys(): |
| 178 | if len(encodings[l]) == 1: | 278 | if len(encodings[l]) == 1: |
| @@ -183,6 +283,11 @@ python package_do_split_gconvs () { | |||
| 183 | encodings[l].remove("UTF-8") | 283 | encodings[l].remove("UTF-8") |
| 184 | for e in encodings[l]: | 284 | for e in encodings[l]: |
| 185 | output_locale('%s-%s' % (l, e), l, e) | 285 | output_locale('%s-%s' % (l, e), l, e) |
| 286 | |||
| 287 | use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1) | ||
| 288 | if use_bin: | ||
| 289 | bb.note("collecting binary locales from locale tree") | ||
| 290 | bb.build.exec_func("do_collect_bins_from_locale_tree", d) | ||
| 186 | } | 291 | } |
| 187 | 292 | ||
| 188 | # We want to do this indirection so that we can safely 'return' | 293 | # We want to do this indirection so that we can safely 'return' |
diff --git a/openembedded/packages/glibc/glibc_2.3.5+cvs20050627.bb b/openembedded/packages/glibc/glibc_2.3.5+cvs20050627.bb index e7adcd0a39..d1925902e4 100644 --- a/openembedded/packages/glibc/glibc_2.3.5+cvs20050627.bb +++ b/openembedded/packages/glibc/glibc_2.3.5+cvs20050627.bb | |||
| @@ -7,11 +7,13 @@ MAINTAINER = "Phil Blundell <pb@handhelds.org>" | |||
| 7 | 7 | ||
| 8 | FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/glibc-cvs-2.3.5" | 8 | FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/glibc-cvs-2.3.5" |
| 9 | SRCDATE = "20050627" | 9 | SRCDATE = "20050627" |
| 10 | PR = "r1" | 10 | PR = "r3" |
| 11 | 11 | ||
| 12 | GLIBC_ADDONS ?= "ports,linuxthreads" | 12 | GLIBC_ADDONS ?= "ports,linuxthreads" |
| 13 | GLIBC_EXTRA_OECONF ?= "" | 13 | GLIBC_EXTRA_OECONF ?= "" |
| 14 | 14 | ||
| 15 | GLIBC_BROKEN_LOCALES = "sid_ET tr_TR mn_MN" | ||
| 16 | |||
| 15 | # | 17 | # |
| 16 | # For now, we will skip building of a gcc package if it is a uclibc one | 18 | # For now, we will skip building of a gcc package if it is a uclibc one |
| 17 | # and our build is not a uclibc one, and we skip a glibc one if our build | 19 | # and our build is not a uclibc one, and we skip a glibc one if our build |
| @@ -41,8 +43,8 @@ INHIBIT_DEFAULT_DEPS = "1" | |||
| 41 | # \ | 43 | # \ |
| 42 | # file://arm-ioperm.patch;patch=1;pnum=0 \ | 44 | # file://arm-ioperm.patch;patch=1;pnum=0 \ |
| 43 | # file://ldd.patch;patch=1;pnum=0 \ | 45 | # file://ldd.patch;patch=1;pnum=0 \ |
| 44 | SRC_URI = "cvs://anoncvs@sources.redhat.com/cvs/glibc;module=libc \ | 46 | SRC_URI = "http://familiar.handhelds.org/source/v0.8.3/stash_libc_sources.redhat.com__20050627.tar.gz \ |
| 45 | cvs://anoncvs@sources.redhat.com/cvs/glibc;module=ports \ | 47 | http://familiar.handhelds.org/source/v0.8.3/stash_ports_sources.redhat.com__20050627.tar.gz \ |
| 46 | file://arm-audit.patch;patch=1 \ | 48 | file://arm-audit.patch;patch=1 \ |
| 47 | file://arm-audit2.patch;patch=1 \ | 49 | file://arm-audit2.patch;patch=1 \ |
| 48 | file://arm-no-hwcap.patch;patch=1 \ | 50 | file://arm-no-hwcap.patch;patch=1 \ |
