summaryrefslogtreecommitdiffstats
path: root/meta/packages/glibc
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-11-19 22:37:45 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2009-11-19 22:37:45 +0000
commit1e549b98e1afbc91a5673dd00954f7c4a358b8c0 (patch)
tree835affae2c6b4ecd8dd54887a4daf9c123e28bed /meta/packages/glibc
parentebf6159c7b63ae01d20b83fdb38201189f0f9a1e (diff)
downloadpoky-1e549b98e1afbc91a5673dd00954f7c4a358b8c0.tar.gz
glibc: Separate out core glibc packaging functionality into a class
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/packages/glibc')
-rw-r--r--meta/packages/glibc/glibc-package.bbclass326
-rw-r--r--meta/packages/glibc/glibc_2.3.5+cvs20050627.bb2
-rw-r--r--meta/packages/glibc/glibc_2.4.bb2
-rw-r--r--meta/packages/glibc/glibc_2.5.bb2
-rw-r--r--meta/packages/glibc/glibc_2.6.1.bb2
-rw-r--r--meta/packages/glibc/glibc_2.9.bb2
-rw-r--r--meta/packages/glibc/glibc_csl-2005q3-2.bb2
7 files changed, 6 insertions, 332 deletions
diff --git a/meta/packages/glibc/glibc-package.bbclass b/meta/packages/glibc/glibc-package.bbclass
deleted file mode 100644
index 561805a66e..0000000000
--- a/meta/packages/glibc/glibc-package.bbclass
+++ /dev/null
@@ -1,326 +0,0 @@
1#
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 glibc one if our build
4# is a uclibc build.
5#
6# See the note in gcc/gcc_3.4.0.oe
7#
8
9python __anonymous () {
10 import bb, re
11 uc_os = (re.match('.*uclibc*', bb.data.getVar('TARGET_OS', d, 1)) != None)
12 if uc_os:
13 raise bb.parse.SkipPackage("incompatible with target %s" %
14 bb.data.getVar('TARGET_OS', d, 1))
15}
16
17
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.
22
23# default to disabled until qemu works for everyone
24ENABLE_BINARY_LOCALE_GENERATION ?= "0"
25
26# BINARY_LOCALE_ARCHES is a space separated list of regular expressions
27BINARY_LOCALE_ARCHES ?= "arm.*"
28
29PACKAGES = "${PN}-dbg ${PN} catchsegv sln nscd ldd localedef glibc-utils glibc-dev glibc-doc glibc-locale libsegfault glibc-extra-nss glibc-thread-db glibc-pcprofile"
30PACKAGES_DYNAMIC = "glibc-gconv-* glibc-charmap-* glibc-localedata-* locale-base-* glibc-binary-localedata-*"
31
32libc_baselibs = "${base_libdir}/libc* ${base_libdir}/libm* ${base_libdir}/ld* ${base_libdir}/libpthread* ${base_libdir}/libresolv* ${base_libdir}/librt* ${base_libdir}/libutil* ${base_libdir}/libnsl* ${base_libdir}/libnss_files* ${base_libdir}/libnss_compat* ${base_libdir}/libnss_dns* ${base_libdir}/libdl* ${base_libdir}/libanl* ${base_libdir}/libBrokenLocale*"
33
34FILES_${PN} = "${sysconfdir} ${libc_baselibs} ${base_sbindir}/ldconfig ${libexecdir}/* ${datadir}/zoneinfo"
35FILES_ldd = "${bindir}/ldd"
36FILES_libsegfault = "${base_libdir}/libSegFault*"
37FILES_glibc-extra-nss = "${base_libdir}/libnss*"
38FILES_sln = "${base_sbindir}/sln"
39FILES_glibc-dev_append = " ${libdir}/*.o ${bindir}/rpcgen"
40FILES_nscd = "${sbindir}/nscd* ${sysconfdir}/nscd* ${sysconfdir}/init.d/nscd*"
41FILES_glibc-utils = "${bindir}/* ${sbindir}/*"
42FILES_glibc-gconv = "${libdir}/gconv/*"
43FILES_${PN}-dbg += " ${libdir}/gconv/.debug ${libexecdir}/*/.debug"
44FILES_catchsegv = "${bindir}/catchsegv"
45RDEPENDS_catchsegv = "libsegfault"
46FILES_glibc-pcprofile = "${base_libdir}/libpcprofile.so"
47FILES_glibc-thread-db = "${base_libdir}/libthread_db*"
48FILES_localedef = "${bindir}/localedef"
49RPROVIDES_glibc-dev += "libc-dev"
50
51DESCRIPTION_sln = "glibc: create symbolic links between files"
52DESCRIPTION_nscd = "glibc: name service cache daemon for passwd, group, and hosts"
53DESCRIPTION_glibc-extra-nss = "glibc: nis, nisplus and hesiod search services"
54DESCRIPTION_ldd = "glibc: print shared library dependencies"
55DESCRIPTION_localedef = "glibc: compile locale definition files"
56DESCRIPTION_glibc-utils = "glibc: misc utilities like iconf, local, gencat, tzselect, rpcinfo, ..."
57
58def get_glibc_fpu_setting(bb, d):
59 if bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]:
60 return "--without-fp"
61 return ""
62
63EXTRA_OECONF += "${@get_glibc_fpu_setting(bb, d)}"
64EXTRA_OEMAKE += "rootsbindir=${base_sbindir}"
65
66OVERRIDES_append = ":${TARGET_ARCH}-${TARGET_OS}"
67
68do_install() {
69 oe_runmake install_root=${D} install
70 for r in ${rpcsvc}; do
71 h=`echo $r|sed -e's,\.x$,.h,'`
72 install -m 0644 ${S}/sunrpc/rpcsvc/$h ${D}/${includedir}/rpcsvc/
73 done
74 install -m 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/
75 install -d ${D}${libdir}/locale
76 make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED"
77 # get rid of some broken files...
78 for i in ${GLIBC_BROKEN_LOCALES}; do
79 grep -v $i ${WORKDIR}/SUPPORTED > ${WORKDIR}/SUPPORTED.tmp
80 mv ${WORKDIR}/SUPPORTED.tmp ${WORKDIR}/SUPPORTED
81 done
82 rm -f ${D}/etc/rpc
83 rm -f ${D}${includedir}/scsi/sg.h
84 rm -f ${D}${includedir}/scsi/scsi_ioctl.h
85 rm -f ${D}${includedir}/scsi/scsi.h
86}
87
88TMP_LOCALE="/tmp/locale${libdir}/locale"
89
90locale_base_postinst() {
91#!/bin/sh
92
93if [ "x$D" != "x" ]; then
94 exit 1
95fi
96
97rm -rf ${TMP_LOCALE}
98mkdir -p ${TMP_LOCALE}
99if [ -f ${libdir}/locale/locale-archive ]; then
100 cp ${libdir}/locale/locale-archive ${TMP_LOCALE}/
101fi
102localedef --inputfile=${datadir}/i18n/locales/%s --charmap=%s --prefix=/tmp/locale %s
103mkdir -p ${libdir}/locale/
104mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/
105rm -rf ${TMP_LOCALE}
106}
107
108locale_base_postrm() {
109#!/bin/sh
110
111rm -rf ${TMP_LOCALE}
112mkdir -p ${TMP_LOCALE}
113if [ -f ${libdir}/locale/locale-archive ]; then
114 cp ${libdir}/locale/locale-archive ${TMP_LOCALE}/
115fi
116localedef --delete-from-archive --inputfile=${datadir}/locales/%s --charmap=%s --prefix=/tmp/locale %s
117mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/
118rm -rf ${TMP_LOCALE}
119}
120
121python __anonymous () {
122 enabled = bb.data.getVar("ENABLE_BINARY_LOCALE_GENERATION", d, 1)
123
124 if enabled and int(enabled):
125 import re
126
127 target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
128 binary_arches = bb.data.getVar("BINARY_LOCALE_ARCHES", d, 1) or ""
129
130 for regexp in binary_arches.split(" "):
131 r = re.compile(regexp)
132
133 if r.match(target_arch):
134 depends = bb.data.getVar("DEPENDS", d, 1)
135 depends = "%s qemu-native" % depends
136 bb.data.setVar("DEPENDS", depends, d)
137 bb.data.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "1", d)
138 break
139}
140
141do_prep_locale_tree() {
142 treedir=${WORKDIR}/locale-tree
143 rm -rf $treedir
144 mkdir -p $treedir/bin $treedir/lib $treedir/${datadir} $treedir/${libdir}/locale
145 cp -pPR ${PKGD}${datadir}/i18n $treedir/${datadir}/i18n
146 # unzip to avoid parsing errors
147 for i in $treedir/${datadir}/i18n/charmaps/*gz; do
148 gunzip $i
149 done
150 cp -pPR ${PKGD}${base_libdir}/* $treedir/lib
151 if [ -f ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.* ]; then
152 cp -pPR ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.* $treedir/lib
153 fi
154 install -m 0755 ${PKGD}${bindir}/localedef $treedir/bin
155}
156
157do_collect_bins_from_locale_tree() {
158 treedir=${WORKDIR}/locale-tree
159
160 mkdir -p ${PKGD}${libdir}
161 cp -pPR $treedir/${libdir}/locale ${PKGD}${libdir}
162}
163
164python package_do_split_gconvs () {
165 import os, re
166 if (bb.data.getVar('PACKAGE_NO_GCONV', d, 1) == '1'):
167 bb.note("package requested not splitting gconvs")
168 return
169
170 if not bb.data.getVar('PACKAGES', d, 1):
171 return
172
173 libdir = bb.data.getVar('libdir', d, 1)
174 if not libdir:
175 bb.error("libdir not defined")
176 return
177 datadir = bb.data.getVar('datadir', d, 1)
178 if not datadir:
179 bb.error("datadir not defined")
180 return
181
182 gconv_libdir = base_path_join(libdir, "gconv")
183 charmap_dir = base_path_join(datadir, "i18n", "charmaps")
184 locales_dir = base_path_join(datadir, "i18n", "locales")
185 binary_locales_dir = base_path_join(libdir, "locale")
186
187 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')
188
189 do_split_packages(d, charmap_dir, file_regex='^(.*)\.gz$', output_pattern='glibc-charmap-%s', description='character map for %s encoding', extra_depends='')
190
191 def calc_locale_deps(fn, pkg, file_regex, output_pattern, group):
192 deps = []
193 f = open(fn, "r")
194 c_re = re.compile('^copy "(.*)"')
195 i_re = re.compile('^include "(\w+)".*')
196 for l in f.readlines():
197 m = c_re.match(l) or i_re.match(l)
198 if m:
199 dp = legitimize_package_name('glibc-localedata-%s' % m.group(1))
200 if not dp in deps:
201 deps.append(dp)
202 f.close()
203 if deps != []:
204 bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d)
205
206 do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
207 bb.data.setVar('PACKAGES', bb.data.getVar('PACKAGES', d) + ' glibc-gconv', d)
208
209 f = open(os.path.join(bb.data.getVar('WORKDIR', d, 1), "SUPPORTED"), "r")
210 supported = f.readlines()
211 f.close()
212
213 dot_re = re.compile("(.*)\.(.*)")
214
215 # Collate the locales by base and encoding
216 utf8_only = int(bb.data.getVar('LOCALE_UTF8_ONLY', d, 1) or 0)
217 encodings = {}
218 for l in supported:
219 l = l[:-1]
220 (locale, charset) = l.split(" ")
221 if utf8_only and charset != 'UTF-8':
222 continue
223 m = dot_re.match(locale)
224 if m:
225 locale = m.group(1)
226 if not encodings.has_key(locale):
227 encodings[locale] = []
228 encodings[locale].append(charset)
229
230 def output_locale_source(name, locale, encoding):
231 pkgname = 'locale-base-' + legitimize_package_name(name)
232
233 bb.data.setVar('RDEPENDS_%s' % pkgname, 'localedef glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d)
234 rprovides = 'virtual-locale-%s' % legitimize_package_name(name)
235 m = re.match("(.*)_(.*)", name)
236 if m:
237 rprovides += ' virtual-locale-%s' % m.group(1)
238 bb.data.setVar('RPROVIDES_%s' % pkgname, rprovides, d)
239 bb.data.setVar('PACKAGES', '%s %s' % (pkgname, bb.data.getVar('PACKAGES', d, 1)), d)
240 bb.data.setVar('ALLOW_EMPTY_%s' % pkgname, '1', d)
241 bb.data.setVar('pkg_postinst_%s' % pkgname, bb.data.getVar('locale_base_postinst', d, 1) % (locale, encoding, locale), d)
242 bb.data.setVar('pkg_postrm_%s' % pkgname, bb.data.getVar('locale_base_postrm', d, 1) % (locale, encoding, locale), d)
243
244 def output_locale_binary(name, locale, encoding):
245 target_arch = bb.data.getVar("TARGET_ARCH", d, 1)
246 qemu = "qemu-%s" % target_arch
247 pkgname = 'locale-base-' + legitimize_package_name(name)
248 m = re.match("(.*)\.(.*)", name)
249 if m:
250 glibc_name = "%s.%s" % (m.group(1), m.group(2).lower().replace("-",""))
251 else:
252 glibc_name = name
253 bb.data.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('glibc-binary-localedata-%s' % glibc_name), d)
254 rprovides = 'virtual-locale-%s' % legitimize_package_name(name)
255 m = re.match("(.*)_(.*)", name)
256 if m:
257 rprovides += ' virtual-locale-%s' % m.group(1)
258 bb.data.setVar('RPROVIDES_%s' % pkgname, rprovides, d)
259 bb.data.setVar('ALLOW_EMPTY_%s' % pkgname, '1', d)
260 bb.data.setVar('PACKAGES', '%s %s' % (pkgname, bb.data.getVar('PACKAGES', d, 1)), d)
261
262 treedir = base_path_join(bb.data.getVar("WORKDIR", d, 1), "locale-tree")
263 path = bb.data.getVar("PATH", d, 1)
264 i18npath = base_path_join(treedir, datadir, "i18n")
265
266 localedef_opts = "--force --old-style --no-archive --prefix=%s --inputfile=%s/i18n/locales/%s --charmap=%s %s" % (treedir, datadir, locale, encoding, name)
267
268 qemu_options = bb.data.getVar("QEMU_OPTIONS_%s" % bb.data.getVar('PACKAGE_ARCH', d, 1), d, 1)
269 if not qemu_options:
270 qemu_options = bb.data.getVar('QEMU_OPTIONS', d, 1)
271
272 cmd = "PATH=\"%s\" I18NPATH=\"%s\" %s -L %s %s %s/bin/localedef %s" % (path, i18npath, qemu, treedir, qemu_options, treedir, localedef_opts)
273 bb.note("generating locale %s (%s)" % (locale, encoding))
274 if os.system(cmd):
275 raise bb.build.FuncFailed("localedef returned an error (command was %s)." % cmd)
276
277 def output_locale(name, locale, encoding):
278 use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
279 if use_bin:
280 output_locale_binary(name, locale, encoding)
281 else:
282 output_locale_source(name, locale, encoding)
283
284 use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
285 if use_bin:
286 bb.note("preparing tree for binary locale generation")
287 bb.build.exec_func("do_prep_locale_tree", d)
288
289 # Reshuffle names so that UTF-8 is preferred over other encodings
290 non_utf8 = []
291 for l in encodings.keys():
292 if len(encodings[l]) == 1:
293 output_locale(l, l, encodings[l][0])
294 if encodings[l][0] != "UTF-8":
295 non_utf8.append(l)
296 else:
297 if "UTF-8" in encodings[l]:
298 output_locale(l, l, "UTF-8")
299 encodings[l].remove("UTF-8")
300 else:
301 non_utf8.append(l)
302 for e in encodings[l]:
303 output_locale('%s.%s' % (l, e), l, e)
304
305 if non_utf8 != []:
306 bb.note("the following locales are supported only in legacy encodings:")
307 bb.note(" " + " ".join(non_utf8))
308
309 use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
310 if use_bin:
311 bb.note("collecting binary locales from locale tree")
312 bb.build.exec_func("do_collect_bins_from_locale_tree", d)
313 do_split_packages(d, binary_locales_dir, file_regex='(.*)', output_pattern='glibc-binary-localedata-%s', description='binary locale definition for %s', extra_depends='', allow_dirs=True)
314 else:
315 bb.note("generation of binary locales disabled. this may break i18n!")
316
317}
318
319# We want to do this indirection so that we can safely 'return'
320# from the called function even though we're prepending
321python populate_packages_prepend () {
322 if bb.data.getVar('DEBIAN_NAMES', d, 1):
323 bb.data.setVar('PKG_glibc', 'libc6', d)
324 bb.data.setVar('PKG_glibc-dev', 'libc6-dev', d)
325 bb.build.exec_func('package_do_split_gconvs', d)
326}
diff --git a/meta/packages/glibc/glibc_2.3.5+cvs20050627.bb b/meta/packages/glibc/glibc_2.3.5+cvs20050627.bb
index 3111ed3583..8c44c21156 100644
--- a/meta/packages/glibc/glibc_2.3.5+cvs20050627.bb
+++ b/meta/packages/glibc/glibc_2.3.5+cvs20050627.bb
@@ -107,4 +107,4 @@ do_compile () {
107 107
108require glibc-stage.inc 108require glibc-stage.inc
109 109
110require glibc-package.bbclass 110require glibc-package.inc
diff --git a/meta/packages/glibc/glibc_2.4.bb b/meta/packages/glibc/glibc_2.4.bb
index 3f184a6b13..3102c5953c 100644
--- a/meta/packages/glibc/glibc_2.4.bb
+++ b/meta/packages/glibc/glibc_2.4.bb
@@ -134,4 +134,4 @@ do_compile () {
134 134
135require glibc-stage.inc 135require glibc-stage.inc
136 136
137require glibc-package.bbclass 137require glibc-package.inc
diff --git a/meta/packages/glibc/glibc_2.5.bb b/meta/packages/glibc/glibc_2.5.bb
index 5f95280584..a63b678949 100644
--- a/meta/packages/glibc/glibc_2.5.bb
+++ b/meta/packages/glibc/glibc_2.5.bb
@@ -145,4 +145,4 @@ do_compile () {
145 145
146require glibc-stage.inc 146require glibc-stage.inc
147 147
148require glibc-package.bbclass 148require glibc-package.inc
diff --git a/meta/packages/glibc/glibc_2.6.1.bb b/meta/packages/glibc/glibc_2.6.1.bb
index 3521f66fe3..790fdde97a 100644
--- a/meta/packages/glibc/glibc_2.6.1.bb
+++ b/meta/packages/glibc/glibc_2.6.1.bb
@@ -151,4 +151,4 @@ do_compile () {
151 151
152require glibc-stage.inc 152require glibc-stage.inc
153 153
154require glibc-package.bbclass 154require glibc-package.inc
diff --git a/meta/packages/glibc/glibc_2.9.bb b/meta/packages/glibc/glibc_2.9.bb
index 75f56d6146..7e3c70e204 100644
--- a/meta/packages/glibc/glibc_2.9.bb
+++ b/meta/packages/glibc/glibc_2.9.bb
@@ -155,6 +155,6 @@ do_compile () {
155 155
156require glibc-stage.inc 156require glibc-stage.inc
157 157
158require glibc-package.bbclass 158require glibc-package.inc
159 159
160BBCLASSEXTEND = "nativesdk" 160BBCLASSEXTEND = "nativesdk"
diff --git a/meta/packages/glibc/glibc_csl-2005q3-2.bb b/meta/packages/glibc/glibc_csl-2005q3-2.bb
index d2aa11605b..b1ea27dec5 100644
--- a/meta/packages/glibc/glibc_csl-2005q3-2.bb
+++ b/meta/packages/glibc/glibc_csl-2005q3-2.bb
@@ -86,4 +86,4 @@ do_compile () {
86 86
87require glibc-stage.inc 87require glibc-stage.inc
88 88
89require glibc-package.bbclass 89require glibc-package.inc