Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit bfdffa7

Browse files
committed
build: i18n: reduce on-disk size
Reduces space by about 1MB with ICU 54 (over without this patch). Also trims a few other source files, but only conditional on the exact ICU version used. This is to future-proof - a file that is unneeded now may be needed in future ICUs.
1 parent ea4dc7d commit bfdffa7

File tree

2 files changed

+87
-7
lines changed

2 files changed

+87
-7
lines changed

tools/icu/icu-generic.gyp

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@
1111
},
1212
'includes': [ '../../icu_config.gypi' ],
1313
'targets': [
14+
{
15+
# a target for additional uconfig defines, target only
16+
'target_name': 'icu_uconfig_target',
17+
'type': 'none',
18+
'toolsets': [ 'target' ],
19+
'direct_dependent_settings': {
20+
'defines': [
21+
'UCONFIG_NO_CONVERSION=1',
22+
]
23+
},
24+
},
1425
{
1526
# a target to hold uconfig defines.
1627
# for now these are hard coded, but could be defined.
@@ -97,19 +108,67 @@
97108
'sources': [
98109
'<@(icu_src_i18n)'
99110
],
111+
'conditions': [
112+
[ 'icu_ver_major == 54', { 'sources!': [
113+
## Strip out the following for ICU 54 only.
114+
## add more conditions in the future?
115+
## if your compiler can dead-strip, this will
116+
## make ZERO difference to binary size.
117+
## Made ICU-specific for future-proofing.
118+
119+
# alphabetic index
120+
'../../deps/icu/source/i18n/alphaindex.cpp',
121+
# BOCSU
122+
# misc
123+
'../../deps/icu/source/i18n/dtitvfmt.cpp',
124+
'../../deps/icu/source/i18n/dtitvinf.cpp',
125+
'../../deps/icu/source/i18n/dtitv_impl.h',
126+
'../../deps/icu/source/i18n/quantityformatter.cpp',
127+
'../../deps/icu/source/i18n/quantityformatter.h',
128+
'../../deps/icu/source/i18n/regexcmp.cpp',
129+
'../../deps/icu/source/i18n/regexcmp.h',
130+
'../../deps/icu/source/i18n/regexcst.h',
131+
'../../deps/icu/source/i18n/regeximp.cpp',
132+
'../../deps/icu/source/i18n/regeximp.h',
133+
'../../deps/icu/source/i18n/regexst.cpp',
134+
'../../deps/icu/source/i18n/regexst.h',
135+
'../../deps/icu/source/i18n/regextxt.cpp',
136+
'../../deps/icu/source/i18n/regextxt.h',
137+
'../../deps/icu/source/i18n/region.cpp',
138+
'../../deps/icu/source/i18n/region_impl.h',
139+
'../../deps/icu/source/i18n/reldatefmt.cpp',
140+
'../../deps/icu/source/i18n/reldatefmt.h',
141+
'../../deps/icu/source/i18n/measfmt.h',
142+
'../../deps/icu/source/i18n/measfmt.cpp',
143+
'../../deps/icu/source/i18n/scientificformathelper.cpp',
144+
'../../deps/icu/source/i18n/tmunit.cpp',
145+
'../../deps/icu/source/i18n/tmutamt.cpp',
146+
'../../deps/icu/source/i18n/tmutfmt.cpp',
147+
'../../deps/icu/source/i18n/uregex.cpp',
148+
'../../deps/icu/source/i18n/uregexc.cpp',
149+
'../../deps/icu/source/i18n/uregion.cpp',
150+
'../../deps/icu/source/i18n/uspoof.cpp',
151+
'../../deps/icu/source/i18n/uspoof_build.cpp',
152+
'../../deps/icu/source/i18n/uspoof_conf.cpp',
153+
'../../deps/icu/source/i18n/uspoof_conf.h',
154+
'../../deps/icu/source/i18n/uspoof_impl.cpp',
155+
'../../deps/icu/source/i18n/uspoof_impl.h',
156+
'../../deps/icu/source/i18n/uspoof_wsconf.cpp',
157+
'../../deps/icu/source/i18n/uspoof_wsconf.h',
158+
]}]],
100159
'include_dirs': [
101160
'../../deps/icu/source/i18n',
102161
],
103162
'defines': [
104163
'U_I18N_IMPLEMENTATION=1',
105164
],
106-
'dependencies': [ 'icuucx', 'icu_implementation', 'icu_uconfig' ],
165+
'dependencies': [ 'icuucx', 'icu_implementation', 'icu_uconfig', 'icu_uconfig_target' ],
107166
'direct_dependent_settings': {
108167
'include_dirs': [
109168
'../../deps/icu/source/i18n',
110169
],
111170
},
112-
'export_dependent_settings': [ 'icuucx' ],
171+
'export_dependent_settings': [ 'icuucx', 'icu_uconfig_target' ],
113172
},
114173
# This exports actual ICU data
115174
{
@@ -289,22 +348,42 @@
289348
'export_dependent_settings': [ 'icuucx', 'icudata' ],
290349
},
291350
# This is the 'real' icuuc.
292-
# tools can depend on 'icuuc + stubdata'
293351
{
294352
'target_name': 'icuucx',
295353
'type': '<(library)',
296-
'dependencies': [ 'icu_implementation', 'icu_uconfig' ],
354+
'dependencies': [ 'icu_implementation', 'icu_uconfig', 'icu_uconfig_target' ],
297355
'toolsets': [ 'target' ],
298356
'sources': [
299-
'<@(icu_src_common)'
357+
'<@(icu_src_common)',
300358
],
359+
'conditions': [
360+
[ 'icu_ver_major == 54', { 'sources!': [
361+
## Strip out the following for ICU 54 only.
362+
## add more conditions in the future?
363+
## if your compiler can dead-strip, this will
364+
## make ZERO difference to binary size.
365+
## Made ICU-specific for future-proofing.
366+
367+
# bidi- not needed (yet!)
368+
'../../deps/icu/source/common/ubidi.c',
369+
'../../deps/icu/source/common/ubidiimp.h',
370+
'../../deps/icu/source/common/ubidiln.c',
371+
'../../deps/icu/source/common/ubidiwrt.c',
372+
#'../../deps/icu/source/common/ubidi_props.c',
373+
#'../../deps/icu/source/common/ubidi_props.h',
374+
#'../../deps/icu/source/common/ubidi_props_data.h',
375+
# and the callers
376+
'../../deps/icu/source/common/ushape.cpp',
377+
'../../deps/icu/source/common/usprep.cpp',
378+
'../../deps/icu/source/common/uts46.cpp',
379+
]}]],
301380
'include_dirs': [
302381
'../../deps/icu/source/common',
303382
],
304383
'defines': [
305384
'U_COMMON_IMPLEMENTATION=1',
306385
],
307-
'export_dependent_settings': [ 'icu_uconfig' ],
386+
'export_dependent_settings': [ 'icu_uconfig', 'icu_uconfig_target' ],
308387
'direct_dependent_settings': {
309388
'include_dirs': [
310389
'../../deps/icu/source/common',

tools/icu/icu_small.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"translit": "none",
2929
"brkfiles": "none",
3030
"brkdict": "none",
31-
"confusables": "none"
31+
"confusables": "none",
32+
"unit": "none"
3233
},
3334
"remove": [
3435
"cnvalias.icu",

0 commit comments

Comments
 (0)