@@ -10,7 +10,8 @@ import sys
10
10
CC = os .environ .get ('CC' , 'cc' )
11
11
12
12
root_dir = os .path .dirname (__file__ )
13
- sys .path .insert (0 , os .path .join (root_dir , 'deps' , 'v8' , 'tools' ))
13
+ sys .path .insert (0 , os .path .join (root_dir , 'tools' , 'gyp' , 'pylib' ))
14
+ from gyp .common import GetFlavor
14
15
15
16
# parse our options
16
17
parser = optparse .OptionParser ()
@@ -236,7 +237,7 @@ parser.add_option("--dest-os",
236
237
action = "store" ,
237
238
dest = "dest_os" ,
238
239
help = "Operating system to build for. Valid values are: "
239
- "win, mac, solaris, freebsd, linux" )
240
+ "win, mac, solaris, freebsd, openbsd, linux" )
240
241
241
242
parser .add_option ("--no-ifaddrs" ,
242
243
action = "store_true" ,
@@ -462,18 +463,18 @@ def configure_node(o):
462
463
# By default, enable DTrace on SunOS systems. Don't allow it on other
463
464
# systems, since it won't work. (The MacOS build process is different than
464
465
# SunOS, and we haven't implemented it.)
465
- if sys . platform . startswith ( 'sunos' ) or sys . platform . startswith ( 'darwin ' ):
466
+ if flavor in ( 'solaris' , 'mac ' ):
466
467
o ['variables' ]['node_use_dtrace' ] = b (not options .without_dtrace )
467
468
o ['variables' ]['uv_use_dtrace' ] = o ['variables' ]['node_use_dtrace' ]
468
469
o ['variables' ]['uv_parent_path' ] = '/deps/uv/'
469
- elif sys . platform . startswith ( 'linux' ) :
470
+ elif flavor == 'linux' :
470
471
o ['variables' ]['node_use_dtrace' ] = 'false'
471
472
o ['variables' ]['node_use_systemtap' ] = b (options .with_dtrace )
472
473
if options .systemtap_includes :
473
474
o ['include_dirs' ] += [options .systemtap_includes ]
474
475
elif options .with_dtrace :
475
476
raise Exception (
476
- 'DTrace is currently only supported on SunOS or Linux systems.' )
477
+ 'DTrace is currently only supported on SunOS, MacOS or Linux systems.' )
477
478
else :
478
479
o ['variables' ]['node_use_dtrace' ] = 'false'
479
480
o ['variables' ]['node_use_systemtap' ] = 'false'
@@ -482,15 +483,15 @@ def configure_node(o):
482
483
o ['defines' ] += ['SUNOS_NO_IFADDRS' ]
483
484
484
485
# By default, enable ETW on Windows.
485
- if sys . platform . startswith ( 'win32' ) :
486
+ if flavor == 'win' :
486
487
o ['variables' ]['node_use_etw' ] = b (not options .without_etw );
487
488
elif options .with_etw :
488
489
raise Exception ('ETW is only supported on Windows.' )
489
490
else :
490
491
o ['variables' ]['node_use_etw' ] = 'false'
491
492
492
493
# By default, enable Performance counters on Windows.
493
- if sys . platform . startswith ( 'win32' ) :
494
+ if flavor == 'win' :
494
495
o ['variables' ]['node_use_perfctr' ] = b (not options .without_perfctr );
495
496
elif options .with_perfctr :
496
497
raise Exception ('Performance counter is only supported on Windows.' )
@@ -603,7 +604,7 @@ def configure_openssl(o):
603
604
604
605
605
606
def configure_winsdk (o ):
606
- if not sys . platform . startswith ( 'win32' ) :
607
+ if flavor != 'win' :
607
608
return
608
609
609
610
winsdk_dir = os .environ .get ("WindowsSdkDir" )
@@ -616,6 +617,13 @@ def configure_winsdk(o):
616
617
print "ctrpp not found in WinSDK path--using pre-gen files from tools/msvs/genfiles."
617
618
618
619
620
+ # determine the "flavor" (operating system) we're building for,
621
+ # leveraging gyp's GetFlavor function
622
+ flavor_params = {};
623
+ if (options .dest_os ):
624
+ flavor_params ['flavor' ] = options .dest_os ;
625
+ flavor = GetFlavor (flavor_params );
626
+
619
627
output = {
620
628
'variables' : { 'python' : sys .executable },
621
629
'include_dirs' : [],
@@ -668,14 +676,12 @@ write('config.mk',
668
676
'# Do not edit. Generated by the configure script.\n ' + config )
669
677
670
678
if options .use_ninja :
671
- gyp_args = ['-f' , 'ninja' ]
679
+ gyp_args = ['-f' , 'ninja-' + flavor ]
672
680
elif options .use_xcode :
673
681
gyp_args = ['-f' , 'xcode' ]
674
- elif os . name == 'nt ' :
682
+ elif flavor == 'win ' :
675
683
gyp_args = ['-f' , 'msvs' , '-G' , 'msvs_version=auto' ]
676
- elif options .dest_os :
677
- gyp_args = ['-f' , 'make-' + options .dest_os ]
678
684
else :
679
- gyp_args = ['-f' , 'make' ]
685
+ gyp_args = ['-f' , 'make-' + flavor ]
680
686
681
687
subprocess .call ([sys .executable , 'tools/gyp_node' ] + gyp_args )
0 commit comments