summaryrefslogtreecommitdiffstats
path: root/meta/classes/siteinfo.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-11-21 14:34:40 +0000
committerRichard Purdie <richard@openedhand.com>2006-11-21 14:34:40 +0000
commit634232e6966404641d838fe744c8c1bf8297a664 (patch)
treee279222cc00a171bf39691b70ca46403f5c0538b /meta/classes/siteinfo.bbclass
parent4c9521de57092b816a332a1801ab625182a58371 (diff)
downloadpoky-634232e6966404641d838fe744c8c1bf8297a664.tar.gz
Site file handling update: Instead of one site file per target, allow entries to be shared. Handled through siteinfo.bbclass
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@931 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes/siteinfo.bbclass')
-rw-r--r--meta/classes/siteinfo.bbclass126
1 files changed, 126 insertions, 0 deletions
diff --git a/meta/classes/siteinfo.bbclass b/meta/classes/siteinfo.bbclass
new file mode 100644
index 0000000000..5a37768b52
--- /dev/null
+++ b/meta/classes/siteinfo.bbclass
@@ -0,0 +1,126 @@
1# This class exists to provide information about the targets that
2# may be needed by other classes and/or recipes. If you add a new
3# target this will probably need to be updated.
4
5#
6# Returns information about 'what' for the named target 'target'
7# where 'target' == "<arch>-<os>"
8#
9# 'what' can be one of
10# * target: Returns the target name ("<arch>-<os>")
11# * endianess: Return "be" for big endian targets, "le" for little endian
12# * bits: Returns the bit size of the target, either "32" or "64"
13# * libc: Returns the name of the c library used by the target
14#
15# It is an error for the target not to exist.
16# If 'what' doesn't exist then an empty value is returned
17#
18def get_siteinfo_list(d):
19 import bb
20
21 target = bb.data.getVar('HOST_ARCH', d, 1) + "-" + bb.data.getVar('HOST_OS', d, 1)
22
23 targetinfo = {\
24 "armeb-linux": "endian-big bit-32 common-glibc arm-common",\
25 "armeb-linux-uclibc": "endian-big bit-32 common-uclibc arm-common",\
26 "arm-linux": "endian-little bit-32 common-glibc arm-common",\
27 "arm-linux-gnueabi": "endian-little bit-32 common-glibc arm-common arm-linux",\
28 "arm-linux-uclibc": "endian-little bit-32 common-uclibc arm-common",\
29 "arm-linux-uclibcgnueabi": "endian-little bit-32 common-uclibc arm-common arm-linux-uclibc",\
30 "i386-linux": "endian-little bit-32 common-glibc ix86-common",\
31 "i486-linux": "endian-little bit-32 common-glibc ix86-common",\
32 "i586-linux": "endian-little bit-32 common-glibc ix86-common",\
33 "i686-linux": "endian-little bit-32 common-glibc ix86-common",\
34 "i386-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
35 "i486-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
36 "i586-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
37 "i686-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
38 "mipsel-linux": "endian-little bit-32 common-glibc",\
39 "mipsel-linux-uclibc": "endian-little bit-32 common-uclibc",\
40 "powerpc-darwin": "endian-big bit-32 common-darwin",\
41 "powerpc-linux": "endian-big bit-32 common-glibc",\
42 "powerpc-linux-uclibc": "endian-big bit-32 common-uclibc",\
43 "sh3-linux": "endian-little bit-32 common-glibc sh-common",\
44 "sh4-linux": "endian-little bit-32 common-glibc sh-common",\
45 "sh4-linux-uclibc": "endian-little bit-32 common-uclibc sh-common",\
46 "sparc-linux": "endian-big bit-32 common-glibc",\
47 "x86_64-linux": "endian-little bit-64 common-glibc",\
48 "x86_64-linux-uclibc": "endian-little bit-64 common-uclibc"}
49 if target in targetinfo:
50 info = targetinfo[target].split()
51 info.append(target)
52 return info
53 else:
54 bb.error("Information not available for target '%s'" % target)
55
56
57#
58# Define which site files to use. We check for several site files and
59# use each one that is found, based on the list returned by get_siteinfo_list()
60#
61# Search for the files in the following directories:
62# 1) ${BBPATH}/site (in reverse) - app specific, then site wide
63# 2) ${FILE_DIRNAME}/site-${PV} - app version specific
64#
65def siteinfo_get_files(d):
66 import bb, os
67
68 sitefiles = ""
69
70 # Determine which site files to look for
71 sites = get_siteinfo_list(d)
72 sites.append("common");
73
74 # Check along bbpath for site files and append in reverse order so
75 # the application specific sites files are last and system site
76 # files first.
77 path_bb = bb.data.getVar('BBPATH', d, 1)
78 for p in (path_bb or "").split(':'):
79 tmp = ""
80 for i in sites:
81 fname = os.path.join(p, 'site', i)
82 if os.path.exists(fname):
83 tmp += fname + " "
84 sitefiles = tmp + sitefiles;
85
86 # Now check for the applications version specific site files
87 path_pkgv = os.path.join(bb.data.getVar('FILE_DIRNAME', d, 1), "site-" + bb.data.getVar('PV', d, 1))
88 for i in sites:
89 fname = os.path.join(path_pkgv, i)
90 if os.path.exists(fname):
91 sitefiles += fname + " "
92
93 bb.note("SITE files " + sitefiles);
94 return sitefiles
95
96#
97# Export CONFIG_SITE to the enviroment. The autotools will make use
98# of this to determine where to load in variables from. This is a
99# space seperate list of shell scripts processed in the order listed.
100#
101export CONFIG_SITE = "${@siteinfo_get_files(d)}"
102
103
104def siteinfo_get_endianess(d):
105 info = get_siteinfo_list(d)
106 if 'endian-little' in info:
107 return "le"
108 elif 'endian-big' in info:
109 return "be"
110 bb.error("Site info could not determine endianess for target")
111
112def siteinfo_get_bits(d):
113 info = get_siteinfo_list(d)
114 if 'bit-32' in info:
115 return "32"
116 elif 'bit-64' in info:
117 return "64"
118 bb.error("Site info could not determine bit size for target")
119
120#
121# Make some information available via variables
122#
123SITEINFO_ENDIANESS = "${@siteinfo_get_endianess(d)}"
124SITEINFO_BITS = "${@siteinfo_get_bits(d)}"
125
126