diff options
Diffstat (limited to 'meta/classes/libc-package.bbclass')
-rw-r--r-- | meta/classes/libc-package.bbclass | 526 |
1 files changed, 263 insertions, 263 deletions
diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index 9df3c17116..e3214a68a2 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass | |||
@@ -28,10 +28,10 @@ python __anonymous () { | |||
28 | 28 | ||
29 | if r.match(target_arch): | 29 | if r.match(target_arch): |
30 | depends = d.getVar("DEPENDS", True) | 30 | depends = d.getVar("DEPENDS", True) |
31 | if use_cross_localedef == "1" : | 31 | if use_cross_localedef == "1" : |
32 | depends = "%s cross-localedef-native" % depends | 32 | depends = "%s cross-localedef-native" % depends |
33 | else: | 33 | else: |
34 | depends = "%s qemu-native" % depends | 34 | depends = "%s qemu-native" % depends |
35 | d.setVar("DEPENDS", depends) | 35 | d.setVar("DEPENDS", depends) |
36 | d.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile") | 36 | d.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile") |
37 | break | 37 | break |
@@ -118,270 +118,270 @@ do_collect_bins_from_locale_tree() { | |||
118 | inherit qemu | 118 | inherit qemu |
119 | 119 | ||
120 | python package_do_split_gconvs () { | 120 | python package_do_split_gconvs () { |
121 | import os, re | 121 | import os, re |
122 | if (d.getVar('PACKAGE_NO_GCONV', True) == '1'): | 122 | if (d.getVar('PACKAGE_NO_GCONV', True) == '1'): |
123 | bb.note("package requested not splitting gconvs") | 123 | bb.note("package requested not splitting gconvs") |
124 | return | 124 | return |
125 | 125 | ||
126 | if not d.getVar('PACKAGES', True): | 126 | if not d.getVar('PACKAGES', True): |
127 | return | 127 | return |
128 | 128 | ||
129 | mlprefix = d.getVar("MLPREFIX", True) or "" | 129 | mlprefix = d.getVar("MLPREFIX", True) or "" |
130 | 130 | ||
131 | bpn = d.getVar('BPN', True) | 131 | bpn = d.getVar('BPN', True) |
132 | libdir = d.getVar('libdir', True) | 132 | libdir = d.getVar('libdir', True) |
133 | if not libdir: | 133 | if not libdir: |
134 | bb.error("libdir not defined") | 134 | bb.error("libdir not defined") |
135 | return | 135 | return |
136 | datadir = d.getVar('datadir', True) | 136 | datadir = d.getVar('datadir', True) |
137 | if not datadir: | 137 | if not datadir: |
138 | bb.error("datadir not defined") | 138 | bb.error("datadir not defined") |
139 | return | 139 | return |
140 | 140 | ||
141 | gconv_libdir = base_path_join(libdir, "gconv") | 141 | gconv_libdir = base_path_join(libdir, "gconv") |
142 | charmap_dir = base_path_join(datadir, "i18n", "charmaps") | 142 | charmap_dir = base_path_join(datadir, "i18n", "charmaps") |
143 | locales_dir = base_path_join(datadir, "i18n", "locales") | 143 | locales_dir = base_path_join(datadir, "i18n", "locales") |
144 | binary_locales_dir = base_path_join(libdir, "locale") | 144 | binary_locales_dir = base_path_join(libdir, "locale") |
145 | 145 | ||
146 | def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group): | 146 | def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group): |
147 | deps = [] | 147 | deps = [] |
148 | f = open(fn, "r") | 148 | f = open(fn, "r") |
149 | c_re = re.compile('^copy "(.*)"') | 149 | c_re = re.compile('^copy "(.*)"') |
150 | i_re = re.compile('^include "(\w+)".*') | 150 | i_re = re.compile('^include "(\w+)".*') |
151 | for l in f.readlines(): | 151 | for l in f.readlines(): |
152 | m = c_re.match(l) or i_re.match(l) | 152 | m = c_re.match(l) or i_re.match(l) |
153 | if m: | 153 | if m: |
154 | dp = legitimize_package_name('%s%s-gconv-%s' % (mlprefix, bpn, m.group(1))) | 154 | dp = legitimize_package_name('%s%s-gconv-%s' % (mlprefix, bpn, m.group(1))) |
155 | if not dp in deps: | 155 | if not dp in deps: |
156 | deps.append(dp) | 156 | deps.append(dp) |
157 | f.close() | 157 | f.close() |
158 | if deps != []: | 158 | if deps != []: |
159 | d.setVar('RDEPENDS_%s' % pkg, " ".join(deps)) | 159 | d.setVar('RDEPENDS_%s' % pkg, " ".join(deps)) |
160 | if bpn != 'glibc': | 160 | if bpn != 'glibc': |
161 | d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) | 161 | d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) |
162 | 162 | ||
163 | do_split_packages(d, gconv_libdir, file_regex='^(.*)\.so$', output_pattern=bpn+'-gconv-%s', \ | 163 | do_split_packages(d, gconv_libdir, file_regex='^(.*)\.so$', output_pattern=bpn+'-gconv-%s', \ |
164 | description='gconv module for character set %s', hook=calc_gconv_deps, \ | 164 | description='gconv module for character set %s', hook=calc_gconv_deps, \ |
165 | extra_depends=bpn+'-gconv') | 165 | extra_depends=bpn+'-gconv') |
166 | 166 | ||
167 | def calc_charmap_deps(fn, pkg, file_regex, output_pattern, group): | 167 | def calc_charmap_deps(fn, pkg, file_regex, output_pattern, group): |
168 | deps = [] | 168 | deps = [] |
169 | f = open(fn, "r") | 169 | f = open(fn, "r") |
170 | c_re = re.compile('^copy "(.*)"') | 170 | c_re = re.compile('^copy "(.*)"') |
171 | i_re = re.compile('^include "(\w+)".*') | 171 | i_re = re.compile('^include "(\w+)".*') |
172 | for l in f.readlines(): | 172 | for l in f.readlines(): |
173 | m = c_re.match(l) or i_re.match(l) | 173 | m = c_re.match(l) or i_re.match(l) |
174 | if m: | 174 | if m: |
175 | dp = legitimize_package_name('%s%s-charmap-%s' % (mlprefix, bpn, m.group(1))) | 175 | dp = legitimize_package_name('%s%s-charmap-%s' % (mlprefix, bpn, m.group(1))) |
176 | if not dp in deps: | 176 | if not dp in deps: |
177 | deps.append(dp) | 177 | deps.append(dp) |
178 | f.close() | 178 | f.close() |
179 | if deps != []: | 179 | if deps != []: |
180 | d.setVar('RDEPENDS_%s' % pkg, " ".join(deps)) | 180 | d.setVar('RDEPENDS_%s' % pkg, " ".join(deps)) |
181 | if bpn != 'glibc': | 181 | if bpn != 'glibc': |
182 | d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) | 182 | d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) |
183 | 183 | ||
184 | do_split_packages(d, charmap_dir, file_regex='^(.*)\.gz$', output_pattern=bpn+'-charmap-%s', \ | 184 | do_split_packages(d, charmap_dir, file_regex='^(.*)\.gz$', output_pattern=bpn+'-charmap-%s', \ |
185 | description='character map for %s encoding', hook=calc_charmap_deps, extra_depends='') | 185 | description='character map for %s encoding', hook=calc_charmap_deps, extra_depends='') |
186 | 186 | ||
187 | def calc_locale_deps(fn, pkg, file_regex, output_pattern, group): | 187 | def calc_locale_deps(fn, pkg, file_regex, output_pattern, group): |
188 | deps = [] | 188 | deps = [] |
189 | f = open(fn, "r") | 189 | f = open(fn, "r") |
190 | c_re = re.compile('^copy "(.*)"') | 190 | c_re = re.compile('^copy "(.*)"') |
191 | i_re = re.compile('^include "(\w+)".*') | 191 | i_re = re.compile('^include "(\w+)".*') |
192 | for l in f.readlines(): | 192 | for l in f.readlines(): |
193 | m = c_re.match(l) or i_re.match(l) | 193 | m = c_re.match(l) or i_re.match(l) |
194 | if m: | 194 | if m: |
195 | dp = legitimize_package_name(mlprefix+bpn+'-localedata-%s' % m.group(1)) | 195 | dp = legitimize_package_name(mlprefix+bpn+'-localedata-%s' % m.group(1)) |
196 | if not dp in deps: | 196 | if not dp in deps: |
197 | deps.append(dp) | 197 | deps.append(dp) |
198 | f.close() | 198 | f.close() |
199 | if deps != []: | 199 | if deps != []: |
200 | d.setVar('RDEPENDS_%s' % pkg, " ".join(deps)) | 200 | d.setVar('RDEPENDS_%s' % pkg, " ".join(deps)) |
201 | if bpn != 'glibc': | 201 | if bpn != 'glibc': |
202 | d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) | 202 | d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) |
203 | 203 | ||
204 | do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern=bpn+'-localedata-%s', \ | 204 | do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern=bpn+'-localedata-%s', \ |
205 | description='locale definition for %s', hook=calc_locale_deps, extra_depends='') | 205 | description='locale definition for %s', hook=calc_locale_deps, extra_depends='') |
206 | d.setVar('PACKAGES', d.getVar('PACKAGES') + ' ' + d.getVar('MLPREFIX') + bpn + '-gconv') | 206 | d.setVar('PACKAGES', d.getVar('PACKAGES') + ' ' + d.getVar('MLPREFIX') + bpn + '-gconv') |
207 | 207 | ||
208 | use_bin = d.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", True) | 208 | use_bin = d.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", True) |
209 | 209 | ||
210 | dot_re = re.compile("(.*)\.(.*)") | 210 | dot_re = re.compile("(.*)\.(.*)") |
211 | 211 | ||
212 | # Read in supported locales and associated encodings | 212 | # Read in supported locales and associated encodings |
213 | supported = {} | 213 | supported = {} |
214 | with open(base_path_join(d.getVar('WORKDIR', True), "SUPPORTED")) as f: | 214 | with open(base_path_join(d.getVar('WORKDIR', True), "SUPPORTED")) as f: |
215 | for line in f.readlines(): | 215 | for line in f.readlines(): |
216 | try: | 216 | try: |
217 | locale, charset = line.rstrip().split() | 217 | locale, charset = line.rstrip().split() |
218 | except ValueError: | 218 | except ValueError: |
219 | continue | 219 | continue |
220 | supported[locale] = charset | 220 | supported[locale] = charset |
221 | 221 | ||
222 | # GLIBC_GENERATE_LOCALES var specifies which locales to be generated. empty or "all" means all locales | 222 | # GLIBC_GENERATE_LOCALES var specifies which locales to be generated. empty or "all" means all locales |
223 | to_generate = d.getVar('GLIBC_GENERATE_LOCALES', True) | 223 | to_generate = d.getVar('GLIBC_GENERATE_LOCALES', True) |
224 | if not to_generate or to_generate == 'all': | 224 | if not to_generate or to_generate == 'all': |
225 | to_generate = supported.keys() | 225 | to_generate = supported.keys() |
226 | else: | 226 | else: |
227 | to_generate = to_generate.split() | 227 | to_generate = to_generate.split() |
228 | for locale in to_generate: | 228 | for locale in to_generate: |
229 | if locale not in supported: | 229 | if locale not in supported: |
230 | if '.' in locale: | 230 | if '.' in locale: |
231 | charset = locale.split('.')[1] | 231 | charset = locale.split('.')[1] |
232 | else: | 232 | else: |
233 | charset = 'UTF-8' | 233 | charset = 'UTF-8' |
234 | bb.warn("Unsupported locale '%s', assuming encoding '%s'" % (locale, charset)) | 234 | bb.warn("Unsupported locale '%s', assuming encoding '%s'" % (locale, charset)) |
235 | supported[locale] = charset | 235 | supported[locale] = charset |
236 | 236 | ||
237 | def output_locale_source(name, pkgname, locale, encoding): | 237 | def output_locale_source(name, pkgname, locale, encoding): |
238 | d.setVar('RDEPENDS_%s' % pkgname, 'localedef %s-localedata-%s %s-charmap-%s' % \ | 238 | d.setVar('RDEPENDS_%s' % pkgname, 'localedef %s-localedata-%s %s-charmap-%s' % \ |
239 | (mlprefix+bpn, legitimize_package_name(locale), mlprefix+bpn, legitimize_package_name(encoding))) | 239 | (mlprefix+bpn, legitimize_package_name(locale), mlprefix+bpn, legitimize_package_name(encoding))) |
240 | d.setVar('pkg_postinst_%s' % pkgname, d.getVar('locale_base_postinst', True) \ | 240 | d.setVar('pkg_postinst_%s' % pkgname, d.getVar('locale_base_postinst', True) \ |
241 | % (locale, encoding, locale)) | 241 | % (locale, encoding, locale)) |
242 | d.setVar('pkg_postrm_%s' % pkgname, d.getVar('locale_base_postrm', True) % \ | 242 | d.setVar('pkg_postrm_%s' % pkgname, d.getVar('locale_base_postrm', True) % \ |
243 | (locale, encoding, locale)) | 243 | (locale, encoding, locale)) |
244 | 244 | ||
245 | def output_locale_binary_rdepends(name, pkgname, locale, encoding): | 245 | def output_locale_binary_rdepends(name, pkgname, locale, encoding): |
246 | m = re.match("(.*)\.(.*)", name) | 246 | m = re.match("(.*)\.(.*)", name) |
247 | if m: | 247 | if m: |
248 | libc_name = "%s.%s" % (m.group(1), m.group(2).lower().replace("-","")) | 248 | libc_name = "%s.%s" % (m.group(1), m.group(2).lower().replace("-","")) |
249 | else: | 249 | else: |
250 | libc_name = name | 250 | libc_name = name |
251 | d.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('%s-binary-localedata-%s' \ | 251 | d.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('%s-binary-localedata-%s' \ |
252 | % (mlprefix+bpn, libc_name))) | 252 | % (mlprefix+bpn, libc_name))) |
253 | 253 | ||
254 | commands = {} | 254 | commands = {} |
255 | 255 | ||
256 | def output_locale_binary(name, pkgname, locale, encoding): | 256 | def output_locale_binary(name, pkgname, locale, encoding): |
257 | treedir = base_path_join(d.getVar("WORKDIR", True), "locale-tree") | 257 | treedir = base_path_join(d.getVar("WORKDIR", True), "locale-tree") |
258 | ldlibdir = base_path_join(treedir, d.getVar("base_libdir", True)) | 258 | ldlibdir = base_path_join(treedir, d.getVar("base_libdir", True)) |
259 | path = d.getVar("PATH", True) | 259 | path = d.getVar("PATH", True) |
260 | i18npath = base_path_join(treedir, datadir, "i18n") | 260 | i18npath = base_path_join(treedir, datadir, "i18n") |
261 | gconvpath = base_path_join(treedir, "iconvdata") | 261 | gconvpath = base_path_join(treedir, "iconvdata") |
262 | outputpath = base_path_join(treedir, libdir, "locale") | 262 | outputpath = base_path_join(treedir, libdir, "locale") |
263 | 263 | ||
264 | use_cross_localedef = d.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF", True) or "0" | 264 | use_cross_localedef = d.getVar("LOCALE_GENERATION_WITH_CROSS-LOCALEDEF", True) or "0" |
265 | if use_cross_localedef == "1": | 265 | if use_cross_localedef == "1": |
266 | target_arch = d.getVar('TARGET_ARCH', True) | 266 | target_arch = d.getVar('TARGET_ARCH', True) |
267 | locale_arch_options = { \ | 267 | locale_arch_options = { \ |
268 | "arm": " --uint32-align=4 --little-endian ", \ | 268 | "arm": " --uint32-align=4 --little-endian ", \ |
269 | "sh4": " --uint32-align=4 --big-endian ", \ | 269 | "sh4": " --uint32-align=4 --big-endian ", \ |
270 | "powerpc": " --uint32-align=4 --big-endian ", \ | 270 | "powerpc": " --uint32-align=4 --big-endian ", \ |
271 | "powerpc64": " --uint32-align=4 --big-endian ", \ | 271 | "powerpc64": " --uint32-align=4 --big-endian ", \ |
272 | "mips": " --uint32-align=4 --big-endian ", \ | 272 | "mips": " --uint32-align=4 --big-endian ", \ |
273 | "mips64": " --uint32-align=4 --big-endian ", \ | 273 | "mips64": " --uint32-align=4 --big-endian ", \ |
274 | "mipsel": " --uint32-align=4 --little-endian ", \ | 274 | "mipsel": " --uint32-align=4 --little-endian ", \ |
275 | "mips64el":" --uint32-align=4 --little-endian ", \ | 275 | "mips64el":" --uint32-align=4 --little-endian ", \ |
276 | "i586": " --uint32-align=4 --little-endian ", \ | 276 | "i586": " --uint32-align=4 --little-endian ", \ |
277 | "i686": " --uint32-align=4 --little-endian ", \ | 277 | "i686": " --uint32-align=4 --little-endian ", \ |
278 | "x86_64": " --uint32-align=4 --little-endian " } | 278 | "x86_64": " --uint32-align=4 --little-endian " } |
279 | 279 | ||
280 | if target_arch in locale_arch_options: | 280 | if target_arch in locale_arch_options: |
281 | localedef_opts = locale_arch_options[target_arch] | 281 | localedef_opts = locale_arch_options[target_arch] |
282 | else: | 282 | else: |
283 | bb.error("locale_arch_options not found for target_arch=" + target_arch) | 283 | bb.error("locale_arch_options not found for target_arch=" + target_arch) |
284 | raise bb.build.FuncFailed("unknown arch:" + target_arch + " for locale_arch_options") | 284 | raise bb.build.FuncFailed("unknown arch:" + target_arch + " for locale_arch_options") |
285 | 285 | ||
286 | localedef_opts += " --force --old-style --no-archive --prefix=%s \ | 286 | localedef_opts += " --force --old-style --no-archive --prefix=%s \ |
287 | --inputfile=%s/%s/i18n/locales/%s --charmap=%s %s/%s" \ | 287 | --inputfile=%s/%s/i18n/locales/%s --charmap=%s %s/%s" \ |
288 | % (treedir, treedir, datadir, locale, encoding, outputpath, name) | 288 | % (treedir, treedir, datadir, locale, encoding, outputpath, name) |
289 | 289 | ||
290 | cmd = "PATH=\"%s\" I18NPATH=\"%s\" GCONV_PATH=\"%s\" cross-localedef %s" % \ | 290 | cmd = "PATH=\"%s\" I18NPATH=\"%s\" GCONV_PATH=\"%s\" cross-localedef %s" % \ |
291 | (path, i18npath, gconvpath, localedef_opts) | 291 | (path, i18npath, gconvpath, localedef_opts) |
292 | else: # earlier slower qemu way | 292 | else: # earlier slower qemu way |
293 | qemu = qemu_target_binary(d) | 293 | qemu = qemu_target_binary(d) |
294 | localedef_opts = "--force --old-style --no-archive --prefix=%s \ | 294 | localedef_opts = "--force --old-style --no-archive --prefix=%s \ |
295 | --inputfile=%s/i18n/locales/%s --charmap=%s %s" \ | 295 | --inputfile=%s/i18n/locales/%s --charmap=%s %s" \ |
296 | % (treedir, datadir, locale, encoding, name) | 296 | % (treedir, datadir, locale, encoding, name) |
297 | 297 | ||
298 | qemu_options = d.getVar("QEMU_OPTIONS_%s" % d.getVar('PACKAGE_ARCH', True), True) | 298 | qemu_options = d.getVar("QEMU_OPTIONS_%s" % d.getVar('PACKAGE_ARCH', True), True) |
299 | if not qemu_options: | 299 | if not qemu_options: |
300 | qemu_options = d.getVar('QEMU_OPTIONS', True) | 300 | qemu_options = d.getVar('QEMU_OPTIONS', True) |
301 | 301 | ||
302 | cmd = "PSEUDO_RELOADED=YES PATH=\"%s\" I18NPATH=\"%s\" %s -L %s \ | 302 | cmd = "PSEUDO_RELOADED=YES PATH=\"%s\" I18NPATH=\"%s\" %s -L %s \ |
303 | -E LD_LIBRARY_PATH=%s %s %s/bin/localedef %s" % \ | 303 | -E LD_LIBRARY_PATH=%s %s %s/bin/localedef %s" % \ |
304 | (path, i18npath, qemu, treedir, ldlibdir, qemu_options, treedir, localedef_opts) | 304 | (path, i18npath, qemu, treedir, ldlibdir, qemu_options, treedir, localedef_opts) |
305 | 305 | ||
306 | commands["%s/%s" % (outputpath, name)] = cmd | 306 | commands["%s/%s" % (outputpath, name)] = cmd |
307 | 307 | ||
308 | bb.note("generating locale %s (%s)" % (locale, encoding)) | 308 | bb.note("generating locale %s (%s)" % (locale, encoding)) |
309 | 309 | ||
310 | def output_locale(name, locale, encoding): | 310 | def output_locale(name, locale, encoding): |
311 | pkgname = d.getVar('MLPREFIX') + 'locale-base-' + legitimize_package_name(name) | 311 | pkgname = d.getVar('MLPREFIX') + 'locale-base-' + legitimize_package_name(name) |
312 | d.setVar('ALLOW_EMPTY_%s' % pkgname, '1') | 312 | d.setVar('ALLOW_EMPTY_%s' % pkgname, '1') |
313 | d.setVar('PACKAGES', '%s %s' % (pkgname, d.getVar('PACKAGES', True))) | 313 | d.setVar('PACKAGES', '%s %s' % (pkgname, d.getVar('PACKAGES', True))) |
314 | rprovides = ' %svirtual-locale-%s' % (mlprefix, legitimize_package_name(name)) | 314 | rprovides = ' %svirtual-locale-%s' % (mlprefix, legitimize_package_name(name)) |
315 | m = re.match("(.*)_(.*)", name) | 315 | m = re.match("(.*)_(.*)", name) |
316 | if m: | 316 | if m: |
317 | rprovides += ' %svirtual-locale-%s' % (mlprefix, m.group(1)) | 317 | rprovides += ' %svirtual-locale-%s' % (mlprefix, m.group(1)) |
318 | d.setVar('RPROVIDES_%s' % pkgname, rprovides) | 318 | d.setVar('RPROVIDES_%s' % pkgname, rprovides) |
319 | 319 | ||
320 | if use_bin == "compile": | 320 | if use_bin == "compile": |
321 | output_locale_binary_rdepends(name, pkgname, locale, encoding) | 321 | output_locale_binary_rdepends(name, pkgname, locale, encoding) |
322 | output_locale_binary(name, pkgname, locale, encoding) | 322 | output_locale_binary(name, pkgname, locale, encoding) |
323 | elif use_bin == "precompiled": | 323 | elif use_bin == "precompiled": |
324 | output_locale_binary_rdepends(name, pkgname, locale, encoding) | 324 | output_locale_binary_rdepends(name, pkgname, locale, encoding) |
325 | else: | 325 | else: |
326 | output_locale_source(name, pkgname, locale, encoding) | 326 | output_locale_source(name, pkgname, locale, encoding) |
327 | 327 | ||
328 | if use_bin == "compile": | 328 | if use_bin == "compile": |
329 | bb.note("preparing tree for binary locale generation") | 329 | bb.note("preparing tree for binary locale generation") |
330 | bb.build.exec_func("do_prep_locale_tree", d) | 330 | bb.build.exec_func("do_prep_locale_tree", d) |
331 | 331 | ||
332 | utf8_only = int(d.getVar('LOCALE_UTF8_ONLY', True) or 0) | 332 | utf8_only = int(d.getVar('LOCALE_UTF8_ONLY', True) or 0) |
333 | encodings = {} | 333 | encodings = {} |
334 | for locale in to_generate: | 334 | for locale in to_generate: |
335 | charset = supported[locale] | 335 | charset = supported[locale] |
336 | if utf8_only and charset != 'UTF-8': | 336 | if utf8_only and charset != 'UTF-8': |
337 | continue | 337 | continue |
338 | 338 | ||
339 | m = dot_re.match(locale) | 339 | m = dot_re.match(locale) |
340 | if m: | 340 | if m: |
341 | base = m.group(1) | 341 | base = m.group(1) |
342 | else: | 342 | else: |
343 | base = locale | 343 | base = locale |
344 | 344 | ||
345 | # Precompiled locales are kept as is, obeying SUPPORTED, while | 345 | # Precompiled locales are kept as is, obeying SUPPORTED, while |
346 | # others are adjusted, ensuring that the non-suffixed locales | 346 | # others are adjusted, ensuring that the non-suffixed locales |
347 | # are utf-8, while the suffixed are not. | 347 | # are utf-8, while the suffixed are not. |
348 | if use_bin == "precompiled": | 348 | if use_bin == "precompiled": |
349 | output_locale(locale, base, charset) | 349 | output_locale(locale, base, charset) |
350 | else: | 350 | else: |
351 | if charset == 'UTF-8': | 351 | if charset == 'UTF-8': |
352 | output_locale(base, base, charset) | 352 | output_locale(base, base, charset) |
353 | else: | 353 | else: |
354 | output_locale('%s.%s' % (base, charset), base, charset) | 354 | output_locale('%s.%s' % (base, charset), base, charset) |
355 | 355 | ||
356 | if use_bin == "compile": | 356 | if use_bin == "compile": |
357 | makefile = base_path_join(d.getVar("WORKDIR", True), "locale-tree", "Makefile") | 357 | makefile = base_path_join(d.getVar("WORKDIR", True), "locale-tree", "Makefile") |
358 | m = open(makefile, "w") | 358 | m = open(makefile, "w") |
359 | m.write("all: %s\n\n" % " ".join(commands.keys())) | 359 | m.write("all: %s\n\n" % " ".join(commands.keys())) |
360 | for cmd in commands: | 360 | for cmd in commands: |
361 | m.write(cmd + ":\n") | 361 | m.write(cmd + ":\n") |
362 | m.write(" " + commands[cmd] + "\n\n") | 362 | m.write("\t" + commands[cmd] + "\n\n") |
363 | m.close() | 363 | m.close() |
364 | d.setVar("B", os.path.dirname(makefile)) | 364 | d.setVar("B", os.path.dirname(makefile)) |
365 | d.setVar("EXTRA_OEMAKE", "${PARALLEL_MAKE}") | 365 | d.setVar("EXTRA_OEMAKE", "${PARALLEL_MAKE}") |
366 | bb.note("Executing binary locale generation makefile") | 366 | bb.note("Executing binary locale generation makefile") |
367 | bb.build.exec_func("oe_runmake", d) | 367 | bb.build.exec_func("oe_runmake", d) |
368 | bb.note("collecting binary locales from locale tree") | 368 | bb.note("collecting binary locales from locale tree") |
369 | bb.build.exec_func("do_collect_bins_from_locale_tree", d) | 369 | bb.build.exec_func("do_collect_bins_from_locale_tree", d) |
370 | do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ | 370 | do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ |
371 | output_pattern=bpn+'-binary-localedata-%s', \ | 371 | output_pattern=bpn+'-binary-localedata-%s', \ |
372 | description='binary locale definition for %s', extra_depends='', allow_dirs=True) | 372 | description='binary locale definition for %s', extra_depends='', allow_dirs=True) |
373 | elif use_bin == "precompiled": | 373 | elif use_bin == "precompiled": |
374 | do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ | 374 | do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ |
375 | output_pattern=bpn+'-binary-localedata-%s', \ | 375 | output_pattern=bpn+'-binary-localedata-%s', \ |
376 | description='binary locale definition for %s', extra_depends='', allow_dirs=True) | 376 | description='binary locale definition for %s', extra_depends='', allow_dirs=True) |
377 | else: | 377 | else: |
378 | bb.note("generation of binary locales disabled. this may break i18n!") | 378 | bb.note("generation of binary locales disabled. this may break i18n!") |
379 | 379 | ||
380 | } | 380 | } |
381 | 381 | ||
382 | # We want to do this indirection so that we can safely 'return' | 382 | # We want to do this indirection so that we can safely 'return' |
383 | # from the called function even though we're prepending | 383 | # from the called function even though we're prepending |
384 | python populate_packages_prepend () { | 384 | python populate_packages_prepend () { |
385 | bb.build.exec_func('package_do_split_gconvs', d) | 385 | bb.build.exec_func('package_do_split_gconvs', d) |
386 | } | 386 | } |
387 | 387 | ||