[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patches] RFC: Locale option group
- To: patches@xxxxxxxxxx
- Subject: Re: [patches] RFC: Locale option group
- From: Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
- Date: Thu, 28 Dec 2006 16:14:53 -0800
Jim Blandy <jimb@xxxxxxxxxxxxxxxx> writes:
> Here's a patch to create a new option group, OPTION_EGLIBC_LOCALES,
> containing EGLIBC's locale data files. Disabling this option group
> reduces the size of an ARM eglibc installation by about 90%, from
> 262MiB to 25MiB (for one multilib).
>
> One thing I suspect is wrong off the bat: the locale source files,
> installed compressed under $sysroot/usr/share/i18n/locales, probably
> ought to also be placed in the OPTION_EGLIBC_LOCALES option group too
> (except for the POSIX locale, which is always present). I don't see
> any use for installing sources for locales the system doesn't
> support. I think doing so would reduce the increase the savings to
> around 92% (20MiB per multilib).
>
> Should the character maps in localedata/charmaps also be in this
> option group? Alternatively, I'd been planning on creating an option
> group for the gconv character set conversion libraries, installed in
> /usr/lib/gconv; should the character maps be grouped with those
> instead?
>
> And there may be other ways to better reflect the logical structure of
> the locale data in the option groups; suggestions are welcome.
Here's a revision of the patch which places both the locale data and
their sources in the OPTION_EGLIBC_LOCALES option group. With this
change, disabling the OPTION_EGLIBC_LOCALES option group cuts the size
of an installation by 92%.
The patch also adds some hooks for people using a single localedef
build tree for more than one multilib; see the comments in
localedef/Makefile.in.
As before, the patch is in two parts, one for libc and one for
localedef.
Index: option-groups.def
===================================================================
--- option-groups.def (revision 158677)
+++ option-groups.def (working copy)
@@ -42,3 +42,10 @@
help
This option group includes functions for accessing message
catalogs: catopen, catclose, and catgets.
+
+config OPTION_EGLIBC_LOCALES
+ bool "Locale definitions"
+ help
+ This option group includes all locale definitions other than
+ that for the "C" locale. If this option group is omitted, then
+ only the "C" locale is supported.
Index: localedata/Makefile
===================================================================
--- localedata/Makefile (revision 158677)
+++ localedata/Makefile (working copy)
@@ -22,15 +22,24 @@
all: # Make this the default target; it will be defined in Rules.
+include ../option-groups.mak
+
# List with all available character set descriptions.
charmaps := $(filter-out $(addprefix charmaps/, CVS RCS SCCS %~), \
$(wildcard charmaps/[A-I]*) \
$(wildcard charmaps/[J-Z]*))
# List with all available character set descriptions.
-locales := $(filter-out $(addprefix locales/, CVS RCS SCCS %~), \
- $(wildcard locales/*))
+all-locales := $(filter-out $(addprefix locales/, CVS RCS SCCS %~), \
+ $(wildcard locales/*))
+# If the EGLIBC_LOCALES option group is not enabled, trim the
+# list of locale sources.
+ifeq ($(OPTION_EGLIBC_LOCALES),y)
+locales := $(all-locales)
+else
+locales := locales/POSIX
+endif
subdir-dirs = tests-mbwc
vpath %.c tests-mbwc
@@ -60,7 +69,7 @@
$(addprefix tstfmon_,$(fmon-tests)) \
distribute := CHECKSUMS README SUPPORTED ChangeLog \
- $(charmaps) $(locales) \
+ $(charmaps) $(all-locales) \
tst-rpmatch.sh tst-locale.sh tst-fmon.sh sort-test.sh \
tst-fmon.data $(test-input-data) $(ld-test-srcs) \
th_TH.in cs_CZ.in tst-mbswcs.sh tst-trans.sh tst-ctype.sh \
@@ -203,6 +212,11 @@
include SUPPORTED
+# Only install locale data if OPTION_EGLIBC_LOCALES is selected.
+ifneq ($(OPTION_EGLIBC_LOCALES),y)
+SUPPORTED-LOCALES :=
+endif
+
INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
# Sometimes the whole collection of locale files should be installed.
Index: option-groups.mak
===================================================================
--- option-groups.mak (revision 158677)
+++ option-groups.mak (working copy)
@@ -1,11 +1,18 @@
# Setup file for subdirectory Makefiles that define EGLIBC option groups.
+# EGLIBC shouldn't need to override this. However, the
+# cross-build-friendly localedef includes this makefile to get option
+# group variable definitions; it uses a single build tree for all the
+# multilibs, and needs to be able to specify a different option group
ChangeLog.eglibc:
2006-12-26 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
* option-groups.def, option-groups.defaults (OPTION_EGLIBC_LOCALES):
New option group.
* localedata/Makefile: Trim locale lists if
OPTION_EGLIBC_LOCALES is not enabled.
* option-groups.mak: Allow includer to override the option
group config file name.
+# configuration file for each multilib.
+option_group_config_file ?= $(objdir)/option-groups.config
+
# Read the default settings for all options.
include $(..)option-groups.defaults
# Read the developer's option group selections, overriding the
# defaults from option-groups.defaults.
--include $(objdir)/option-groups.config
+-include $(option_group_config_file)
# Establish 'routines-y', etc. as simply expanded variables.
routines-y :=
Index: option-groups.defaults
===================================================================
--- option-groups.defaults (revision 158677)
+++ option-groups.defaults (working copy)
@@ -9,3 +9,4 @@
#
# By default, all option groups are enabled.
OPTION_EGLIBC_CATGETS = y
+OPTION_EGLIBC_LOCALES = y
ChangeLog.eglibc:
2006-12-26 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
* Makefile.in: Include option-groups.mak from glibc. Trim
locale list if OPTION_EGLIBC_LOCALES is not enabled.
Index: Makefile.in
===================================================================
--- Makefile.in (revision 158677)
+++ Makefile.in (working copy)
@@ -118,8 +118,22 @@
#----------------------------------------------------------------------------
# Based on localedata/Makefile
#----------------------------------------------------------------------------
+.. = glibc/
+
+# Get EGLIBC's option group variable definitions. By default, this
+# will look for an 'option-groups.config' file in localedef's top
+# build directory. If you are using a single localedef build tree
+# with several different option group configurations, set
+# option_group_config_file on the make command line to the name of the
+# option group config file to use.
+include glibc/option-groups.mak
include glibc/localedata/SUPPORTED
+# Only install locale data if OPTION_EGLIBC_LOCALES is selected.
+ifneq ($(OPTION_EGLIBC_LOCALES),y)
+SUPPORTED-LOCALES :=
+endif
+
INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
LOCALEDEF=\