CC = os.environ.get('CC', 'cc')
root_dir = os.path.dirname(__file__)
-sys.path.insert(0, os.path.join(root_dir, 'deps', 'v8', 'tools'))
+sys.path.insert(0, os.path.join(root_dir, 'tools', 'gyp', 'pylib'))
+from gyp.common import GetFlavor
# parse our options
parser = optparse.OptionParser()
action="store",
dest="dest_os",
help="Operating system to build for. Valid values are: "
- "win, mac, solaris, freebsd, linux")
+ "win, mac, solaris, freebsd, openbsd, linux")
parser.add_option("--no-ifaddrs",
action="store_true",
# By default, enable DTrace on SunOS systems. Don't allow it on other
# systems, since it won't work. (The MacOS build process is different than
# SunOS, and we haven't implemented it.)
- if sys.platform.startswith('sunos') or sys.platform.startswith('darwin'):
+ if flavor in ('solaris', 'mac'):
o['variables']['node_use_dtrace'] = b(not options.without_dtrace)
- elif sys.platform.startswith('linux'):
+ elif flavor == 'linux':
o['variables']['node_use_dtrace'] = 'false'
o['variables']['node_use_systemtap'] = b(options.with_dtrace)
if options.systemtap_includes:
o['include_dirs'] += [options.systemtap_includes]
elif options.with_dtrace:
raise Exception(
- 'DTrace is currently only supported on SunOS or Linux systems.')
+ 'DTrace is currently only supported on SunOS, MacOS or Linux systems.')
else:
o['variables']['node_use_dtrace'] = 'false'
o['variables']['node_use_systemtap'] = 'false'
o['defines'] += ['SUNOS_NO_IFADDRS']
# By default, enable ETW on Windows.
- if sys.platform.startswith('win32'):
+ if flavor == 'win':
o['variables']['node_use_etw'] = b(not options.without_etw);
elif options.with_etw:
raise Exception('ETW is only supported on Windows.')
o['variables']['node_use_etw'] = 'false'
# By default, enable Performance counters on Windows.
- if sys.platform.startswith('win32'):
+ if flavor == 'win':
o['variables']['node_use_perfctr'] = b(not options.without_perfctr);
elif options.with_perfctr:
raise Exception('Performance counter is only supported on Windows.')
def configure_winsdk(o):
- if not sys.platform.startswith('win32'):
+ if flavor != 'win':
return
winsdk_dir = os.environ.get("WindowsSdkDir")
print "ctrpp not found in WinSDK path--using pre-gen files from tools/msvs/genfiles."
+# determine the "flavor" (operating system) we're building for,
+# leveraging gyp's GetFlavor function
+flavor_params = {};
+if (options.dest_os):
+ flavor_params['flavor'] = options.dest_os;
+flavor = GetFlavor(flavor_params);
+
output = {
'variables': { 'python': sys.executable },
'include_dirs': [],
'# Do not edit. Generated by the configure script.\n' + config)
if options.use_ninja:
- gyp_args = ['-f', 'ninja']
+ gyp_args = ['-f', 'ninja-' + flavor]
elif options.use_xcode:
gyp_args = ['-f', 'xcode']
-elif os.name == 'nt':
+elif flavor == 'win':
gyp_args = ['-f', 'msvs', '-G', 'msvs_version=auto']
-elif options.dest_os:
- gyp_args = ['-f', 'make-' + options.dest_os]
else:
- gyp_args = ['-f', 'make']
+ gyp_args = ['-f', 'make-' + flavor]
subprocess.call([sys.executable, 'tools/gyp_node'] + gyp_args)