diff options
Diffstat (limited to 'meta/recipes-core/eglibc/eglibc-options.inc')
-rw-r--r-- | meta/recipes-core/eglibc/eglibc-options.inc | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/meta/recipes-core/eglibc/eglibc-options.inc b/meta/recipes-core/eglibc/eglibc-options.inc new file mode 100644 index 0000000000..c55d05d163 --- /dev/null +++ b/meta/recipes-core/eglibc/eglibc-options.inc | |||
@@ -0,0 +1,128 @@ | |||
1 | def eglibc_cfg(feature, features, tokens, cnf): | ||
2 | if type(tokens) == type(""): | ||
3 | tokens = [tokens] | ||
4 | if type(features) == type([]) and feature in features: | ||
5 | cnf.extend([token + '=y' for token in tokens]) | ||
6 | else: | ||
7 | for token in tokens: | ||
8 | cnf.extend([token + '=n']) | ||
9 | if token == 'OPTION_EGLIBC_NSSWITCH': | ||
10 | cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG=\"${S}/nss/nsswitch.conf\""]) | ||
11 | cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS=\"${S}/nss/fixed-nsswitch.functions\""]) | ||
12 | |||
13 | # arrange the dependencies among eglibc configuable options according to file option-groups.def from eglibc source code | ||
14 | def distro_features_check_deps(distro_features): | ||
15 | new_dep = True | ||
16 | while new_dep: | ||
17 | new_dep = False | ||
18 | |||
19 | if 'ipv6' in distro_features and 'ipv4' not in distro_features: | ||
20 | new_dep = True | ||
21 | distro_features.extend(['ipv4']) | ||
22 | |||
23 | if 'ipv4' in distro_features and 'libc-nsswitch' not in distro_features: | ||
24 | new_dep = True | ||
25 | distro_features.extend(['libc-nsswitch']) | ||
26 | |||
27 | if 'libc-cxx-tests' in distro_features: | ||
28 | if 'libc-posix-wchar-io' not in distro_features: | ||
29 | new_dep = True | ||
30 | distro_features.extend(['libc-posix-wchar-io']) | ||
31 | if 'libc-libm' not in distro_features: | ||
32 | new_dep = True | ||
33 | distro_features.extend(['libc-libm']) | ||
34 | |||
35 | if 'libc-catgets' in distro_features and 'libc-locale-code' not in distro_features: | ||
36 | new_dep = True | ||
37 | distro_features.extend(['libc-locale-code']) | ||
38 | |||
39 | if 'libc-crypt-ufc' in distro_features and 'libc-crypt' not in distro_features: | ||
40 | new_dep = True | ||
41 | distro_features.extend(['libc-crypt']) | ||
42 | |||
43 | if 'libc-getlogin' in distro_features and 'libc-utmp' not in distro_features: | ||
44 | new_dep = True | ||
45 | distro_features.extend(['libc-utmp']) | ||
46 | |||
47 | if 'libc-inet-anl' in distro_features and 'ipv4' not in distro_features: | ||
48 | new_dep = True | ||
49 | distro_features.extend(['ipv4']) | ||
50 | |||
51 | if 'libc-locale-code' in distro_features and 'libc-posix-clang-wchar' not in distro_features: | ||
52 | new_dep = True | ||
53 | distro_features.extend(['libc-posix-clang-wchar']) | ||
54 | |||
55 | if 'libc-nis' in distro_features: | ||
56 | if 'ipv4' not in distro_features: | ||
57 | new_dep = True | ||
58 | distro_features.extend(['ipv4']) | ||
59 | if 'libc-sunrpc' not in distro_features: | ||
60 | new_dep = True | ||
61 | distro_features.extend(['libc-sunrpc']) | ||
62 | |||
63 | if 'libc-rcmd' in distro_features and 'ipv4' not in distro_features: | ||
64 | new_dep = True | ||
65 | distro_features.extend(['ipv4']) | ||
66 | |||
67 | if 'libc-sunrpc' in distro_features and 'ipv4' not in distro_features: | ||
68 | new_dep = True | ||
69 | distro_features.extend(['ipv4']) | ||
70 | |||
71 | if 'libc-utmpx' in distro_features and 'libc-utmp' not in distro_features: | ||
72 | new_dep = True | ||
73 | distro_features.extend(['libc-utmp']) | ||
74 | |||
75 | if 'libc-posix-regexp-glibc' in distro_features and 'libc-posix-regexp' not in distro_features: | ||
76 | new_dep = True | ||
77 | distro_features.extend(['libc-posix-regexp']) | ||
78 | |||
79 | if 'libc-posix-wchar-io' in distro_features and 'libc-posix-clang-wchar' not in distro_features: | ||
80 | new_dep = True | ||
81 | distro_features.extend(['libc-posix-clang-wchar']) | ||
82 | |||
83 | # Map distro features to eglibc options settings | ||
84 | def features_to_eglibc_settings(d): | ||
85 | cnf = ([]) | ||
86 | distro_features = (d.getVar('DISTRO_FEATURES', True) or '').split() | ||
87 | |||
88 | distro_features_check_deps(distro_features) | ||
89 | |||
90 | eglibc_cfg('ipv6', distro_features, 'OPTION_EGLIBC_ADVANCED_INET6', cnf) | ||
91 | eglibc_cfg('libc-backtrace', distro_features, 'OPTION_EGLIBC_BACKTRACE', cnf) | ||
92 | eglibc_cfg('libc-big-macros', distro_features, 'OPTION_EGLIBC_BIG_MACROS', cnf) | ||
93 | eglibc_cfg('libc-bsd', distro_features, 'OPTION_EGLIBC_BSD', cnf) | ||
94 | eglibc_cfg('libc-cxx-tests', distro_features, 'OPTION_EGLIBC_CXX_TESTS', cnf) | ||
95 | eglibc_cfg('libc-catgets', distro_features, 'OPTION_EGLIBC_CATGETS', cnf) | ||
96 | eglibc_cfg('libc-charsets', distro_features, 'OPTION_EGLIBC_CHARSETS', cnf) | ||
97 | eglibc_cfg('libc-crypt', distro_features, 'OPTION_EGLIBC_CRYPT', cnf) | ||
98 | eglibc_cfg('libc-crypt-ufc', distro_features, 'OPTION_EGLIBC_CRYPT_UFC', cnf) | ||
99 | eglibc_cfg('libc-db-aliases', distro_features, 'OPTION_EGLIBC_DB_ALIASES', cnf) | ||
100 | eglibc_cfg('libc-envz', distro_features, 'OPTION_EGLIBC_ENVZ', cnf) | ||
101 | eglibc_cfg('libc-fcvt', distro_features, 'OPTION_EGLIBC_FCVT', cnf) | ||
102 | eglibc_cfg('libc-fmtmsg', distro_features, 'OPTION_EGLIBC_FMTMSG', cnf) | ||
103 | eglibc_cfg('libc-fstab', distro_features, 'OPTION_EGLIBC_FSTAB', cnf) | ||
104 | eglibc_cfg('libc-ftraverse', distro_features, 'OPTION_EGLIBC_FTRAVERSE', cnf) | ||
105 | eglibc_cfg('libc-getlogin', distro_features, 'OPTION_EGLIBC_GETLOGIN', cnf) | ||
106 | eglibc_cfg('libc-idn', distro_features, 'OPTION_EGLIBC_IDN', cnf) | ||
107 | eglibc_cfg('ipv4', distro_features, 'OPTION_EGLIBC_INET', cnf) | ||
108 | eglibc_cfg('libc-inet-anl', distro_features, 'OPTION_EGLIBC_INET_ANL', cnf) | ||
109 | eglibc_cfg('libc-libm', distro_features, 'OPTION_EGLIBC_LIBM', cnf) | ||
110 | eglibc_cfg('libc-locales', distro_features, 'OPTION_EGLIBC_LOCALES', cnf) | ||
111 | eglibc_cfg('libc-locale-code', distro_features, 'OPTION_EGLIBC_LOCALE_CODE', cnf) | ||
112 | eglibc_cfg('libc-memusage', distro_features, 'OPTION_EGLIBC_MEMUSAGE', cnf) | ||
113 | eglibc_cfg('libc-nis', distro_features, 'OPTION_EGLIBC_NIS', cnf) | ||
114 | eglibc_cfg('libc-nsswitch', distro_features, 'OPTION_EGLIBC_NSSWITCH', cnf) | ||
115 | eglibc_cfg('libc-rcmd', distro_features, 'OPTION_EGLIBC_RCMD', cnf) | ||
116 | eglibc_cfg('libc-rtld-debug', distro_features, 'OPTION_EGLIBC_RTLD_DEBUG', cnf) | ||
117 | eglibc_cfg('libc-spawn', distro_features, 'OPTION_EGLIBC_SPAWN', cnf) | ||
118 | eglibc_cfg('libc-streams', distro_features, 'OPTION_EGLIBC_STREAMS', cnf) | ||
119 | eglibc_cfg('libc-sunrpc', distro_features, 'OPTION_EGLIBC_SUNRPC', cnf) | ||
120 | eglibc_cfg('libc-utmp', distro_features, 'OPTION_EGLIBC_UTMP', cnf) | ||
121 | eglibc_cfg('libc-utmpx', distro_features, 'OPTION_EGLIBC_UTMPX', cnf) | ||
122 | eglibc_cfg('libc-wordexp', distro_features, 'OPTION_EGLIBC_WORDEXP', cnf) | ||
123 | eglibc_cfg('libc-posix-clang-wchar', distro_features, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf) | ||
124 | eglibc_cfg('libc-posix-regexp', distro_features, 'OPTION_POSIX_REGEXP', cnf) | ||
125 | eglibc_cfg('libc-posix-regexp-glibc', distro_features, 'OPTION_POSIX_REGEXP_GLIBC', cnf) | ||
126 | eglibc_cfg('libc-posix-wchar-io', distro_features, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf) | ||
127 | |||
128 | return "\n".join(cnf) | ||