diff options
author | Khem Raj <raj.khem@gmail.com> | 2012-08-15 23:18:55 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-21 12:15:32 +0100 |
commit | 9a33e7b9a81fd4e6c2bbe2eb832b55d1da998d6b (patch) | |
tree | ec12950a760b95090cac7dc22441a45a2f76ffe9 /meta/recipes-core/uclibc/uclibc-config.inc | |
parent | 48df3fe947c4d900aa6b66d9d8352c0d9e59ebe4 (diff) | |
download | poky-9a33e7b9a81fd4e6c2bbe2eb832b55d1da998d6b.tar.gz |
uclibc.inc,uclibc-config.inc: Untabify python snippets
To appease bitbake
(From OE-Core rev: cf975073a11c93f4a9fb5bdd72c16dc0ca9c3c54)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/uclibc/uclibc-config.inc')
-rw-r--r-- | meta/recipes-core/uclibc/uclibc-config.inc | 128 |
1 files changed, 71 insertions, 57 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-config.inc b/meta/recipes-core/uclibc/uclibc-config.inc index 265626c38d..fd36fa593a 100644 --- a/meta/recipes-core/uclibc/uclibc-config.inc +++ b/meta/recipes-core/uclibc/uclibc-config.inc | |||
@@ -32,84 +32,98 @@ x86_64 \ | |||
32 | xtensa \ | 32 | xtensa \ |
33 | " | 33 | " |
34 | def map_uclibc_arch(a, d): | 34 | def map_uclibc_arch(a, d): |
35 | """Return the uClibc architecture for the given TARGET_ARCH.""" | 35 | """Return the uClibc architecture for the given TARGET_ARCH.""" |
36 | import re | 36 | import re |
37 | 37 | ||
38 | valid_archs = d.getVar('valid_archs', True).split() | 38 | valid_archs = d.getVar('valid_archs', True).split() |
39 | 39 | ||
40 | if re.match('^(arm|sa110).*', a): return 'arm' | 40 | if re.match('^(arm|sa110).*', a): |
41 | elif re.match('^(i.86|athlon)$', a): return 'i386' | 41 | return 'arm' |
42 | elif re.match('^mips.*', a): return 'mips' | 42 | elif re.match('^(i.86|athlon)$', a): |
43 | elif re.match('^parisc.*', a): return 'hppa' | 43 | return 'i386' |
44 | elif re.match('^ppc.*', a): return 'powerpc' | 44 | elif re.match('^mips.*', a): |
45 | elif re.match('^s390.*', a): return 's390' | 45 | return 'mips' |
46 | elif re.match('^sh.*', a): return 'sh' | 46 | elif re.match('^parisc.*', a): |
47 | elif re.match('^(sun|sparc).*', a): return 'sparc' | 47 | return 'hppa' |
48 | elif re.match('^xtensa.*', a): return 'xtensa' | 48 | elif re.match('^ppc.*', a): |
49 | elif a in valid_archs: return a | 49 | return 'powerpc' |
50 | else: | 50 | elif re.match('^s390.*', a): |
51 | bb.error("cannot map '%s' to a uClibc architecture" % a) | 51 | return 's390' |
52 | elif re.match('^sh.*', a): | ||
53 | return 'sh' | ||
54 | elif re.match('^(sun|sparc).*', a): | ||
55 | return 'sparc' | ||
56 | elif re.match('^xtensa.*', a): | ||
57 | return 'xtensa' | ||
58 | elif a in valid_archs: | ||
59 | return a | ||
60 | else: | ||
61 | bb.error("cannot map '%s' to a uClibc architecture" % a) | ||
52 | 62 | ||
53 | export UCLIBC_ARCH = "${@map_uclibc_arch(d.getVar('TARGET_ARCH', True), d)}" | 63 | export UCLIBC_ARCH = "${@map_uclibc_arch(d.getVar('TARGET_ARCH', True), d)}" |
54 | 64 | ||
55 | def map_uclibc_abi(o, d): | 65 | def map_uclibc_abi(o, d): |
56 | """Return the uClibc ABI for the given TARGET_OS.""" | 66 | """Return the uClibc ABI for the given TARGET_OS.""" |
57 | import re | 67 | import re |
58 | 68 | ||
59 | arch = d.getVar('TARGET_ARCH', True) | 69 | arch = d.getVar('TARGET_ARCH', True) |
60 | if map_uclibc_arch(d.getVar('TARGET_ARCH', True), d) == "arm": | 70 | if map_uclibc_arch(d.getVar('TARGET_ARCH', True), d) == "arm": |
61 | if re.match('.*eabi$', o): return 'ARM_EABI' | 71 | if re.match('.*eabi$', o): |
62 | else: return 'ARM_OABI' | 72 | return 'ARM_EABI' |
63 | # FIXME: This is inaccurate! Handle o32, n32, n64 | 73 | else: |
64 | elif re.match('^mips.*64$', arch): return 'MIPS_N64_ABI' | 74 | return 'ARM_OABI' |
65 | elif re.match('^mips.*', arch): return 'MIPS_O32_ABI' | 75 | # FIXME: This is inaccurate! Handle o32, n32, n64 |
66 | return "" | 76 | elif re.match('^mips.*64$', arch): |
77 | return 'MIPS_N64_ABI' | ||
78 | elif re.match('^mips.*', arch): | ||
79 | return 'MIPS_O32_ABI' | ||
80 | return "" | ||
67 | 81 | ||
68 | export UCLIBC_ABI = "${@map_uclibc_abi(d.getVar('TARGET_OS', True), d)}" | 82 | export UCLIBC_ABI = "${@map_uclibc_abi(d.getVar('TARGET_OS', True), d)}" |
69 | 83 | ||
70 | def map_uclibc_endian(a, d): | 84 | def map_uclibc_endian(a, d): |
71 | """Return the uClibc endianess for the given TARGET_ARCH.""" | 85 | """Return the uClibc endianess for the given TARGET_ARCH.""" |
72 | import re | 86 | import re |
73 | 87 | ||
74 | # Always BE | 88 | # Always BE |
75 | if re.match('^(avr32|e1|frv|(parisc|hppa)|m68k|microblaze|powerpc.*|(sparc|sun).*)$', a): | 89 | if re.match('^(avr32|e1|frv|(parisc|hppa)|m68k|microblaze|powerpc.*|(sparc|sun).*)$', a): |
76 | return 'BIG' | 90 | return 'BIG' |
77 | # Possibly BE | 91 | # Possibly BE |
78 | elif re.match('^(((arm|sa110).*eb)|h8300.*eb|(parisc|hppa).*eb|mips|mips64|sh.*eb|xtensa.*eb)$', a): | 92 | elif re.match('^(((arm|sa110).*eb)|h8300.*eb|(parisc|hppa).*eb|mips|mips64|sh.*eb|xtensa.*eb)$', a): |
79 | return 'BIG' | 93 | return 'BIG' |
80 | return 'LITTLE' | 94 | return 'LITTLE' |
81 | 95 | ||
82 | export UCLIBC_ENDIAN = "${@map_uclibc_endian(d.getVar('TARGET_ARCH', True), d)}" | 96 | export UCLIBC_ENDIAN = "${@map_uclibc_endian(d.getVar('TARGET_ARCH', True), d)}" |
83 | 97 | ||
84 | # internal helper | 98 | # internal helper |
85 | def uclibc_cfg(feature, features, tokens, cnf, rem): | 99 | def uclibc_cfg(feature, features, tokens, cnf, rem): |
86 | if type(tokens) == type(""): | 100 | if type(tokens) == type(""): |
87 | tokens = [tokens] | 101 | tokens = [tokens] |
88 | rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens]) | 102 | rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens]) |
89 | if type(features) == type([]) and feature in features: | 103 | if type(features) == type([]) and feature in features: |
90 | cnf.extend([token + '=y' for token in tokens]) | 104 | cnf.extend([token + '=y' for token in tokens]) |
91 | else: | 105 | else: |
92 | cnf.extend(['# ' + token + ' is not set' for token in tokens]) | 106 | cnf.extend(['# ' + token + ' is not set' for token in tokens]) |
93 | 107 | ||
94 | # Map distro features to config settings | 108 | # Map distro features to config settings |
95 | def features_to_uclibc_settings(d): | 109 | def features_to_uclibc_settings(d): |
96 | cnf, rem = ([], []) | 110 | cnf, rem = ([], []) |
97 | distro_features = d.getVar('DISTRO_FEATURES', True).split() | 111 | distro_features = d.getVar('DISTRO_FEATURES', True).split() |
98 | uclibc_cfg('ipv4', distro_features, 'UCLIBC_HAS_IPV4', cnf, rem) | 112 | uclibc_cfg('ipv4', distro_features, 'UCLIBC_HAS_IPV4', cnf, rem) |
99 | uclibc_cfg('ipv6', distro_features, 'UCLIBC_HAS_IPV6', cnf, rem) | 113 | uclibc_cfg('ipv6', distro_features, 'UCLIBC_HAS_IPV6', cnf, rem) |
100 | uclibc_cfg('largefile', distro_features, 'UCLIBC_HAS_LFS', cnf, rem) | 114 | uclibc_cfg('largefile', distro_features, 'UCLIBC_HAS_LFS', cnf, rem) |
101 | uclibc_cfg('nls', distro_features, 'UCLIBC_HAS_LOCALE', cnf, rem) | 115 | uclibc_cfg('nls', distro_features, 'UCLIBC_HAS_LOCALE', cnf, rem) |
102 | uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem) | 116 | uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem) |
103 | uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem) | 117 | uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem) |
104 | uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem) | 118 | uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem) |
105 | uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem) | 119 | uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem) |
106 | uclibc_cfg('libc-posix-clang-wchar', distro_features,'UCLIBC_HAS_WCHAR', cnf, rem) | 120 | uclibc_cfg('libc-posix-clang-wchar', distro_features,'UCLIBC_HAS_WCHAR', cnf, rem) |
107 | return "\n".join(cnf), "\n".join(rem) | 121 | return "\n".join(cnf), "\n".join(rem) |
108 | # X, Y = ${@features_to_uclibc_settings(d)} | 122 | # X, Y = ${@features_to_uclibc_settings(d)} |
109 | # unfortunately doesn't seem to work with bitbake, workaround: | 123 | # unfortunately doesn't seem to work with bitbake, workaround: |
110 | def features_to_uclibc_conf(d): | 124 | def features_to_uclibc_conf(d): |
111 | cnf, rem = features_to_uclibc_settings(d) | 125 | cnf, rem = features_to_uclibc_settings(d) |
112 | return cnf | 126 | return cnf |
113 | def features_to_uclibc_del(d): | 127 | def features_to_uclibc_del(d): |
114 | cnf, rem = features_to_uclibc_settings(d) | 128 | cnf, rem = features_to_uclibc_settings(d) |
115 | return rem | 129 | return rem |