summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch
blob: 7caba48112f0ce7dbcb8f775f27f6fd0b746830f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
pulled from

http://www.eglibc.org/archives/patches/msg01043.html


Upstream-Status: Pending
Signed-off-by: Khem


This patch builds on the menuconfig patch for EGLIBC.


There are a few options that have non-boolean types, that would benefit from the new 'make *config' support:

EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE (int)
EGLIBC_NSSWITCH_FIXED_CONFIG (string)
EGLIBC_NSSWITCH_FIXED_FUNCTIONS (string)


The patch converts these to real options in libc/option-groups.def. Also, libc/scripts/option-groups.awk is modified to output a '#define' line for int, hex, or string options encountered in the config file.

In the post-processing script config-postproc.pl, a small change is needed: for any boolean option FOO that is implicitly disabled in the kconfig output, make sure that option is indeed a boolean before printing the explicit OPTION_FOO=n.

Finally, libc/malloc/Makefile passes __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE as a CPPFLAGS, which is not necessary anymore because this macro will now be present in the generated header.

attached is the updated patch to address above issues.

Steve

--
Steve Longerbeam | Senior Embedded Engineer, ESD Services
Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538
P 510.354.5838 | M 408.410.2735
Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS


Index: libc/malloc/Makefile
===================================================================
--- libc.orig/malloc/Makefile	2012-01-04 22:06:18.000000000 -0800
+++ libc/malloc/Makefile	2012-05-09 19:35:28.598682105 -0700
@@ -48,10 +48,6 @@
 ifeq ($(OPTION_EGLIBC_MEMUSAGE),y)
 extra-libs = libmemusage
 extra-libs-others = $(extra-libs)
-
-ifdef OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-CPPFLAGS-memusage += -D__OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE=$(OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE)
-endif
 endif
 
 libmemusage-routines = memusage
Index: libc/option-groups.def
===================================================================
--- libc.orig/option-groups.def	2012-05-09 19:33:48.398677256 -0700
+++ libc/option-groups.def	2012-05-09 19:35:28.610682107 -0700
@@ -513,8 +513,11 @@
        the `memusage' and `memusagestat' utilities.
        These components provide memory profiling functions.
 
-       EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
-
+config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE
+   int "Memory profiling library buffer size"
+   depends on EGLIBC_MEMUSAGE
+   default "32768"
+   help
        Libmemusage library buffers the profiling data in memory
        before writing it out to disk.  By default, the library
        allocates 1.5M buffer, which can be substantial for some
@@ -553,8 +556,11 @@
        'option-groups.config' file must set the following two
        variables:
 
-       EGLIBC_NSSWITCH_FIXED_CONFIG
-
+config EGLIBC_NSSWITCH_FIXED_CONFIG
+   string "Nsswitch fixed config filename"
+   depends on !EGLIBC_NSSWITCH
+   default ""
+   help
           Set this to the name of a file whose contents observe the
           same syntax as an ordinary '/etc/nsswitch.conf' file.  The
           EGLIBC build process parses this file just as EGLIBC would
@@ -576,8 +582,11 @@
           you will probably want to delete references to databases not
           needed on your system.
 
-       EGLIBC_NSSWITCH_FIXED_FUNCTIONS
-
+config EGLIBC_NSSWITCH_FIXED_FUNCTIONS
+   string "Nsswitch fixed functions filename"
+   depends on !EGLIBC_NSSWITCH
+   default ""
+   help
           The EGLIBC build process uses this file to decide which
           functions to make available from which service libraries.
           The file 'nss/fixed-nsswitch.functions' serves as a sample
Index: libc/options-config/config-postproc.pl
===================================================================
--- libc.orig/options-config/config-postproc.pl	2012-05-09 19:33:36.530676681 -0700
+++ libc/options-config/config-postproc.pl	2012-05-09 19:35:28.610682107 -0700
@@ -8,7 +8,7 @@
 die "Could not open $ARGV[0]" unless -T $ARGV[0];
 
 sub yank {
-    @option = grep($_ ne $_[0], @option);
+    @option = grep(!($_ =~ /$_[0]\s*=/), @option);
 }
 
 open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
@@ -16,7 +16,7 @@
 # get the full list of available options using the default config file
 $i = 0;
 while (<DEFAULTS>) {
-    if (/^\s*OPTION_(\w+)\s*=/) {
+    if (/^\s*OPTION_(\w+\s*=.*$)/) {
 	$option[$i++] = $1;
     }
 }
@@ -35,8 +35,9 @@
 	s/CONFIG_/OPTION_/g;
 	print;
     } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) {
-	# this is a comment line, change CONFIG_ to OPTION_, remove this
-	# option from option list, and convert to explicit OPTION_FOO=n
+	# this is a comment line for an unset boolean option, change CONFIG_
+	# to OPTION_, remove this option from option list, and convert to
+	# explicit OPTION_FOO=n
 	$opt = $1;
 	yank($opt);
 	s/CONFIG_/OPTION_/g;
@@ -46,9 +47,12 @@
     }
 }
 
-# any options left in @options, are options that were not mentioned in
+# any boolean options left in @options, are options that were not mentioned in
 # the config file, and implicitly that means the option must be set =n,
 # so do that here.
 foreach $opt (@option) {
-    print "OPTION_$opt=n\n";
+    if ($opt =~ /=\s*[yn]/) {
+	$opt =~ s/=\s*[yn]/=n/;
+	print "OPTION_$opt\n";
+    }
 }
Index: libc/scripts/option-groups.awk
===================================================================
--- libc.orig/scripts/option-groups.awk	2012-01-04 22:06:00.000000000 -0800
+++ libc/scripts/option-groups.awk	2012-05-09 19:35:28.610682107 -0700
@@ -46,9 +46,15 @@
                 print "#define __" var " 1"
             else if (vars[var] == "n")
                 print "/* #undef __" var " */"
-            # Ignore variables that don't have boolean values.
-            # Ideally, this would be driven by the types given in
-            # option-groups.def.
+	    else if (vars[var] ~ /^[0-9]+/ ||
+		     vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ ||
+		     vars[var] ~ /^\"/)
+		 print "#define __" var " " vars[var]
+	    else
+		print "/* #undef __" var " */"
+            # Ignore variables that don't have boolean, int, hex, or
+	    # string values. Ideally, this would be driven by the types
+	    # given in option-groups.def.
         }
     }