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

[patches] First cut at simple option group support

Here's a first shot at some simple option group support, following the
design outlined earlier on this list:


There's one sample option group implemented, OPTION_CATGETS, which
controls the inclusion of the catopen, catclose, and catgets
functions.  The 'option-groups.def' file will document option groups
as we add them.

One concern that was expressed in internal CodeSourcery discussion is
that while this code resembles the Linux and uClibc configuration
systems, it differs from it sufficiently to invite confusion: whereas
in Linux leaving a boolean or tristate variable unset omits the option
group, in the present EGLIBC option group system, leaving a variable
unset enables the option group.

This was a deliberate choice.  By having eglibc.config list only those
option groups that should be omitted, we make it easier for developers
to avoid breaking binary compatibility as EGLIBC evolves: re-using an
old configuration file with a newer EGLIBC will never shrink the set
of available functions.  It also makes the default configuration ---
all option groups included --- more obvious: it's an empty or omitted
eglibc.config file.

That explained, we'd be happy for the discussion to continue here.

One other point: the OPTION_CATGETS group is *almost* identical to the
the POSIX XSI_I18N option group; the latter also includes nl_langinfo.
We would have preferred to actually implement XSI_I18N, but it wasn't
trivial to disable nl_langinfo, so we elected to post the patch as it
stands, to at least get things started.

Next we're planning to work on placing internationalization support in
an option group, since this is a large component of EGLIBC (and
also contributes a substantial portion of its build time).  We
anticipate this will complicate the component configuration system, as
the i18n support is used within EGLIBC itself, so its omission will
require code to change, not simply be included or omitted.

If discussion is favorable, we'll be committing this patch shortly.

2006-12-08  Jim Blandy  <jimb@xxxxxxxxxxxxxxxx>

	Add rudimentary option group support.
	* option-groups.mak, option-groups.def: New files.
	* Makerules: Add contents of enabled option groups to the values
	of the variables 'routines', 'others', 'install-bin',
	'install-sbin', 'extra-objs', 'tests', and 'test-srcs'.
	* catgets/Makefile: Add the catgets directory's routines and
	programs to the OPTION_CATGETS option group.

Index: glibc-2.5/Makerules
--- glibc-2.5.orig/Makerules	2006-12-08 18:51:01.000000000 -0800
+++ glibc-2.5/Makerules	2006-12-08 18:51:26.000000000 -0800
@@ -405,6 +405,21 @@
+# Handle option groups.
+# We reference both 'routines-y' and 'routines-' because our default
+# is to include option groups that aren't mentioned in the config; an
+# unset OPTION_ variable expands to the empty string.  And similarly
+# for other variables.
+routines     += $(routines-y)     $(routines-)
+others       += $(others-y)       $(others-)
+install-bin  += $(install-bin-y)  $(install-bin-)
+install-sbin += $(install-sbin-y) $(install-sbin-)
+extra-objs   += $(extra-objs-y)   $(extra-objs-)
+tests        += $(tests-y)        $(tests-)
+test-srcs    += $(test-srcs-y)    $(test-srcs-)
 # Modify the list of routines we build for different targets
 ifeq (yesyes,$(build-shared)$(elf))
Index: glibc-2.5/catgets/Makefile
--- glibc-2.5.orig/catgets/Makefile	2006-12-08 18:51:01.000000000 -0800
+++ glibc-2.5/catgets/Makefile	2006-12-08 18:51:26.000000000 -0800
@@ -21,16 +21,18 @@
 subdir	:= catgets
+include ../option-groups.mak
 headers		= nl_types.h
 distribute	= catgetsinfo.h config.h xopen-msg.sed test1.msg test2.msg \
 		  test-gencat.sh sample.SJIS
-routines	= catgets open_catalog
-others		= gencat
-install-bin	= gencat
-extra-objs	= $(gencat-modules:=.o)
+routines-$(OPTION_CATGETS)    := catgets open_catalog
+others-$(OPTION_CATGETS)      := gencat
+install-bin-$(OPTION_CATGETS) := gencat
+extra-objs-$(OPTION_CATGETS)  := $(gencat-modules:=.o)
-tests = tst-catgets
-test-srcs = test-gencat
+tests-$(OPTION_CATGETS)       := tst-catgets
+test-srcs-$(OPTION_CATGETS)   := test-gencat
 gencat-modules	= xmalloc
Index: glibc-2.5/option-groups.mak
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ glibc-2.5/option-groups.mak	2006-12-08 18:52:17.000000000 -0800
@@ -0,0 +1,23 @@
+# Setup file for subdirectory Makefiles that define EGLIBC option groups.
+# Read the developer's option group selections.  If there is no
+# eglibc.config file, all options are enabled.
+-include $(objdir)/eglibc.config
+# Establish 'routines-y', etc. as simply expanded variables.  And,
+# since including things is our default, define 'routines-', etc. in
+# the same way.
+routines-y     :=
+routines-      :=
+others-y       :=
+others-        :=
+install-bin-y  :=
+install-bin-   :=
+install-sbin-y :=
+install-sbin-  :=
+extra-objs-y   :=
+extra-objs-    :=
+tests-y        :=
+tests-         :=
+test-srcs-y    :=
+test-srcs-     :=
Index: glibc-2.5/option-groups.def
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ glibc-2.5/option-groups.def	2006-12-09 00:07:31.000000000 -0800
@@ -0,0 +1,22 @@
+# This file documents the option groups EGLIBC currently supports, in
+# a format akin to the Linux Kconfig system's.  The syntax may change
+# over time.
+# All option groups are enabled by default.  To disable option groups,
+# place lines of the form:
+# in the file 'eglibc.config' in the top of your build tree.  To
+# explicitly enable an option group, you may also write:
+# although this has the same effect as leaving OPTION_GROUP_NAME
+# unset.
+   bool "Functions for accessing message catalogs"
+   help
+       This option group includes functions for accessing message
+       catalogs: catopen, catclose, and catgets.