2 # For now, we will skip building of a gcc package if it is a uclibc one
3 # and our build is not a uclibc one, and we skip a eglibc one if our build
6 # See the note in gcc/gcc_3.4.0.oe
9 python __anonymous () {
11 uc_os = (re.match('.*uclibc*', bb.data.getVar('TARGET_OS', d, 1)) != None)
13 raise bb.parse.SkipPackage("incompatible with target %s" %
14 bb.data.getVar('TARGET_OS', d, 1))
18 # Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION
19 # is set. The idea is to avoid running localedef on the target (at first boot)
20 # to decrease initial boot time and avoid localedef being killed by the OOM
21 # killer which used to effectively break i18n on machines with < 128MB RAM.
23 # default to disabled until qemu works for everyone
24 ENABLE_BINARY_LOCALE_GENERATION ?= "0"
26 # BINARY_LOCALE_ARCHES is a space separated list of regular expressions
27 BINARY_LOCALE_ARCHES ?= "arm.*"
29 PACKAGES = "eglibc-dbg eglibc catchsegv sln nscd ldd localedef eglibc-utils eglibc-dev eglibc-doc eglibc-locale libsegfault eglibc-extra-nss eglibc-thread-db eglibc-pcprofile"
30 PACKAGES_DYNAMIC = "glibc-gconv-* glibc-charmap-* glibc-localedata-* glibc-binary-localedata-* eglibc-gconv-* eglibc-charmap-* eglibc-localedata-* eglibc-binary-localedata-* locale-base-*"
32 RPROVIDES_eglibc = "glibc"
33 RPROVIDES_eglibc-utils = "glibc-utils"
34 RPROVIDES_eglibc-dev = "glibc-dev"
35 RPROVIDES_eglibc-doc = "glibc-doc"
36 RPROVIDES_eglibc-locale = "glibc-locale"
37 RPROVIDES_eglibc-extra-nss = "glibc-extra-nss"
38 RPROVIDES_eglibc-thread-db = "glibc-thread-db"
39 RPROVIDES_eglibc-pcprofile = "glibc-pcprofile"
40 RPROVIDES_eglibc-dbg = "glibc-dbg"
42 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*"
44 FILES_${PN} = "${sysconfdir} ${libc_baselibs} /sbin/ldconfig ${libexecdir}/* ${datadir}/zoneinfo"
45 FILES_ldd = "${bindir}/ldd"
46 FILES_libsegfault = "/lib/libSegFault*"
47 FILES_eglibc-extra-nss = "/lib/libnss*"
48 FILES_sln = "/sbin/sln"
49 FILES_eglibc-dev_append = " ${libdir}/*.o ${bindir}/rpcgen"
50 FILES_nscd = "${sbindir}/nscd*"
51 FILES_eglibc-utils = "${bindir}/* ${sbindir}/*"
52 FILES_eglibc-gconv = "${libdir}/gconv/*"
53 FILES_${PN}-dbg += "${libexecdir}/*/.debug ${libdir}/gconv/.debug"
54 FILES_catchsegv = "${bindir}/catchsegv"
55 RDEPENDS_catchsegv = "libsegfault"
56 FILES_eglibc-pcprofile = "/lib/libpcprofile.so"
57 FILES_eglibc-thread-db = "/lib/libthread_db*"
58 FILES_localedef = "${bindir}/localedef"
59 RPROVIDES_eglibc-dev += "libc-dev"
61 DESCRIPTION_sln = "eglibc: create symbolic links between files"
62 DESCRIPTION_nscd = "eglibc: name service cache daemon for passwd, group, and hosts"
63 DESCRIPTION_eglibc-extra-nss = "eglibc: nis, nisplus and hesiod search services"
64 DESCRIPTION_ldd = "eglibc: print shared library dependencies"
65 DESCRIPTION_localedef = "eglibc: compile locale definition files"
66 DESCRIPTION_eglibc-utils = "eglibc: misc utilities like iconf, local, gencat, tzselect, rpcinfo, ..."
68 def get_eglibc_fpu_setting(bb, d):
69 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
73 EXTRA_OECONF += "${@get_eglibc_fpu_setting(bb, d)}"
75 OVERRIDES_append = ":${TARGET_ARCH}-${TARGET_OS}"
78 oe_runmake install_root=${D} install
79 for r in ${rpcsvc}; do
80 h=`echo $r|sed -e's,\.x$,.h,'`
81 install -m 0644 ${S}/sunrpc/rpcsvc/$h ${D}/${includedir}/rpcsvc/
83 install -m 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/
84 install -d ${D}${libdir}/locale
85 make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED"
86 # get rid of some broken files...
87 for i in ${GLIBC_BROKEN_LOCALES}; do
88 grep -v $i ${WORKDIR}/SUPPORTED > ${WORKDIR}/SUPPORTED.tmp
89 mv ${WORKDIR}/SUPPORTED.tmp ${WORKDIR}/SUPPORTED
92 rm -f ${D}${includedir}/scsi/sg.h
93 rm -f ${D}${includedir}/scsi/scsi_ioctl.h
94 rm -f ${D}${includedir}/scsi/scsi.h
97 TMP_LOCALE="/tmp/locale${libdir}/locale"
99 locale_base_postinst() {
102 if [ "x$D" != "x" ]; then
107 mkdir -p ${TMP_LOCALE}
108 if [ -f ${libdir}/locale/locale-archive ]; then
109 cp ${libdir}/locale/locale-archive ${TMP_LOCALE}/
111 localedef --inputfile=${datadir}/i18n/locales/%s --charmap=%s --prefix=/tmp/locale %s
112 mkdir -p ${libdir}/locale/
113 mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/
117 locale_base_postrm() {
121 mkdir -p ${TMP_LOCALE}
122 if [ -f ${libdir}/locale/locale-archive ]; then
123 cp ${libdir}/locale/locale-archive ${TMP_LOCALE}/
125 localedef --delete-from-archive --inputfile=${datadir}/locales/%s --charmap=%s --prefix=/tmp/locale %s
126 mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/
130 python __anonymous () {
131 enabled = bb.data.getVar("ENABLE_BINARY_LOCALE_GENERATION", d, 1)
133 if enabled and int(enabled):
136 target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
137 binary_arches = bb.data.getVar("BINARY_LOCALE_ARCHES", d, 1) or ""
139 for regexp in binary_arches.split(" "):
140 r = re.compile(regexp)
142 if r.match(target_arch):
143 depends = bb.data.getVar("DEPENDS", d, 1)
144 depends = "%s qemu-native" % depends
145 bb.data.setVar("DEPENDS", depends, d)
146 bb.data.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "1", d)
150 do_prep_locale_tree() {
151 treedir=${WORKDIR}/locale-tree
153 mkdir -p $treedir/bin $treedir/lib $treedir/${datadir} $treedir/${libdir}/locale
154 cp -pPR ${D}${datadir}/i18n $treedir/${datadir}/i18n
155 # unzip to avoid parsing errors
156 for i in $treedir/${datadir}/i18n/charmaps/*gz; do
159 ls ${D}/lib/* | xargs -iBLAH cp -pPR BLAH $treedir/lib
160 if [ -f ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.* ]; then
161 cp -pPR ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.* $treedir/lib
163 install -m 0755 ${D}${bindir}/localedef $treedir/bin
166 do_collect_bins_from_locale_tree() {
167 treedir=${WORKDIR}/locale-tree
169 mkdir -p ${D}${libdir}
170 cp -pPR $treedir/${libdir}/locale ${D}${libdir}
173 python package_do_split_gconvs () {
175 if (bb.data.getVar('PACKAGE_NO_GCONV', d, 1) == '1'):
176 bb.note("package requested not splitting gconvs")
179 if not bb.data.getVar('PACKAGES', d, 1):
182 libdir = bb.data.getVar('libdir', d, 1)
184 bb.error("libdir not defined")
186 datadir = bb.data.getVar('datadir', d, 1)
188 bb.error("datadir not defined")
191 gconv_libdir = base_path_join(libdir, "gconv")
192 charmap_dir = base_path_join(datadir, "i18n", "charmaps")
193 locales_dir = base_path_join(datadir, "i18n", "locales")
194 binary_locales_dir = base_path_join(libdir, "locale")
196 def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group):
199 c_re = re.compile('^copy "(.*)"')
200 i_re = re.compile('^include "(\w+)".*')
201 for l in f.readlines():
202 m = c_re.match(l) or i_re.match(l)
204 dp = legitimize_package_name('eglibc-gconv-%s' % m.group(1))
209 bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d)
210 bb.data.setVar('RPROVIDES_%s' % pkg, 'glibc-gconv-%s' % group.lower(), d)
212 do_split_packages(d, gconv_libdir, file_regex='^(.*)\.so$', output_pattern='eglibc-gconv-%s', description='gconv module for character set %s', hook=calc_gconv_deps, extra_depends='eglibc-gconv')
214 def calc_charmap_deps(fn, pkg, file_regex, output_pattern, group):
217 c_re = re.compile('^copy "(.*)"')
218 i_re = re.compile('^include "(\w+)".*')
219 for l in f.readlines():
220 m = c_re.match(l) or i_re.match(l)
222 dp = legitimize_package_name('eglibc-charmap-%s' % m.group(1))
227 bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d)
228 bb.data.setVar('RPROVIDES_%s' % pkg, 'glibc-charmap-%s' % group.lower(), d)
230 do_split_packages(d, charmap_dir, file_regex='^(.*)\.gz$', output_pattern='eglibc-charmap-%s', description='character map for %s encoding', hook=calc_charmap_deps, extra_depends='')
232 def calc_locale_deps(fn, pkg, file_regex, output_pattern, group):
235 c_re = re.compile('^copy "(.*)"')
236 i_re = re.compile('^include "(\w+)".*')
237 for l in f.readlines():
238 m = c_re.match(l) or i_re.match(l)
240 dp = legitimize_package_name('eglibc-localedata-%s' % m.group(1))
245 bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d)
246 bb.data.setVar('RPROVIDES_%s' % pkg, 'glibc-localedata-%s' % group.lower(), d)
248 do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='eglibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
249 bb.data.setVar('PACKAGES', bb.data.getVar('PACKAGES', d) + ' eglibc-gconv', d)
251 supported = bb.data.getVar('GLIBC_GENERATE_LOCALES', d, 1)
252 if not supported or supported == "all":
253 f = open(base_path_join(bb.data.getVar('WORKDIR', d, 1), "SUPPORTED"), "r")
254 supported = f.readlines()
257 supported = supported.split()
258 supported = map(lambda s:s.replace(".", " ") + "\n", supported)
260 dot_re = re.compile("(.*)\.(.*)")
262 # Collate the locales by base and encoding
266 (locale, charset) = l.split(" ")
267 m = dot_re.match(locale)
270 if not encodings.has_key(locale):
271 encodings[locale] = []
272 encodings[locale].append(charset)
274 def output_locale_source(name, locale, encoding):
275 pkgname = 'locale-base-' + legitimize_package_name(name)
277 bb.data.setVar('RDEPENDS_%s' % pkgname, 'localedef eglibc-localedata-%s eglibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d)
278 rprovides = 'virtual-locale-%s' % legitimize_package_name(name)
279 m = re.match("(.*)_(.*)", name)
281 rprovides += ' virtual-locale-%s' % m.group(1)
282 bb.data.setVar('RPROVIDES_%s' % pkgname, rprovides, d)
283 bb.data.setVar('PACKAGES', '%s %s' % (pkgname, bb.data.getVar('PACKAGES', d, 1)), d)
284 bb.data.setVar('ALLOW_EMPTY_%s' % pkgname, '1', d)
285 bb.data.setVar('pkg_postinst_%s' % pkgname, bb.data.getVar('locale_base_postinst', d, 1) % (locale, encoding, locale), d)
286 bb.data.setVar('pkg_postrm_%s' % pkgname, bb.data.getVar('locale_base_postrm', d, 1) % (locale, encoding, locale), d)
288 def output_locale_binary(name, locale, encoding):
289 target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
290 qemu = "qemu-%s -r 2.6.16" % target_arch
291 pkgname = 'locale-base-' + legitimize_package_name(name)
292 m = re.match("(.*)\.(.*)", name)
294 eglibc_name = "%s.%s" % (m.group(1), m.group(2).lower().replace("-",""))
297 bb.data.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('eglibc-binary-localedata-%s' % eglibc_name), d)
298 bb.data.setVar('RPROVIDES_%s' % pkgname, 'glibc-binary-localedata-%s' % eglibc_name, d)
299 rprovides = 'virtual-locale-%s' % legitimize_package_name(name)
300 m = re.match("(.*)_(.*)", name)
302 rprovides += ' virtual-locale-%s' % m.group(1)
303 bb.data.setVar('RPROVIDES_%s' % pkgname, rprovides, d)
304 bb.data.setVar('ALLOW_EMPTY_%s' % pkgname, '1', d)
305 bb.data.setVar('PACKAGES', '%s %s' % (pkgname, bb.data.getVar('PACKAGES', d, 1)), d)
307 treedir = base_path_join(bb.data.getVar("WORKDIR", d, 1), "locale-tree")
308 path = bb.data.getVar("PATH", d, 1)
309 i18npath = base_path_join(treedir, datadir, "i18n")
311 localedef_opts = "--force --old-style --no-archive --prefix=%s --inputfile=%s/i18n/locales/%s --charmap=%s %s" % (treedir, datadir, locale, encoding, name)
312 cmd = "PATH=\"%s\" I18NPATH=\"%s\" %s -L %s %s/bin/localedef %s" % (path, i18npath, qemu, treedir, treedir, localedef_opts)
313 bb.note("generating locale %s (%s)" % (locale, encoding))
315 raise bb.build.FuncFailed("localedef returned an error (command was %s)." % cmd)
317 def output_locale(name, locale, encoding):
318 use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
320 output_locale_binary(name, locale, encoding)
322 output_locale_source(name, locale, encoding)
324 use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
326 bb.note("preparing tree for binary locale generation")
327 bb.build.exec_func("do_prep_locale_tree", d)
329 # Reshuffle names so that UTF-8 is preferred over other encodings
331 for l in encodings.keys():
332 if len(encodings[l]) == 1:
333 output_locale(l, l, encodings[l][0])
334 if encodings[l][0] != "UTF-8":
337 if "UTF-8" in encodings[l]:
338 output_locale(l, l, "UTF-8")
339 encodings[l].remove("UTF-8")
342 for e in encodings[l]:
343 output_locale('%s.%s' % (l, e), l, e)
346 bb.note("the following locales are supported only in legacy encodings:")
347 bb.note(" " + " ".join(non_utf8))
349 use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
351 bb.note("collecting binary locales from locale tree")
352 bb.build.exec_func("do_collect_bins_from_locale_tree", d)
353 do_split_packages(d, binary_locales_dir, file_regex='(.*)', output_pattern='eglibc-binary-localedata-%s', description='binary locale definition for %s', extra_depends='', allow_dirs=True)
355 bb.note("generation of binary locales disabled. this may break i18n!")
359 # We want to do this indirection so that we can safely 'return'
360 # from the called function even though we're prepending
361 python populate_packages_prepend () {
362 if bb.data.getVar('DEBIAN_NAMES', d, 1):
363 bb.data.setVar('PKG_eglibc', 'libc6', d)
364 bb.data.setVar('PKG_eglibc-dev', 'libc6-dev', d)
365 bb.build.exec_func('package_do_split_gconvs', d)