summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/autotools.bbclass3
-rw-r--r--classes/autotools_stage.bbclass1
-rw-r--r--classes/base.bbclass79
-rw-r--r--classes/binconfig.bbclass1
-rw-r--r--classes/chicken.bbclass11
-rw-r--r--classes/cmake.bbclass22
-rw-r--r--classes/corecdp-mirrors.bbclass4
-rw-r--r--classes/cpan-base.bbclass6
-rw-r--r--classes/cpan.bbclass2
-rw-r--r--classes/cpan_build.bbclass3
-rw-r--r--classes/efl.bbclass11
-rw-r--r--classes/gconf.bbclass4
-rw-r--r--classes/gettext.bbclass2
-rw-r--r--classes/glibc-package.bbclass305
-rw-r--r--classes/gtk-icon-cache.bbclass5
-rw-r--r--classes/icecc.bbclass12
-rw-r--r--classes/image.bbclass3
-rw-r--r--classes/insane.bbclass24
-rw-r--r--classes/java.bbclass2
-rw-r--r--classes/kernel-arch.bbclass2
-rw-r--r--classes/kernel.bbclass53
-rw-r--r--classes/linux-kernel-base.bbclass6
-rw-r--r--classes/manifest.bbclass2
-rw-r--r--classes/mime.bbclass4
-rw-r--r--classes/module_strip.bbclass36
-rw-r--r--classes/native.bbclass9
-rw-r--r--classes/openmoko-base.bbclass1
-rw-r--r--classes/openmoko2.bbclass2
-rw-r--r--classes/package.bbclass76
-rw-r--r--classes/package_dbg.bbclass125
-rw-r--r--classes/package_deb.bbclass8
-rw-r--r--classes/package_ipk.bbclass19
-rw-r--r--classes/package_rpm.bbclass11
-rw-r--r--classes/package_tar.bbclass9
-rw-r--r--classes/packaged-staging.bbclass31
-rw-r--r--classes/packagehistory.bbclass6
-rw-r--r--classes/patch.bbclass11
-rw-r--r--classes/pkgconfig.bbclass4
-rw-r--r--classes/qemu.bbclass15
-rw-r--r--classes/qmake_base.bbclass3
-rw-r--r--classes/qt4x11.bbclass2
-rw-r--r--classes/recipe_sanity.bbclass9
-rw-r--r--classes/rm_work.bbclass5
-rw-r--r--classes/sanity.bbclass34
-rw-r--r--classes/siteinfo.bbclass4
-rw-r--r--classes/sourcepkg.bbclass4
-rw-r--r--classes/src_distribute.bbclass2
-rw-r--r--classes/task.bbclass1
-rw-r--r--classes/tinderclient.bbclass5
-rw-r--r--classes/update-alternatives.bbclass1
-rw-r--r--classes/update-rc.d.bbclass1
-rw-r--r--classes/xfce.bbclass2
52 files changed, 723 insertions, 280 deletions
diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass
index a944f0ec9f..1ea4b6f1d0 100644
--- a/classes/autotools.bbclass
+++ b/classes/autotools.bbclass
@@ -2,8 +2,6 @@
AUTOTOOLS_NATIVE_STAGE_INSTALL = "1"
def autotools_dep_prepend(d):
- import bb;
-
if bb.data.getVar('INHIBIT_AUTOTOOLS_DEPS', d, 1):
return ''
@@ -34,7 +32,6 @@ acpaths = "default"
EXTRA_AUTORECONF = "--exclude=autopoint"
def autotools_set_crosscompiling(d):
- import bb
if not bb.data.inherits_class('native', d):
return " cross_compiling=yes"
return ""
diff --git a/classes/autotools_stage.bbclass b/classes/autotools_stage.bbclass
index 3007eef969..ff0f4cd880 100644
--- a/classes/autotools_stage.bbclass
+++ b/classes/autotools_stage.bbclass
@@ -3,4 +3,3 @@ inherit autotools
do_stage () {
autotools_stage_all
}
-
diff --git a/classes/base.bbclass b/classes/base.bbclass
index aa1037e472..e6cfeccc46 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -56,6 +56,50 @@ def base_chk_load_parser(config_paths):
return parser
+def base_chk_file_vars(parser, localpath, params, data):
+ try:
+ name = params["name"]
+ except KeyError:
+ return False
+ flagName = "%s.md5sum" % name
+ want_md5sum = bb.data.getVarFlag("SRC_URI", flagName, data)
+ flagName = "%s.sha256sum" % name
+ want_sha256sum = bb.data.getVarFlag("SRC_URI", flagName, data)
+
+ if (want_sha256sum == None and want_md5sum == None):
+ # no checksums to check, nothing to do
+ return False
+
+ if not os.path.exists(localpath):
+ localpath = base_path_out(localpath, data)
+ bb.note("The localpath does not exist '%s'" % localpath)
+ raise Exception("The path does not exist '%s'" % localpath)
+
+ if want_md5sum:
+ try:
+ md5pipe = os.popen('PATH=%s md5sum %s' % (bb.data.getVar('PATH', data, True), localpath))
+ md5data = (md5pipe.readline().split() or [ "" ])[0]
+ md5pipe.close()
+ except OSError, e:
+ raise Exception("Executing md5sum failed")
+ if want_md5sum != md5data:
+ bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (want_md5sum, md5data))
+ raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (want_md5sum, md5data))
+
+ if want_sha256sum:
+ try:
+ shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath))
+ sha256data = (shapipe.readline().split() or [ "" ])[0]
+ shapipe.close()
+ except OSError, e:
+ raise Exception("Executing shasum failed")
+ if want_sha256sum != sha256data:
+ bb.note("The SHA256Sums did not match. Wanted: '%s' and Got: '%s'" % (want_sha256sum, sha256data))
+ raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (want_sha256sum, sha256data))
+
+ return True
+
+
def base_chk_file(parser, pn, pv, src_uri, localpath, data):
no_checksum = False
# Try PN-PV-SRC_URI first and then try PN-SRC_URI
@@ -639,15 +683,15 @@ python base_do_fetch() {
# Check each URI
for url in src_uri.split():
localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
- (type,host,path,_,_,_) = bb.decodeurl(url)
+ (type,host,path,_,_,params) = bb.decodeurl(url)
uri = "%s://%s%s" % (type,host,path)
try:
- if type == "http" or type == "https" or type == "ftp" or type == "ftps":
- if not base_chk_file(parser, pn, pv,uri, localpath, d):
- if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS",d, True):
- bb.fatal("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
+ if type in [ "http", "https", "ftp", "ftps" ]:
+ if not (base_chk_file_vars(parser, localpath, params, d) or base_chk_file(parser, pn, pv,uri, localpath, d)):
+ if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS", d, True):
+ bb.fatal("%s-%s: %s has no checksum defined, cannot check archive integrity" % (pn,pv,uri))
else:
- bb.note("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
+ bb.note("%s-%s: %s has no checksum defined, archive integrity not checked" % (pn,pv,uri))
except Exception:
raise bb.build.FuncFailed("Checksum of '%s' failed" % uri)
}
@@ -1028,7 +1072,6 @@ sysroot_stage_all() {
}
def is_legacy_staging(d):
- import bb
stagefunc = bb.data.getVar('do_stage', d, True)
legacy = True
if stagefunc is None:
@@ -1041,6 +1084,8 @@ def is_legacy_staging(d):
legacy = False
if bb.data.getVar('PSTAGE_BROKEN_DESTDIR', d, 1) == "1":
legacy = True
+ if bb.data.getVar('FORCE_LEGACY_STAGING', d, 1) == "1":
+ legacy = True
return legacy
do_populate_staging[dirs] = "${STAGING_DIR_TARGET}/${bindir} ${STAGING_DIR_TARGET}/${libdir} \
@@ -1085,9 +1130,11 @@ python do_populate_staging () {
if legacy:
bb.data.setVar("SYSROOT_DESTDIR", "", d)
bb.note("Legacy staging mode for %s" % bb.data.getVar("FILE", d, True))
+ if bb.data.getVarFlags('do_stage', d) is None:
+ bb.fatal("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True))
lock = bb.utils.lockfile(lockfile)
- bb.build.exec_func('do_stage', d)
bb.build.exec_func('populate_staging_prehook', d)
+ bb.build.exec_func('do_stage', d)
for f in (bb.data.getVar('SYSROOT_PREPROCESS_FUNCS', d, True) or '').split():
bb.build.exec_func(f, d)
bb.build.exec_func('populate_staging_posthook', d)
@@ -1248,6 +1295,9 @@ python () {
base_after_parse(d)
if is_legacy_staging(d):
bb.debug(1, "Legacy staging mode for %s" % bb.data.getVar("FILE", d, True))
+ if bb.data.getVarFlags('do_stage', d) is None:
+ bb.error("This recipe (%s) has a do_stage_prepend or do_stage_append and do_stage now doesn't exist. Please rename this to do_stage()" % bb.data.getVar("FILE", d, True))
+
}
def check_app_exists(app, d):
@@ -1257,19 +1307,6 @@ def check_app_exists(app, d):
path = data.getVar('PATH', d, 1)
return len(which(path, app)) != 0
-def check_gcc3(data):
- # Primarly used by qemu to make sure we have a workable gcc-3.4.x.
- # Start by checking for the program name as we build it, was not
- # all host-provided gcc-3.4's will work.
-
- gcc3_versions = 'gcc-3.4.6 gcc-3.4.4 gcc34 gcc-3.4 gcc-3.4.7 gcc-3.3 gcc33 gcc-3.3.6 gcc-3.2 gcc32'
-
- for gcc3 in gcc3_versions.split():
- if check_app_exists(gcc3, data):
- return gcc3
-
- return False
-
# Patch handling
inherit patch
diff --git a/classes/binconfig.bbclass b/classes/binconfig.bbclass
index dad54a5f56..b3b2236709 100644
--- a/classes/binconfig.bbclass
+++ b/classes/binconfig.bbclass
@@ -2,7 +2,6 @@ FILES_${PN}-dev += "${bindir}/*-config"
# The namespaces can clash here hence the two step replace
def get_binconfig_mangle(d):
- import bb.data
s = "-e ''"
if not bb.data.inherits_class('native', d):
optional_quote = r"\(\"\?\)"
diff --git a/classes/chicken.bbclass b/classes/chicken.bbclass
new file mode 100644
index 0000000000..5ebe1ff462
--- /dev/null
+++ b/classes/chicken.bbclass
@@ -0,0 +1,11 @@
+def chicken_arch(bb, d):
+ import re
+ arch_pattern = re.compile('^i.*86$')
+ target_arch = d.getVar("TARGET_ARCH", 1)
+ if arch_pattern.match(target_arch):
+ return 'x86'
+ else:
+ return target_arch
+
+CHICKEN_ARCH = "${@chicken_arch(bb, d)}"
+
diff --git a/classes/cmake.bbclass b/classes/cmake.bbclass
index 4978421b63..f21c4d6545 100644
--- a/classes/cmake.bbclass
+++ b/classes/cmake.bbclass
@@ -20,9 +20,27 @@ cmake_do_configure() {
cmake ${OECMAKE_SOURCEPATH} \
-DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
- -DCMAKE_FIND_ROOT_PATH=${STAGING_DIR_HOST} \
+ -DCMAKE_FIND_ROOT_PATH:PATH=${STAGING_DIR_HOST} \
${EXTRA_OECMAKE} \
-Wno-dev
}
-EXPORT_FUNCTIONS do_configure
+cmake_do_compile() {
+ if [ ${OECMAKE_BUILDPATH} ]
+ then
+ cd ${OECMAKE_BUILDPATH}
+ fi
+
+ base_do_compile
+}
+
+cmake_do_install() {
+ if [ ${OECMAKE_BUILDPATH} ];
+ then
+ cd ${OECMAKE_BUILDPATH}
+ fi
+
+ autotools_do_install
+}
+
+EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/classes/corecdp-mirrors.bbclass b/classes/corecdp-mirrors.bbclass
new file mode 100644
index 0000000000..0d1f0b4a7b
--- /dev/null
+++ b/classes/corecdp-mirrors.bbclass
@@ -0,0 +1,4 @@
+MIRRORS_append () {
+ftp://.*/.* http://www.multitech.net/corecdp/sources/
+https?$://.*/.* http://www.multitech.net/corecdp/sources/
+}
diff --git a/classes/cpan-base.bbclass b/classes/cpan-base.bbclass
index cc0d11e515..82fd5b459a 100644
--- a/classes/cpan-base.bbclass
+++ b/classes/cpan-base.bbclass
@@ -9,8 +9,8 @@ RDEPENDS += "${@["perl", ""][(bb.data.inherits_class('native', d))]}"
# Determine the staged version of perl from the perl configuration file
def get_perl_version(d):
- import os, bb, re
- cfg = bb.data.expand('${STAGING_DIR}/${HOST_SYS}/perl/config.sh', d)
+ import re
+ cfg = bb.data.expand('${STAGING_LIBDIR}/perl/config.sh', d)
try:
f = open(cfg, 'r')
except IOError:
@@ -33,7 +33,6 @@ def is_new_perl(d):
# Determine where the library directories are
def perl_get_libdirs(d):
- import bb
libdir = bb.data.getVar('libdir', d, 1)
if is_new_perl(d) == "yes":
libdirs = libdir + '/perl5'
@@ -42,7 +41,6 @@ def perl_get_libdirs(d):
return libdirs
def is_target(d):
- import bb
if not bb.data.inherits_class('native', d):
return "yes"
return "no"
diff --git a/classes/cpan.bbclass b/classes/cpan.bbclass
index 7b3faa2561..66054bc755 100644
--- a/classes/cpan.bbclass
+++ b/classes/cpan.bbclass
@@ -16,7 +16,7 @@ export PERL_ARCHLIB = "${STAGING_LIBDIR}/perl/${@get_perl_version(d)}"
cpan_do_configure () {
yes '' | perl Makefile.PL ${EXTRA_CPANFLAGS}
if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
- . ${STAGING_DIR_TARGET}/perl/config.sh
+ . ${STAGING_LIBDIR}/perl/config.sh
if [ "${IS_NEW_PERL}" = "yes" ]; then
sed -i -e "s:\(SITELIBEXP = \).*:\1${sitelibexp}:" \
-e "s:\(SITEARCHEXP = \).*:\1${sitearchexp}:" \
diff --git a/classes/cpan_build.bbclass b/classes/cpan_build.bbclass
index c3804ff4cc..b2ec8255de 100644
--- a/classes/cpan_build.bbclass
+++ b/classes/cpan_build.bbclass
@@ -12,7 +12,6 @@ INHIBIT_NATIVE_STAGE_INSTALL = "1"
# libmodule-build-perl)
#
def cpan_build_dep_prepend(d):
- import bb;
if bb.data.getVar('CPAN_BUILD_DEPS', d, 1):
return ''
pn = bb.data.getVar('PN', d, 1)
@@ -25,7 +24,7 @@ DEPENDS_prepend = "${@cpan_build_dep_prepend(d)}"
cpan_build_do_configure () {
if [ ${@is_target(d)} == "yes" ]; then
# build for target
- . ${STAGING_DIR_TARGET}/perl/config.sh
+ . ${STAGING_LIBDIR}/perl/config.sh
if [ "${IS_NEW_PERL}" = "yes" ]; then
perl Build.PL --installdirs vendor \
--destdir ${D} \
diff --git a/classes/efl.bbclass b/classes/efl.bbclass
index d4c3baa9cf..900d9c7f0d 100644
--- a/classes/efl.bbclass
+++ b/classes/efl.bbclass
@@ -11,16 +11,19 @@ PE = "2"
ARM_INSTRUCTION_SET = "arm"
-AUTOTOOLS_STAGE_PKGCONFIG = "1"
-# do NOT inherit pkgconfig here, see note in autotools_stage_all
inherit autotools
+# evas-native looks at this var, so keep it
+AUTOTOOLS_STAGE_PKGCONFIG = "1"
+
do_configure_prepend() {
touch config.rpath
}
-do_stage() {
- autotools_stage_all
+do_install_prepend () {
+ for i in `find ${S}/ -name "*.pc" -type f` ; do \
+ sed -i -e 's:-L${STAGING_LIBDIR}::g' -e 's:-I${STAGING_INCDIR}::g' $i
+ done
}
# This construction is stupid, someone with more E knowledge should change it to =+ or something
diff --git a/classes/gconf.bbclass b/classes/gconf.bbclass
index 47df06329b..f55ae2c2ae 100644
--- a/classes/gconf.bbclass
+++ b/classes/gconf.bbclass
@@ -32,10 +32,10 @@ fi
python populate_packages_append () {
import os.path, re
packages = bb.data.getVar('PACKAGES', d, 1).split()
- workdir = bb.data.getVar('WORKDIR', d, 1)
+ pkgdest = bb.data.getVar('PKGDEST', d, 1)
for pkg in packages:
- schema_dir = '%s/install/%s/etc/gconf/schemas' % (workdir, pkg)
+ schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg)
schemas = []
schema_re = re.compile(".*\.schemas$")
if os.path.exists(schema_dir):
diff --git a/classes/gettext.bbclass b/classes/gettext.bbclass
index bc0a1dfaba..b2ff2849fa 100644
--- a/classes/gettext.bbclass
+++ b/classes/gettext.bbclass
@@ -1,6 +1,5 @@
DEPENDS =+ "gettext-native"
def gettext_after_parse(d):
- import bb
# Remove the NLS bits if USE_NLS is no.
if bb.data.getVar('USE_NLS', d, 1) == 'no':
cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d)
@@ -15,4 +14,3 @@ python () {
DEPENDS =+ "gettext-native"
EXTRA_OECONF += "--enable-nls"
-
diff --git a/classes/glibc-package.bbclass b/classes/glibc-package.bbclass
new file mode 100644
index 0000000000..90b9bfd584
--- /dev/null
+++ b/classes/glibc-package.bbclass
@@ -0,0 +1,305 @@
+#
+# This class knows how to package up glibc. Its shared since prebuild binary toolchains
+# may need packaging and its pointless to duplicate this code.
+#
+# Caller should set GLIBC_INTERNAL_USE_BINARY_LOCALE to one of:
+# "compile" - Use QEMU to generate the binary locale files
+# "precompiled" - The binary locale files are pregenerated and already present
+# "ondevice" - The device will build the locale files upon first boot through the postinst
+
+inherit qemu
+
+GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "ondevice"
+
+PACKAGES = "glibc-dbg glibc catchsegv sln nscd ldd localedef glibc-utils glibc-dev glibc-static glibc-doc glibc-locale libcidn libmemusage libsegfault glibc-extra-nss glibc-thread-db glibc-pcprofile"
+PACKAGES_DYNAMIC = "glibc-gconv-* glibc-charmap-* glibc-localedata-* locale-base-* glibc-binary-localedata-*"
+
+INSANE_SKIP_glibc-dbg = True
+
+libc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so ${base_libdir}/libc*.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so"
+
+# The problem is that if PN = "glibc", FILES_${PN} will overwrite FILES_glibc
+# Solution: Make them both the same thing, then it doesn't matter
+
+glibcfiles = "${libc_baselibs} ${libexecdir}/* ${datadir}/zoneinfo ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig', '', d)}"
+glibcdbgfiles = "${bindir}/.debug ${sbindir}/.debug ${libdir}/.debug \
+ ${base_bindir}/.debug ${base_sbindir}/.debug ${base_libdir}/.debug \
+ ${libdir}/gconv/.debug ${libexecdir}/*/.debug"
+glibcdevfiles = "${bindir}/rpcgen ${includedir} ${libdir}/lib*${SOLIBSDEV} ${libdir}/*.la \
+ ${libdir}/*.a ${libdir}/*.o ${libdir}/pkgconfig ${libdir}/*nonshared.a \
+ ${base_libdir}/*.a ${base_libdir}/*.o ${datadir}/aclocal"
+
+FILES_glibc = "${glibcfiles}"
+FILES_${PN} = "${glibcfiles}"
+FILES_ldd = "${bindir}/ldd"
+FILES_libsegfault = "${base_libdir}/libSegFault*"
+FILES_libcidn = "${base_libdir}/libcidn*.so"
+FILES_libmemusage = "${base_libdir}/libmemusage.so"
+FILES_glibc-extra-nss = "${base_libdir}/libnss*"
+FILES_sln = "${base_sbindir}/sln"
+FILES_glibc-dev = "${glibcdevfiles}"
+FILES_${PN}-dev = "${glibcdevfiles}"
+FILES_glibc-dbg = "${glibcdbgfiles}"
+FILES_${PN}-dbg = "${glibcdbgfiles}"
+FILES_nscd = "${sbindir}/nscd* ${sysconfdir}/nscd* ${sysconfdir}/init.d/nscd*"
+FILES_glibc-utils = "${bindir}/* ${sbindir}/*"
+FILES_glibc-gconv = "${libdir}/gconv/*"
+FILES_catchsegv = "${bindir}/catchsegv"
+RDEPENDS_catchsegv = "libsegfault"
+FILES_glibc-pcprofile = "${base_libdir}/libpcprofile.so"
+FILES_glibc-thread-db = "${base_libdir}/libthread_db*"
+FILES_localedef = "${bindir}/localedef"
+RPROVIDES_glibc-dev += "libc-dev"
+
+DESCRIPTION_sln = "glibc: create symbolic links between files"
+DESCRIPTION_nscd = "glibc: name service cache daemon for passwd, group, and hosts"
+DESCRIPTION_glibc-extra-nss = "glibc: nis, nisplus and hesiod search services"
+DESCRIPTION_ldd = "glibc: print shared library dependencies"
+DESCRIPTION_localedef = "glibc: compile locale definition files"
+DESCRIPTION_glibc-utils = "glibc: misc utilities like iconf, local, gencat, tzselect, rpcinfo, ..."
+
+TMP_LOCALE="/tmp/locale${libdir}/locale"
+
+locale_base_postinst() {
+#!/bin/sh
+
+if [ "x$D" != "x" ]; then
+ exit 1
+fi
+
+rm -rf ${TMP_LOCALE}
+mkdir -p ${TMP_LOCALE}
+if [ -f ${libdir}/locale/locale-archive ]; then
+ cp ${libdir}/locale/locale-archive ${TMP_LOCALE}/
+fi
+localedef --inputfile=${datadir}/i18n/locales/%s --charmap=%s --prefix=/tmp/locale %s
+mkdir -p ${libdir}/locale/
+mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/
+rm -rf ${TMP_LOCALE}
+}
+
+locale_base_postrm() {
+#!/bin/sh
+
+rm -rf ${TMP_LOCALE}
+mkdir -p ${TMP_LOCALE}
+if [ -f ${libdir}/locale/locale-archive ]; then
+ cp ${libdir}/locale/locale-archive ${TMP_LOCALE}/
+fi
+localedef --delete-from-archive --inputfile=${datadir}/locales/%s --charmap=%s --prefix=/tmp/locale %s
+mv ${TMP_LOCALE}/locale-archive ${libdir}/locale/
+rm -rf ${TMP_LOCALE}
+}
+
+do_prep_locale_tree() {
+ treedir=${WORKDIR}/locale-tree
+ rm -rf $treedir
+ mkdir -p $treedir/bin $treedir/lib $treedir/${datadir} $treedir/${libdir}/locale
+ cp -pPR ${PKGD}${datadir}/i18n $treedir/${datadir}/i18n
+ # unzip to avoid parsing errors
+ for i in $treedir/${datadir}/i18n/charmaps/*gz; do
+ gunzip $i
+ done
+ ls -d ${PKGD}${base_libdir}/* | xargs -iBLAH cp -pPR BLAH $treedir/lib
+ if [ -f ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.so ]; then
+ cp -pPR ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.so $treedir/lib
+ fi
+ if [ -f ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.so.* ]; then
+ cp -pPR ${CROSS_DIR}/${TARGET_SYS}/lib/libgcc_s.so.* $treedir/lib
+ fi
+ install -m 0755 ${PKGD}${bindir}/localedef $treedir/bin
+}
+
+do_collect_bins_from_locale_tree() {
+ treedir=${WORKDIR}/locale-tree
+
+ mkdir -p ${PKGD}${libdir}
+ cp -pPR $treedir/${libdir}/locale ${PKGD}${libdir}
+}
+
+python package_do_split_gconvs () {
+ import os, re
+ if (bb.data.getVar('PACKAGE_NO_GCONV', d, 1) == '1'):
+ bb.note("package requested not splitting gconvs")
+ return
+
+ if not bb.data.getVar('PACKAGES', d, 1):
+ return
+
+ libdir = bb.data.getVar('libdir', d, 1)
+ if not libdir:
+ bb.error("libdir not defined")
+ return
+ datadir = bb.data.getVar('datadir', d, 1)
+ if not datadir:
+ bb.error("datadir not defined")
+ return
+
+ gconv_libdir = base_path_join(libdir, "gconv")
+ charmap_dir = base_path_join(datadir, "i18n", "charmaps")
+ locales_dir = base_path_join(datadir, "i18n", "locales")
+ binary_locales_dir = base_path_join(libdir, "locale")
+
+ 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')
+
+ do_split_packages(d, charmap_dir, file_regex='^(.*)\.gz$', output_pattern='glibc-charmap-%s', description='character map for %s encoding', extra_depends='')
+
+ def calc_locale_deps(fn, pkg, file_regex, output_pattern, group):
+ deps = []
+ f = open(fn, "r")
+ c_re = re.compile('^copy "(.*)"')
+ i_re = re.compile('^include "(\w+)".*')
+ for l in f.readlines():
+ m = c_re.match(l) or i_re.match(l)
+ if m:
+ dp = legitimize_package_name('glibc-localedata-%s' % m.group(1))
+ if not dp in deps:
+ deps.append(dp)
+ f.close()
+ if deps != []:
+ bb.data.setVar('RDEPENDS_%s' % pkg, " ".join(deps), d)
+
+ do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern='glibc-localedata-%s', description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
+ bb.data.setVar('PACKAGES', bb.data.getVar('PACKAGES', d) + ' glibc-gconv', d)
+
+ use_bin = bb.data.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", d, 1)
+
+ dot_re = re.compile("(.*)\.(.*)")
+
+ if use_bin != "precompiled":
+ supported = bb.data.getVar('GLIBC_GENERATE_LOCALES', d, 1)
+ if not supported or supported == "all":
+ f = open(base_path_join(bb.data.getVar('WORKDIR', d, 1), "SUPPORTED"), "r")
+ supported = f.readlines()
+ f.close()
+ else:
+ supported = supported.split()
+ supported = map(lambda s:s.replace(".", " ") + "\n", supported)
+ else:
+ supported = []
+ full_bin_path = bb.data.getVar('PKGD', d, True) + binary_locales_dir
+ for dir in os.listdir(full_bin_path):
+ dbase = dir.split(".")
+ d2 = " "
+ if len(dbase) > 1:
+ d2 = "." + dbase[1].upper() + " "
+ supported.append(dbase[0] + d2)
+
+ # Collate the locales by base and encoding
+ utf8_only = int(bb.data.getVar('LOCALE_UTF8_ONLY', d, 1) or 0)
+ encodings = {}
+ for l in supported:
+ l = l[:-1]
+ (locale, charset) = l.split(" ")
+ if utf8_only and charset != 'UTF-8':
+ continue
+ m = dot_re.match(locale)
+ if m:
+ locale = m.group(1)
+ if not encodings.has_key(locale):
+ encodings[locale] = []
+ encodings[locale].append(charset)
+
+ def output_locale_source(name, pkgname, locale, encoding):
+ bb.data.setVar('RDEPENDS_%s' % pkgname, 'localedef glibc-localedata-%s glibc-charmap-%s' % (legitimize_package_name(locale), legitimize_package_name(encoding)), d)
+ bb.data.setVar('pkg_postinst_%s' % pkgname, bb.data.getVar('locale_base_postinst', d, 1) % (locale, encoding, locale), d)
+ bb.data.setVar('pkg_postrm_%s' % pkgname, bb.data.getVar('locale_base_postrm', d, 1) % (locale, encoding, locale), d)
+
+ def output_locale_binary_rdepends(name, pkgname, locale, encoding):
+ m = re.match("(.*)\.(.*)", name)
+ if m:
+ glibc_name = "%s.%s" % (m.group(1), m.group(2).lower().replace("-",""))
+ else:
+ glibc_name = name
+ bb.data.setVar('RDEPENDS_%s' % pkgname, legitimize_package_name('glibc-binary-localedata-%s' % glibc_name), d)
+
+ def output_locale_binary(name, pkgname, locale, encoding):
+ # This is a hack till linux-libc-headers gets patched for the missing arm syscalls and all arm device kernels as well
+ if bb.data.getVar("DISTRO_NAME", d, 1) == "Angstrom":
+ kernel_ver = "2.6.24"
+ elif bb.data.getVar("DISTRO_NAME", d, 1) == "KaeilOS":
+ kernel_ver = "2.6.24"
+ else:
+ kernel_ver = bb.data.getVar("OLDEST_KERNEL", d, 1)
+
+ qemu = qemu_target_binary(d) + " -s 1048576"
+ if kernel_ver:
+ qemu += " -r %s" % (kernel_ver)
+ pkgname = 'locale-base-' + legitimize_package_name(name)
+
+ treedir = base_path_join(bb.data.getVar("WORKDIR", d, 1), "locale-tree")
+ ldlibdir = "%s/lib" % treedir
+ path = bb.data.getVar("PATH", d, 1)
+ i18npath = base_path_join(treedir, datadir, "i18n")
+
+ localedef_opts = "--force --old-style --no-archive --prefix=%s --inputfile=%s/i18n/locales/%s --charmap=%s %s" % (treedir, datadir, locale, encoding, name)
+
+ qemu_options = bb.data.