@@ -303,20 +303,28 @@ parser.add_option('--with-etw',
303
303
intl_optgroup .add_option ('--with-intl' ,
304
304
action = 'store' ,
305
305
dest = 'with_intl' ,
306
- default = 'none ' ,
306
+ default = 'small-icu ' ,
307
307
choices = valid_intl_modes ,
308
308
help = 'Intl mode (valid choices: {0}) [default: %default]' .format (
309
309
', ' .join (valid_intl_modes )))
310
310
311
+ intl_optgroup .add_option ('--without-intl' ,
312
+ action = 'store_const' ,
313
+ dest = 'with_intl' ,
314
+ const = 'none' ,
315
+ help = 'Disable Intl, same as --with-intl=none' )
316
+
311
317
intl_optgroup .add_option ('--with-icu-path' ,
312
318
action = 'store' ,
313
319
dest = 'with_icu_path' ,
314
320
help = 'Path to icu.gyp (ICU i18n, Chromium version only.)' )
315
321
322
+ icu_default_locales = 'root,en'
323
+
316
324
intl_optgroup .add_option ('--with-icu-locales' ,
317
325
action = 'store' ,
318
326
dest = 'with_icu_locales' ,
319
- default = 'root,en' ,
327
+ default = icu_default_locales ,
320
328
help = 'Comma-separated list of locales for "small-icu". "root" is assumed. '
321
329
'[default: %default]' )
322
330
@@ -880,7 +888,7 @@ do_not_edit = '# Do not edit. Generated by the configure script.\n'
880
888
881
889
def glob_to_var (dir_base , dir_sub , patch_dir ):
882
890
list = []
883
- dir_all = os . path . join (dir_base , dir_sub )
891
+ dir_all = '%s/%s' % (dir_base , dir_sub )
884
892
files = os .walk (dir_all )
885
893
for ent in files :
886
894
(path , dirs , files ) = ent
@@ -968,6 +976,7 @@ def configure_intl(o):
968
976
locs = set (options .with_icu_locales .split (',' ))
969
977
locs .add ('root' ) # must have root
970
978
o ['variables' ]['icu_locales' ] = string .join (locs ,',' )
979
+ # We will check a bit later if we can use the canned deps/icu-small
971
980
elif with_intl == 'full-icu' :
972
981
# full ICU
973
982
o ['variables' ]['v8_enable_i18n_support' ] = 1
@@ -994,15 +1003,42 @@ def configure_intl(o):
994
1003
# this is just the 'deps' dir. Used for unpacking.
995
1004
icu_parent_path = os .path .join (root_dir , 'deps' )
996
1005
997
- # The full path to the ICU source directory.
998
- icu_full_path = os . path . join ( icu_parent_path , ' icu')
1006
+ # The full path to the ICU source directory. Should not include './'.
1007
+ icu_full_path = 'deps/ icu'
999
1008
1000
1009
# icu-tmp is used to download and unpack the ICU tarball.
1001
1010
icu_tmp_path = os .path .join (icu_parent_path , 'icu-tmp' )
1002
1011
1012
+ # canned ICU. see tools/icu/README.md to update.
1013
+ canned_icu_dir = 'deps/icu-small'
1014
+
1015
+ # We can use 'deps/icu-small' - pre-canned ICU *iff*
1016
+ # - with_intl == small-icu (the default!)
1017
+ # - with_icu_locales == 'root,en' (the default!)
1018
+ # - deps/icu-small exists!
1019
+ # - with_icu_source is unset (i.e. no other ICU was specified)
1020
+ # (Note that this is the *DEFAULT CASE*.)
1021
+ #
1022
+ # This is *roughly* equivalent to
1023
+ # $ configure --with-intl=small-icu --with-icu-source=deps/icu-small
1024
+ # .. Except that we avoid copying icu-small over to deps/icu.
1025
+ # In this default case, deps/icu is ignored, although make clean will
1026
+ # still harmlessly remove deps/icu.
1027
+
1028
+ # are we using default locales?
1029
+ using_default_locales = ( options .with_icu_locales == icu_default_locales )
1030
+
1031
+ # make sure the canned ICU really exists
1032
+ canned_icu_available = os .path .isdir (canned_icu_dir )
1033
+
1034
+ if (o ['variables' ]['icu_small' ] == b (True )) and using_default_locales and (not with_icu_source ) and canned_icu_available :
1035
+ # OK- we can use the canned ICU.
1036
+ icu_config ['variables' ]['icu_small_canned' ] = 1
1037
+ icu_full_path = canned_icu_dir
1038
+
1003
1039
# --with-icu-source processing
1004
- # first , check that they didn't pass --with-icu-source=deps/icu
1005
- if with_icu_source and os .path .abspath (icu_full_path ) == os .path .abspath (with_icu_source ):
1040
+ # now , check that they didn't pass --with-icu-source=deps/icu
1041
+ elif with_icu_source and os .path .abspath (icu_full_path ) == os .path .abspath (with_icu_source ):
1006
1042
print 'Ignoring redundant --with-icu-source=%s' % (with_icu_source )
1007
1043
with_icu_source = None
1008
1044
# if with_icu_source is still set, try to use it.
@@ -1043,7 +1079,7 @@ def configure_intl(o):
1043
1079
1044
1080
# ICU mode. (icu-generic.gyp)
1045
1081
o ['variables' ]['icu_gyp_path' ] = 'tools/icu/icu-generic.gyp'
1046
- # ICU source dir relative to root
1082
+ # ICU source dir relative to tools/icu (for .gyp file)
1047
1083
o ['variables' ]['icu_path' ] = icu_full_path
1048
1084
if not os .path .isdir (icu_full_path ):
1049
1085
print '* ECMA-402 (Intl) support didn\' t find ICU in %s..' % (icu_full_path )
@@ -1083,14 +1119,14 @@ def configure_intl(o):
1083
1119
'source/data/in' ,
1084
1120
icu_data_file_l )
1085
1121
# relative to dep..
1086
- icu_data_in = os .path .join ('../../deps/icu/ source/data/in' , icu_data_file_l )
1122
+ icu_data_in = os .path .join ('..' , '..' , icu_full_path , ' source/data/in' , icu_data_file_l )
1087
1123
if not os .path .isfile (icu_data_path ) and icu_endianness != 'l' :
1088
1124
# use host endianness
1089
1125
icu_data_path = os .path .join (icu_full_path ,
1090
1126
'source/data/in' ,
1091
1127
icu_data_file )
1092
1128
# relative to dep..
1093
- icu_data_in = os .path .join ('icu/ source/data/in' ,
1129
+ icu_data_in = os .path .join ('..' , icu_full_path , ' source/data/in' ,
1094
1130
icu_data_file )
1095
1131
# this is the input '.dat' file to use .. icudt*.dat
1096
1132
# may be little-endian if from a icu-project.org tarball
@@ -1117,7 +1153,7 @@ def configure_intl(o):
1117
1153
# with a list of the src files to use
1118
1154
for i in icu_src :
1119
1155
var = 'icu_src_%s' % i
1120
- path = '../../deps/icu/ source/%s' % icu_src [i ]
1156
+ path = '../../%s/ source/%s' % ( icu_full_path , icu_src [i ])
1121
1157
icu_config ['variables' ][var ] = glob_to_var ('tools/icu' , path , 'patches/%s/source/%s' % (icu_ver_major , icu_src [i ]) )
1122
1158
# write updated icu_config.gypi with a bunch of paths
1123
1159
write (icu_config_name , do_not_edit +
0 commit comments