Update drivers
[vuplus_openembedded] / classes / siteinfo.bbclass
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 #
18 def get_siteinfo_list(d):
19        target = bb.data.getVar('HOST_ARCH', d, 1) + "-" + bb.data.getVar('HOST_OS', d, 1)
20
21        targetinfo = {\
22                "armeb-linux":             "endian-big bit-32 common-linux common-glibc arm-common",\
23                "armeb-linux-gnueabi":     "endian-big bit-32 common-linux common-glibc arm-common armeb-linux",\
24                "armeb-linux-uclibc":      "endian-big bit-32 common-linux common-uclibc arm-common",\
25                "armeb-linux-uclibceabi":  "endian-big bit-32 common-linux common-uclibc arm-common armeb-linux-uclibc",\
26                "arm-darwin":              "endian-little bit-32 common-darwin",\
27                "arm-darwin9":             "endian-little bit-32 common-darwin",\
28                "arm-linux":               "endian-little bit-32 common-linux common-glibc arm-common",\
29                "arm-linux-gnueabi":       "endian-little bit-32 common-linux common-glibc arm-common arm-linux",\
30                "arm-linux-uclibc":        "endian-little bit-32 common-linux common-uclibc arm-common",\
31                "arm-linux-uclibceabi":    "endian-little bit-32 common-linux common-uclibc arm-common arm-linux-uclibc",\
32                "avr32-linux-uclibc":      "endian-big bit-32 common-linux common-uclibc avr32-common",\
33                "bfin-uclinux-uclibc":     "endian-little bit-32 common-uclibc bfin-common",\
34                "i386-linux":          "endian-little bit-32 common-linux common-glibc ix86-common",\
35                "i486-linux":          "endian-little bit-32 common-linux common-glibc ix86-common",\
36                "i586-linux":          "endian-little bit-32 common-linux common-glibc ix86-common",\
37                "i686-linux":          "endian-little bit-32 common-linux common-glibc ix86-common",\
38                "i386-linux-uclibc":       "endian-little bit-32 common-linux common-uclibc ix86-common",\
39                "i486-linux-uclibc":       "endian-little bit-32 common-linux common-uclibc ix86-common",\
40                "i586-linux-uclibc":       "endian-little bit-32 common-linux common-uclibc ix86-common",\
41                "i686-linux-uclibc":       "endian-little bit-32 common-linux common-uclibc ix86-common",\
42                "i386-cygwin":             "endian-little bit-32 common-cygwin ix86-common",\
43                "i486-cygwin":             "endian-little bit-32 common-cygwin ix86-common",\
44                "i586-cygwin":             "endian-little bit-32 common-cygwin ix86-common",\
45                "i686-cygwin":             "endian-little bit-32 common-cygwin ix86-common",\
46                "i386-mingw32":            "endian-little bit-32 common-mingw ix86-common",\
47                "i486-mingw32":            "endian-little bit-32 common-mingw ix86-common",\
48                "i586-mingw32":            "endian-little bit-32 common-mingw ix86-common",\
49                "i686-mingw32":            "endian-little bit-32 common-mingw ix86-common",\
50                "ia64-linux":              "endian-little bit-64 common-linux common-glibc",\
51                "mipsel-linux":            "endian-little bit-32 common-linux common-glibc mips-common",\
52                "mipsel-linux-uclibc":     "endian-little bit-32 common-linux common-uclibc mips-common",\
53                "mips-linux":              "endian-big bit-32 common-linux common-glibc mips-common",\
54                "mips-linux-uclibc":       "endian-big bit-32 common-linux common-uclibc mips-common",\
55                "powerpc-darwin":          "endian-big bit-32 common-darwin",\
56                "ppc-linux":               "endian-big bit-32 common-linux common-glibc powerpc-common powerpc-linux",\
57                "ppc64-linux":             "endian-big bit-64 common-linux common-glibc powerpc-common powerpc64-linux",\
58                "powerpc-linux":           "endian-big bit-32 common-linux common-glibc powerpc-common",\
59                "powerpc-linux-gnuspe":       "endian-big bit-32 common-linux common-glibc powerpc-common powerpc-linux",\
60                "powerpc-linux-uclibc":    "endian-big bit-32 common-linux common-uclibc powerpc-common",\
61                "powerpc-linux-uclibcspe": "endian-big bit-32 common-linux common-uclibc powerpc-common powerpc-linux-uclibc",\
62                "sh3-linux":               "endian-little bit-32 common-linux common-glibc sh-common",\
63                "sh4-linux":               "endian-little bit-32 common-linux common-glibc sh-common",\
64                "sh4-linux-uclibc":        "endian-little bit-32 common-linux common-uclibc sh-common",\
65                "sparc-linux":         "endian-big bit-32 common-linux common-glibc",\
66                "viac3-linux":         "endian-little bit-32 common-linux common-glibc ix86-common",\
67                "x86_64-linux":            "endian-little bit-64 common-linux common-glibc",\
68                "x86_64-linux-uclibc":     "endian-little bit-64 common-linux common-uclibc"}
69        if target in targetinfo:
70                info = targetinfo[target].split()
71                info.append(target)
72                info.append("common")
73                return info
74        else:
75                bb.error("Information not available for target '%s'" % target)
76
77
78 #
79 # Define which site files to use. We check for several site files and
80 # use each one that is found, based on the list returned by get_siteinfo_list()
81 #
82 # Search for the files in the following directories:
83 # 1) ${BBPATH}/site (in reverse) - app specific, then site wide
84 # 2) ${FILE_DIRNAME}/site-${PV}         - app version specific
85 #
86 def siteinfo_get_files(d):
87        sitefiles = ""
88
89        # Determine which site files to look for
90        sites = get_siteinfo_list(d)
91        sites.append("common");
92
93        # Check along bbpath for site files and append in reverse order so
94        # the application specific sites files are last and system site
95        # files first.
96        path_bb = bb.data.getVar('BBPATH', d, 1)
97        for p in (path_bb or "").split(':'):
98                tmp = ""
99                for i in sites:
100                        fname = os.path.join(p, 'site', i)
101                        if os.path.exists(fname):
102                                tmp += fname + " "
103                sitefiles = tmp + sitefiles;
104
105        # Now check for the applications version specific site files
106        path_pkgv = os.path.join(bb.data.getVar('FILE_DIRNAME', d, 1), "site-" + bb.data.getVar('PV', d, 1))
107        for i in sites:
108                fname = os.path.join(path_pkgv, i)
109                if os.path.exists(fname):
110                        sitefiles += fname + " "
111
112        bb.debug(1, "SITE files " + sitefiles);
113        return sitefiles
114
115 #
116 # Export CONFIG_SITE to the enviroment. The autotools will make use
117 # of this to determine where to load in variables from. This is a
118 # space seperate list of shell scripts processed in the order listed.
119 #
120 export CONFIG_SITE = "${@siteinfo_get_files(d)}"
121
122
123 def siteinfo_get_endianess(d):
124        info = get_siteinfo_list(d)
125        if 'endian-little' in info:
126               return "le"
127        elif 'endian-big' in info:
128               return "be"
129        bb.error("Site info could not determine endianess for target")
130
131 def siteinfo_get_bits(d):
132        info = get_siteinfo_list(d)
133        if 'bit-32' in info:
134               return "32"
135        elif 'bit-64' in info:
136               return "64"
137        bb.error("Site info could not determine bit size for target")
138
139 #
140 # Make some information available via variables
141 #
142 SITEINFO_ENDIANESS  = "${@siteinfo_get_endianess(d)}"
143 SITEINFO_BITS       = "${@siteinfo_get_bits(d)}"
144
145