[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patches] int/hex/string option types



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.

--
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

 malloc/Makefile                   |    4 ----
 option-groups.def                 |   21 +++++++++++++++------
 options-config/config-postproc.pl |   16 ++++++++++------
 scripts/option-groups.awk         |   10 +++++++---
 4 files changed, 32 insertions(+), 19 deletions(-)

diff -Nupbar -X /home/stevel/dontdiff eglibc.orig/libc/malloc/Makefile eglibc/libc/malloc/Makefile
--- eglibc.orig/libc/malloc/Makefile	2011-11-02 18:09:04.087690718 -0700
+++ eglibc/libc/malloc/Makefile	2011-11-23 11:05:51.463544028 -0800
@@ -48,10 +48,6 @@ non-lib.a := libmcheck.a
 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
diff -Nupbar -X /home/stevel/dontdiff eglibc.orig/libc/option-groups.def eglibc/libc/option-groups.def
--- eglibc.orig/libc/option-groups.def	2011-11-22 17:45:20.447158205 -0800
+++ eglibc/libc/option-groups.def	2011-11-23 15:21:55.823911212 -0800
@@ -513,8 +513,11 @@ config EGLIBC_MEMUSAGE
        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 @@ config EGLIBC_NSSWITCH
        '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 @@ config EGLIBC_NSSWITCH
           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
diff -Nupbar -X /home/stevel/dontdiff eglibc.orig/libc/options-config/config-postproc.pl eglibc/libc/options-config/config-postproc.pl
--- eglibc.orig/libc/options-config/config-postproc.pl	2011-11-22 17:09:41.768826502 -0800
+++ eglibc/libc/options-config/config-postproc.pl	2011-11-23 15:01:04.877717837 -0800
@@ -8,7 +8,7 @@ die "$usage" unless @ARGV;
 die "Could not open $ARGV[0]" unless -T $ARGV[0];
 
 sub yank {
-    @option = grep($_ ne $_[0], @option);
+    @option = grep(!($_ =~ /$_[0]/), @option);
 }
 
 open(DEFAULTS, $defaults) || die "Could not open $defaults\n";
@@ -16,7 +16,7 @@ open(DEFAULTS, $defaults) || die "Could
 # 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 @@ while (<>) {
 	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 @@ while (<>) {
     }
 }
 
-# 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";
+    }
 }
diff -Nupbar -X /home/stevel/dontdiff eglibc.orig/libc/scripts/option-groups.awk eglibc/libc/scripts/option-groups.awk
--- eglibc.orig/libc/scripts/option-groups.awk	2011-11-22 17:32:21.356911312 -0800
+++ eglibc/libc/scripts/option-groups.awk	2011-11-23 15:08:37.792003410 -0800
@@ -46,9 +46,13 @@ END {
                 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*x*[0-9]+/ || vars[var] ~ /\"\w*\"/)
+		 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.
         }
     }
 
_______________________________________________
Patches mailing list
Patches@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/patches