4545
4646valid_os = ('win' , 'mac' , 'solaris' , 'freebsd' , 'openbsd' , 'linux' ,
4747 'android' , 'aix' , 'cloudabi' )
48- valid_arch = ('arm' , 'arm64' , 'ia32' , 'ppc' ,
48+ valid_arch = ('arm' , 'arm64' , 'ia32' , 'mips' , 'mipsel' , 'mips64el' , ' ppc' ,
4949 'ppc64' , 'x32' ,'x64' , 'x86' , 'x86_64' , 's390' , 's390x' )
5050valid_arm_float_abi = ('soft' , 'softfp' , 'hard' )
5151valid_arm_fpu = ('vfp' , 'vfpv3' , 'vfpv3-d16' , 'neon' )
52+ valid_mips_arch = ('loongson' , 'r1' , 'r2' , 'r6' , 'rx' )
53+ valid_mips_fpu = ('fp32' , 'fp64' , 'fpxx' )
54+ valid_mips_float_abi = ('soft' , 'hard' )
5255valid_intl_modes = ('none' , 'small-icu' , 'full-icu' , 'system-icu' )
5356with open ('tools/icu/icu_versions.json' ) as f :
5457 icu_versions = json .load (f )
365368 help = 'ARM FPU mode ({0}) [default: %default]' .format (
366369 ', ' .join (valid_arm_fpu )))
367370
371+ parser .add_option ('--with-mips-arch-variant' ,
372+ action = 'store' ,
373+ dest = 'mips_arch_variant' ,
374+ default = 'r2' ,
375+ choices = valid_mips_arch ,
376+ help = 'MIPS arch variant ({0}) [default: %default]' .format (
377+ ', ' .join (valid_mips_arch )))
378+
379+ parser .add_option ('--with-mips-fpu-mode' ,
380+ action = 'store' ,
381+ dest = 'mips_fpu_mode' ,
382+ default = 'fp32' ,
383+ choices = valid_mips_fpu ,
384+ help = 'MIPS FPU mode ({0}) [default: %default]' .format (
385+ ', ' .join (valid_mips_fpu )))
386+
387+ parser .add_option ('--with-mips-float-abi' ,
388+ action = 'store' ,
389+ dest = 'mips_float_abi' ,
390+ default = 'hard' ,
391+ choices = valid_mips_float_abi ,
392+ help = 'MIPS floating-point ABI ({0}) [default: %default]' .format (
393+ ', ' .join (valid_mips_float_abi )))
394+
368395parser .add_option ('--with-dtrace' ,
369396 action = 'store_true' ,
370397 dest = 'with_dtrace' ,
@@ -846,6 +873,8 @@ def host_arch_cc():
846873 '__aarch64__' : 'arm64' ,
847874 '__arm__' : 'arm' ,
848875 '__i386__' : 'ia32' ,
876+ '__MIPSEL__' : 'mipsel' ,
877+ '__mips__' : 'mips' ,
849878 '__PPC64__' : 'ppc64' ,
850879 '__PPC__' : 'ppc64' ,
851880 '__x86_64__' : 'x64' ,
@@ -861,6 +890,9 @@ def host_arch_cc():
861890 if rtn != 's390' :
862891 break
863892
893+ if rtn == 'mipsel' and '_LP64' in k :
894+ rtn = 'mips64el'
895+
864896 return rtn
865897
866898
@@ -874,6 +906,7 @@ def host_arch_win():
874906 'AMD64' : 'x64' ,
875907 'x86' : 'ia32' ,
876908 'arm' : 'arm' ,
909+ 'mips' : 'mips' ,
877910 }
878911
879912 return matchup .get (arch , 'ia32' )
@@ -905,6 +938,14 @@ def configure_arm(o):
905938 o ['variables' ]['arm_fpu' ] = options .arm_fpu or arm_fpu
906939
907940
941+ def configure_mips (o ):
942+ can_use_fpu_instructions = (options .mips_float_abi != 'soft' )
943+ o ['variables' ]['v8_can_use_fpu_instructions' ] = b (can_use_fpu_instructions )
944+ o ['variables' ]['v8_use_mips_abi_hardfloat' ] = b (can_use_fpu_instructions )
945+ o ['variables' ]['mips_arch_variant' ] = options .mips_arch_variant
946+ o ['variables' ]['mips_fpu_mode' ] = options .mips_fpu_mode
947+
948+
908949def gcc_version_ge (version_checked ):
909950 for compiler in [(CC , 'c' ), (CXX , 'c++' )]:
910951 ok , is_clang , clang_version , compiler_version = \
@@ -949,6 +990,8 @@ def configure_node(o):
949990
950991 if target_arch == 'arm' :
951992 configure_arm (o )
993+ elif target_arch in ('mips' , 'mipsel' , 'mips64el' ):
994+ configure_mips (o )
952995
953996 if flavor == 'aix' :
954997 o ['variables' ]['node_target_type' ] = 'static_library'
0 commit comments