@@ -25,12 +25,20 @@ import nodedownload
25
25
# parse our options
26
26
parser = optparse .OptionParser ()
27
27
28
+ valid_os = ('win' , 'mac' , 'solaris' , 'freebsd' , 'openbsd' , 'linux' , 'android' )
29
+ valid_arch = ('arm' , 'arm64' , 'ia32' , 'mips' , 'mipsel' , 'x32' , 'x64' )
30
+ valid_arm_float_abi = ('soft' , 'softfp' , 'hard' )
31
+ valid_mips_arch = ('loongson' , 'r1' , 'r2' , 'r6' , 'rx' )
32
+ valid_mips_fpu = ('fp32' , 'fp64' , 'fpxx' )
33
+ valid_mips_float_abi = ('soft' , 'hard' )
34
+
28
35
# Options should be in alphabetical order but keep --prefix at the top,
29
36
# that's arguably the one people will be looking for most.
30
37
parser .add_option ('--prefix' ,
31
38
action = 'store' ,
32
39
dest = 'prefix' ,
33
- help = 'select the install prefix (defaults to /usr/local)' )
40
+ default = '/usr/local' ,
41
+ help = 'select the install prefix [default: %default]' )
34
42
35
43
parser .add_option ('--debug' ,
36
44
action = 'store_true' ,
@@ -40,14 +48,14 @@ parser.add_option('--debug',
40
48
parser .add_option ('--dest-cpu' ,
41
49
action = 'store' ,
42
50
dest = 'dest_cpu' ,
43
- help = 'CPU architecture to build for. '
44
- 'Valid values are: arm, arm64, ia32, mips, mipsel, x32, x64' )
51
+ choices = valid_arch ,
52
+ help = 'CPU architecture to build for ({0})' . format ( ', ' . join ( valid_arch )) )
45
53
46
54
parser .add_option ('--dest-os' ,
47
55
action = 'store' ,
48
56
dest = 'dest_os' ,
49
- help = 'operating system to build for. Valid values are: '
50
- 'win, mac, solaris, freebsd, openbsd, linux, android' )
57
+ choices = valid_os ,
58
+ help = 'operating system to build for ({0})' . format ( ', ' . join ( valid_os )) )
51
59
52
60
parser .add_option ('--gdb' ,
53
61
action = 'store_true' ,
@@ -83,7 +91,8 @@ parser.add_option('--shared-http-parser-includes',
83
91
parser .add_option ('--shared-http-parser-libname' ,
84
92
action = 'store' ,
85
93
dest = 'shared_http_parser_libname' ,
86
- help = 'alternative lib name to link to (default: \' http_parser\' )' )
94
+ default = 'http_parser' ,
95
+ help = 'alternative lib name to link to [default: %default]' )
87
96
88
97
parser .add_option ('--shared-http-parser-libpath' ,
89
98
action = 'store' ,
@@ -103,7 +112,8 @@ parser.add_option('--shared-libuv-includes',
103
112
parser .add_option ('--shared-libuv-libname' ,
104
113
action = 'store' ,
105
114
dest = 'shared_libuv_libname' ,
106
- help = 'alternative lib name to link to (default: \' uv\' )' )
115
+ default = 'uv' ,
116
+ help = 'alternative lib name to link to [default: %default]' )
107
117
108
118
parser .add_option ('--shared-libuv-libpath' ,
109
119
action = 'store' ,
@@ -123,7 +133,8 @@ parser.add_option('--shared-openssl-includes',
123
133
parser .add_option ('--shared-openssl-libname' ,
124
134
action = 'store' ,
125
135
dest = 'shared_openssl_libname' ,
126
- help = 'alternative lib name to link to (default: \' crypto,ssl\' )' )
136
+ default = 'crypto,ssl' ,
137
+ help = 'alternative lib name to link to [default: %default]' )
127
138
128
139
parser .add_option ('--shared-openssl-libpath' ,
129
140
action = 'store' ,
@@ -143,7 +154,8 @@ parser.add_option('--shared-zlib-includes',
143
154
parser .add_option ('--shared-zlib-libname' ,
144
155
action = 'store' ,
145
156
dest = 'shared_zlib_libname' ,
146
- help = 'alternative lib name to link to (default: \' z\' )' )
157
+ default = 'z' ,
158
+ help = 'alternative lib name to link to [default: %default]' )
147
159
148
160
parser .add_option ('--shared-zlib-libpath' ,
149
161
action = 'store' ,
@@ -170,26 +182,33 @@ parser.add_option('--v8-options',
170
182
parser .add_option ('--with-arm-float-abi' ,
171
183
action = 'store' ,
172
184
dest = 'arm_float_abi' ,
173
- help = 'specifies which floating-point ABI to use. Valid values are: '
174
- 'soft, softfp, hard' )
185
+ choices = valid_arm_float_abi ,
186
+ help = 'specifies which floating-point ABI to use ({0}).' .format (
187
+ ', ' .join (valid_arm_float_abi )))
175
188
176
189
parser .add_option ('--with-mips-arch-variant' ,
177
190
action = 'store' ,
178
191
dest = 'mips_arch_variant' ,
179
192
default = 'r2' ,
180
- help = 'MIPS arch variant: loongson, r1, r2, r6, rx' )
193
+ choices = valid_mips_arch ,
194
+ help = 'MIPS arch variant ({0}) [default: %default]' .format (
195
+ ', ' .join (valid_mips_arch )))
181
196
182
197
parser .add_option ('--with-mips-fpu-mode' ,
183
198
action = 'store' ,
184
199
dest = 'mips_fpu_mode' ,
185
200
default = 'fp32' ,
186
- help = 'MIPS FPU mode: fp32, fp64, fpxx' )
201
+ choices = valid_mips_fpu ,
202
+ help = 'MIPS FPU mode ({0}) [default: %default]' .format (
203
+ ', ' .join (valid_mips_fpu )))
187
204
188
205
parser .add_option ('--with-mips-float-abi' ,
189
206
action = 'store' ,
190
207
dest = 'mips_float_abi' ,
191
208
default = 'hard' ,
192
- help = 'MIPS floating-point ABI: soft, hard' )
209
+ choices = valid_mips_float_abi ,
210
+ help = 'MIPS floating-point ABI ({0}) [default: %default]' .format (
211
+ ', ' .join (valid_mips_float_abi )))
193
212
194
213
parser .add_option ('--with-dtrace' ,
195
214
action = 'store_true' ,
@@ -219,12 +238,14 @@ parser.add_option('--with-icu-path',
219
238
parser .add_option ('--with-icu-locales' ,
220
239
action = 'store' ,
221
240
dest = 'with_icu_locales' ,
222
- help = 'Comma-separated list of locales for "small-icu". Default: "root,en". "root" is assumed.' )
241
+ default = 'root,en' ,
242
+ help = 'Comma-separated list of locales for "small-icu". "root" is assumed. '
243
+ '[default: %default]' )
223
244
224
245
parser .add_option ('--with-intl' ,
225
246
action = 'store' ,
226
247
dest = 'with_intl' ,
227
- help = 'Intl mode: none, full-icu, small-icu ( default is none) ' )
248
+ help = 'Intl mode: none, full-icu, small-icu [ default: none] ' )
228
249
229
250
parser .add_option ('--with-icu-source' ,
230
251
action = 'store' ,
@@ -583,44 +604,35 @@ def configure_node(o):
583
604
def configure_libz (o ):
584
605
o ['variables' ]['node_shared_zlib' ] = b (options .shared_zlib )
585
606
586
- # assume shared_zlib if one of these is set?
607
+ if b (options .shared_zlib ) == True :
608
+ o ['libraries' ] += ['-l%s' % options .shared_zlib_libname ]
587
609
if options .shared_zlib_libpath :
588
610
o ['libraries' ] += ['-L%s' % options .shared_zlib_libpath ]
589
- if options .shared_zlib_libname :
590
- o ['libraries' ] += ['-l%s' % options .shared_zlib_libname ]
591
- elif options .shared_zlib :
592
- o ['libraries' ] += ['-lz' ]
593
611
if options .shared_zlib_includes :
594
612
o ['include_dirs' ] += [options .shared_zlib_includes ]
595
613
596
614
597
615
def configure_http_parser (o ):
598
616
o ['variables' ]['node_shared_http_parser' ] = b (options .shared_http_parser )
599
-
600
- # assume shared http_parser if one of these is set?
617
+
618
+ if b (options .shared_http_parser ) == True :
619
+ o ['libraries' ] += ['-l%s' % options .shared_http_parser_libname ]
601
620
if options .shared_http_parser_libpath :
602
621
o ['libraries' ] += ['-L%s' % options .shared_http_parser_libpath ]
603
- if options .shared_http_parser_libname :
604
- o ['libraries' ] += ['-l%s' % options .shared_http_parser_libname ]
605
- elif options .shared_http_parser :
606
- o ['libraries' ] += ['-lhttp_parser' ]
607
622
if options .shared_http_parser_includes :
608
623
o ['include_dirs' ] += [options .shared_http_parser_includes ]
609
624
610
625
611
626
def configure_libuv (o ):
612
627
o ['variables' ]['node_shared_libuv' ] = b (options .shared_libuv )
613
628
614
- # assume shared libuv if one of these is set?
629
+ if b (options .shared_libuv ) == True :
630
+ o ['libraries' ] += ['-l%s' % options .shared_libuv_libname ]
615
631
if options .shared_libuv_libpath :
616
632
o ['libraries' ] += ['-L%s' % options .shared_libuv_libpath ]
617
633
else :
618
634
o ['variables' ]['uv_library' ] = 'static_library'
619
635
620
- if options .shared_libuv_libname :
621
- o ['libraries' ] += ['-l%s' % options .shared_libuv_libname ]
622
- elif options .shared_libuv :
623
- o ['libraries' ] += ['-luv' ]
624
636
if options .shared_libuv_includes :
625
637
o ['include_dirs' ] += [options .shared_libuv_includes ]
626
638
@@ -644,15 +656,12 @@ def configure_openssl(o):
644
656
if options .shared_openssl :
645
657
(libs , cflags ) = pkg_config ('openssl' ) or ('-lssl -lcrypto' , '' )
646
658
659
+ libnames = options .shared_openssl_libname .split (',' )
660
+ o ['libraries' ] += ['-l%s' % s for s in libnames ]
661
+
647
662
if options .shared_openssl_libpath :
648
663
o ['libraries' ] += ['-L%s' % options .shared_openssl_libpath ]
649
664
650
- if options .shared_openssl_libname :
651
- libnames = options .shared_openssl_libname .split (',' )
652
- o ['libraries' ] += ['-l%s' % s for s in libnames ]
653
- else :
654
- o ['libraries' ] += libs .split ()
655
-
656
665
if options .shared_openssl_includes :
657
666
o ['include_dirs' ] += [options .shared_openssl_includes ]
658
667
else :
@@ -760,23 +769,14 @@ def configure_intl(o):
760
769
return
761
770
# --with-intl=<with_intl>
762
771
# set the default
763
- if with_intl is None :
764
- with_intl = 'none' # The default mode of Intl
765
- # sanity check localelist
766
- if options .with_icu_locales and (with_intl != 'small-icu' ):
767
- print 'Error: --with-icu-locales only makes sense with --with-intl=small-icu'
768
- sys .exit (1 )
769
- if with_intl == 'none' or with_intl is None :
772
+ if with_intl in (None , 'none' ):
770
773
o ['variables' ]['v8_enable_i18n_support' ] = 0
771
774
return # no Intl
772
775
elif with_intl == 'small-icu' :
773
776
# small ICU (English only)
774
777
o ['variables' ]['v8_enable_i18n_support' ] = 1
775
778
o ['variables' ]['icu_small' ] = b (True )
776
- with_icu_locales = options .with_icu_locales
777
- if not with_icu_locales :
778
- with_icu_locales = 'root,en'
779
- locs = set (with_icu_locales .split (',' ))
779
+ locs = set (options .with_icu_locales .split (',' ))
780
780
locs .add ('root' ) # must have root
781
781
o ['variables' ]['icu_locales' ] = string .join (locs ,',' )
782
782
elif with_intl == 'full-icu' :
0 commit comments