diff options
author | Nitin A Kamble <nitin.a.kamble@intel.com> | 2010-10-04 13:31:23 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-07 22:53:28 +0100 |
commit | 2f19e2a1e6fe519f77b1d9611beadbfd2c74a22a (patch) | |
tree | 65dda95a7dd3471162678eaa63a9443d45e7385d | |
parent | 2e040618978b93d0add0e7e115c17545685c9dfc (diff) | |
download | poky-2f19e2a1e6fe519f77b1d9611beadbfd2c74a22a.tar.gz |
libc-package.bbclass, eglibc, glibc: enable locales generation using cross-localedef
Along with qemu this provides another option to generate locales for
[e]glibc. The new method is to use cross-localedef with appropriate arch
specific parameters.
The cross-localedef method is found to be 15 times faster than qemu's
emnualted method.
LOCALE_GENERATION_WITH_CROSS-LOCALEDEF : This is new config variable
introduced to selet qemu or cross-localedef method for locale generation.
Thanks to Mark Hatle from Windriver for providing the rich
information for cross locale generation.
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-rw-r--r-- | meta/classes/libc-package.bbclass | 73 | ||||
-rw-r--r-- | meta/recipes-core/eglibc/eglibc-package.inc | 27 | ||||
-rw-r--r-- | meta/recipes-core/glibc/glibc-package.inc | 24 |
3 files changed, 71 insertions, 53 deletions
diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index 1c034e09be..4709b33c0e 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass | |||
@@ -9,7 +9,29 @@ | |||
9 | 9 | ||
10 | GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice" | 10 | GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice" |
11 | 11 | ||
12 | inherit qemu | 12 | python __anonymous () { |
13 | enabled = bb.data.getVar("ENABLE_BINARY_LOCALE_GENERATION", d, 1) | ||
14 | |||
15 | if enabled and int(enabled): | ||
16 | import re | ||
17 | |||
18 | target_arch = bb.data.getVar("TARGET_ARCH", d, 1) | ||
19 | binary_arches = bb.data.getVar("BINARY_LOCALE_ARCHES", d, 1) or "" | ||
20 | use_cross_localedef = bb.data.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF", d, 1) or "" | ||
21 | |||
22 | for regexp in binary_arches.split(" "): | ||
23 | r = re.compile(regexp) | ||
24 | |||
25 | if r.match(target_arch): | ||
26 | depends = bb.data.getVar("DEPENDS", d, 1) | ||
27 | if use_cross_localedef == "1" : | ||
28 | depends = "%s cross-localedef-native" % depends | ||
29 | else: | ||
30 | depends = "%s qemu-native" % depends | ||
31 | bb.data.setVar("DEPENDS", depends, d) | ||
32 | bb.data.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile", d) | ||
33 | break | ||
34 | } | ||
13 | 35 | ||
14 | def get_libc_fpu_setting(bb, d): | 36 | def get_libc_fpu_setting(bb, d): |
15 | if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]: | 37 | if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]: |
@@ -105,6 +127,8 @@ do_collect_bins_from_locale_tree() { | |||
105 | cp -pPR $treedir/${libdir}/locale ${PKGD}${libdir} | 127 | cp -pPR $treedir/${libdir}/locale ${PKGD}${libdir} |
106 | } | 128 | } |
107 | 129 | ||
130 | inherit qemu | ||
131 | |||
108 | python package_do_split_gconvs () { | 132 | python package_do_split_gconvs () { |
109 | import os, re | 133 | import os, re |
110 | if (bb.data.getVar('PACKAGE_NO_GCONV', d, 1) == '1'): | 134 | if (bb.data.getVar('PACKAGE_NO_GCONV', d, 1) == '1'): |
@@ -251,24 +275,49 @@ python package_do_split_gconvs () { | |||
251 | bb.data.setVar('RPROVIDES_%s' % pkgname, " ".join(rprovides), d) | 275 | bb.data.setVar('RPROVIDES_%s' % pkgname, " ".join(rprovides), d) |
252 | 276 | ||
253 | def output_locale_binary(name, pkgname, locale, encoding): | 277 | def output_locale_binary(name, pkgname, locale, encoding): |
254 | qemu = qemu_target_binary(d) | ||
255 | |||
256 | treedir = base_path_join(bb.data.getVar("WORKDIR", d, 1), "locale-tree") | 278 | treedir = base_path_join(bb.data.getVar("WORKDIR", d, 1), "locale-tree") |
257 | ldlibdir = "%s/lib" % treedir | 279 | ldlibdir = "%s/lib" % treedir |
258 | path = bb.data.getVar("PATH", d, 1) | 280 | path = bb.data.getVar("PATH", d, 1) |
259 | i18npath = base_path_join(treedir, datadir, "i18n") | 281 | i18npath = base_path_join(treedir, datadir, "i18n") |
282 | gconvpath = base_path_join(treedir, "iconvdata") | ||
283 | |||
284 | use_cross_localedef = bb.data.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF", d, 1) or "0" | ||
285 | if use_cross_localedef == "1": | ||
286 | target_arch = bb.data.getVar('TARGET_ARCH', d, True) | ||
287 | locale_arch_options = { \ | ||
288 | "arm": " --uint32-align=4 --little-endian ", \ | ||
289 | "powerpc": " --uint32-align=4 --big-endian ", \ | ||
290 | "mips": " --uint32-align=4 --big-endian ", \ | ||
291 | "mipsel": " --uint32-align=4 --little-endian ", \ | ||
292 | "i586": " --uint32-align=4 --little-endian ", \ | ||
293 | "x86_64": " --uint32-align=4 --little-endian " } | ||
294 | |||
295 | if target_arch in locale_arch_options: | ||
296 | localedef_opts = locale_arch_options[target_arch] | ||
297 | else: | ||
298 | bb.error("locale_arch_options not found for target_arch=" + target_arch) | ||
299 | raise bb.build.FuncFailed("unknown arch:" + target_arch + " for locale_arch_options") | ||
300 | |||
301 | localedef_opts += " --force --old-style --no-archive --prefix=%s \ | ||
302 | --inputfile=%s/%s/i18n/locales/%s --charmap=%s %s/usr/lib/locale/%s" \ | ||
303 | % (treedir, treedir, datadir, locale, encoding, treedir, name) | ||
304 | |||
305 | cmd = "PATH=\"%s\" I18NPATH=\"%s\" GCONV_PATH=\"%s\" cross-localedef %s" % \ | ||
306 | (path, i18npath, gconvpath, localedef_opts) | ||
307 | else: # earlier slower qemu way | ||
308 | qemu = qemu_target_binary(d) | ||
309 | localedef_opts = "--force --old-style --no-archive --prefix=%s \ | ||
310 | --inputfile=%s/i18n/locales/%s --charmap=%s %s" \ | ||
311 | % (treedir, datadir, locale, encoding, name) | ||
260 | 312 | ||
261 | localedef_opts = "--force --old-style --no-archive --prefix=%s \ | 313 | qemu_options = bb.data.getVar("QEMU_OPTIONS_%s" % bb.data.getVar('PACKAGE_ARCH', d, 1), d, 1) |
262 | --inputfile=%s/i18n/locales/%s --charmap=%s %s" \ | 314 | if not qemu_options: |
263 | % (treedir, datadir, locale, encoding, name) | 315 | qemu_options = bb.data.getVar('QEMU_OPTIONS', d, 1) |
264 | 316 | ||
265 | qemu_options = bb.data.getVar("QEMU_OPTIONS_%s" % bb.data.getVar('PACKAGE_ARCH', d, 1), d, 1) | 317 | cmd = "PSEUDO_RELOADED=YES PATH=\"%s\" I18NPATH=\"%s\" %s -L %s \ |
266 | if not qemu_options: | 318 | -E LD_LIBRARY_PATH=%s %s %s/bin/localedef %s" % \ |
267 | qemu_options = bb.data.getVar('QEMU_OPTIONS', d, 1) | 319 | (path, i18npath, qemu, treedir, ldlibdir, qemu_options, treedir, localedef_opts) |
268 | 320 | ||
269 | cmd = "PSEUDO_RELOADED=YES PATH=\"%s\" I18NPATH=\"%s\" %s -L %s \ | ||
270 | -E LD_LIBRARY_PATH=%s %s %s/bin/localedef %s" % \ | ||
271 | (path, i18npath, qemu, treedir, ldlibdir, qemu_options, treedir, localedef_opts) | ||
272 | bb.note("generating locale %s (%s)" % (locale, encoding)) | 321 | bb.note("generating locale %s (%s)" % (locale, encoding)) |
273 | import subprocess | 322 | import subprocess |
274 | process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | 323 | process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
diff --git a/meta/recipes-core/eglibc/eglibc-package.inc b/meta/recipes-core/eglibc/eglibc-package.inc index 35001fd6fc..ac0ba94bc2 100644 --- a/meta/recipes-core/eglibc/eglibc-package.inc +++ b/meta/recipes-core/eglibc/eglibc-package.inc | |||
@@ -19,13 +19,18 @@ python __anonymous () { | |||
19 | # to decrease initial boot time and avoid localedef being killed by the OOM | 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. | 20 | # killer which used to effectively break i18n on machines with < 128MB RAM. |
21 | 21 | ||
22 | # default to disabled until qemu works for everyone | 22 | # default to disabled |
23 | ENABLE_BINARY_LOCALE_GENERATION ?= "0" | 23 | ENABLE_BINARY_LOCALE_GENERATION ?= "0" |
24 | ENABLE_BINARY_LOCALE_GENERATION_pn-eglibc-nativesdk = "0" | 24 | ENABLE_BINARY_LOCALE_GENERATION_pn-eglibc-nativesdk = "0" |
25 | 25 | ||
26 | #enable locale generation on these arches | ||
26 | # BINARY_LOCALE_ARCHES is a space separated list of regular expressions | 27 | # BINARY_LOCALE_ARCHES is a space separated list of regular expressions |
27 | BINARY_LOCALE_ARCHES ?= "arm.* i[3-6]86 x86_64 powerpc mips" | 28 | BINARY_LOCALE_ARCHES ?= "arm.* i[3-6]86 x86_64 powerpc mips" |
28 | 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 | |||
29 | # Set this to zero if you don't want ldconfig in the output package | 34 | # Set this to zero if you don't want ldconfig in the output package |
30 | USE_LDCONFIG ?= "1" | 35 | USE_LDCONFIG ?= "1" |
31 | 36 | ||
@@ -79,25 +84,5 @@ DESCRIPTION_ldd = "eglibc: print shared library dependencies" | |||
79 | DESCRIPTION_localedef = "eglibc: compile locale definition files" | 84 | DESCRIPTION_localedef = "eglibc: compile locale definition files" |
80 | DESCRIPTION_eglibc-utils = "eglibc: misc utilities like iconf, local, gencat, tzselect, rpcinfo, ..." | 85 | DESCRIPTION_eglibc-utils = "eglibc: misc utilities like iconf, local, gencat, tzselect, rpcinfo, ..." |
81 | 86 | ||
82 | python __anonymous () { | ||
83 | enabled = bb.data.getVar("ENABLE_BINARY_LOCALE_GENERATION", d, 1) | ||
84 | |||
85 | if enabled and int(enabled): | ||
86 | import re | ||
87 | |||
88 | target_arch = bb.data.getVar("TARGET_ARCH", d, 1) | ||
89 | binary_arches = bb.data.getVar("BINARY_LOCALE_ARCHES", d, 1) or "" | ||
90 | |||
91 | for regexp in binary_arches.split(" "): | ||
92 | r = re.compile(regexp) | ||
93 | |||
94 | if r.match(target_arch): | ||
95 | depends = bb.data.getVar("DEPENDS", d, 1) | ||
96 | depends = "%s qemu-native" % depends | ||
97 | bb.data.setVar("DEPENDS", depends, d) | ||
98 | bb.data.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile", d) | ||
99 | break | ||
100 | } | ||
101 | |||
102 | inherit libc-package | 87 | inherit libc-package |
103 | 88 | ||
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc index 3c9132820d..8faeeb7e89 100644 --- a/meta/recipes-core/glibc/glibc-package.inc +++ b/meta/recipes-core/glibc/glibc-package.inc | |||
@@ -27,6 +27,10 @@ ENABLE_BINARY_LOCALE_GENERATION_pn-glibc-nativesdk = "0" | |||
27 | # BINARY_LOCALE_ARCHES is a space separated list of regular expressions | 27 | # BINARY_LOCALE_ARCHES is a space separated list of regular expressions |
28 | BINARY_LOCALE_ARCHES ?= "arm.* i[3-6]86 x86_64 powerpc mips" | 28 | BINARY_LOCALE_ARCHES ?= "arm.* i[3-6]86 x86_64 powerpc mips" |
29 | 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 | |||
30 | PKGSUFFIX = "" | 34 | PKGSUFFIX = "" |
31 | PKGSUFFIX_virtclass-nativesdk = "-nativesdk" | 35 | PKGSUFFIX_virtclass-nativesdk = "-nativesdk" |
32 | 36 | ||
@@ -86,24 +90,4 @@ DESCRIPTION_glibc-utils = "glibc: misc utilities like iconf, local, gencat, tzse | |||
86 | 90 | ||
87 | EXTRA_OEMAKE += "rootsbindir=${base_sbindir}" | 91 | EXTRA_OEMAKE += "rootsbindir=${base_sbindir}" |
88 | 92 | ||
89 | python __anonymous () { | ||
90 | enabled = bb.data.getVar("ENABLE_BINARY_LOCALE_GENERATION", d, 1) | ||
91 | |||
92 | if enabled and int(enabled): | ||
93 | import re | ||
94 | |||
95 | target_arch = bb.data.getVar("TARGET_ARCH", d, 1) | ||
96 | binary_arches = bb.data.getVar("BINARY_LOCALE_ARCHES", d, 1) or "" | ||
97 | |||
98 | for regexp in binary_arches.split(" "): | ||
99 | r = re.compile(regexp) | ||
100 | |||
101 | if r.match(target_arch): | ||
102 | depends = bb.data.getVar("DEPENDS", d, 1) | ||
103 | depends = "%s qemu-native" % depends | ||
104 | bb.data.setVar("DEPENDS", depends, d) | ||
105 | bb.data.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile", d) | ||
106 | break | ||
107 | } | ||
108 | |||
109 | inherit libc-package | 93 | inherit libc-package |