diff options
Diffstat (limited to 'meta/recipes-core/uclibc/uclibc-config.inc')
-rw-r--r-- | meta/recipes-core/uclibc/uclibc-config.inc | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-config.inc b/meta/recipes-core/uclibc/uclibc-config.inc deleted file mode 100644 index 8b9e41c64d..0000000000 --- a/meta/recipes-core/uclibc/uclibc-config.inc +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | DEPENDS += "kern-tools-native" | ||
2 | inherit cml1 | ||
3 | # | ||
4 | # Set the ARCH environment variable for uClibc compilation. | ||
5 | # Return value must match one of the architectures known to uClibc: | ||
6 | # libc/sysdeps/*/* | ||
7 | # | ||
8 | |||
9 | valid_archs = "\ | ||
10 | alpha \ | ||
11 | arm \ | ||
12 | avr32 \ | ||
13 | bfin \ | ||
14 | c6x \ | ||
15 | cris \ | ||
16 | e1 \ | ||
17 | frv \ | ||
18 | h8300 \ | ||
19 | hppa \ | ||
20 | i386 \ | ||
21 | i960 \ | ||
22 | ia64 \ | ||
23 | m68k \ | ||
24 | microblaze \ | ||
25 | mips \ | ||
26 | nios \ | ||
27 | nios2 \ | ||
28 | powerpc \ | ||
29 | sh \ | ||
30 | sh64 \ | ||
31 | sparc \ | ||
32 | v850 \ | ||
33 | vax \ | ||
34 | x86_64 \ | ||
35 | xtensa \ | ||
36 | " | ||
37 | def map_uclibc_arch(a, d): | ||
38 | """Return the uClibc architecture for the given TARGET_ARCH.""" | ||
39 | import re | ||
40 | |||
41 | valid_archs = d.getVar('valid_archs', True).split() | ||
42 | |||
43 | if re.match('^(arm|sa110).*', a): | ||
44 | return 'arm' | ||
45 | elif re.match('^(i.86|athlon)$', a): | ||
46 | return 'i386' | ||
47 | elif re.match('^mips.*', a): | ||
48 | return 'mips' | ||
49 | elif re.match('^parisc.*', a): | ||
50 | return 'hppa' | ||
51 | elif re.match('^ppc.*', a): | ||
52 | return 'powerpc' | ||
53 | elif re.match('^s390.*', a): | ||
54 | return 's390' | ||
55 | elif re.match('^sh.*', a): | ||
56 | return 'sh' | ||
57 | elif re.match('^(sun|sparc).*', a): | ||
58 | return 'sparc' | ||
59 | elif re.match('^xtensa.*', a): | ||
60 | return 'xtensa' | ||
61 | elif a in valid_archs: | ||
62 | return a | ||
63 | else: | ||
64 | bb.error("cannot map '%s' to a uClibc architecture" % a) | ||
65 | |||
66 | export UCLIBC_ARCH = "${@map_uclibc_arch(d.getVar('TARGET_ARCH', True), d)}" | ||
67 | |||
68 | def map_uclibc_abi(o, d): | ||
69 | """Return the uClibc ABI for the given TARGET_OS.""" | ||
70 | import re | ||
71 | |||
72 | arch = d.getVar('TARGET_ARCH', True) | ||
73 | if map_uclibc_arch(d.getVar('TARGET_ARCH', True), d) == "arm": | ||
74 | if re.match('.*eabi$', o): | ||
75 | return 'ARM_EABI' | ||
76 | else: | ||
77 | return 'ARM_OABI' | ||
78 | # FIXME: This is inaccurate! Handle o32, n32, n64 | ||
79 | elif re.match('^mips.*64$', arch): | ||
80 | return 'MIPS_N64_ABI' | ||
81 | elif re.match('^mips.*', arch): | ||
82 | return 'MIPS_O32_ABI' | ||
83 | return "" | ||
84 | |||
85 | export UCLIBC_ABI = "${@map_uclibc_abi(d.getVar('TARGET_OS', True), d)}" | ||
86 | |||
87 | def map_uclibc_endian(a, d): | ||
88 | """Return the uClibc endianess for the given TARGET_ARCH.""" | ||
89 | import re | ||
90 | |||
91 | # Always BE | ||
92 | if re.match('^(avr32|e1|frv|(parisc|hppa)|m68k|microblaze|powerpc.*|(sparc|sun).*)$', a): | ||
93 | return 'BIG' | ||
94 | # Possibly BE | ||
95 | elif re.match('^(((arm|sa110).*eb)|h8300.*eb|(parisc|hppa).*eb|mips|mips64|sh.*eb|xtensa.*eb)$', a): | ||
96 | return 'BIG' | ||
97 | return 'LITTLE' | ||
98 | |||
99 | export UCLIBC_ENDIAN = "${@map_uclibc_endian(d.getVar('TARGET_ARCH', True), d)}" | ||
100 | |||
101 | # internal helper | ||
102 | def uclibc_cfg(feature, features, tokens, cnf, rem): | ||
103 | if type(tokens) == type(""): | ||
104 | tokens = [tokens] | ||
105 | rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens]) | ||
106 | if type(features) == type([]) and feature in features: | ||
107 | cnf.extend([token + '=y' for token in tokens]) | ||
108 | else: | ||
109 | cnf.extend(['# ' + token + ' is not set' for token in tokens]) | ||
110 | |||
111 | # Map distro features to config settings | ||
112 | def features_to_uclibc_settings(d): | ||
113 | cnf, rem = ([], []) | ||
114 | distro_features = d.getVar('DISTRO_FEATURES', True).split() | ||
115 | uclibc_cfg('ipv4', distro_features, 'UCLIBC_HAS_IPV4', cnf, rem) | ||
116 | uclibc_cfg('ipv6', distro_features, 'UCLIBC_HAS_IPV6', cnf, rem) | ||
117 | uclibc_cfg('largefile', distro_features, 'UCLIBC_HAS_LFS', cnf, rem) | ||
118 | uclibc_cfg('nls', distro_features, 'UCLIBC_HAS_LOCALE', cnf, rem) | ||
119 | uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem) | ||
120 | uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem) | ||
121 | uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem) | ||
122 | uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem) | ||
123 | uclibc_cfg('libc-posix-clang-wchar', distro_features,'UCLIBC_HAS_WCHAR', cnf, rem) | ||
124 | return "\n".join(cnf), "\n".join(rem) | ||
125 | # X, Y = ${@features_to_uclibc_settings(d)} | ||
126 | # unfortunately doesn't seem to work with bitbake, workaround: | ||
127 | def features_to_uclibc_conf(d): | ||
128 | cnf, rem = features_to_uclibc_settings(d) | ||
129 | return cnf | ||
130 | def features_to_uclibc_del(d): | ||
131 | cnf, rem = features_to_uclibc_settings(d) | ||
132 | return rem | ||
133 | |||
134 | # returns all the elements from the src uri that are .cfg files | ||
135 | def find_cfgs(d): | ||
136 | sources=src_patches(d, True) | ||
137 | sources_list=[] | ||
138 | for s in sources: | ||
139 | if s.endswith('.cfg'): | ||
140 | sources_list.append(s) | ||
141 | |||
142 | return sources_list | ||