Kaydet (Commit) 8774a2b1 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Let --with-locales prune also built-in collator data

Effective in the DISABLE_DYNLOADING case.

Introduce a new gbuild macro gb_Helper_optional_locale.

Change-Id: I43eb39fa810f71cadb6bc6d5c117ae145629ecb9
üst f8fd4b70
...@@ -11,18 +11,29 @@ $(eval $(call gb_CustomTarget_CustomTarget,i18npool/collator)) ...@@ -11,18 +11,29 @@ $(eval $(call gb_CustomTarget_CustomTarget,i18npool/collator))
i18npool_CODIR := $(call gb_CustomTarget_get_workdir,i18npool/collator) i18npool_CODIR := $(call gb_CustomTarget_get_workdir,i18npool/collator)
i18npool_COTXTS := \ i18npool_COTXTS := \
ca_charset.txt \ $(call gb_Helper_optional_locale,ca, \
dz_charset.txt \ ca_charset.txt) \
hu_charset.txt \ $(call gb_Helper_optional_locale,dz, \
dz_charset.txt) \
$(call gb_Helper_optional_locale,hu, \
hu_charset.txt) \
$(call gb_Helper_optional_locale,ja, \
ja_charset.txt \ ja_charset.txt \
ja_phonetic_alphanumeric_first.txt \ ja_phonetic_alphanumeric_first.txt \
ja_phonetic_alphanumeric_last.txt \ ja_phonetic_alphanumeric_last.txt) \
ko_charset.txt \ $(call gb_Helper_optional_locale,ko, \
ku_alphanumeric.txt \ ko_charset.txt) \
ln_charset.txt \ $(call gb_Helper_optional_locale,ku, \
my_dictionary.txt \ ku_alphanumeric.txt) \
ne_charset.txt \ $(call gb_Helper_optional_locale,ln, \
sid_charset.txt \ ln_charset.txt) \
$(call gb_Helper_optional_locale,my, \
my_dictionary.txt) \
$(call gb_Helper_optional_locale,ne, \
ne_charset.txt) \
$(call gb_Helper_optional_locale,sid, \
sid_charset.txt) \
$(call gb_Helper_optional_locale,zh, \
zh_charset.txt \ zh_charset.txt \
zh_pinyin.txt \ zh_pinyin.txt \
zh_radical.txt \ zh_radical.txt \
...@@ -30,7 +41,7 @@ i18npool_COTXTS := \ ...@@ -30,7 +41,7 @@ i18npool_COTXTS := \
zh_TW_charset.txt \ zh_TW_charset.txt \
zh_TW_radical.txt \ zh_TW_radical.txt \
zh_TW_stroke.txt \ zh_TW_stroke.txt \
zh_zhuyin.txt zh_zhuyin.txt)
$(call gb_CustomTarget_get_target,i18npool/collator) : $(SRCDIR)/i18npool/CustomTarget_collator.mk \ $(call gb_CustomTarget_get_target,i18npool/collator) : $(SRCDIR)/i18npool/CustomTarget_collator.mk \
$(i18npool_CODIR)/lrl_include.hxx $(foreach txt,$(i18npool_COTXTS), \ $(i18npool_CODIR)/lrl_include.hxx $(foreach txt,$(i18npool_COTXTS), \
...@@ -44,10 +55,20 @@ $(i18npool_CODIR)/collator_%.cxx : \ ...@@ -44,10 +55,20 @@ $(i18npool_CODIR)/collator_%.cxx : \
$(call gb_Helper_abbreviate_dirs, \ $(call gb_Helper_abbreviate_dirs, \
$(call gb_Helper_execute,gencoll_rule) $< $@ $*) $(call gb_Helper_execute,gencoll_rule) $< $@ $*)
define i18npool_echo_one_lang
echo '#define LOCAL_RULE_$(1)' >>$@
endef
$(i18npool_CODIR)/lrl_include.hxx : \ $(i18npool_CODIR)/lrl_include.hxx : \
$(SRCDIR)/i18npool/source/collator/data | $(i18npool_CODIR)/.dir $(SRCDIR)/i18npool/source/collator/data | $(i18npool_CODIR)/.dir
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1) $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),ECH,1)
echo '#define LOCAL_RULE_LANGS "$(sort $(foreach txt,$(i18npool_COTXTS), \ echo '#define LOCAL_RULE_LANGS "$(sort $(foreach txt,$(i18npool_COTXTS), \
$(firstword $(subst _, ,$(txt)))))"' > $@ $(firstword $(subst _, ,$(txt)))))"' > $@
ifeq ($(WITH_LOCALES),)
echo '#define LOCAL_RULE_ALL' >>$@
else
$(foreach txt,$(i18npool_COTXTS),$(call i18npool_echo_one_lang,$(subst .txt,,$(txt))))
endif
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -154,16 +154,25 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: ...@@ -154,16 +154,25 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
} }
} }
#else #else
if ( rLocale.Language == "ca" ) { if (false) {
;
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_ca_charset
} else if ( rLocale.Language == "ca" ) {
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_ca_charset; func = get_collator_data_ca_charset;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_dz_charset
} else if ( rLocale.Language == "dz" || rLocale.Language == "bo" ) { } else if ( rLocale.Language == "dz" || rLocale.Language == "bo" ) {
// 'bo' Tibetan uses the same collation rules as 'dz' Dzongkha // 'bo' Tibetan uses the same collation rules as 'dz' Dzongkha
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_dz_charset; func = get_collator_data_dz_charset;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_hu
} else if ( rLocale.Language == "hu" ) { } else if ( rLocale.Language == "hu" ) {
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_hu_charset; func = get_collator_data_hu_charset;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_ja_charset
} else if ( rLocale.Language == "ja" ) { } else if ( rLocale.Language == "ja" ) {
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_ja_charset; func = get_collator_data_ja_charset;
...@@ -171,24 +180,38 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: ...@@ -171,24 +180,38 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
func = get_collator_data_ja_phonetic_alphanumeric_first; func = get_collator_data_ja_phonetic_alphanumeric_first;
else if ( rAlgorithm == "phonetic (alphanumeric last)" ) else if ( rAlgorithm == "phonetic (alphanumeric last)" )
func = get_collator_data_ja_phonetic_alphanumeric_last; func = get_collator_data_ja_phonetic_alphanumeric_last;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_ko_charset
} else if ( rLocale.Language == "ko" ) { } else if ( rLocale.Language == "ko" ) {
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_ko_charset; func = get_collator_data_ko_charset;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_ku_charset
} else if ( rLocale.Language == "ku" ) { } else if ( rLocale.Language == "ku" ) {
if ( rAlgorithm == "alphanumeric" ) if ( rAlgorithm == "alphanumeric" )
func = get_collator_data_ku_alphanumeric; func = get_collator_data_ku_alphanumeric;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_ln_charset
} else if ( rLocale.Language == "ln" ) { } else if ( rLocale.Language == "ln" ) {
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_ln_charset; func = get_collator_data_ln_charset;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_my_charset
} else if ( rLocale.Language == "my" ) { } else if ( rLocale.Language == "my" ) {
if ( rAlgorithm == "dictionary" ) if ( rAlgorithm == "dictionary" )
func = get_collator_data_my_dictionary; func = get_collator_data_my_dictionary;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_ne_charset
} else if ( rLocale.Language == "ne" ) { } else if ( rLocale.Language == "ne" ) {
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_ne_charset; func = get_collator_data_ne_charset;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_sid_charset
} else if ( rLocale.Language == "sid" ) { } else if ( rLocale.Language == "sid" ) {
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_sid_charset; func = get_collator_data_sid_charset;
#endif
#if defined LOCAL_RULE_ALL || defined LOCAL_RULE_zh_charset
} else if ( rLocale.Language == "zh" && (rLocale.Country == "TW" || rLocale.Country == "HK" || rLocale.Country == "MO") ) { } else if ( rLocale.Language == "zh" && (rLocale.Country == "TW" || rLocale.Country == "HK" || rLocale.Country == "MO") ) {
if ( rAlgorithm == "charset" ) if ( rAlgorithm == "charset" )
func = get_collator_data_zh_TW_charset; func = get_collator_data_zh_TW_charset;
...@@ -207,8 +230,9 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: ...@@ -207,8 +230,9 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
func = get_collator_data_zh_stroke; func = get_collator_data_zh_stroke;
else if ( rAlgorithm == "zhuyin" ) else if ( rAlgorithm == "zhuyin" )
func = get_collator_data_zh_zhuyin; func = get_collator_data_zh_zhuyin;
}
#endif #endif
}
#endif // DISABLE_DYNLOADING
if (func) { if (func) {
const sal_uInt8* ruleImage=func(); const sal_uInt8* ruleImage=func();
uca_base = new RuleBasedCollator(static_cast<UChar*>(NULL), status); uca_base = new RuleBasedCollator(static_cast<UChar*>(NULL), status);
......
...@@ -242,6 +242,16 @@ define gb_Helper_optional ...@@ -242,6 +242,16 @@ define gb_Helper_optional
$(if $(filter $(1),$(BUILD_TYPE)),$(2)) $(if $(filter $(1),$(BUILD_TYPE)),$(2))
endef endef
ifeq ($(WITH_LOCALES),)
define gb_Helper_optional_locale
$(2)
endef
else
define gb_Helper_optional_locale
$(if $(filter $(1) $(1)_%,$(WITH_LOCALES)),$(2))
endef
endif
define gb_Helper_optional_for_host define gb_Helper_optional_for_host
$(if $(filter $(1),$(BUILD_TYPE_FOR_HOST)),$(2)) $(if $(filter $(1),$(BUILD_TYPE_FOR_HOST)),$(2))
endef endef
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment