@@ -31,6 +31,16 @@ valid_arm_float_abi = ('soft', 'softfp', 'hard')
3131valid_mips_arch = ('loongson' , 'r1' , 'r2' , 'r6' , 'rx' )
3232valid_mips_fpu = ('fp32' , 'fp64' , 'fpxx' )
3333valid_mips_float_abi = ('soft' , 'hard' )
34+ valid_intl_modes = ('none' , 'small-icu' , 'full-icu' , 'system-icu' )
35+
36+ # create option groups
37+ shared_optgroup = optparse .OptionGroup (parser , "Shared libraries" ,
38+ "Flags that allows you to control whether you want to build against "
39+ "built-in dependencies or its shared representations. If necessary, "
40+ "provide multiple libraries with comma." )
41+ intl_optgroup = optparse .OptionGroup (parser , "Internationalization" ,
42+ "Flags that lets you enable i18n features in io.js as well as which "
43+ "library you want to build against." )
3444
3545# Options should be in alphabetical order but keep --prefix at the top,
3646# that's arguably the one people will be looking for most.
@@ -78,90 +88,92 @@ parser.add_option("--openssl-no-asm",
7888 dest = "openssl_no_asm" ,
7989 help = "Do not build optimized assembly for OpenSSL" )
8090
81- parser .add_option ('--shared-http-parser' ,
91+ shared_optgroup .add_option ('--shared-http-parser' ,
8292 action = 'store_true' ,
8393 dest = 'shared_http_parser' ,
8494 help = 'link to a shared http_parser DLL instead of static linking' )
8595
86- parser .add_option ('--shared-http-parser-includes' ,
96+ shared_optgroup .add_option ('--shared-http-parser-includes' ,
8797 action = 'store' ,
8898 dest = 'shared_http_parser_includes' ,
8999 help = 'directory containing http_parser header files' )
90100
91- parser .add_option ('--shared-http-parser-libname' ,
101+ shared_optgroup .add_option ('--shared-http-parser-libname' ,
92102 action = 'store' ,
93103 dest = 'shared_http_parser_libname' ,
94104 default = 'http_parser' ,
95105 help = 'alternative lib name to link to [default: %default]' )
96106
97- parser .add_option ('--shared-http-parser-libpath' ,
107+ shared_optgroup .add_option ('--shared-http-parser-libpath' ,
98108 action = 'store' ,
99109 dest = 'shared_http_parser_libpath' ,
100110 help = 'a directory to search for the shared http_parser DLL' )
101111
102- parser .add_option ('--shared-libuv' ,
112+ shared_optgroup .add_option ('--shared-libuv' ,
103113 action = 'store_true' ,
104114 dest = 'shared_libuv' ,
105115 help = 'link to a shared libuv DLL instead of static linking' )
106116
107- parser .add_option ('--shared-libuv-includes' ,
117+ shared_optgroup .add_option ('--shared-libuv-includes' ,
108118 action = 'store' ,
109119 dest = 'shared_libuv_includes' ,
110120 help = 'directory containing libuv header files' )
111121
112- parser .add_option ('--shared-libuv-libname' ,
122+ shared_optgroup .add_option ('--shared-libuv-libname' ,
113123 action = 'store' ,
114124 dest = 'shared_libuv_libname' ,
115125 default = 'uv' ,
116126 help = 'alternative lib name to link to [default: %default]' )
117127
118- parser .add_option ('--shared-libuv-libpath' ,
128+ shared_optgroup .add_option ('--shared-libuv-libpath' ,
119129 action = 'store' ,
120130 dest = 'shared_libuv_libpath' ,
121131 help = 'a directory to search for the shared libuv DLL' )
122132
123- parser .add_option ('--shared-openssl' ,
133+ shared_optgroup .add_option ('--shared-openssl' ,
124134 action = 'store_true' ,
125135 dest = 'shared_openssl' ,
126136 help = 'link to a shared OpenSSl DLL instead of static linking' )
127137
128- parser .add_option ('--shared-openssl-includes' ,
138+ shared_optgroup .add_option ('--shared-openssl-includes' ,
129139 action = 'store' ,
130140 dest = 'shared_openssl_includes' ,
131141 help = 'directory containing OpenSSL header files' )
132142
133- parser .add_option ('--shared-openssl-libname' ,
143+ shared_optgroup .add_option ('--shared-openssl-libname' ,
134144 action = 'store' ,
135145 dest = 'shared_openssl_libname' ,
136146 default = 'crypto,ssl' ,
137147 help = 'alternative lib name to link to [default: %default]' )
138148
139- parser .add_option ('--shared-openssl-libpath' ,
149+ shared_optgroup .add_option ('--shared-openssl-libpath' ,
140150 action = 'store' ,
141151 dest = 'shared_openssl_libpath' ,
142152 help = 'a directory to search for the shared OpenSSL DLLs' )
143153
144- parser .add_option ('--shared-zlib' ,
154+ shared_optgroup .add_option ('--shared-zlib' ,
145155 action = 'store_true' ,
146156 dest = 'shared_zlib' ,
147157 help = 'link to a shared zlib DLL instead of static linking' )
148158
149- parser .add_option ('--shared-zlib-includes' ,
159+ shared_optgroup .add_option ('--shared-zlib-includes' ,
150160 action = 'store' ,
151161 dest = 'shared_zlib_includes' ,
152162 help = 'directory containing zlib header files' )
153163
154- parser .add_option ('--shared-zlib-libname' ,
164+ shared_optgroup .add_option ('--shared-zlib-libname' ,
155165 action = 'store' ,
156166 dest = 'shared_zlib_libname' ,
157167 default = 'z' ,
158168 help = 'alternative lib name to link to [default: %default]' )
159169
160- parser .add_option ('--shared-zlib-libpath' ,
170+ shared_optgroup .add_option ('--shared-zlib-libpath' ,
161171 action = 'store' ,
162172 dest = 'shared_zlib_libpath' ,
163173 help = 'a directory to search for the shared zlib DLL' )
164174
175+ parser .add_option_group (shared_optgroup )
176+
165177# TODO document when we've decided on what the tracing API and its options will
166178# look like
167179parser .add_option ('--systemtap-includes' ,
@@ -225,33 +237,38 @@ parser.add_option('--with-etw',
225237 dest = 'with_etw' ,
226238 help = 'build with ETW (default is true on Windows)' )
227239
228- parser .add_option ('--download ' ,
240+ parser .add_option ('--with-intl ' ,
229241 action = 'store' ,
230- dest = 'download_list' ,
231- help = nodedownload .help ())
242+ dest = 'with_intl' ,
243+ default = 'none' ,
244+ choices = valid_intl_modes ,
245+ help = 'Intl mode (valid choices: {0}) [default: %default]' .format (
246+ ', ' .join (valid_intl_modes )))
232247
233- parser .add_option ('--with-icu-path' ,
248+ intl_optgroup .add_option ('--with-icu-path' ,
234249 action = 'store' ,
235250 dest = 'with_icu_path' ,
236251 help = 'Path to icu.gyp (ICU i18n, Chromium version only.)' )
237252
238- parser .add_option ('--with-icu-locales' ,
253+ intl_optgroup .add_option ('--with-icu-locales' ,
239254 action = 'store' ,
240255 dest = 'with_icu_locales' ,
241256 default = 'root,en' ,
242257 help = 'Comma-separated list of locales for "small-icu". "root" is assumed. '
243258 '[default: %default]' )
244259
245- parser .add_option ('--with-intl' ,
246- action = 'store' ,
247- dest = 'with_intl' ,
248- help = 'Intl mode: none, full-icu, small-icu [default: none]' )
249-
250- parser .add_option ('--with-icu-source' ,
260+ intl_optgroup .add_option ('--with-icu-source' ,
251261 action = 'store' ,
252262 dest = 'with_icu_source' ,
253263 help = 'Intl mode: optional local path to icu/ dir, or path/URL of icu source archive.' )
254264
265+ intl_optgroup .add_option ('--download' ,
266+ action = 'store' ,
267+ dest = 'download_list' ,
268+ help = nodedownload .help ())
269+
270+ parser .add_option_group (intl_optgroup )
271+
255272parser .add_option ('--with-perfctr' ,
256273 action = 'store_true' ,
257274 dest = 'with_perfctr' ,
@@ -812,7 +829,7 @@ def configure_intl(o):
812829 with_intl = options .with_intl
813830 with_icu_source = options .with_icu_source
814831 have_icu_path = bool (options .with_icu_path )
815- if have_icu_path and with_intl :
832+ if have_icu_path and with_intl != 'none' :
816833 print 'Error: Cannot specify both --with-icu-path and --with-intl'
817834 sys .exit (1 )
818835 elif have_icu_path :
@@ -850,11 +867,6 @@ def configure_intl(o):
850867 # use the "system" .gyp
851868 o ['variables' ]['icu_gyp_path' ] = 'tools/icu/icu-system.gyp'
852869 return
853- else :
854- print 'Error: unknown value --with-intl=%s' % with_intl
855- sys .exit (1 )
856- # Note: non-ICU implementations could use other 'with_intl'
857- # values.
858870
859871 # this is just the 'deps' dir. Used for unpacking.
860872 icu_parent_path = os .path .join (root_dir , 'deps' )
0 commit comments