diff options
author | Tom Rini <tom_rini@mentor.com> | 2011-07-12 09:29:34 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-07-21 10:59:18 +0100 |
commit | 997b1fc7f722ee20212107f8243fd71fef4fcf7e (patch) | |
tree | d93cac7247a83fd8c1d97afa823a67b4f8ff9165 /meta/classes | |
parent | fe7db148c2f0286c1e4106d718c650f86cbb5030 (diff) | |
download | poky-997b1fc7f722ee20212107f8243fd71fef4fcf7e.tar.gz |
siteinfo.bbclass: Port over oe.dev logic for site files
In oe.dev we have a sets to pick out hostos/hostarch/etc site
files out of and include things like a common-linux site file.
This should also help out with adding multilib-specific site files
(ie x32). In oe.dev we have an iterator but at Richard's request
we continue to return a list of files in siteinfo_get_files().
(From OE-Core rev: cb3d7cd1c0f2bbcd448abbb832074ca965e0af5e)
Signed-off-by: Tom Rini <tom_rini@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/siteinfo.bbclass | 203 |
1 files changed, 98 insertions, 105 deletions
diff --git a/meta/classes/siteinfo.bbclass b/meta/classes/siteinfo.bbclass index 78b7008e85..ff9fd0db95 100644 --- a/meta/classes/siteinfo.bbclass +++ b/meta/classes/siteinfo.bbclass | |||
@@ -15,121 +15,114 @@ | |||
15 | # It is an error for the target not to exist. | 15 | # It is an error for the target not to exist. |
16 | # If 'what' doesn't exist then an empty value is returned | 16 | # If 'what' doesn't exist then an empty value is returned |
17 | # | 17 | # |
18 | def get_siteinfo_list(d): | 18 | def siteinfo_data(d): |
19 | target = bb.data.getVar('HOST_ARCH', d, 1) + "-" + bb.data.getVar('HOST_OS', d, 1) | 19 | archinfo = { |
20 | "allarch": "endian-little bit-32", # bogus, but better than special-casing the checks below for allarch | ||
21 | "arm": "endian-little bit-32 arm-common", | ||
22 | "armeb": "endian-big bit-32 arm-common", | ||
23 | "avr32": "endian-big bit-32 avr32-common", | ||
24 | "bfin": "endian-little bit-32 bfin-common", | ||
25 | "i386": "endian-little bit-32 ix86-common", | ||
26 | "i486": "endian-little bit-32 ix86-common", | ||
27 | "i586": "endian-little bit-32 ix86-common", | ||
28 | "i686": "endian-little bit-32 ix86-common", | ||
29 | "ia64": "endian-little bit-64", | ||
30 | "microblaze": "endian-big bit-32 microblaze-common", | ||
31 | "microblazeel": "endian-little bit-32 microblaze-common", | ||
32 | "mips": "endian-big bit-32 mips-common", | ||
33 | "mips64": "endian-big bit-64 mips64-common", | ||
34 | "mips64el": "endian-little bit-64 mips64-common", | ||
35 | "mipsel": "endian-little bit-32 mips-common", | ||
36 | "powerpc": "endian-big bit-32 powerpc-common", | ||
37 | "nios2": "endian-little bit-32 nios2-common", | ||
38 | "powerpc64": "endian-big bit-64 powerpc-common powerpc64-linux", | ||
39 | "ppc": "endian-big bit-32 powerpc-common", | ||
40 | "ppc64": "endian-big bit-64 powerpc-common powerpc64-linux", | ||
41 | "sh3": "endian-little bit-32 sh-common", | ||
42 | "sh4": "endian-little bit-32 sh-common", | ||
43 | "sparc": "endian-big bit-32", | ||
44 | "viac3": "endian-little bit-32 ix86-common", | ||
45 | "x86_64": "endian-little bit-64", | ||
46 | } | ||
47 | osinfo = { | ||
48 | "darwin": "common-darwin", | ||
49 | "darwin9": "common-darwin", | ||
50 | "linux": "common-linux common-glibc", | ||
51 | "linux-gnueabi": "common-linux common-glibc", | ||
52 | "linux-gnuspe": "common-linux common-glibc", | ||
53 | "linux-uclibc": "common-linux common-uclibc", | ||
54 | "linux-uclibceabi": "common-linux common-uclibc", | ||
55 | "linux-uclibcspe": "common-linux common-uclibc", | ||
56 | "uclinux-uclibc": "common-uclibc", | ||
57 | "cygwin": "common-cygwin", | ||
58 | "mingw32": "common-mingw", | ||
59 | } | ||
60 | targetinfo = { | ||
61 | "arm-linux-gnueabi": "arm-linux", | ||
62 | "arm-linux-uclibceabi": "arm-linux-uclibc", | ||
63 | "armeb-linux-gnueabi": "armeb-linux", | ||
64 | "armeb-linux-uclibceabi": "armeb-linux-uclibc", | ||
65 | "powerpc-linux-gnuspe": "powerpc-linux", | ||
66 | "powerpc-linux-uclibcspe": "powerpc-linux-uclibc", | ||
67 | } | ||
20 | 68 | ||
21 | targetinfo = {\ | 69 | hostarch = d.getVar("HOST_ARCH", True) |
22 | "allarch-linux": "",\ | 70 | hostos = d.getVar("HOST_OS", True) |
23 | "armeb-linux": "endian-big bit-32 common-glibc arm-common",\ | 71 | target = "%s-%s" % (hostarch, hostos) |
24 | "armeb-linux-gnueabi": "endian-big bit-32 common-glibc arm-common armeb-linux",\ | ||
25 | "armeb-linux-uclibc": "endian-big bit-32 common-uclibc arm-common",\ | ||
26 | "armeb-linux-uclibceabi": "endian-big bit-32 common-uclibc arm-common armeb-linux-uclibc",\ | ||
27 | "arm-darwin": "endian-little bit-32 common-darwin",\ | ||
28 | "arm-darwin8": "endian-little bit-32 common-darwin",\ | ||
29 | "arm-linux": "endian-little bit-32 common-glibc arm-common",\ | ||
30 | "arm-linux-gnueabi": "endian-little bit-32 common-glibc arm-common arm-linux",\ | ||
31 | "arm-linux-uclibc": "endian-little bit-32 common-uclibc arm-common",\ | ||
32 | "arm-linux-uclibceabi": "endian-little bit-32 common-uclibc arm-common arm-linux-uclibc",\ | ||
33 | "avr32-linux": "endian-big bit-32 common-glibc avr32-common",\ | ||
34 | "avr32-linux-uclibc": "endian-big bit-32 common-uclibc avr32-common",\ | ||
35 | "bfin-uclinux-uclibc": "endian-little bit-32 common-uclibc bfin-common",\ | ||
36 | "i386-linux": "endian-little bit-32 common-glibc ix86-common",\ | ||
37 | "i486-linux": "endian-little bit-32 common-glibc ix86-common",\ | ||
38 | "i586-linux": "endian-little bit-32 common-glibc ix86-common",\ | ||
39 | "i686-linux": "endian-little bit-32 common-glibc ix86-common",\ | ||
40 | "i386-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ | ||
41 | "i486-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ | ||
42 | "i586-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ | ||
43 | "i686-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\ | ||
44 | "microblaze-linux-gnu": "endian-big bit-32 common-glibc microblaze-common",\ | ||
45 | "microblazeel-linux-gnu": "endian-little bit-32 common-glibc microblaze-common",\ | ||
46 | "mipsel-linux": "endian-little bit-32 common-glibc mips-common",\ | ||
47 | "mipsel-linux-uclibc": "endian-little bit-32 common-uclibc mips-common",\ | ||
48 | "mips-linux": "endian-big bit-32 common-glibc mips-common",\ | ||
49 | "mips-linux-uclibc": "endian-big bit-32 common-uclibc mips-common",\ | ||
50 | "powerpc-darwin": "endian-big bit-32 common-darwin",\ | ||
51 | "ppc-linux": "endian-big bit-32 common-glibc powerpc-common",\ | ||
52 | "powerpc-linux": "endian-big bit-32 common-glibc powerpc-common",\ | ||
53 | "powerpc-linux-gnuspe": "endian-big bit-32 common-glibc powerpc-common",\ | ||
54 | "powerpc-linux-uclibc": "endian-big bit-32 common-uclibc powerpc-common",\ | ||
55 | "sh3-linux": "endian-little bit-32 common-glibc sh-common",\ | ||
56 | "sh4-linux": "endian-little bit-32 common-glibc sh-common",\ | ||
57 | "sh4-linux-uclibc": "endian-little bit-32 common-uclibc sh-common",\ | ||
58 | "sparc-linux": "endian-big bit-32 common-glibc",\ | ||
59 | "x86_64-linux": "endian-little bit-64 common-glibc",\ | ||
60 | "x86_64-linux-uclibc": "endian-little bit-64 common-uclibc"} | ||
61 | if target in targetinfo: | ||
62 | info = targetinfo[target].split() | ||
63 | info.append(target) | ||
64 | info.append("common") | ||
65 | return info | ||
66 | else: | ||
67 | bb.error("Information not available for target '%s'" % target) | ||
68 | 72 | ||
73 | sitedata = [] | ||
74 | if hostarch in archinfo: | ||
75 | sitedata.extend(archinfo[hostarch].split()) | ||
76 | if hostos in osinfo: | ||
77 | sitedata.extend(osinfo[hostos].split()) | ||
78 | if target in targetinfo: | ||
79 | sitedata.extend(targetinfo[target].split()) | ||
80 | sitedata.append(target) | ||
81 | sitedata.append("common") | ||
69 | 82 | ||
70 | # | 83 | bb.debug(1, "SITE files %s" % sitedata); |
71 | # Define which site files to use. We check for several site files and | 84 | return sitedata |
72 | # use each one that is found, based on the list returned by get_siteinfo_list() | ||
73 | # | ||
74 | # Search for the files in the following directories: | ||
75 | # 1) ${BBPATH}/site (in reverse) - app specific, then site wide | ||
76 | # 2) ${FILE_DIRNAME}/site-${PV} - app version specific | ||
77 | # | ||
78 | def siteinfo_get_files(d): | ||
79 | sitefiles = "" | ||
80 | 85 | ||
81 | # Determine which site files to look for | 86 | python () { |
82 | sites = get_siteinfo_list(d) | 87 | sitedata = set(siteinfo_data(d)) |
88 | if "endian-little" in sitedata: | ||
89 | d.setVar("SITEINFO_ENDIANESS", "le") | ||
90 | elif "endian-big" in sitedata: | ||
91 | d.setVar("SITEINFO_ENDIANESS", "be") | ||
92 | else: | ||
93 | bb.error("Unable to determine endianness for architecture '%s'" % | ||
94 | d.getVar("HOST_ARCH", True)) | ||
95 | bb.fatal("Please add your architecture to siteinfo.bbclass") | ||
83 | 96 | ||
84 | # Check along bbpath for site files and append in reverse order so | 97 | if "bit-32" in sitedata: |
85 | # the application specific sites files are last and system site | 98 | d.setVar("SITEINFO_BITS", "32") |
86 | # files first. | 99 | elif "bit-64" in sitedata: |
87 | path_bb = bb.data.getVar('BBPATH', d, 1) | 100 | d.setVar("SITEINFO_BITS", "64") |
88 | for p in (path_bb or "").split(':'): | 101 | else: |
89 | tmp = "" | 102 | bb.error("Unable to determine bit size for architecture '%s'" % |
90 | for i in sites: | 103 | d.getVar("HOST_ARCH", True)) |
91 | fname = os.path.join(p, 'site', i) | 104 | bb.fatal("Please add your architecture to siteinfo.bbclass") |
92 | if os.path.exists(fname): | 105 | } |
93 | tmp += fname + " " | ||
94 | sitefiles = tmp + sitefiles; | ||
95 | 106 | ||
96 | # Now check for the applications version specific site files | 107 | def siteinfo_get_files(d): |
97 | path_pkgv = os.path.join(bb.data.getVar('FILE_DIRNAME', d, 1), "site-" + bb.data.getVar('PV', d, 1)) | 108 | sitedata = siteinfo_data(d) |
98 | for i in sites: | 109 | sitefiles = "" |
99 | fname = os.path.join(path_pkgv, i) | 110 | for path in d.getVar("BBPATH", True).split(":"): |
100 | if os.path.exists(fname): | 111 | for element in sitedata: |
101 | sitefiles += fname + " " | 112 | filename = os.path.join(path, "site", element) |
102 | 113 | if os.path.exists(filename): | |
103 | # Now check for siteconfig cache files | 114 | sitefiles += filename + " " |
104 | path_siteconfig = bb.data.getVar('SITECONFIG_SYSROOTCACHE', d, 1) | ||
105 | if os.path.isdir(path_siteconfig): | ||
106 | for i in os.listdir(path_siteconfig): | ||
107 | fname = os.path.join(path_siteconfig, i) | ||
108 | sitefiles += fname + " " | ||
109 | |||
110 | bb.debug(1, "SITE files " + sitefiles); | ||
111 | return sitefiles | ||
112 | 115 | ||
113 | def siteinfo_get_endianess(d): | 116 | # Now check for siteconfig cache files |
114 | info = get_siteinfo_list(d) | 117 | path_siteconfig = bb.data.getVar('SITECONFIG_SYSROOTCACHE', d, 1) |
115 | if 'endian-little' in info: | 118 | if os.path.isdir(path_siteconfig): |
116 | return "le" | 119 | for i in os.listdir(path_siteconfig): |
117 | elif 'endian-big' in info: | 120 | filename = os.path.join(path_siteconfig, i) |
118 | return "be" | 121 | sitefiles += filename + " " |
119 | bb.error("Site info could not determine endianess for target") | ||
120 | 122 | ||
121 | def siteinfo_get_bits(d): | 123 | return sitefiles |
122 | info = get_siteinfo_list(d) | ||
123 | if 'bit-32' in info: | ||
124 | return "32" | ||
125 | elif 'bit-64' in info: | ||
126 | return "64" | ||
127 | bb.error("Site info could not determine bit size for target") | ||
128 | 124 | ||
129 | # | 125 | # |
130 | # Make some information available via variables | 126 | # Make some information available via variables |
131 | # | 127 | # |
132 | SITEINFO_ENDIANESS = "${@siteinfo_get_endianess(d)}" | ||
133 | SITEINFO_BITS = "${@siteinfo_get_bits(d)}" | ||
134 | SITECONFIG_SYSROOTCACHE = "${STAGING_DATADIR}/${TARGET_SYS}_config_site.d" | 128 | SITECONFIG_SYSROOTCACHE = "${STAGING_DATADIR}/${TARGET_SYS}_config_site.d" |
135 | |||