qmake2: Define env var for strip. Convert to use INC_PR.
[openembedded.git] / classes / siteinfo.bbclass
bloba18ada16ba9caa71280cb2ada467afc4c3a7c360
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.
6 # Returns information about 'what' for the named target 'target'
7 # where 'target' == "<arch>-<os>"
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
15 # It is an error for the target not to exist.
16 # If 'what' doesn't exist then an empty value is returned
18 def siteinfo_data(d):
19     archinfo = {
20         "arm": "endian-little bit-32 arm-common",
21         "armeb": "endian-big bit-32 arm-common",
22         "avr32": "endian-big bit-32 avr32-common",
23         "bfin": "endian-little bit-32 bfin-common",
24         "i386": "endian-little bit-32 ix86-common",
25         "i486": "endian-little bit-32 ix86-common",
26         "i586": "endian-little bit-32 ix86-common",
27         "i686": "endian-little bit-32 ix86-common",
28         "ia64": "endian-little bit-64",
29         "mips": "endian-big bit-32 mips-common",
30         "mips64": "endian-big bit-64 mips64-common",
31         "mips64el": "endian-little bit-64 mips64-common",
32         "mipsel": "endian-little bit-32 mips-common",
33         "powerpc": "endian-big bit-32 powerpc-common",
34         "nios2": "endian-little bit-32 nios2-common",
35         "powerpc64": "endian-big bit-64 powerpc-common powerpc64-linux",
36         "ppc": "endian-big bit-32 powerpc-common",
37         "ppc64": "endian-big bit-64 powerpc-common powerpc64-linux",
38         "sh3": "endian-little bit-32 sh-common",
39         "sh4": "endian-little bit-32 sh-common",
40         "sparc": "endian-big bit-32",
41         "viac3": "endian-little bit-32 ix86-common",
42         "x86_64": "endian-little bit-64",
43     }
44     osinfo = {
45         "darwin": "common-darwin",
46         "darwin9": "common-darwin",
47         "linux": "common-linux common-glibc",
48         "linux-gnu": "common-linux common-glibc",
49         "linux-gnueabi": "common-linux common-glibc",
50         "linux-gnuspe": "common-linux common-glibc",
51         "linux-uclibc": "common-linux common-uclibc",
52         "linux-uclibceabi": "common-linux common-uclibc",
53         "linux-uclibcspe": "common-linux common-uclibc",
54         "uclinux-uclibc": "common-uclibc",
55         "cygwin": "common-cygwin",
56         "mingw32": "common-mingw",
57     }
58     targetinfo = {
59         "arm-linux-gnueabi":    "arm-linux",
60         "arm-linux-uclibceabi":    "arm-linux-uclibc",
61         "armeb-linux-gnueabi":     "armeb-linux",
62         "armeb-linux-uclibceabi":  "armeb-linux-uclibc",
63         "powerpc-linux-gnuspe":    "powerpc-linux",
64         "powerpc-linux-uclibcspe": "powerpc-linux-uclibc",
65     }
67     arch = d.getVar("HOST_ARCH", True)
68     os = d.getVar("HOST_OS", True)
69     target = "%s-%s" % (arch, os)
71     sitedata = []
72     if arch in archinfo:
73         sitedata.extend(archinfo[arch].split())
74     if os in osinfo:
75         sitedata.extend(osinfo[os].split())
76     if target in targetinfo:
77         sitedata.extend(targetinfo[target].split())
78     sitedata.append(target)
79     sitedata.append("common")
81     return sitedata
83 python () {
84     sitedata = set(siteinfo_data(d))
85     if "endian-little" in sitedata:
86         d.setVar("SITEINFO_ENDIANNESS", "le")
87     elif "endian-big" in sitedata:
88         d.setVar("SITEINFO_ENDIANNESS", "be")
89     else:
90         bb.error("Unable to determine endianness for architecture '%s'" %
91                  d.getVar("HOST_ARCH", True))
92         bb.fatal("Please add your architecture to siteinfo.bbclass")
94     if "bit-32" in sitedata:
95         d.setVar("SITEINFO_BITS", "32")
96     elif "bit-64" in sitedata:
97         d.setVar("SITEINFO_BITS", "64")
98     else:
99         bb.error("Unable to determine bit size for architecture '%s'" %
100                  d.getVar("HOST_ARCH", True))
101         bb.fatal("Please add your architecture to siteinfo.bbclass")